From 6b3d39349a7794a877f439b78853cc6107739911 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Tue, 12 Mar 2019 19:26:20 +0100 Subject: [PATCH 01/71] export R options passed to mx unittest commands as env vars --- mx.fastr/mx_fastr.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/mx.fastr/mx_fastr.py b/mx.fastr/mx_fastr.py index 046157755e..4516119fc0 100644 --- a/mx.fastr/mx_fastr.py +++ b/mx.fastr/mx_fastr.py @@ -205,6 +205,17 @@ def setREnvironment(env=None): env[lib_env] = lib_value +def setUnitTestEnvironment(args): + env = os.environ + rOptions = [] + for arg in args: + if arg.startswith("--R."): + ss = arg.split("=") + env['FASTR_OPTION_' + ss[0][4:]] = ss[1] + rOptions.append(arg) + for rOption in rOptions: + args.remove(rOption) + def run_r(args, command, parser=None, extraVmArgs=None, jdk=None, **kwargs): ''' Common function for running either R, Rscript (or rrepl). @@ -327,20 +338,29 @@ def _unittest_config_participant(config): return (vmArgs, mainClass, mainClassArgs) def ut_simple(args): + setUnitTestEnvironment(args) return mx_unittest.unittest(args + _simple_unit_tests()) def ut_noapps(args): + setUnitTestEnvironment(args) return mx_unittest.unittest(args + _gate_noapps_unit_tests()) def ut_default(args): + setUnitTestEnvironment(args) return mx_unittest.unittest(args + _all_unit_tests()) def ut_gate(args): + setUnitTestEnvironment(args) return mx_unittest.unittest(args + _gate_unit_tests()) def ut_gen(args): + setUnitTestEnvironment(args) return mx_unittest.unittest(args + _all_generated_unit_tests()) +def ut(args): + setUnitTestEnvironment(args) + return mx_unittest.unittest(args) + def _test_package(): return 'com.oracle.truffle.r.test' @@ -692,6 +712,7 @@ def r_pkgtest_analyze(args, **kwargs): 'rutdefault' : [ut_default, ['options']], 'rutgate' : [ut_gate, ['options']], 'rutgen' : [ut_gen, ['options']], + 'unittest' : [ut, ['options']], 'rutnoapps' : [ut_noapps, ['options']], 'rbcheck' : [rbcheck, '--filter [gnur-only,fastr-only,both,both-diff]'], 'rbdiag' : [rbdiag, '(builtin)* [-v] [-n] [-m] [--sweep | --sweep=lite | --sweep=total] [--mnonly] [--noSelfTest] [--matchLevel=same | --matchLevel=error] [--maxSweeps=N] [--outMaxLev=N]'], From c5b0878a33d5ea751ee2c2cc833244b539bbfc95 Mon Sep 17 00:00:00 2001 From: Miloslav Metelka Date: Mon, 11 Mar 2019 10:39:06 +0100 Subject: [PATCH 02/71] UpdateComment should use VectorReuse node. --- .../r/nodes/builtin/base/UpdateComment.java | 62 ++++++++++++++++--- .../truffle/r/test/ExpectedTestOutput.test | 38 +++++++++--- .../builtins/TestBuiltin_commentassign.java | 4 ++ 3 files changed, 85 insertions(+), 19 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateComment.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateComment.java index 13f941fe57..d97e74850f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateComment.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateComment.java @@ -30,6 +30,7 @@ import com.oracle.truffle.api.dsl.Cached; import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetCommentAttributeNode; import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.RemoveCommentAttributeNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; @@ -38,9 +39,11 @@ import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RAttributable; import com.oracle.truffle.r.runtime.data.RNull; +import com.oracle.truffle.r.runtime.data.RShareable; import com.oracle.truffle.r.runtime.data.RSharingAttributeStorage; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; +import com.oracle.truffle.r.runtime.data.nodes.VectorReuse; @RBuiltin(name = "comment<-", kind = INTERNAL, parameterNames = {"x", "value"}, dispatch = INTERNAL_GENERIC, behavior = PURE) public abstract class UpdateComment extends RBuiltinNode.Arg2 { @@ -51,32 +54,71 @@ public abstract class UpdateComment extends RBuiltinNode.Arg2 { casts.arg("value").defaultError(RError.Message.SET_INVALID_ATTR, "comment").mustNotBeMissing().allowNull().mustBe(stringValue()).asStringVector(); } - @Specialization + @Specialization(guards = "vectorReuse.supports(container)", limit = "getVectorAccessCacheSize()") protected Object updateComment(RAbstractVector container, RAbstractStringVector value, @Cached("create()") SetCommentAttributeNode setCommentAttrNode, + @Cached("createNonShared(container)") VectorReuse vectorReuse, @Cached("create()") ShareObjectNode updateRefCountNode) { updateRefCountNode.execute(value); - RAbstractVector res = container.materialize(); + RAbstractVector res = vectorReuse.getResult(container).materialize(); setCommentAttrNode.setAttr(res, value); return res; } + @Specialization(replaces = "updateComment") + protected Object updateCommentGeneric(RAbstractVector container, RAbstractStringVector value, + @Cached("create()") SetCommentAttributeNode setCommentAttrNode, + @Cached("createNonSharedGeneric()") VectorReuse vectorReuse, + @Cached("create()") ShareObjectNode updateRefCountNode) { + return updateComment(container, value, setCommentAttrNode, vectorReuse, updateRefCountNode); + } + @Specialization(guards = "!isRAbstractVector(container)") - protected Object updateComment(RAttributable container, RAbstractStringVector value, + protected Object updateCommentNonVector(RAttributable container, RAbstractStringVector value, + @Cached("createClassProfile()") ValueProfile classProfile, @Cached("create()") SetCommentAttributeNode setCommentAttrNode) { - setCommentAttrNode.setAttr(container, value); - return container; + Object result = classProfile.profile(container); + if (result instanceof RShareable) { + result = ((RShareable) result).copy(); + } else { + RSharingAttributeStorage.verify(result); + } + setCommentAttrNode.setAttr(result, value); + return result; + } + + @Specialization(guards = "vectorReuse.supports(container)", limit = "getVectorAccessCacheSize()") + protected Object updateCommentNull(RAbstractVector container, @SuppressWarnings("unused") RNull value, + @Cached("createNonShared(container)") VectorReuse vectorReuse, + @Cached("create()") RemoveCommentAttributeNode removeCommentNode) { + RAbstractVector res = vectorReuse.getResult(container); + removeCommentNode.execute(res); + return res; + } + + @Specialization(replaces = "updateCommentNull") + protected Object updateCommentNullGeneric(RAbstractVector container, @SuppressWarnings("unused") RNull value, + @Cached("createNonSharedGeneric()") VectorReuse vectorReuse, + @Cached("create()") RemoveCommentAttributeNode removeCommentNode) { + return updateCommentNull(container, value, vectorReuse, removeCommentNode); } - @Specialization - protected Object updateComment(RAttributable container, @SuppressWarnings("unused") RNull value, + @Specialization(guards = "!isRAbstractVector(container)") + protected Object updateCommentNullNonVector(RAttributable container, @SuppressWarnings("unused") RNull value, + @Cached("createClassProfile()") ValueProfile classProfile, @Cached("create()") RemoveCommentAttributeNode removeCommentNode) { - removeCommentNode.execute(container); - return container; + Object result = classProfile.profile(container); + if (result instanceof RShareable) { + result = ((RShareable) result).copy(); + } else { + RSharingAttributeStorage.verify(result); + } + removeCommentNode.execute(result); + return result; } @Fallback - protected Object updateComment(Object vector, Object value) { + protected Object updateCommentFallback(Object vector, Object value) { // cast pipeline should ensure this: assert value == RNull.instance || value instanceof RAbstractStringVector; RSharingAttributeStorage.verify(vector); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index d539e25c7b..611fdd8144 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -19030,6 +19030,26 @@ character(0) #argv <- list(logical(0), NULL); .Internal(`comment<-`(argv[[1]], argv[[2]])) logical(0) +##com.oracle.truffle.r.test.builtins.TestBuiltin_commentassign.testcommentassign4# +#foo <- function(x) 3*x; bar <- foo; comment(foo) <- 'hello'; comment(foo); comment(bar) +[1] "hello" +NULL + +##com.oracle.truffle.r.test.builtins.TestBuiltin_commentassign.testcommentassign4# +#foo <- function(x) 3*x; comment(foo) <- 'hello'; bar <- foo; comment(foo) <- NULL; comment(foo); comment(bar) +NULL +[1] "hello" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_commentassign.testcommentassign4# +#x <- c(1,2); comment(x) <- 'hello'; y <- x; comment(x) <- NULL; comment(x); comment(y) +NULL +[1] "hello" + +##com.oracle.truffle.r.test.builtins.TestBuiltin_commentassign.testcommentassign4# +#x <- c(1,2); y <- x; comment(x) <- 'hello'; comment(x); comment(y) +[1] "hello" +NULL + ##com.oracle.truffle.r.test.builtins.TestBuiltin_commentassign.testcommentassign4# #x<-42; comment(x) <- 'a' @@ -81277,19 +81297,19 @@ Error in get("xx", envir = 6) : not that many frames on the stack #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-1)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-2)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "enclos" "envir" "expr" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-3)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-4)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-6)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(-6)" on the search list @@ -81304,26 +81324,26 @@ In ls(sys.frame(-6)) : ‘sys.frame(-6)’ converted to character string #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(1)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(2)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "enclos" "envir" "expr" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(3)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(4)); eval(parse(text='f1()'), envir=environment())}; f() } character(0) -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(5)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(5)" on the search list In addition: Warning message: In ls(sys.frame(5)) : ‘sys.frame(5)’ converted to character string -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(6)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(6)" on the search list diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_commentassign.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_commentassign.java index 441f7d225b..371c6ac045 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_commentassign.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_commentassign.java @@ -57,6 +57,10 @@ public void testcommentassign4() { assertEval(Output.IgnoreErrorContext, "x<-c(); comment(x) <- 'a'"); assertEval(Output.IgnoreErrorContext, "x<-NULL; comment(x) <- 'a'"); assertEval("x<-NA; comment(x) <- 'a'"); + assertEval("x <- c(1,2); y <- x; comment(x) <- 'hello'; comment(x); comment(y)"); + assertEval("x <- c(1,2); comment(x) <- 'hello'; y <- x; comment(x) <- NULL; comment(x); comment(y)"); + assertEval("foo <- function(x) 3*x; bar <- foo; comment(foo) <- 'hello'; comment(foo); comment(bar)"); + assertEval("foo <- function(x) 3*x; comment(foo) <- 'hello'; bar <- foo; comment(foo) <- NULL; comment(foo); comment(bar)"); } @Test From 2c72d1bb3956bfebd610a032a533d83e3794fbf0 Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Tue, 5 Mar 2019 11:06:19 +0100 Subject: [PATCH 03/71] Fix: Return correct status code if timeout is given. --- .../nodes/builtin/base/system/ProcessSystemFunctionFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java index 0a4e1773a5..0244e17035 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java @@ -75,7 +75,7 @@ private Object execute(String command, boolean intern, int timeoutSecs) { p.destroy(); RError.warning(SHOW_CALLER, Message.COMMAND_TIMED_OUT, command, timeoutSecs); } - rc = exited ? 0 : 127; + rc = exited ? p.exitValue() : 127; } else { rc = p.waitFor(); } From ece03ee247df0b23b5eaf0fa3b20fceff60e7ea3 Mon Sep 17 00:00:00 2001 From: Miloslav Metelka Date: Wed, 13 Mar 2019 12:11:38 +0100 Subject: [PATCH 04/71] Avoid setting the visibility in PromiseHelper node where possible. --- .../truffle/r/ffi/impl/nodes/RfEvalNode.java | 6 +- .../r/nodes/builtin/base/DotDotDotElt.java | 4 +- .../truffle/r/nodes/builtin/base/Return.java | 2 +- .../builtin/base/S3DispatchFunctions.java | 2 +- .../truffle/r/nodes/builtin/base/Switch.java | 10 +-- .../r/nodes/builtin/base/WithVisible.java | 4 +- .../access/ReadVariadicComponentNode.java | 4 +- .../variables/LocalReadVariableNode.java | 4 +- .../access/variables/ReadVariableNode.java | 2 +- .../access/vector/ExtractVectorNode.java | 2 +- .../nodes/binary/BinaryBooleanScalarNode.java | 2 +- .../r/nodes/function/PromiseHelperNode.java | 86 +++++++++++++------ .../truffle/r/nodes/function/RCallNode.java | 6 +- .../r/nodes/helpers/GetFromEnvironment.java | 4 +- .../truffle/r/test/ExpectedTestOutput.test | 18 ++-- 15 files changed, 96 insertions(+), 60 deletions(-) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java index 42ad04a498..6fed3162f1 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java @@ -76,13 +76,13 @@ private static RCaller createCall(REnvironment env) { @Specialization @TruffleBoundary Object handlePromise(RPromise expr, @SuppressWarnings("unused") RNull nulLEnv) { - return getPromiseHelper().evaluate(Utils.getActualCurrentFrame().materialize(), expr); + return getPromiseHelper().visibleEvaluate(Utils.getActualCurrentFrame().materialize(), expr); } @Specialization @TruffleBoundary Object handlePromise(RPromise expr, REnvironment env) { - return getPromiseHelper().evaluate(env.getFrame(), expr); + return getPromiseHelper().visibleEvaluate(env.getFrame(), expr); } @Specialization @@ -121,7 +121,7 @@ Object handlePairList(RPairList l, Object envArg, Object car = l.car(); RFunction f = null; if (isPromiseProfile.profile(car instanceof RPromise)) { - car = getPromiseHelper().evaluate(null, (RPromise) car); + car = getPromiseHelper().visibleEvaluate(null, (RPromise) car); } if (car instanceof RFunction) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotDotDotElt.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotDotDotElt.java index 57d32db846..17bb15cf42 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotDotDotElt.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DotDotDotElt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -79,7 +79,7 @@ protected Object lookupElt(VirtualFrame frame, int n) { CompilerDirectives.transferToInterpreterAndInvalidate(); promiseHelper = insert(new PromiseHelperNode()); } - arg = promiseHelper.evaluate(frame, (RPromise) arg); + arg = promiseHelper.visibleEvaluate(frame, (RPromise) arg); } return arg; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java index d78ca38c4d..17d087e26f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Return.java @@ -104,7 +104,7 @@ protected Object returnFunction(VirtualFrame frame, RPromise x, if (x.isEvaluated()) { visibility.execute(frame, true); } - Object value = promiseHelper.evaluate(frame, x); + Object value = promiseHelper.visibleEvaluate(frame, x); throw doReturn(frame, value, unwrapCallerProfile); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java index 0963e4d652..2d9ff59ab5 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java @@ -201,7 +201,7 @@ private Object getEnclosingArg(VirtualFrame frame, String generic) { CompilerDirectives.transferToInterpreterAndInvalidate(); promiseCheckHelper = insert(new PromiseCheckHelperNode()); } - return promiseCheckHelper.checkEvaluate(frame, enclosingArg); + return promiseCheckHelper.checkVisibleEvaluate(frame, enclosingArg); } private static Object getFirstNonMissingArg(VirtualFrame frame, int startIdx) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java index a8c9b377ca..878d03c30d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java @@ -14,7 +14,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2014, Purdue University - * Copyright (c) 2014, 2018, Oracle and/or its affiliates + * Copyright (c) 2014, 2019, Oracle and/or its affiliates * * All rights reserved. */ @@ -125,13 +125,13 @@ private Object doSwitchString(VirtualFrame frame, String xStr, RArgsValuesAndNam throw RError.error(RError.NO_CALLER, RError.Message.ZERO_LENGTH_VARIABLE); } else if (xStr.equals(suppliedArgName)) { // match, evaluate the associated arg - Object optionalArgValue = promiseHelper.checkEvaluate(frame, optionalArgValues[i]); + Object optionalArgValue = promiseHelper.checkVisibleEvaluate(frame, optionalArgValues[i]); if (optionalArgValue == RMissing.instance) { matchedArgIsMissing.enter(); // Fall-through: If the matched value is missing, take the next non-missing for (int j = i + 1; j < optionalArgValues.length; j++) { - Object val = promiseHelper.checkEvaluate(frame, optionalArgValues[j]); + Object val = promiseHelper.checkVisibleEvaluate(frame, optionalArgValues[j]); if (val != RMissing.instance) { return val; } @@ -160,7 +160,7 @@ private Object doSwitchString(VirtualFrame frame, String xStr, RArgsValuesAndNam } } if (returnValueProfile.profile(currentDefault != null)) { - return promiseHelper.checkEvaluate(frame, currentDefault); + return promiseHelper.checkVisibleEvaluate(frame, currentDefault); } else { return null; } @@ -193,7 +193,7 @@ private Object doSwitchInt(VirtualFrame frame, int index, RArgsValuesAndNames op } Object[] optionalArgValues = optionalArgs.getArguments(); if (index >= 1 && index <= optionalArgValues.length) { - Object value = promiseHelper.checkEvaluate(frame, optionalArgValues[index - 1]); + Object value = promiseHelper.checkVisibleEvaluate(frame, optionalArgValues[index - 1]); if (value != null) { return value; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java index 695618f767..9f2c688a8c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,7 +82,7 @@ protected RList withVisible(VirtualFrame frame, RPromise x, if (x.isEvaluated()) { return RDataFactory.createList(new Object[]{x.getValue(), RRuntime.LOGICAL_TRUE}, LISTNAMES); } - Object value = promiseHelper.evaluate(frame, x); + Object value = promiseHelper.visibleEvaluate(frame, x); if (value == RMissing.instance) { CompilerDirectives.transferToInterpreter(); throw error(Message.ARGUMENT_MISSING, "x"); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java index e425601e1b..b39eb01326 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/ReadVariadicComponentNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -71,7 +71,7 @@ public Object execute(VirtualFrame frame) { throw error(RError.Message.DOT_DOT_SHORT, index + 1); } Object ret = argsValuesAndNames.getArgument(index); - return ret == null ? RMissing.instance : promiseHelper.checkEvaluate(frame, ret); + return ret == null ? RMissing.instance : promiseHelper.checkVisibleEvaluate(frame, ret); } public String getPrintForm() { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java index 3a8f8339ef..18c5a5eeb0 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/LocalReadVariableNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,7 +151,7 @@ public Object execute(VirtualFrame frame, Frame variableFrame) { CompilerDirectives.transferToInterpreterAndInvalidate(); promiseHelper = insert(new PromiseHelperNode()); } - result = promiseHelper.evaluate(frame, (RPromise) result); + result = promiseHelper.visibleEvaluate(frame, (RPromise) result); } } return result; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java index 7b780eceaf..63abd7adde 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/variables/ReadVariableNode.java @@ -294,7 +294,7 @@ Object executeInternal(VirtualFrame frame, Frame initialFrame) { CompilerDirectives.transferToInterpreterAndInvalidate(); promiseHelper = insert(new PromiseHelperNode()); } - return promiseHelper.evaluate(frame, (RPromise) result); + return promiseHelper.visibleEvaluate(frame, (RPromise) result); } if (isActiveBindingProfile.profile(ActiveBinding.isActiveBinding(result))) { if (readActiveBinding == null) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java index 8c9ed9424c..b47892f8e6 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/ExtractVectorNode.java @@ -162,7 +162,7 @@ protected Object doExtractEnvironment(REnvironment env, Object[] positions, @Sup String name = positions.length == 1 ? extractName.execute(positions[0]) : null; if (name != null) { Object obj = env.get(name); - return obj == null ? RNull.instance : promiseHelper.checkEvaluate(null, obj); + return obj == null ? RNull.instance : promiseHelper.checkVisibleEvaluate(null, obj); } throw error(RError.Message.WRONG_ARGS_SUBSET_ENV); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java index ea9dbf4f6c..69d0b60788 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java @@ -84,7 +84,7 @@ public abstract class BinaryBooleanScalarNode extends RBuiltinNode.Arg2 { protected byte binary(VirtualFrame frame, Object leftValue, Object rightValue) { byte left = leftCast.executeCast(leftBox.execute(leftValue)); if (profile.profile(logic.requiresRightOperand(left))) { - return logic.applyLogical(left, rightCast.executeCast(rightBox.execute(promiseHelper.checkEvaluate(frame, rightValue)))); + return logic.applyLogical(left, rightCast.executeCast(rightBox.execute(promiseHelper.checkVisibleEvaluate(frame, rightValue)))); } return left; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java index 2c1078127f..e204aed26e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java @@ -71,6 +71,22 @@ public static final class PromiseCheckHelperNode extends RBaseNode { private final ConditionProfile isPromiseProfile = ConditionProfile.createCountingProfile(); + /** + * Check promise evaluation and update visibility. + * + * @return If obj is an {@link RPromise}, it is evaluated and its result returned + */ + public Object checkVisibleEvaluate(VirtualFrame frame, Object obj) { + if (isPromiseProfile.profile(obj instanceof RPromise)) { + if (promiseHelper == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + promiseHelper = insert(new PromiseHelperNode()); + } + return promiseHelper.visibleEvaluate(frame, (RPromise) obj); + } + return obj; + } + /** * @return If obj is an {@link RPromise}, it is evaluated and its result returned */ @@ -141,8 +157,8 @@ public PromiseHelperNode(byte recursiveCounter) { private final ValueProfile promiseFrameProfile = ValueProfile.createClassProfile(); /** - * Main entry point for proper evaluation of the given Promise; including - * {@link RPromise#isEvaluated()}, dependency cycles. Guarded by + * Main entry point for proper evaluation of the given Promise when visibility updating is not + * required; including {@link RPromise#isEvaluated()}, dependency cycles. Guarded by * {@link #isInOriginFrame(VirtualFrame,RPromise)}. * * @param frame The current {@link VirtualFrame} @@ -150,6 +166,22 @@ public PromiseHelperNode(byte recursiveCounter) { * @return Evaluates the given {@link RPromise} in the given frame using the given inline cache */ public Object evaluate(VirtualFrame frame, RPromise promise) { + return evaluateImpl(frame, promise, false); + } + + /** + * Evaluation of the given Promise updating visibility; including {@link RPromise#isEvaluated()} + * , dependency cycles. Guarded by {@link #isInOriginFrame(VirtualFrame,RPromise)}. + * + * @param frame The current {@link VirtualFrame} + * @param promise The {@link RPromise} to evaluate + * @return Evaluates the given {@link RPromise} in the given frame using the given inline cache + */ + public Object visibleEvaluate(VirtualFrame frame, RPromise promise) { + return evaluateImpl(frame, promise, true); + } + + private Object evaluateImpl(VirtualFrame frame, RPromise promise, boolean visibleExec) { Object value = promise.getRawValue(); if (isEvaluatedProfile.profile(value != null)) { return value; @@ -166,16 +198,16 @@ public Object evaluate(VirtualFrame frame, RPromise promise) { if (isDefaultOptProfile.profile(PromiseState.isDefaultOpt(state))) { // default values of arguments are evaluated in the frame of the function that takes // them, we do not need to retrieve the frame of the promise, we already have it - return generateValueDefault(frame, promise); + return generateValueDefault(frame, promise, visibleExec); } else { // non-default arguments we need to evaluate in the frame of the function that supplied // them and that would mean frame materialization, we first try to see if the promise // can be optimized - return generateValueNonDefault(frame, state, (EagerPromise) promise); + return generateValueNonDefault(frame, state, (EagerPromise) promise, visibleExec); } } - private Object generateValueDefault(VirtualFrame frame, RPromise promise) { + private Object generateValueDefault(VirtualFrame frame, RPromise promise, boolean visibleExec) { // Check for dependency cycle if (isUnderEvaluation(promise)) { throw RError.error(RError.SHOW_CALLER, RError.Message.PROMISE_CYCLE); @@ -190,7 +222,7 @@ private Object generateValueDefault(VirtualFrame frame, RPromise promise) { boolean inOrigin = inOriginProfile.profile(isInOriginFrame(frame, promise)); Frame execFrame = inOrigin ? frame : wrapPromiseFrame(frame, promiseFrameProfile.profile(promise.getFrame())); Object value = promiseClosureCache.execute(execFrame, promise.getClosure()); - if (!inOrigin && frame != null) { + if (visibleExec && !inOrigin && frame != null) { if (setVisibility == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); setVisibility = insert(SetVisibilityNode.create()); @@ -211,14 +243,14 @@ private static boolean getVisibilitySlowPath(Frame frame) { return GetVisibilityNode.executeSlowPath(frame); } - private Object generateValueNonDefault(VirtualFrame frame, int state, EagerPromise promise) { + private Object generateValueNonDefault(VirtualFrame frame, int state, EagerPromise promise, boolean visibleExec) { assert !PromiseState.isDefaultOpt(state); if (!isDeoptimized(promise)) { if (generateValueNonDefaultOptimizedNode == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); generateValueNonDefaultOptimizedNode = insert(GenerateValueNonDefaultOptimizedNodeGen.create(recursiveCounter)); } - Object result = generateValueNonDefaultOptimizedNode.execute(frame, state, promise); + Object result = generateValueNonDefaultOptimizedNode.execute(frame, state, promise, visibleExec); if (result != null) { return result; } else { @@ -229,7 +261,7 @@ private Object generateValueNonDefault(VirtualFrame frame, int state, EagerPromi } } // Call - return generateValueDefault(frame, promise); + return generateValueDefault(frame, promise, visibleExec); } @TruffleBoundary @@ -422,7 +454,7 @@ protected GenerateValueNonDefaultOptimizedNode(byte recursiveCounter) { } } - public abstract Object execute(VirtualFrame frame, int state, EagerPromise promise); + public abstract Object execute(VirtualFrame frame, int state, EagerPromise promise, boolean visibleExec); // @formatter:off // data from "rutgen" tests @@ -451,38 +483,38 @@ protected GenerateValueNonDefaultOptimizedNode(byte recursiveCounter) { "isCompatibleEagerValueProfile(eagerValueProfile, state)", "isCompatibleWrapNode(wrapArgumentNode, promise, state)"}, // limit = "getCacheSize(ASSUMPTION_CACHE_SIZE)") - Object doCachedAssumption(VirtualFrame frame, int state, EagerPromise promise, + Object doCachedAssumption(VirtualFrame frame, int state, EagerPromise promise, boolean visibleExec, @SuppressWarnings("unused") @Cached("promise.getIsValidAssumption()") Assumption eagerAssumption, @Cached("createEagerValueProfile(state)") ValueProfile eagerValueProfile, @Cached("createWrapArgumentNode(promise, state)") WrapArgumentNode wrapArgumentNode) { - return generateValue(frame, state, promise, wrapArgumentNode, eagerValueProfile); + return generateValue(frame, state, promise, wrapArgumentNode, eagerValueProfile, visibleExec); } @Specialization(replaces = "doCachedAssumption", guards = { "isCompatibleWrapNode(wrapArgumentNode, promise, state)", "isCompatibleEagerValueProfile(eagerValueProfile, state)"}, // limit = "CACHE_SIZE") - Object doUncachedAssumption(VirtualFrame frame, int state, EagerPromise promise, + Object doUncachedAssumption(VirtualFrame frame, int state, EagerPromise promise, boolean visibleExec, @Cached("createBinaryProfile()") ConditionProfile isValidProfile, @Cached("createEagerValueProfile(state)") ValueProfile eagerValueProfile, @Cached("createWrapArgumentNode(promise, state)") WrapArgumentNode wrapArgumentNode) { // Note: the assumption inside the promise is not constant anymore, so we profile the // result of isValid if (isValidProfile.profile(promise.isValid())) { - return generateValue(frame, state, promise, wrapArgumentNode, eagerValueProfile); + return generateValue(frame, state, promise, wrapArgumentNode, eagerValueProfile, visibleExec); } else { return null; } } @Specialization(replaces = "doUncachedAssumption") - Object doFallback(@SuppressWarnings("unused") int state, @SuppressWarnings("unused") EagerPromise promise) { + Object doFallback(@SuppressWarnings("unused") int state, @SuppressWarnings("unused") EagerPromise promise, @SuppressWarnings("unused") boolean visibleExec) { throw RInternalError.shouldNotReachHere("The cache of doUncachedAssumption should never overflow"); } // If promise evaluates to another promise, we create another RPromiseHelperNode to evaluate // that, but only up to certain recursion level - private Object evaluateNextNode(VirtualFrame frame, RPromise nextPromise) { + private Object evaluateNextNode(VirtualFrame frame, RPromise nextPromise, boolean visibleExec) { if (recursiveCounter == -1) { evaluateNextNodeSlowPath(frame.materialize(), nextPromise); } @@ -490,7 +522,9 @@ private Object evaluateNextNode(VirtualFrame frame, RPromise nextPromise) { CompilerDirectives.transferToInterpreterAndInvalidate(); nextNode = insert(new PromiseHelperNode((byte) (recursiveCounter + 1))); } - return nextNode.evaluate(frame, nextPromise); + return visibleExec + ? nextNode.visibleEvaluate(frame, nextPromise) + : nextNode.evaluate(frame, nextPromise); } @TruffleBoundary @@ -498,14 +532,14 @@ private static void evaluateNextNodeSlowPath(MaterializedFrame frame, RPromise n PromiseHelperNode.evaluateSlowPath(frame, nextPromise); } - private Object generateValue(VirtualFrame frame, int state, EagerPromise promise, WrapArgumentNode wrapArgumentNode, ValueProfile eagerValueProfile) { + private Object generateValue(VirtualFrame frame, int state, EagerPromise promise, WrapArgumentNode wrapArgumentNode, ValueProfile eagerValueProfile, boolean visibleExec) { Object value; if (PromiseState.isEager(state)) { assert eagerValueProfile != null; - value = getEagerValue(frame, promise, wrapArgumentNode, eagerValueProfile); + value = getEagerValue(frame, promise, wrapArgumentNode, eagerValueProfile, visibleExec); } else { RPromise nextPromise = (RPromise) promise.getEagerValue(); - value = evaluateNextNode(frame, nextPromise); + value = evaluateNextNode(frame, nextPromise, visibleExec); } assert promise.getRawValue() == null; assert value != null; @@ -545,16 +579,18 @@ static ValueProfile createEagerValueProfile(int state) { * Returns {@link EagerPromise#getEagerValue()} profiled and takes care of wrapping the * value with {@link WrapArgumentNode}. */ - private Object getEagerValue(VirtualFrame frame, EagerPromise promise, WrapArgumentNode wrapArgumentNode, ValueProfile eagerValueProfile) { + private Object getEagerValue(VirtualFrame frame, EagerPromise promise, WrapArgumentNode wrapArgumentNode, ValueProfile eagerValueProfile, boolean visibleExec) { Object o = promise.getEagerValue(); if (wrapArgumentNode != null) { wrapArgumentNode.execute(frame, o); } - if (visibility == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - visibility = insert(SetVisibilityNode.create()); + if (visibleExec) { + if (visibility == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + visibility = insert(SetVisibilityNode.create()); + } + visibility.execute(frame, true); } - visibility.execute(frame, true); return eagerValueProfile.profile(o); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java index 930d0f221b..bcb9ac6231 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/RCallNode.java @@ -418,7 +418,7 @@ public Object callInternalGenericExplicit(VirtualFrame frame, RFunction function } } } - type = classHierarchyNode.execute(promiseHelperNode.checkEvaluate(frame, dispatchObject)); + type = classHierarchyNode.execute(promiseHelperNode.checkVisibleEvaluate(frame, dispatchObject)); } S3Args s3Args; @@ -507,7 +507,7 @@ public Object callGroupGeneric(VirtualFrame frame, RFunction function, typeXIdx = 1; } - Object dispatchObject = promiseHelperNode.checkEvaluate(frame, args[typeXIdx]); + Object dispatchObject = promiseHelperNode.checkVisibleEvaluate(frame, args[typeXIdx]); boolean isS4Dispatch = false; @@ -527,7 +527,7 @@ public Object callGroupGeneric(VirtualFrame frame, RFunction function, } if (isS4Dispatch) { - RList list = (RList) promiseHelperNode.checkEvaluate(frame, REnvironment.getRegisteredNamespace("methods").get(".BasicFunsList")); + RList list = (RList) promiseHelperNode.checkVisibleEvaluate(frame, REnvironment.getRegisteredNamespace("methods").get(".BasicFunsList")); int index = list.getElementIndexByName(builtin.getName()); if (index != -1) { RFunction basicFun = (RFunction) list.getDataAt(index); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/helpers/GetFromEnvironment.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/helpers/GetFromEnvironment.java index bc5b79603c..200e925747 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/helpers/GetFromEnvironment.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/helpers/GetFromEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,7 +60,7 @@ protected Object checkPromise(VirtualFrame frame, Object r, String identifier) { CompilerDirectives.transferToInterpreterAndInvalidate(); promiseHelper = insert(new PromiseHelperNode()); } - return promiseHelper.evaluate(frame, (RPromise) r); + return promiseHelper.visibleEvaluate(frame, (RPromise) r); } else { return r; } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index d539e25c7b..9adbaeaee5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -81277,19 +81277,19 @@ Error in get("xx", envir = 6) : not that many frames on the stack #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-1)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-2)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "enclos" "envir" "expr" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-3)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-4)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(-6)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(-6)" on the search list @@ -81304,26 +81304,26 @@ In ls(sys.frame(-6)) : ‘sys.frame(-6)’ converted to character string #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(1)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(2)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "enclos" "envir" "expr" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(3)); eval(parse(text='f1()'), envir=environment())}; f() } [1] "f1" "xx" -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(4)); eval(parse(text='f1()'), envir=environment())}; f() } character(0) -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(5)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(5)" on the search list In addition: Warning message: In ls(sys.frame(5)) : ‘sys.frame(5)’ converted to character string -##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval#Ignored.ImplementationError# +##com.oracle.truffle.r.test.builtins.TestBuiltin_sysframe.sysFrameViaEval# #{ f <- function() { xx <- 'xv'; f1 <- function() ls(sys.frame(6)); eval(parse(text='f1()'), envir=environment())}; f() } Error in as.environment(pos) : no item called "sys.frame(6)" on the search list From acb237452ead2e04919604fbe1a05bb0dab5542a Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Wed, 13 Mar 2019 10:38:19 +0100 Subject: [PATCH 05/71] pkgtest: remove quotes for 'FASTR_INTERNAL_ARGS'. --- com.oracle.truffle.r.release/src/R_legacy | 4 ++-- com.oracle.truffle.r.release/src/Rscript_legacy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/com.oracle.truffle.r.release/src/R_legacy b/com.oracle.truffle.r.release/src/R_legacy index 3f7900aa05..ff939cd1db 100755 --- a/com.oracle.truffle.r.release/src/R_legacy +++ b/com.oracle.truffle.r.release/src/R_legacy @@ -116,9 +116,9 @@ cp="$JAVA_HOME/jre/languages/R/fastr-launcher.jar:$cp" ## REMOVE FOR NATIVE IMAGE: END # internal variable used to pass args to child R processes if [ -z "$FASTR_INTERNAL_ARGS" ]; then - FASTR_INTERNAL_ARGS=() + FASTR_INTERNAL_ARGS="" fi # we can invoke FastR directly, but we do have to set R_HOME export R_HOME="$JRE/languages/R" -exec "$JAVA_HOME/bin/java" -cp "$cp" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx8g "${jvm_args[@]}" com.oracle.truffle.r.launcher.RMain R "${FASTR_INTERNAL_ARGS[@]}" "${launcher_args[@]}" +exec "$JAVA_HOME/bin/java" -cp "$cp" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx8g "${jvm_args[@]}" com.oracle.truffle.r.launcher.RMain R ${FASTR_INTERNAL_ARGS[@]} "${launcher_args[@]}" diff --git a/com.oracle.truffle.r.release/src/Rscript_legacy b/com.oracle.truffle.r.release/src/Rscript_legacy index 727cb775f4..a9d0b937fc 100755 --- a/com.oracle.truffle.r.release/src/Rscript_legacy +++ b/com.oracle.truffle.r.release/src/Rscript_legacy @@ -116,9 +116,9 @@ cp="$JAVA_HOME/jre/languages/R/fastr-launcher.jar:$cp" ## REMOVE FOR NATIVE IMAGE: END # internal variable used to pass args to child R processes if [ -z "$FASTR_INTERNAL_ARGS" ]; then - FASTR_INTERNAL_ARGS=() + FASTR_INTERNAL_ARGS="" fi # we can invoke FastR directly, but we do have to set R_HOME export R_HOME="$JRE/languages/R" -exec "$JAVA_HOME/bin/java" -cp "$cp" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx4g "${jvm_args[@]}" com.oracle.truffle.r.launcher.RMain Rscript "${FASTR_INTERNAL_ARGS[@]}" "${launcher_args[@]}" +exec "$JAVA_HOME/bin/java" -cp "$cp" -noverify -Dgraal.TruffleCompilationThreshold=10000 -Dgraal.TruffleCompilerThreads=2 -Xmx4g "${jvm_args[@]}" com.oracle.truffle.r.launcher.RMain Rscript ${FASTR_INTERNAL_ARGS[@]} "${launcher_args[@]}" From 7f47ada614734a9408bf7c9bd6a60fb1044cfd9f Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Wed, 13 Mar 2019 13:20:19 +0100 Subject: [PATCH 06/71] fix copyrights --- .../nodes/builtin/base/system/ProcessSystemFunctionFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java index 0244e17035..a7a3c676ca 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/system/ProcessSystemFunctionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it From 92c0894e60ed77faf93bb0a32c7200ca99b97270 Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Wed, 13 Mar 2019 15:00:59 +0100 Subject: [PATCH 07/71] Do not initialize FASTR_INTERNAL_ARGS if missing. --- com.oracle.truffle.r.release/src/R_legacy | 4 ---- com.oracle.truffle.r.release/src/Rscript_legacy | 4 ---- 2 files changed, 8 deletions(-) diff --git a/com.oracle.truffle.r.release/src/R_legacy b/com.oracle.truffle.r.release/src/R_legacy index ff939cd1db..b319c03352 100755 --- a/com.oracle.truffle.r.release/src/R_legacy +++ b/com.oracle.truffle.r.release/src/R_legacy @@ -114,10 +114,6 @@ cp="$(IFS=: ; echo "${absolute_cp[*]}")" cp="$JAVA_HOME/jre/languages/R/fastr-launcher.jar:$cp" ## REMOVE FOR NATIVE IMAGE: END -# internal variable used to pass args to child R processes -if [ -z "$FASTR_INTERNAL_ARGS" ]; then - FASTR_INTERNAL_ARGS="" -fi # we can invoke FastR directly, but we do have to set R_HOME export R_HOME="$JRE/languages/R" diff --git a/com.oracle.truffle.r.release/src/Rscript_legacy b/com.oracle.truffle.r.release/src/Rscript_legacy index a9d0b937fc..b499f1b533 100755 --- a/com.oracle.truffle.r.release/src/Rscript_legacy +++ b/com.oracle.truffle.r.release/src/Rscript_legacy @@ -114,10 +114,6 @@ cp="$(IFS=: ; echo "${absolute_cp[*]}")" cp="$JAVA_HOME/jre/languages/R/fastr-launcher.jar:$cp" ## REMOVE FOR NATIVE IMAGE: END -# internal variable used to pass args to child R processes -if [ -z "$FASTR_INTERNAL_ARGS" ]; then - FASTR_INTERNAL_ARGS="" -fi # we can invoke FastR directly, but we do have to set R_HOME export R_HOME="$JRE/languages/R" From 18d6c01f85ea2639699badb99cc3989ff7c7480e Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Wed, 13 Mar 2019 15:55:06 +0100 Subject: [PATCH 08/71] add jacoco coverage --- ci.hocon | 2 ++ ci_common/common.hocon | 8 ++++++++ mx.fastr/suite.py | 1 + 3 files changed, 11 insertions(+) diff --git a/ci.hocon b/ci.hocon index b50f1b61f9..36873302ee 100644 --- a/ci.hocon +++ b/ci.hocon @@ -22,4 +22,6 @@ builds = [ ${internalPkgtest} {capabilities : [linux, amd64], targets : [gate], name: "gate-internal-pkgtest-linux-amd64"} ${gateTestJava9Linux} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-test-java9-linux-amd64"} # ${gnurTests} {capabilities : [linux, amd64, fast], targets : [gate], name: "gate-gnur-tests"} + + ${coverageLinux} {capabilities : [linux, amd64], targets : [weekly], name: "coverage-r-linux-amd64"} ] diff --git a/ci_common/common.hocon b/ci_common/common.hocon index 4e893086b7..44ba2f9645 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -258,3 +258,11 @@ gnurTests: ${commonLinux} { ["mx", "gnu-rtests"] ] } + + +coverageLinux : ${commonLinux} { + run : [ + ['mx', '--jacoco-whitelist-package', 'com.oracle.truffle.r', '--jacoco-exclude-annotation', '@GeneratedBy', "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", '--jacocout', 'html'], + ['mx', '--jacoco-whitelist-package', 'com.oracle.truffle.r', '--jacoco-exclude-annotation', '@GeneratedBy', 'sonarqube-upload', "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", '--exclude-generated'] + ] +} diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 067e564eed..35f0582eee 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -74,6 +74,7 @@ "annotationProcessors" : ["TRUFFLE_R_PARSER_PROCESSOR"], "spotbugsIgnoresGenerated" : True, "workingSets" : "Truffle,FastR", + "jacoco" : "include", }, "com.oracle.truffle.r.nodes" : { From 9fb3618e9f709ce692d4a55792898533e2ee25f4 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Wed, 13 Mar 2019 16:33:07 +0100 Subject: [PATCH 09/71] formatting for hocon --- ci_common/common.hocon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci_common/common.hocon b/ci_common/common.hocon index 44ba2f9645..7414235063 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -262,7 +262,7 @@ gnurTests: ${commonLinux} { coverageLinux : ${commonLinux} { run : [ - ['mx', '--jacoco-whitelist-package', 'com.oracle.truffle.r', '--jacoco-exclude-annotation', '@GeneratedBy', "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", '--jacocout', 'html'], - ['mx', '--jacoco-whitelist-package', 'com.oracle.truffle.r', '--jacoco-exclude-annotation', '@GeneratedBy', 'sonarqube-upload', "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", '--exclude-generated'] + ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"], + ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"] ] } From 3efaab6756894a840c4586f0dc53b8ace73b4b68 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Wed, 13 Mar 2019 18:11:34 +0100 Subject: [PATCH 10/71] don't exclude generated classes for the time being --- ci_common/common.hocon | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ci_common/common.hocon b/ci_common/common.hocon index 7414235063..05cfa11986 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -262,7 +262,10 @@ gnurTests: ${commonLinux} { coverageLinux : ${commonLinux} { run : [ - ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"], - ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"] +// cannot run with excluded "GeneratedBy" since that would lead to "command line too long" +// ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"], +// ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--jacoco-exclude-annotation", "@GeneratedBy", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"] + ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "--strict-compliance", "rgate", "-B=--force-deprecation-as-warning", "--strict-mode", "-t", "Versions,JDKReleaseInfo,BuildJavaWithJavac,UnitTests: no specials,UnitTests: with specials,Rembedded", "--jacocout", "html"], + ["mx", "--jacoco-whitelist-package", "com.oracle.truffle.r", "sonarqube-upload", "-Dsonar.host.url=$SONAR_HOST_URL", "-Dsonar.projectKey=com.oracle.graalvm.r", "-Dsonar.projectName=GraalVM - R", "--exclude-generated"] ] } From 3d790c668028be6564ada160454a85432022799b Mon Sep 17 00:00:00 2001 From: stepan Date: Thu, 14 Mar 2019 15:26:00 +0100 Subject: [PATCH 11/71] CrossProduct should increment ref count of a reused vector --- .../r/nodes/builtin/base/CrossprodCommon.java | 15 ++++++++++++--- .../oracle/truffle/r/test/ExpectedTestOutput.test | 8 ++++++++ .../r/test/builtins/TestBuiltin_tcrossprod.java | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CrossprodCommon.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CrossprodCommon.java index 63b9e56e6e..d73b706ed8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CrossprodCommon.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CrossprodCommon.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,6 +36,8 @@ import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.GetDimNamesAttributeNode; import com.oracle.truffle.r.nodes.attributes.SpecialAttributesFunctions.SetDimNamesAttributeNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import com.oracle.truffle.r.nodes.function.opt.ShareObjectNode; +import com.oracle.truffle.r.nodes.function.opt.UnShareObjectNode; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.builtins.RBuiltin; import com.oracle.truffle.r.runtime.data.RDataFactory; @@ -117,8 +119,15 @@ protected RDoubleVector crossprodDoubleMatrix(RAbstractDoubleVector x, @Suppress } @Specialization - protected Object crossprod(RAbstractVector x, @SuppressWarnings("unused") RNull y) { - return copyDimNames(x, x, (RAbstractVector) matMult.executeObject(transposeX(x), transposeY(x))); + protected Object crossprod(RAbstractVector x, @SuppressWarnings("unused") RNull y, + @Cached("create()") ShareObjectNode shareObjectNode, + @Cached("create()") UnShareObjectNode unShareObjectNode) { + // We need to bump up ref count of "x" so that the transpose does not reuse a temporary + // vector + shareObjectNode.execute(x); + RAbstractVector result = copyDimNames(x, x, (RAbstractVector) matMult.executeObject(transposeX(x), transposeY(x))); + unShareObjectNode.execute(x); + return result; } private Object transposeX(RAbstractVector x) { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 611fdd8144..135b6e9350 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -82115,6 +82115,14 @@ Error in tanpi(argv[[1]]) : unimplemented complex function Warning message: In tanpi(argv[[1]]) : NaNs produced +##com.oracle.truffle.r.test.builtins.TestBuiltin_tcrossprod.testSingleVector# +#apply(array(NA, dim=c(2,1)), 2 ,tcrossprod) + [,1] +[1,] NA +[2,] NA +[3,] NA +[4,] NA + ##com.oracle.truffle.r.test.builtins.TestBuiltin_tcrossprod.testSingleVector# #tcrossprod(c(1,2)) [,1] [,2] diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tcrossprod.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tcrossprod.java index edb7f388cd..93a49fb1b8 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tcrossprod.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_tcrossprod.java @@ -76,5 +76,6 @@ public void testTCrossprodDimnames() { public void testSingleVector() { assertEval("tcrossprod(c(1,2))"); assertEval("tcrossprod(matrix(1:4, nrow=2))"); + assertEval("apply(array(NA, dim=c(2,1)), 2 ,tcrossprod)"); } } From 6e3815b8f3c24326adf1053292d403dd1f1dddf9 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 28 Dec 2018 17:57:04 +0100 Subject: [PATCH 12/71] Add a dummy package with GNU-R regression tests --- .../packages/Makefile | 2 +- .../packages/PACKAGES | 6 + .../packages/gnurtests/Makefile | 24 ++ .../packages/gnurtests/gnurtests/DESCRIPTION | 10 + .../packages/gnurtests/gnurtests/NAMESPACE | 0 .../packages/gnurtests/gnurtests/R/dummy.R | 23 ++ .../gnurtests/gnurtests/tests/any-all.R | 93 ++++++ .../gnurtests/gnurtests/tests/arith-true.R | 220 +++++++++++++++ .../gnurtests/gnurtests/tests/arith.R | 26 ++ .../gnurtests/gnurtests/tests/datetime.R | 37 +++ .../gnurtests/gnurtests/tests/demos2.R | 10 + .../gnurtests/gnurtests/tests/eval-fns.R | 77 +++++ .../gnurtests/gnurtests/tests/iec60559.R | 18 ++ .../gnurtests/gnurtests/tests/lm-tests.R | 78 +++++ .../gnurtests/tests/method-dispatch.R | 62 ++++ .../gnurtests/tests/p-r-random-tests.R | 138 +++++++++ .../gnurtests/gnurtests/tests/print-tests.R | 266 ++++++++++++++++++ .../gnurtests/gnurtests/tests/r-strict-tst.R | 58 ++++ .../gnurtests/gnurtests/tests/reg-BLAS.R | 135 +++++++++ .../gnurtests/gnurtests/tests/reg-IO.R | 61 ++++ .../gnurtests/gnurtests/tests/simple-true.R | 190 +++++++++++++ .../gnurtests/gnurtests/tests/timezone.R | 9 + .../packages/gnurtests/gnurtests/tests/utf8.R | 54 ++++ .../packages/pkg-filelist | 1 + 24 files changed, 1597 insertions(+), 1 deletion(-) create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/Makefile create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/DESCRIPTION create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/NAMESPACE create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/R/dummy.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/any-all.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith-true.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/datetime.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/demos2.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/eval-fns.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/iec60559.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/lm-tests.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/method-dispatch.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/p-r-random-tests.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/print-tests.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/r-strict-tst.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-BLAS.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-IO.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/simple-true.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/timezone.R create mode 100644 com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/utf8.R diff --git a/com.oracle.truffle.r.test.native/packages/Makefile b/com.oracle.truffle.r.test.native/packages/Makefile index beef62c98c..b98c730e35 100644 --- a/com.oracle.truffle.r.test.native/packages/Makefile +++ b/com.oracle.truffle.r.test.native/packages/Makefile @@ -23,7 +23,7 @@ .PHONY: all clean make_subdirs clean_subdirs clean_recommended -SUBDIRS = testrffi vanilla tests4 +SUBDIRS = testrffi vanilla tests4 gnurtests NATIVE_RECOMMENDED_PROJECT = $(subst test.native,native.recommended,$(TOPDIR)) ifndef GNUR_HOME_BINARY FASTR_R_HOME = $(abspath $(TOPDIR)/..) diff --git a/com.oracle.truffle.r.test.native/packages/PACKAGES b/com.oracle.truffle.r.test.native/packages/PACKAGES index aa815aabd4..4c3f9db2e2 100644 --- a/com.oracle.truffle.r.test.native/packages/PACKAGES +++ b/com.oracle.truffle.r.test.native/packages/PACKAGES @@ -15,3 +15,9 @@ Version: 1.0 Depends: R License: GPL-2 NeedsCompilation: no + +Package: gnurtests +Version: 1.0 +Depends: R +License: GPL-3 +NeedsCompilation: no diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/Makefile b/com.oracle.truffle.r.test.native/packages/gnurtests/Makefile new file mode 100644 index 0000000000..aac48647b8 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/Makefile @@ -0,0 +1,24 @@ +# +# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 3 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 3 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +include ../package.mk diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/DESCRIPTION b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/DESCRIPTION new file mode 100644 index 0000000000..af343f4f23 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/DESCRIPTION @@ -0,0 +1,10 @@ +Package: gnurtests +Type: Package +Title: Empty package that contains the regression tests from GNU-R +Version: 1.0 +Date: 2018-12-24 +Author: FastR Tester +Maintainer: FastR Tester +Description: Contains the GNU-R regression tests +License: GPL-3 +Depends: R (>= 3.1.3) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/NAMESPACE b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/NAMESPACE new file mode 100644 index 0000000000..e69de29bb2 diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/R/dummy.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/R/dummy.R new file mode 100644 index 0000000000..badddd43b1 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/R/dummy.R @@ -0,0 +1,23 @@ +# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 3 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 3 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. + + +# dummy file, the important part of this package are the tests diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/any-all.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/any-all.R new file mode 100644 index 0000000000..80007e29ba --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/any-all.R @@ -0,0 +1,93 @@ +basic_tests <- list( + list(input=c(TRUE, FALSE), any=TRUE, all=FALSE), + list(input=c(FALSE, TRUE), any=TRUE, all=FALSE), + + list(input=c(TRUE, TRUE), any=TRUE, all=TRUE), + list(input=c(FALSE, FALSE), any=FALSE, all=FALSE), + + list(input=c(NA, FALSE), any=NA, all=FALSE, any.na.rm=FALSE), + list(input=c(FALSE, NA), any=NA, all=FALSE, any.na.rm=FALSE), + + list(input=c(NA, TRUE), any=TRUE, all=NA, all.na.rm=TRUE), + list(input=c(TRUE, NA), any=TRUE, all=NA, all.na.rm=TRUE), + + list(input=logical(0), any=FALSE, all=TRUE), + + list(input=NA, any=NA, all=NA, any.na.rm=FALSE, any.na.rm=TRUE), + + list(input=c(TRUE, NA, FALSE), any=TRUE, any.na.rm=TRUE, + all=FALSE, all.na.rm=FALSE) + ) + +## any, all accept '...' for input. +list_input_tests <- + list( + list(input=list(TRUE, TRUE), all=TRUE, any=TRUE), + list(input=list(FALSE, FALSE), all=FALSE, any=FALSE), + list(input=list(TRUE, FALSE), all=FALSE, any=TRUE), + list(input=list(FALSE, TRUE), all=FALSE, any=TRUE), + + list(input=list(FALSE, NA), + all=FALSE, all.na.rm=FALSE, any=NA, any.na.rm=FALSE), + list(input=list(NA, FALSE), + all=FALSE, all.na.rm=FALSE, any=NA, any.na.rm=FALSE), + + list(input=list(TRUE, NA), + all=NA, all.na.rm=TRUE, any=TRUE, any.na.rm=TRUE), + list(input=list(NA, TRUE), + all=NA, all.na.rm=TRUE, any=TRUE, any.na.rm=TRUE), + + list(input=list(NA, NA), + any=NA, any.na.rm=FALSE, all=NA, all.na.rm=TRUE), + + list(input=list(rep(TRUE, 2), rep(TRUE, 10)), + all=TRUE, any=TRUE), + + list(input=list(rep(TRUE, 2), c(TRUE, NA)), + all=NA, all.na.rm=TRUE, any=TRUE), + + list(input=list(rep(TRUE, 2), c(TRUE, FALSE)), + all=FALSE, any=TRUE), + + list(input=list(c(TRUE, FALSE), c(TRUE, NA)), + all=FALSE, all.na.rm=FALSE, any=TRUE, any.na.rm=TRUE) + ) + + + +do_tests <- function(L) +{ + run <- function(f, input, na.rm = FALSE) + { + if (is.list(input)) + do.call(f, c(input, list(na.rm = na.rm))) + else f(input, na.rm = na.rm) + } + + do_check <- function(case, f) + { + fun <- deparse(substitute(f)) + if (!identical(case[[fun]], run(f, case$input))) { + cat("input: "); dput(case$input) + stop(fun, " returned ", run(f, case$input), + " wanted ", case[[fun]], call. = FALSE) + } + narm <- paste(fun, ".na.rm", sep = "") + if (!is.null(case[[narm]])) { + if (!identical(case[[narm]], + run(f, case$input, na.rm = TRUE))) { + cat("input: "); dput(case$input) + stop(narm, " returned ", run(f, case$input, na.rm = TRUE), + " wanted ", case[[narm]], call. = FALSE) + } + } + } + lab <- deparse(substitute(L)) + for (case in L) { + do_check(case, any) + do_check(case, all) + } +} + +do_tests(basic_tests) +do_tests(list_input_tests) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith-true.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith-true.R new file mode 100644 index 0000000000..c0183ab9c1 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith-true.R @@ -0,0 +1,220 @@ +####=== Numerical / Arithmetic Tests +####--- ALL tests here should return TRUE ! +### +### '##P': These lines don't give TRUE but relevant ``Print output'' + +### --> d-p-q-r-tests.R for distribution things + +.proctime00 <- proc.time() +opt.conformance <- 0 +Meps <- .Machine $ double.eps + +## this uses random inputs, so set the seed +set.seed(1) + +options(rErr.eps = 1e-30) +rErr <- function(approx, true, eps = .Options$rErr.eps) +{ + if(is.null(eps)) { eps <- 1e-30; options(rErr.eps = eps) } + ifelse(Mod(true) >= eps, + 1 - approx / true, # relative error + true - approx) # absolute error (e.g. when true=0) +} + +abs(1- .Machine$double.xmin * 10^(-.Machine$double.min.exp*log10(2)))/Meps < 1e3 +##P (1- .Machine$double.xmin * 10^(-.Machine$double.min.exp*log10(2)))/Meps +if(opt.conformance)#fails at least on SGI/IRIX 6.5 +abs(1- .Machine$double.xmax * 10^(-.Machine$double.max.exp*log10(2)))/Meps < 1e3 + +## More IEEE Infinity/NaN checks +i1 <- pi / 0 +i1 == (i2 <- 1:1 / 0:0) +is.infinite( i1) & is.infinite( i2) & i1 > 12 & i2 > 12 +is.infinite(-i1) & is.infinite(-i2) & (-i1) < -12 & (-i2) < -12 + +is.nan(n1 <- 0 / 0) +is.nan( - n1) + +i1 == i1 + i1 +i1 == i1 * i1 +is.nan(i1 - i1) +is.nan(i1 / i1) + +1/0 == Inf & 0 ^ -1 == Inf +1/Inf == 0 & Inf ^ -1 == 0 + +iNA <- as.integer(NA) +!is.na(Inf) & !is.nan(Inf) & is.infinite(Inf) & !is.finite(Inf) +!is.na(-Inf)& !is.nan(-Inf)& is.infinite(-Inf)& !is.finite(-Inf) + is.na(NA) & !is.nan(NA) & !is.infinite(NA) & !is.finite(NA) + is.na(NaN) & is.nan(NaN) & !is.infinite(NaN) & !is.finite(NaN) + is.na(iNA) & !is.nan(iNA) & !is.infinite(iNA) & !is.finite(iNA) + +## These are "double"s: +all(!is.nan(c(1.,NA))) +all(c(FALSE,TRUE,FALSE) == is.nan(c (1.,NaN,NA))) +## lists are no longer allowed +## all(c(FALSE,TRUE,FALSE) == is.nan(list(1.,NaN,NA))) + + +## log() and "pow()" -- POSIX is not specific enough.. +log(0) == -Inf +is.nan(log(-1))# TRUE and warning + +rp <- c(1:2,Inf); rn <- rev(- rp) +r <- c(rn, 0, rp, NA, NaN) +all(r^0 == 1) +ir <- suppressWarnings(as.integer(r)) +all(ir^0 == 1) +# FastR commented-out: all(ir^0L == 1)# not in R <= 2.15.0 +all( 1^r == 1)# not in R 0.64 +all(1L^r == 1) +# FastR commented-out: all(1L^ir == 1)# not in R <= 2.15.0 +all((rn ^ -3) == -((-rn) ^ -3)) +# +all(c(1.1,2,Inf) ^ Inf == Inf) +all(c(1.1,2,Inf) ^ -Inf == 0) +.9 ^ Inf == 0 +.9 ^ -Inf == Inf +## Wasn't ok in 0.64: +all(is.nan(rn ^ .5))# in some C's : (-Inf) ^ .5 gives Inf, instead of NaN + + +## Real Trig.: +cos(0) == 1 +sin(3*pi/2) == cos(pi) +x <- rnorm(99) +all( sin(-x) == - sin(x)) +all( cos(-x) == cos(x)) + +x <- 1:99/100 +all(abs(1 - x / asin(sin(x))) <= 2*Meps)# "== 2*" for HP-UX +all(abs(1 - x / atan(tan(x))) < 2*Meps) + +## Sun has asin(.) = acos(.) = 0 for these: +## is.nan(acos(1.1)) && is.nan(asin(-2)) [!] + +## gamma() +abs(gamma(1/2)^2 - pi) < 4* Meps +r <- rlnorm(5000) # NB random, and next has failed for some seed +all(abs(rErr(gamma(r+1), r*gamma(r))) < 500 * Meps) +## more accurate for integers n <= 50 since R 1.8.0 Sol8: perfect +n <- 20; all( gamma(1:n) == cumprod(c(1,1:(n-1))))# Lnx: up too n=28 +n <- 50; all(abs(rErr( gamma(1:n), cumprod(c(1,1:(n-1))))) < 20*Meps)#Lnx: f=2 +n <- 120; all(abs(rErr( gamma(1:n), cumprod(c(1,1:(n-1))))) < 1000*Meps) +n <- 10000;all(abs(rErr(lgamma(1:n),cumsum(log(c(1,1:(n-1)))))) < 100*Meps) + +n <- 10; all( gamma(1:n) == cumprod(c(1,1:(n-1)))) +n <- 20; all(abs(rErr( gamma(1:n), cumprod(c(1,1:(n-1))))) < 100*Meps) +n <- 120; all(abs(rErr( gamma(1:n), cumprod(c(1,1:(n-1))))) < 1000*Meps) +n <- 10000;all(abs(rErr(lgamma(1:n),cumsum(log(c(1,1:(n-1)))))) < 100*Meps) + +all(is.nan(gamma(0:-47))) # + warn. + +## choose() {and lchoose}: +n51 <- c(196793068630200, 229591913401900, 247959266474052) +abs(c(n51, rev(n51))- choose(51, 23:28)) <= 2 +all(choose(0:4,2) == c(0,0,1,3,6)) +## 3 to 8 units off and two NaN's in 1.8.1 + +## psi[gamma](x) and derivatives: +## psi == digamma: +gEuler <- 0.577215664901532860606512# = Euler's gamma +abs(digamma(1) + gEuler) < 32*Meps # i386 Lx: = 2.5*Meps +all.equal(digamma(1) - digamma(1/2), log(4), tolerance = 32*Meps)# Linux: < 1*Meps! +n <- 1:12 +all.equal(digamma(n), + - gEuler + c(0, cumsum(1/n)[-length(n)]),tolerance = 32*Meps)#i386 Lx: 1.3 Meps +all.equal(digamma(n + 1/2), + - gEuler - log(4) + 2*cumsum(1/(2*n-1)),tolerance = 32*Meps)#i386 Lx: 1.8 Meps +## higher psigamma: +all.equal(psigamma(1, deriv=c(1,3,5)), + pi^(2*(1:3)) * c(1/6, 1/15, 8/63), tolerance = 32*Meps) +x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length=61), 5.1, 77) +## Intel icc showed a < 1ulp difference in the second. +# FastR commented-out: stopifnot(all.equal( digamma(x), psigamma(x,0), tolerance = 2*Meps), +# FastR commented-out: all.equal(trigamma(x), psigamma(x,1), tolerance = 2*Meps))# TRUE (+ NaN warnings) +## very large x: +x <- 1e30 ^ (1:10) +a.relE <- function(appr, true) abs(1 - appr/true) +stopifnot(a.relE(digamma(x), log(x)) < 1e-13, + a.relE(trigamma(x), 1/x) < 1e-13) +x <- sqrt(x[2:6]); stopifnot(a.relE(psigamma(x,2), - 1/x^2) < 1e-13) +x <- 10^(10*(2:6));stopifnot(a.relE(psigamma(x,5), +24/x^5) < 1e-13) + +## fft(): +ok <- TRUE +##test EXTENSIVELY: for(N in 1:100) { + cat(".") + for(n in c(1:30, 1000:1050)) { + x <- rnorm(n) + er <- Mod(rErr(fft(fft(x), inverse = TRUE)/n, x*(1+0i))) + n.ok <- all(er < 1e-8) & quantile(er, 0.95, names=FALSE) < 10000*Meps + if(!n.ok) cat("\nn=",n,": quantile(rErr, c(.95,1)) =", + formatC(quantile(er, prob= c(.95,1))),"\n") + ok <- ok & n.ok + } + cat("\n") +##test EXTENSIVELY: } +ok + +## var(): +for(n in 2:10) + print(all.equal(n*(n-1)*var(diag(n)), + matrix(c(rep(c(n-1,rep(-1,n)),n-1), n-1), nr=n, nc=n), + tolerance = 20*Meps)) # use tolerance = 0 to see rel.error + +## pmin() & pmax() -- "attributes" ! +v1 <- c(a=2) +m1 <- cbind( 2:4,3) +m2 <- cbind(a=2:4,2) + +all( pmax(v1, 1:3) == pmax(1:3, v1) & pmax(1:3, v1) == c(2,2,3)) +all( pmin(v1, 1:3) == pmin(1:3, v1) & pmin(1:3, v1) == c(1,2,2)) + +oo <- options(warn = -1)# These four lines each would give 3-4 warnings : + all( pmax(m1, 1:7) == pmax(1:7, m1) & pmax(1:7, m1) == c(2:4,4:7)) + all( pmin(m1, 1:7) == pmin(1:7, m1) & pmin(1:7, m1) == c(1:3,3,3,3,2)) + all( pmax(m2, 1:7) == pmax(1:7, m2) & pmax(1:7, m2) == pmax(1:7, m1)) + all( pmin(m2, 1:7) == pmin(1:7, m2) & pmin(1:7, m2) == c(1:3,2,2,2,2)) +options(oo) + +## pretty() +stopifnot(pretty(1:15) == seq(0,16, by=2), + pretty(1:15, h=2) == seq(0,15, by=5), + pretty(1) == 0:1, + pretty(pi) == c(2,4), + pretty(pi, n=6) == 2:4, + pretty(pi, n=10) == 2:5, + pretty(pi, shr=.1)== c(3, 3.5)) + +## gave infinite loop [R 0.64; Solaris], seealso PR#390 : +all(pretty((1-1e-5)*c(1,1+3*Meps), 7) == seq(0,1,len=3)) + +n <- 1000 +x12 <- matrix(NA, 2,n); x12[,1] <- c(2.8,3) # Bug PR#673 +for(j in 1:2) x12[j, -1] <- round(rnorm(n-1), dig = rpois(n-1, lam=3.5) - 2) +for(i in 1:n) { + lp <- length(p <- pretty(x <- sort(x12[,i]))) + stopifnot(p[1] <= x[1] & x[2] <= p[lp], + all(x==0) || all.equal(p, rev(-pretty(-x)), tolerance = 10*Meps)) +} + +## PR#741: +pi != (pi0 <- pi + 2*.Machine$double.eps) +is.na(match(c(1,pi,pi0), pi)[3]) + +## PR#749: +all(is.na(c(NA && TRUE, TRUE && NA, NA && NA, + NA || FALSE,FALSE || NA, NA || NA))) + +all((c(NA || TRUE, TRUE || NA, + !c(NA && FALSE,FALSE && NA)))) + + +## not sure what the point of this is: it gives mean(numeric(0)), that is NaN +(z <- mean(rep(NA_real_, 2), trim = .1, na.rm = TRUE)) +is.na(z) + +## Last Line: +# FastR commented-out: cat('Time elapsed: ', proc.time() - .proctime00,'\n') diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith.R new file mode 100644 index 0000000000..9ee37234dd --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/arith.R @@ -0,0 +1,26 @@ +options(digits=7) + +## powers +outer(a <- -4:12, -2:7, "^") + +for (n1 in 1:7) + print(zapsmall(polyroot(1:n1), digits = 10)) + +## lowess() {incl. sort, etc}: +options(digits = 5) + +lowess(c(3,2,6,3,8,4))$y # this used to differ on Linux + +y1 <- c(3,1:2,5:2,4,1:3,3) +lowess(y1)$y +lowess(y1, f = .4)$y + +lowess(c(y1,100), f = .4)$y + +## this is the test sample from Cleveland's original lowess.doc: +x <- c(1:5, rep(6,10),8,10,12,14,50) +y <- c(18,2,15,6,10,4,16,11,7,3,14,17,20,12,9,13,1,8,5,19) +lowess(x,y, f = .25, iter = 0, delta = 0)$y +lowess(x,y, f = .25, iter = 0, delta = 3)$y +lowess(x,y, f = .25, iter = 2, delta = 0)$y + diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/datetime.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/datetime.R new file mode 100644 index 0000000000..083cc53ed3 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/datetime.R @@ -0,0 +1,37 @@ +#### Test R's (64-bit) date-time functions .. output tested *sloppily* + +## R's internal fixes are used on 32-bit platforms. +## macOS gets these wrong: see HAVE_WORKING_64BIT_MKTIME + +Sys.setenv(TZ = "UTC") +(z <- as.POSIXct("1848-01-01 12:00")) +c(unclass(z)) +(z <- as.POSIXct("2040-01-01 12:00")) +c(unclass(z)) +(z <- as.POSIXct("2040-07-01 12:00")) +c(unclass(z)) + +Sys.setenv(TZ = "Europe/London") # pretty much portable. +(z <- as.POSIXct("1848-01-01 12:00")) +c(unclass(z)) +(z <- as.POSIXct("2040-01-01 12:00")) +c(unclass(z)) +# FastR commented-out(different time type on gate 'BST' vs 'GMT'): (z <- as.POSIXct("2040-07-01 12:00")) +# FastR commented-out: c(unclass(z)) + +Sys.setenv(TZ = "EST5EDT") +(z <- as.POSIXct("1848-01-01 12:00")) +c(unclass(z)) +(z <- as.POSIXct("2040-01-01 12:00")) +c(unclass(z)) +# FastR commented-out: (z <- as.POSIXct("2040-07-01 12:00")) +# FastR commented-out: c(unclass(z)) + +## PR15613: had day as > 24hrs. +# FastR commented-out: as.POSIXlt(ISOdate(2071,1,13,0,0,tz="Etc/GMT-1"))$wday +# FastR commented-out: as.POSIXlt(ISOdate(2071,1,13,0,1,tz="Etc/GMT-1"))$wday + + +## Incorrect use of %d should work even though abbreviation does match +old <- Sys.setlocale("LC_TIME", "C") # to be sure +stopifnot(!is.na(strptime("11-August-1903", "%d-%b-%Y"))) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/demos2.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/demos2.R new file mode 100644 index 0000000000..1971215f71 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/demos2.R @@ -0,0 +1,10 @@ +#### Run all demos for which we do not wish to diff the output +.ptime <- proc.time() +set.seed(123) + +# FastR changed: demos <- c("Hershey", "Japanese", "lm.glm", "nlm", "plotmath") +demos <- c("Hershey", "Japanese") + +for(nam in demos) demo(nam, character.only = TRUE) + +# FastR commented-out: cat("Time elapsed: ", proc.time() - .ptime, "\n") diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/eval-fns.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/eval-fns.R new file mode 100644 index 0000000000..316ed5d15d --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/eval-fns.R @@ -0,0 +1,77 @@ +### Checking parse(* deparse()) "inversion property" ---------------------------- +## EPD := eval-parse-deparse : eval(text = parse(deparse(*))) +## Hopefully typically the identity(): +pd0 <- function(expr, backtick = TRUE, ...) + parse(text = deparse(expr, backtick=backtick, ...)) +id_epd <- function(expr, control = c("all","digits17"), ...) + eval(pd0(expr, control=control, ...)) +dPut <- function(x, control = c("all","digits17")) dput(x, control=control) +##' Does 'x' contain "real" numbers +##' with > 3 digits after "." where deparse may be platform dependent? +hasReal <- function(x) { + if(is.double(x) || is.complex(x)) + !all((x == round(x, 3)) | is.na(x)) + else if(is.logical(x) || is.integer(x) || + is.symbol(x) || is.call(x) || is.environment(x) || is.character(x)) + FALSE + else if(is.recursive(x)) # recurse : + any(vapply(x, hasReal, NA)) + else if(isS4(x)) { + if(length(sn <- slotNames(x))) + any(vapply(sn, function(s) hasReal(slot(x, s)), NA)) + else # no slots + FALSE # ? + } + else FALSE +} +isMissObj <- function(obj) identical(obj, alist(a=)[[1]]) +##' Does 'obj' contain "the missing object" ? +##' @note defined recursively! +hasMissObj <- function(obj) { + if(is.recursive(obj)) { + if(is.function(obj) || is.language(obj)) + FALSE + else # incl pairlist()s + any(vapply(obj, hasMissObj, NA)) + } else isMissObj(obj) +} +check_EPD <- function(obj, show = !hasReal(obj), oNam = deparse(substitute(obj)), + ## FIXME: add "niceNames" here: ?!? + control = c("keepInteger","showAttributes","keepNA"), + not.identical.ldouble = if(!interactive()) c("t1", "t2", "ydata"), + eq.tol = if(noLdbl) 2*.Machine$double.eps else 0) { + stopifnot(is.character(oNam)) + if(show) dPut(obj) + if(is.environment(obj) || hasMissObj(obj)) { + cat("__ not parse()able __:", + if(is.environment(obj)) "environment" else "hasMissObj(.) is true", "\n") + return(invisible(obj)) # cannot parse it + } + ob2 <- id_epd(obj) + po <- tryCatch(pd0(obj, control=control),# the default deparse() *should* typically parse + error = function(e) { + cat("default parse(*, deparse(obj)) failed:\n ", + conditionMessage(e), + "\n but deparse(*, control='all') should work.\n") + pd0(obj, control = "all") }) + noLdbl <- (.Machine$sizeof.longdouble <= 8) ## TRUE typically from --disable-long-double + if(!identical(obj, ob2, ignore.environment=TRUE, + ignore.bytecode=TRUE, ignore.srcref=TRUE)) { + ae <- all.equal(obj, ob2, tolerance = eq.tol) + if(is.na(match(oNam, not.identical.ldouble))) { + ae.txt <- "all.equal(*,*, tol = ..)" + ## differs for "no-ldouble": sprintf("all.equal(*,*, tol = %.3g)", eq.tol) + cat("not identical(*, ignore.env=T),", if(isTRUE(ae)) paste("but", ae.txt), "\n") + } + if(!isTRUE(ae)) stop("Not equal: ", ae.txt, " giving\n", ae) + } + if(!is.language(obj)) { + ob2. <- eval(obj) ## almost always *NOT* identical to obj, but eval()ed + } + if(show || !is.list(obj)) { ## check it works when wrapped (but do not recurse inf.!) + cat(" --> checking list(*): ") + check_EPD(list(.chk = obj), show = FALSE, oNam=oNam, eq.tol=eq.tol) + cat("Ok\n") + } + invisible(obj) +} diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/iec60559.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/iec60559.R new file mode 100644 index 0000000000..3f3c926547 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/iec60559.R @@ -0,0 +1,18 @@ +## Tests for various features of IEC60559 doubles. +## Most of these are optional, so this is a sloppy test. + +# Goes to denormal (aka subnormal) numbers at -708.4 +exp(c(-745:-740, -730, -720, -710:-705)) + +# goes to subnormal numbers at -308, to zero at ca 5e-324. +# FastR commented-out: 10^-(324:307) +# FastR commented-out: 2^-(1022:1075) + +# And because most libm pow() functions special-case integer powers. +10^-(324:307-0.01)/10^0.01 + +# IEC60559 mandates this, but C99/C11 do not. +# Mingw-w64 did not do so in v 2.0.1 +x <- 0*(-1) # negative zero +sqrt(x) +identical(x, sqrt(x)) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/lm-tests.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/lm-tests.R new file mode 100644 index 0000000000..0a2bd81186 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/lm-tests.R @@ -0,0 +1,78 @@ +###-- Linear Models, basic functionality -- weights included. + +## From John Maindonald : +roller <- data.frame( + weight = c(1.9, 3.1, 3.3, 4.8, 5.3, 6.1, 6.4, 7.6, 9.8, 12.4), + depression = c( 2, 1, 5, 5, 20, 20, 23, 10, 30, 25)) + +roller.lmu <- lm(weight~depression, data=roller) +# FastR commented-out: roller.lsfu <- lsfit(roller$depression, roller$weight) + +roller.lsf <- lsfit(roller$depression, roller$weight, wt = 1:10) +roller.lsf0 <- lsfit(roller$depression, roller$weight, wt = 0:9) +roller.lm <- lm(weight~depression, data=roller, weights= 1:10) +roller.lm0 <- lm(weight~depression, data=roller, weights= 0:9) +roller.lm9 <- lm(weight~depression, data=roller[-1,],weights= 1:9) +roller.glm <- glm(weight~depression, data=roller, weights= 1:10) +roller.glm0<- glm(weight~depression, data=roller, weights= 0:9) + +predict(roller.glm0, type="terms")# failed till 2003-03-31 + +## FIXME : glm()$residual [1] is NA, lm()'s is ok. +## all.equal(residuals(roller.glm0, type = "partial"), +## residuals(roller.lm0, type = "partial") ) + + +all.equal(deviance(roller.lm), + deviance(roller.glm)) +all.equal(weighted.residuals(roller.lm), + residuals (roller.glm)) + +all.equal(deviance(roller.lm0), + deviance(roller.glm0)) +all.equal(weighted.residuals(roller.lm0, drop=FALSE), + residuals (roller.glm0)) + +(im.lm0 <- influence.measures(roller.lm0)) + +# FastR commented-out: all.equal(unname(im.lm0 $ infmat), +# FastR commented-out: unname(cbind( dfbetas (roller.lm0) +# FastR commented-out: , dffits (roller.lm0) +# FastR commented-out: , covratio (roller.lm0) +# FastR commented-out: ,cooks.distance(roller.lm0) +# FastR commented-out: ,lm.influence (roller.lm0)$hat) +# FastR commented-out: )) + +all.equal(rstandard(roller.lm9), + rstandard(roller.lm0),tolerance = 1e-14) +all.equal(rstudent(roller.lm9), + rstudent(roller.lm0),tolerance = 1e-14) +all.equal(rstudent(roller.lm), + rstudent(roller.glm)) +# FastR commented-out: all.equal(cooks.distance(roller.lm), +# FastR commented-out: cooks.distance(roller.glm)) + + +all.equal(summary(roller.lm0)$coefficients, + summary(roller.lm9)$coefficients, tolerance = 1e-14) +all.equal(print(anova(roller.lm0), signif.st=FALSE), + anova(roller.lm9), tolerance = 1e-14) + + +### more regression tests for lm(), glm(), etc : + +## moved from ?influence.measures: +lm.SR <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings) +(IM <- influence.measures(lm.SR)) +summary(IM) +## colnames will differ in the next line +all.equal(dfbetas(lm.SR), IM$infmat[, 1:5], check.attributes = FALSE, + tolerance = 1e-12) + +signif(dfbeta(lm.SR), 3) +covratio (lm.SR) + +## predict.lm(.) + +all.equal(predict(roller.lm, se.fit=TRUE)$se.fit, + predict(roller.lm, newdata=roller, se.fit=TRUE)$se.fit, tolerance = 1e-14) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/method-dispatch.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/method-dispatch.R new file mode 100644 index 0000000000..11fced1bf8 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/method-dispatch.R @@ -0,0 +1,62 @@ +#### Testing UseMethod() and even more NextMethod() +#### -------------------- +#### i.e., S3 methods *only*. For S4, see reg-S4.R +## ~~~~~~~~ + +###-- Group methods + +## previous versions used print() and hit an auto-printing bug. + +### Arithmetic "Ops" : +">.bar" <- function(...) {cat("using >.bar\n"); FALSE} +">.foo" <- function(...) {cat("using >.foo\n"); TRUE} +Ops.foo <- function(...) { + cat("using Ops.foo\n") + NextMethod() +} +Ops.bar <- function(...) { + cat("using Ops.bar\n") + TRUE +} + +x <- 2:4 ; class(x) <- c("foo", "bar") +y <- 4:2 ; class(y) <- c("bar", "foo") + +## The next 4 give a warning each about incompatible methods: +# FastR commented-out: x > y +# FastR commented-out: y < x # should be the same (warning msg not, however) +# FastR commented-out: x == y +# FastR commented-out: x <= y + +x > 3 ##[1] ">.foo" + +rm(list=">.foo") +x > 3 #-> "Ops.foo" and ">.bar" + + + +### ------------ was ./mode-methods.R till R ver. 1.0.x ---------------- + +###-- Using Method Dispatch on "mode" etc : +## Tests S3 dispatch with the class attr forced to be data.class +## Not very relevant when S4 methods are around, but kept for historical interest +abc <- function(x, ...) { + cat("abc: Before dispatching; x has class `", class(x), "':", sep="") + str(x) + UseMethod("abc", x) ## UseMethod("abc") (as in S) fails +} + +abc.default <- function(x, ...) sys.call() + +"abc.(" <- function(x) + cat("'(' method of abc:", deparse(sys.call(sys.parent())),"\n") +abc.expression <- function(x) + cat("'expression' method of abc:", deparse(sys.call(sys.parent())),"\n") + +abc(1) +e0 <- expression((x)) +e1 <- expression(sin(x)) +abc(e0) +abc(e1) +# FastR commented-out: abc(e0[[1]]) +abc(e1[[1]]) diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/p-r-random-tests.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/p-r-random-tests.R new file mode 100644 index 0000000000..233ab6481d --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/p-r-random-tests.R @@ -0,0 +1,138 @@ +## +## RNG tests using DKW inequality for rate of convergence +## +## P(sup | F_n - F | > t) < 2 exp(-2nt^2) +## +## The 2 in front of exp() was derived by Massart. It is the best possible +## constant valid uniformly in t,n,F. For large n*t^2 this agrees with the +## large-sample approximation to the Kolmogorov-Smirnov statistic. +## + + +superror <- function(rfoo,pfoo,sample.size,...) { + x <- rfoo(sample.size,...) + tx <- table(signif(x, 12)) # such that xi will be sort(unique(x)) + xi <- as.numeric(names(tx)) + f <- pfoo(xi,...) + fhat <- cumsum(tx)/sample.size + max(abs(fhat-f)) +} + +pdkwbound <- function(n,t) 2*exp(-2*n*t*t) + +qdkwbound <- function(n,p) sqrt(log(p/2)/(-2*n)) + +dkwtest <- function(stub = "norm", ..., + sample.size = 10000, pthreshold = 0.001, + print.result = TRUE, print.detail = FALSE, + stop.on.failure = TRUE) +{ + rfoo <- eval(as.name(paste("r", stub, sep=""))) + pfoo <- eval(as.name(paste("p", stub, sep=""))) + s <- superror(rfoo, pfoo, sample.size, ...) + if (print.result || print.detail) { + printargs <- substitute(list(...)) + printargs[[1]] <- as.name(stub) + cat(deparse(printargs)) + if (print.detail) + cat("\nsupremum error = ",signif(s,2), + " with p-value=",min(1,round(pdkwbound(sample.size,s),4)),"\n") + } + rval <- (s < qdkwbound(sample.size,pthreshold)) + if (print.result) + cat(c(" FAILED\n"," PASSED\n")[rval+1]) + if (stop.on.failure && !rval) + stop("dkwtest failed") + rval +} + +.proctime00 <- proc.time() # start timing + + +dkwtest("binom",size = 1,prob = 0.2) +dkwtest("binom",size = 2,prob = 0.2) +dkwtest("binom",size = 100,prob = 0.2) +dkwtest("binom",size = 1e4,prob = 0.2) +dkwtest("binom",size = 1,prob = 0.8) +dkwtest("binom",size = 100,prob = 0.8) +dkwtest("binom",size = 100,prob = 0.999) + +dkwtest("pois",lambda = 0.095) +dkwtest("pois",lambda = 0.95) +dkwtest("pois",lambda = 9.5) +dkwtest("pois",lambda = 95) + +dkwtest("nbinom",size = 1,prob = 0.2) +dkwtest("nbinom",size = 2,prob = 0.2) +dkwtest("nbinom",size = 100,prob = 0.2) +dkwtest("nbinom",size = 1e4,prob = 0.2) +dkwtest("nbinom",size = 1,prob = 0.8) +dkwtest("nbinom",size = 100,prob = 0.8) +dkwtest("nbinom",size = 100,prob = 0.999) + +dkwtest("norm") +dkwtest("norm",mean = 5,sd = 3) + +dkwtest("gamma",shape = 0.1) +dkwtest("gamma",shape = 0.2) +dkwtest("gamma",shape = 10) +dkwtest("gamma",shape = 20) + +dkwtest("hyper",m = 40,n = 30,k = 20) +dkwtest("hyper",m = 40,n = 3,k = 20) +dkwtest("hyper",m = 6,n = 3,k = 2) +dkwtest("hyper",m = 5,n = 3,k = 2) +dkwtest("hyper",m = 4,n = 3,k = 2) + + +dkwtest("signrank",n = 1) +dkwtest("signrank",n = 2) +dkwtest("signrank",n = 10) +dkwtest("signrank",n = 30) + +dkwtest("wilcox",m = 40,n = 30) +dkwtest("wilcox",m = 40,n = 10) +dkwtest("wilcox",m = 6,n = 3) +dkwtest("wilcox",m = 5,n = 3) +dkwtest("wilcox",m = 4,n = 3) + +dkwtest("chisq",df = 1) +dkwtest("chisq",df = 10) + +dkwtest("logis") +dkwtest("logis",location = 4,scale = 2) + +dkwtest("t",df = 1) +dkwtest("t",df = 10) +dkwtest("t",df = 40) + +dkwtest("beta",shape1 = 1, shape2 = 1) +dkwtest("beta",shape1 = 2, shape2 = 1) +dkwtest("beta",shape1 = 1, shape2 = 2) +dkwtest("beta",shape1 = 2, shape2 = 2) +dkwtest("beta",shape1 = .2,shape2 = .2) + +dkwtest("cauchy") +dkwtest("cauchy",location = 4,scale = 2) + +dkwtest("f",df1 = 1,df2 = 1) +dkwtest("f",df1 = 1,df2 = 10) +dkwtest("f",df1 = 10,df2 = 10) +dkwtest("f",df1 = 30,df2 = 3) + +dkwtest("weibull",shape = 1) +dkwtest("weibull",shape = 4,scale = 4) + +## regression test for PR#7314 +dkwtest("hyper", m=60, n=100, k=50) +dkwtest("hyper", m=6, n=10, k=5) +dkwtest("hyper", m=600, n=1000, k=500) + +## regression test for non-central t bug +dkwtest("t", df=20, ncp=3) +## regression test for non-central F bug +dkwtest("f", df1=10, df2=2, ncp=3) + + +# FastR commented-out: cat('Time elapsed: ', proc.time() - .proctime00,'\n') + diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/print-tests.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/print-tests.R new file mode 100644 index 0000000000..a93d5dcae9 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/print-tests.R @@ -0,0 +1,266 @@ +#### Testing print(), format() and the like --- mainly with numeric() +#### +#### to be run as +#### +#### R < print-tests.R >& print-tests.out-__version__ +#### == (csh) +opt.conformance <- 0 + +DIG <- function(d) + if(missing(d)) getOption("digits") else options(digits=as.integer(d)) + +DIG(7)#-- the default; just to make sure ... +options(width = 200) + +n1 <- 2^(4*1:7) +i1 <- as.integer(n1) + +v1 <- 2^c(-12, 2*(-4:-2),3,6,9) +v2 <- v1^(63/64) +## avoid ending in `5' as printing then depends on rounding of +## the run-time (and not all round to even). +v1[1:4] <-c(2.44140624e-04, 3.90624e-03, 1.5624e-02, 6.24e-02) + + +v3 <- pi*100^(-1:3) +v4 <- (0:2)/1000 + 1e-10 #-- tougher one + +digs1 <- c(1,2*(1:5),11:15) # 16: platform dependent + # 30 gives ERROR : options(digits=30) +digs2 <- c(1:20)#,30) gives 'error' in R: ``print.default(): invalid digits..'' + +all(i1 == n1)# TRUE +i1# prints nicely +n1# did not; does now (same as 'i1') + +round (v3, 3)#S+ & R 0.49: +##[1] 0.031 3.142 314.159 31415.927 3141592.654 +signif(v3, 3) +##R.49: [1] 0.0314 3.1400 314.0000 31400.0000 3140000.0000 +##S+ [1] 3.14e-02 3.14e+00 3.14e+02 3.14e+04 3.14e+06 + +###---------------------------------------------------------------- +##- Date: Tue, 20 May 97 17:11:18 +0200 + +##- From: Martin Maechler +##- To: R-devel@stat.math.ethz.ch +##- Subject: R-alpha: print 'problems': print(2^30, digits=12); comments at start of function() +##- +##- Both of these bugs are not a real harm, +##- however, they have been annoying me for too long ... ;-) +##- +##- 1) +print (2^30, digits = 12) #- WAS exponential form, unnecessarily -- now ok +formatC(2^30, digits = 12) #- shows you what you'd want above + +## S and R are now the same here; note that the problem also affects +## paste(.) & format(.) : + +DIG(10); paste(n1); DIG(7) + + +## Assignment to .Options$digits: Does NOT work for print() nor cat() +for(i in digs1) { .Options$digits <- i; cat(i,":"); print (v1[-1]) } + +## using options() *does* things +for(i in digs1) { DIG(i); cat(i,":"); print (v3) } +for(i in digs1) { DIG(i); cat(i,":", formatC(v3, digits=i, width=8),"\n") } + + +## R-0.50: switches to NON-exp at 14, but should only at 15... +## R-0.61++: doesn' switch at all (or at 20 only) +## S-plus: does not switch at all.. +for(i in digs1) { cat(i,":"); print(v1, digits=i) } + +## R 0.50-a1: switches at 10 inst. 11 +for(i in digs1) { cat(i,":"); print(v1[-1], digits=i) } + +for(i in digs1) { DIG(i); cat(i,":", formatC(v2, digits=i, width=8),"\n") } + +for(i in digs1) { cat(i,":"); print(v2, digits=i) } #-- exponential all thru +## ^^^^^ digs2 (>= 18: PLATFORM dependent !! +for(i in digs1) { cat(i,":", formatC(v2, digits=i, width=8),"\n") } + +DIG(7)#-- the default; just to make sure ... + +N1 <- 10; N2 <- 7; n <- 8 +x <- 0:N1 +Mhyp <- rbind(phyper(x, N1, N2, n), dhyper(x, N1, N2, n)) +Mhyp +##- [,1] [,2] [,3] [,4] [,5] [,6] [,7] +##- [1,] 0 0.0004113534 0.01336898 0.117030 0.4193747 0.7821884 0.9635952 +##- [2,] 0 0.0004113534 0.01295763 0.103661 0.3023447 0.3628137 0.1814068 +##- [,8] [,9] [,10] [,11] +##- [1,] 0.99814891 1.00000000 1 1 +##- [2,] 0.03455368 0.00185109 0 0 + +m11 <- c(-1,1) +Mm <- pi*outer(m11, 10^(-5:5)) +Mm <- cbind(Mm, outer(m11, 10^-(5:1))) +Mm +do.p <- TRUE +do.p <- FALSE +for(di in 1:10) { + options(digits=di) +# FastR changed: cat(if(do.p)"\n",formatC(di,w=2),":", format.info(Mm),"\n") + cat(formatC(di,w=2),":", format.info(Mm),"\n") + if(do.p)print(Mm) +} +##-- R-0.49 (4/1997) R-0.50-a1 (7.7.97) +##- 1 : 13 5 0 1 : 6 0 1 +##- 2 : 8 1 1 = 2 : 8 1 1 +##- 3 : 9 2 1 = 3 : 9 2 1 +##- 4 : 10 3 1 = 4 : 10 3 1 +##- 5 : 11 4 1 = 5 : 11 4 1 +##- 6 : 12 5 1 = 6 : 12 5 1 +##- 7 : 13 6 1 = 7 : 13 6 1 +##- 8 : 14 7 1 = 8 : 14 7 1 +##- 9 : 15 8 1 = 9 : 15 8 1 +##- 10 : 16 9 1 = 10 : 16 9 1 +nonFin <- list(c(Inf,-Inf), c(NaN,NA), NA_real_, Inf) +mm <- sapply(nonFin, format.info) +fm <- lapply(nonFin, format) +w <- c(4,3,2,3) +stopifnot(sapply(lapply(fm, nchar), max) == w, + mm == rbind(w, 0, 0))# m[2,] was 2147483647; m[3,] was 1 +cnF <- c(lapply(nonFin, function(x) complex(re=x, im=x))[-3], + complex(re=NaN, im=-Inf)) +cmm <- sapply(cnF, format.info) +cfm <- lapply(cnF, format) +cw <- sapply(lapply(cfm, nchar), max) +stopifnot(cw == cmm[1,]+1 +cmm[4,]+1, + nchar(format(c(NA, 1 + 2i))) == 4)# wrongly was (5,4) + + +##-- Ok now, everywhere +for(d in 1:9) {cat(d,":"); print(v4, digits=d) } +DIG(7) + + +###------------ Very big and very small +umach <- unlist(.Machine)[paste("double.x", c("min","max"), sep='')] +xmin <- umach[1] +xmax <- umach[2] +tx <- unique(c(outer(-1:1,c(.1,1e-3,1e-7))))# 7 values (out of 9) +tx <- unique(sort(c(outer(umach,1+tx))))# 11 values (+ 1 Inf) +length(tx <- tx[is.finite(tx)]) # 11 +# FastR changed(results differ): (txp <- tx[tx >= 1])#-- Positive exponent -- 4 values +txp <- tx[tx >= 1] #-- Positive exponent -- 4 values +# FastR changed(results differ): (txn <- tx[tx < 1])#-- Negative exponent -- 7 values +txn <- tx[tx < 1] #-- Negative exponent -- 7 values + +x2 <- c(0.099999994, 0.2) +x2 # digits=7: show all seven "9"s +print(x2, digits=6) # 0.1 0.2 , not 0.10 0.20 +v <- 6:8; names(v) <- v; sapply(v, format.info, x=x2) + +(z <- sort(c(outer(range(txn), 8^c(0,2:3))))) +outer(z, 0:6, signif) # had NaN's till 1.1.1 + +olddig <- options(digits=14) # RH6.0 fails at 15 +z <- 1.234567891234567e27 +for(dig in 1:14) cat(formatC(dig,w=2), + format(z, digits=dig), signif(z, digits=dig), "\n") +options(olddig) +# The following are tests of printf inside formatC +##------ Use Emacs screen width 134 ; Courier 12 ---- +# cat("dig| formatC(txp, d=dig)\n") +# for(dig in 1:17)# about >= 18 is platform dependent [libc's printf()..]. +# cat(formatC(dig,w=2), formatC(txp, dig=dig, wid=-29),"\n") +# cat("signif() behavior\n~~~~~~~~\n", +# "dig| formatC(signif(txp, dig=dig), dig = dig\n") +# for(dig in 1:15)# +# cat(formatC(dig,w=2), formatC(signif(txp, d=dig), dig=dig, wid=-26),"\n") + +# if(opt.conformance >= 1) { +# noquote(cbind(formatC(txp, dig = 22))) +# } + +# cat("dig| formatC(signif(txn, d = dig), dig=dig\n") +# for(dig in 1:15)# +# cat(formatC(dig,w=2), formatC(signif(txn, d=dig), dig=dig, wid=-20),"\n") + +# ##-- Testing 'print' / digits : +# for(dig in 1:13) { ## 12:13: libc-2.0.7 diff; 14:18 --- PLATFORM-dependent !!! +# cat("dig=",formatC(dig,w=2),": "); print(signif(txp, d=dig),dig=dig+1) +# } + +##-- Wrong alignment when printing character matrices with quote = FALSE +m1 <- matrix(letters[1:24],6,4) +m1 +noquote(m1) + +##--- Complex matrices and named vectors : + +x0 <- x <- c(1+1i, 1.2 + 10i) +names(x) <- c("a","b") +# FastR commented-out: x +(xx <- rbind(x, 2*x)) + rbind(x0, 2*x0) +x[4:6] <- c(Inf,Inf*c(-1,1i)) +# FastR commented-out: x + pi +matrix(x + pi, 2) +matrix(x + 1i*pi, 3) +xx + pi +t(cbind(xx, xx+ 1i*c(1,pi))) + +#--- format checks after incorrect changes in Nov 2000 +zz <- data.frame("(row names)" = c("aaaaa", "b"), check.names = FALSE) +format(zz) +format(zz, justify = "left") +zz <- data.frame(a = I("abc"), b = I("def\"gh")) +format(zz) +# " (font-locking: closing the string above) + +# test format.data.frame on former AsIs's. +set.seed(321) +dd <- data.frame(x = 1:5, y = rnorm(5), z = c(1, 2, NA, 4, 5)) +model <- glm(y ~ x, data = dd, subset = 1:4, na.action = na.omit) +expand.model.frame(model, "z", na.expand = FALSE) +# FastR commented-out: expand.model.frame(model, "z", na.expand = TRUE) + +## print.table() changes affecting summary.data.frame +options(width=82) +# FastR added-line: +options(digits=3) +summary(attenu) # ``one line'' +lst <- levels(attenu$station) +levels(attenu$station)[lst == "117"] <- paste(rep(letters,3),collapse="") +summary(attenu) # {2 + one long + 2 } variables +## in 1.7.0, things were split to more lines + +## format.default(*, nsmall > 0) -- for real and complex + +sf <- function(x, N=14) sapply(0:N, function(i) format(x,nsmall=i)) +sf(2) +sf(3.141) +# FastR commented-out: sf(-1.25, 20) + +oDig <- options(digits= 3) +sf(pi) +sf(1.2e7) +sf(1.23e7) +s <- -0.01234 +sf(s) + +sf(pi + 2.2i) +sf(s + pi*1i) + +options(oDig) + +# FastR commented-out: e1 <- tryCatch(options(max.print=Inf), error=function(e)e) +e2 <- tryCatch(options(max.print= 0), error=function(e)e) +# FastR commented-out: stopifnot(inherits(e1, "error")) + + +## Printing of "Date"s +options(width = 80) +op <- options(max.print = 500) +dd <- as.Date("2012-03-12") + -10000:100 +writeLines(t1 <- tail(capture.output(dd))) +l6 <- length(capture.output(print(dd, max = 600))) +options(op) +t2 <- tail(capture.output(print(dd, max = 500))) +stopifnot(identical(t1, t2), l6 == 121) +## not quite consistent in R <= 2.14.x + diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/r-strict-tst.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/r-strict-tst.R new file mode 100644 index 0000000000..bf2aa960df --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/r-strict-tst.R @@ -0,0 +1,58 @@ +#### Strict "regression" (no output comparison) tests +#### or [R]andom number generating functions + +options(warn = 2)# warnings are errors here + +## For integer valued comparisons +all.eq0 <- function(x,y, ...) all.equal(x,y, tolerance = 0, ...) + +###------- Discrete Distributions ---------------- + +set.seed(17) +stopifnot( + all.eq0(rhyper(100, 3024, 27466, 251), + c(25, 24, 21, 31, 25, 33, 28, 28, 27, 37, 26, 31, 27, 22, 21, + 33, 22, 32, 27, 28, 29, 22, 20, 20, 21, 18, 23, 21, 26, 22, 28, + 24, 25, 16, 38, 26, 35, 24, 28, 26, 21, 15, 19, 24, 26, 21, 28, + 21, 27, 27, 24, 31, 22, 18, 27, 24, 28, 22, 25, 19, 29, 31, 27, + 24, 26, 26, 24, 23, 20, 23, 23, 26, 22, 36, 29, 32, 23, 25, 20, + 12, 36, 29, 28, 23, 24, 26, 29, 25, 28, 18, 18, 27, 24, 18, 22, + 32, 31, 23, 26, 23)) + , + all.eq0(rhyper(100, 329, 3059, 225), + c(21, 21, 17, 21, 15, 25, 24, 15, 27, 21, 18, 22, 29, 17, 18, + 19, 32, 23, 23, 22, 20, 20, 15, 23, 19, 25, 25, 18, 17, 17, 19, + 28, 17, 20, 21, 21, 20, 17, 25, 21, 21, 15, 25, 25, 15, 21, 26, + 14, 21, 23, 21, 14, 15, 24, 23, 21, 20, 20, 20, 24, 16, 21, 25, + 30, 17, 19, 22, 19, 22, 23, 19, 20, 18, 15, 21, 12, 24, 20, 14, + 20, 25, 22, 19, 23, 14, 19, 15, 23, 23, 15, 23, 26, 32, 23, 25, + 19, 23, 18, 24, 25)) + , + ## using branch II in ../src/nmath/rhyper.c : +# FastR changed(time difference printed: 0 vs 0.01): print(ct3 <- system.time(N <- rhyper(100, 8000, 1e9-8000, 1e6))[1]) < 0.02 +ct3 <- system.time(N <- rhyper(100, 8000, 1e9-8000, 1e6))[1] < 0.2 + , + all.eq0(N, c(11, 9, 7, 4, 8, 6, 10, 5, 9, 8, 10, 5, 8, 8, 4, 10, 9, 8, 7, + 9, 11, 5, 7, 9, 8, 8, 5, 5, 10, 7, 8, 5, 4, 11, 9, 7, 8, 6, 7, + 9, 14, 9, 8, 8, 8, 4, 12, 9, 8, 11, 10, 12, 9, 13, 13, 8, 8, + 10, 9, 4, 7, 9, 11, 2, 5, 8, 7, 8, 11, 8, 6, 8, 6, 3, 4, 12, + 8, 10, 9, 6, 3, 6, 7, 10, 7, 4, 5, 8, 10, 8, 7, 11, 8, 12, 4, + 9, 5, 9, 7, 11)) +) + + +N <- 1e10; m <- 1e5; n <- N-m; k <- 1e6 +n /.Machine$integer.max ## 4.66 +p <- m/N; q <- 1 - p +# FastR commented-out(%g printing extra zeros): cat(sprintf( +# FastR commented-out: "N = n+m = %g, m = Np = %g; k = %g ==> (p,f) = (m,k)/N = (%g, %g)\n k*p*q = %.4g > 1: %s\n", +# FastR commented-out: N, m, k, m/N, k/N, k*p*q, k*p*q > 1)) +set.seed(11) +rH <- rhyper(20, m=m, n=n, k=k) # now via qhyper() - may change! +stopifnot( is.finite(rH), 3 <= rH, rH <= 24) # allow slack for change +## gave all NA_integer_ in R < 3.3.0 + + +stopifnot(identical(rgamma(1, Inf), Inf), + identical(rgamma(1, 0, 0), 0)) +## gave NaN in R <= 3.3.0 diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-BLAS.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-BLAS.R new file mode 100644 index 0000000000..4835e52033 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-BLAS.R @@ -0,0 +1,135 @@ + +## PR#4582 %*% with NAs +stopifnot(is.na(NA %*% 0), is.na(0 %*% NA)) +## depended on the BLAS in use. + + +## found from fallback test in slam 0.1-15 +## most likely indicates an inaedquate BLAS. +x <- matrix(c(1, 0, NA, 1), 2, 2) +y <- matrix(c(1, 0, 0, 2, 1, 0), 3, 2) +(z <- tcrossprod(x, y)) +stopifnot(identical(z, x %*% t(y))) +stopifnot(is.nan(log(0) %*% 0)) +## depended on the BLAS in use: some (including the reference BLAS) +## had z[1,3] == 0 and log(0) %*% 0 as as.matrix(0). + +## matrix products +for(mopt in c("default","internal","default.simd")) { + + # matprod="blas" is excluded because some tests fail due to issues + # in NaN/Inf propagation even in Rblas + options(matprod=mopt) + + m <- matrix(c(1,2,3,4), ncol=2) + v <- c(11,12) + rv <- v; dim(rv) <- c(1,2) + cv <- v; dim(cv) <- c(2,1) + + Cm <- m+0*1i; # cast to complex keeping dimensions + Cv <- v+0*1i; + Ccv <- cv+0*1i; + Crv <- rv+0*1i; + + cprod <- function(rres, cres, expected) { + stopifnot(identical(rres, expected)) + stopifnot(identical(Re(cres), expected)) + } + + cprod(m %*% m, Cm %*% Cm, matrix(c(7,10,15,22), 2, 2) ) + cprod(m %*% cv, Cm %*% Ccv, matrix(c(47,70), 2, 1) ) + cprod(m %*% v, Cm %*% Cv, matrix(c(47,70), 2, 1) ) + cprod(rv %*% m, Crv %*% Cm, matrix(c(35,81), 1, 2) ) + cprod(v %*% m, Cv %*% Cm, matrix(c(35,81), 1, 2) ) + cprod(rv %*% cv, Crv %*% Ccv, matrix(265,1,1) ) + cprod(cv %*% rv, Ccv %*% Crv, matrix(c(121,132,132,144), 2, 2) ) + cprod(v %*% v, Cv %*% Cv, matrix(265,1,1) ) + + cprod(crossprod(m, m), crossprod(Cm, Cm), matrix(c(5,11,11,25), 2, 2) ) + cprod(crossprod(m), crossprod(Cm), matrix(c(5,11,11,25), 2, 2) ) + cprod(crossprod(m, cv), crossprod(Cm, Ccv), matrix(c(35,81), 2, 1) ) + cprod(crossprod(m, v), crossprod(Cm, Cv), matrix(c(35,81), 2, 1) ) + cprod(crossprod(cv, m), crossprod(Ccv, Cm), matrix(c(35,81), 1, 2) ) + cprod(crossprod(v, m), crossprod(Cv, Cm), matrix(c(35,81), 1, 2) ) + cprod(crossprod(cv, cv), crossprod(Ccv, Ccv), matrix(265,1,1) ) + cprod(crossprod(v, v), crossprod(Cv, Cv), matrix(265,1,1) ) + cprod(crossprod(rv, rv), crossprod(Crv, Crv), matrix(c(121,132,132,144), 2, 2) ) + + cprod(tcrossprod(m, m), tcrossprod(Cm, Cm), matrix(c(10,14,14,20), 2, 2) ) + cprod(tcrossprod(m), tcrossprod(Cm), matrix(c(10,14,14,20), 2, 2) ) + cprod(tcrossprod(m, rv), tcrossprod(Cm, Crv), matrix(c(47,70), 2, 1) ) + cprod(tcrossprod(rv, m), tcrossprod(Crv, Cm), matrix(c(47,70), 1, 2) ) + cprod(tcrossprod(v, m), tcrossprod(Cv, Cm), matrix(c(47,70), 1, 2) ) + cprod(tcrossprod(rv, rv), tcrossprod(Crv, Crv), matrix(265,1,1) ) + cprod(tcrossprod(cv, cv), tcrossprod(Ccv, Ccv), matrix(c(121,132,132,144), 2, 2) ) + cprod(tcrossprod(v, v), tcrossprod(Cv, Cv), matrix(c(121,132,132,144), 2, 2) ) + + ## non-square matrix, with Inf + + m1 <- matrix(c(1,2,Inf,4,5,6), ncol=2) + m2 <- matrix(c(1,2,3,4), ncol=2) + + v <- c(11,12) + rv <- v; dim(rv) <- c(1,2) + cv <- v; dim(cv) <- c(2,1) + + v1 <- c(11,12,13) + rv1 <- v1; dim(rv1) <- c(1,3) + cv1 <- v1; dim(cv1) <- c(3,1) + + Cm1 <- m1+0*1i + Cm2 <- m2+0*1i + Cv <- v+0*1i + Crv <- rv+0*1i + Ccv <- cv+0*1i + Cv1 <- v1+0*1i + Crv1 <- rv1+0*1i + Ccv1 <- cv1+0*1i + + cprod(m1 %*% m2, Cm1 %*% Cm2, matrix(c(9,12,Inf,19,26,Inf), 3, 2) ) + cprod(m1 %*% cv, Cm1 %*% Ccv, matrix(c(59,82,Inf), 3, 1) ) + + # the following 7 lines fail with Rblas and matprod = "blas" + cprod(rv1 %*% m1, Crv1 %*% Cm1, matrix(c(Inf,182), 1, 2) ) + + cprod(crossprod(m1, m1), crossprod(Cm1, Cm1), matrix(c(Inf,Inf,Inf,77), 2, 2) ) + cprod(crossprod(m1, cv1), crossprod(Cm1, Ccv1), matrix(c(Inf,182), 2, 1) ) + cprod(crossprod(cv1, m1), crossprod(Ccv1, Cm1), matrix(c(Inf,182), 1, 2) ) + + cprod(tcrossprod(m1, m1), tcrossprod(Cm1, Cm1), matrix(c(17,22,Inf,22,29,Inf,Inf,Inf,Inf), 3,3) ) + cprod(tcrossprod(m2, m1), tcrossprod(Cm2, Cm1), matrix(c(13,18,17,24,Inf,Inf), 2, 3) ) + cprod(tcrossprod(rv, m1), tcrossprod(Crv, Cm1), matrix(c(59,82,Inf), 1, 3) ) + # the previous 7 lines fail with Rblas and matprod = "blas" + + cprod(tcrossprod(m1, rv), tcrossprod(Cm1, Crv), matrix(c(59,82,Inf), 3, 1) ) + + ## complex + + m1 <- matrix(c(1+1i,2+2i,3+3i,4+4i,5+5i,6+6i), ncol=2) + m2 <- matrix(c(1+1i,2+2i,3+3i,4+4i), ncol=2) + + stopifnot(identical(m1 %*% m2, matrix(c(18i,24i,30i,38i,52i,66i), 3, 2) )) + stopifnot(identical(crossprod(m1, m1), t(m1) %*% m1)) + stopifnot(identical(tcrossprod(m1, m1), m1 %*% t(m1))) +} + +## check that propagation of NaN/Inf values in multiplication of complex +## numbers is the same as in multiplication of complex matrices + +for(mopt in c("default","internal","default.simd")) { + # matprod="blas" is excluded because some tests fail due to issues + # in NaN/Inf propagation even in Rblas + options(matprod=mopt) + + vals <- c(0, 1, NaN, Inf) + for(ar in vals) + for(ai in vals) + for(br in vals) + for(bi in vals) { + a = ar + 1i * ai + b = br + 1i * bi +# FastR commented-out: stopifnot(identical(a * b, as.complex(a %*% b))) + stopifnot(identical(a * b, as.complex(crossprod(a,b)))) + stopifnot(identical(a * b, as.complex(tcrossprod(a,b)))) + } +} diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-IO.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-IO.R new file mode 100644 index 0000000000..b903e84ce0 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/reg-IO.R @@ -0,0 +1,61 @@ +## NB: this file must be a DOS (CRLF) format file + +## Keep comments and original formatting +options(keep.source=TRUE) + +## simple tests that multiple lines are read correctly +print(2+3) +print(4+5) + +## generate some files to source + +# FastR changed(last line not shown by source() if it's comment and pi shown twice): z <- c("# line 1", "2+3", "ls()", "pi", "# last line") +z <- c("# line 1", "2+3", "ls()") + +## ======== LF file +cat(z, file="testIO.R", sep="\n") +readLines("testIO.R") +source("testIO.R", echo=TRUE) +unlink("testIO.R") + +## ======== LF file, incomplete final line +zz <- file("testIO.R", "wt") +cat(z, file=zz, sep="\n") +cat("5+6", file=zz) +close(zz) +readLines("testIO.R") +source("testIO.R", echo=TRUE) +unlink("testIO.R") + +## ======== CRLF file +cat(z, file="testIO.R", sep="\r\n") +source("testIO.R", echo=TRUE) +readLines("testIO.R") +unlink("testIO.R") + +## ======== CRLF file, incomplete final line +zz <- file("testIO.R", "wt") +cat(z, file=zz, sep="\r\n") +cat("5+6", file=zz) +close(zz) +readLines("testIO.R") +source("testIO.R", echo=TRUE) +unlink("testIO.R") + +## ======== CR file +cat(z, file="testIO.R", sep="\r") +readLines("testIO.R") +source("testIO.R", echo=TRUE) +unlink("testIO.R") + +## ======== CR file, incomplete final line +zz <- file("testIO.R", "wt") +cat(z, file=zz, sep="\r") +cat("\r5+6", file=zz) +close(zz) +readLines("testIO.R") +source("testIO.R", echo=TRUE) +unlink("testIO.R") + +## end of reg-IO.R: the next line has no EOL chars +2 + 2 diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/simple-true.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/simple-true.R new file mode 100644 index 0000000000..86e9f954bc --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/simple-true.R @@ -0,0 +1,190 @@ +###---- ALL tests here should return TRUE ! +### +###---- "Real" Arithmetic; Numerics etc --> ./arith-true.R + +### mode checking, etc. +is.recursive(expression(1+3, 2/sqrt(pi)))# fix PR#9 + +## sum(): +all(1:12 == cumsum(rep(1,12))) +x <- rnorm(127); sx <- sum(x); abs((sum(rev(x)) -sx)) < 1e-12 * abs(sx) + +## seq(): +typeof(1:4) == "integer" #-- fails for 0.2, 0.3,.., 0.9 + +## Check parsing with L suffix for integer literals. +typeof(1L) == "integer" +typeof(1000L) == "integer" +typeof(1e3L) == "integer" +# FastR commented-out(extra whitespace in message): typeof(1e-3L) == "double" # gives warning +# FastR commented-out(extra whitespace in message): 1.L # gives warning +# FastR commented-out(extra output from parser): try(parse(text = "12iL")) # gives syntax error + + +all((0:6) == pi + ((-pi):pi)) +all((0:7) == (pi+seq(-pi,pi, length=8))*7/(2*pi)) + +1 == as.integer(is.na(c(pi,NA)[2])) +1 == as.integer(is.nan(0/0)) + +## rev(): +cc <- c(1:10,10:1) ; all(cc == rev(cc)) + +## dim[names](): +all(names(c(a=pi, b=1, d=1:4)) == c("a","b", paste("d", 1:4, sep=""))) +##P names(c(a=pi, b=1, d=1:4)) +ncb <- dimnames(cbind(a=1, yy=1:3))[[2]] +(!is.null(ncb)) && all(ncb == c("a","yy")) + +all(cbind(a=1:2, b=1:3, c=1:6) == t(rbind(a=1:2, b=1:3, c=1:6))) +##P rbind(a=1:2, b=1:3, c=1:6) +all(dim(cbind(cbind(I=1,x=1:4), c(a=pi))) == 4:3)# fails in S+ + +a <- b <- 1:3 +all(dimnames(cbind(a, b))[[2]] == c("a","b")) + +## rbind PR#338 +all(dim(m <- rbind(1:2, diag(2))) == 3:2) +all(m == c(1,1,0, 2,0,1)) + +## factor(): +is.factor(factor(integer())) +all(levels(ordered(rev(gl(3,4)))) == 1:3)# coercion to char +all(levels(factor(factor(9:1)[3:5])) == 5:7) +## crossing bug PR#40 +# FastR commented-out(FALSE vs TRUE and warnings): is.factor(ff <- gl(2,3) : gl(3,2)) && length(ff) == 6 +# FastR commented-out: all(levels(ff) == t(outer(1:2, 1:3, paste, sep=":"))) +## from PR#5 +ll <- c("A","B"); ff <- factor(ll); f0 <- ff[, drop=TRUE] +all(f0 == ff) && all(levels(ff) == ll) && is.factor(ff) && is.factor(f0) + +### data.frame s : + +## from lists [bug PR#100] +x <- NULL +x$x1 <- 1:10 +x$x2 <- 0:9 +all(dim(dx <- as.data.frame(x)) == c(10,2)) + +## Logicals: (S is wrong) +l1 <- c(TRUE,FALSE,TRUE) +(! as.logical(as.data.frame(FALSE)[,1])) +all(l1 == as.logical(as.data.frame(l1)[,1])) + +## empty data.frames : +x <- data.frame(a=1:3) +x30 <- { + if(is.R()) x[, -1]# not even possible in S+ + else structure(list(), row.names = paste(1:3), class = "data.frame") +} +all(dim(x30) == c(3,0)) +x01 <- x[-(1:3), , drop = FALSE] +x00 <- x01[,-1] +all(dim(x01) == 0:1) +all(dim(x00) == 0) +all(dim(x) == dim(rbind(x, x01))) +## bugs up to 1.2.3 : +all(dim(x30) == dim(m30 <- as.matrix(x30))) +all(dim(x01) == dim(m01 <- as.matrix(x01))) +all(dim(x30) == dim(as.data.frame(m30))) +all(dim(x01) == dim(as.data.frame(m01))) +all(dim(x01) == dim( data.frame(m01))) +all(dim(x30) == dim( data.frame(m30))) +all(dim(x) == dim(cbind(x, x30))) +## up to 1.4.0 : +all(dim(x30) == dim( data.matrix(x30))) +all(dim(x00) == dim( data.matrix(x00))) + +m0 <- matrix(pi, 0,3) +a302 <- array("", dim=c(3,0,2)) +identical(apply(m0, 1, dim), NULL) +identical(apply(m0, 2, dim), NULL) +identical(apply(m0, 1,length), integer(0)) +identical(apply(m0, 2,length), integer(3)) +identical(apply(a302, 1, mode), rep("character",3)) +## NO (maybe later?): +## identical(apply(a302, 2, mode), rep("character",0)) +is.character(aa <- apply(a302, 2, mode)) && length(aa) == 0 +identical(apply(a302, 3, mode), rep("character",2)) +identical(apply(a302, 3, length),integer(2)) +identical(apply(a302, 3, dim), matrix(as.integer(c(3,0)), 2 ,2)) +identical(apply(a302, 1, dim), matrix(as.integer(c(0,2)), 2 ,3)) +identical(apply(array(dim=3), 1,length), rep(1:1, 3)) +identical(apply(array(dim=0), 1,length), rep(1:1, 0))# = integer(0) + + +### Subsetting + +## bug PR#425 +x <- matrix(1:4, 2, 2, dimnames=list(c("abc","ab"), c("cde","cd"))) +y <- as.data.frame(x) +all(x["ab",] == c(2,4)) +all(y["ab",] == c(2,4)) + +## from bug PR#447 +x <- 1:2 ; x[c("2","2")] <- 4 +all.equal(x, c(1:2, "2" = 4)) + +## stretching +l2 <- list(a=1, b=2) +l2["cc"] <- pi +l2[["d"]] <- 4 +l2 $ e <- 55 +all.equal(l2, list(a = 1, b = 2, cc = pi, d = 4, e = 55), tolerance = 0) +all.equal(l2["d"], list(d = 4)) +l2$d == 4 && l2$d == l2[["d"]] + +## bug in R <= 1.1 +f1 <- y1 ~ x1 +f2 <- y2 ~ x2 +# FastR commented-out(FALSE vs TRUE and warning): f2[2] <- f1[2] +# FastR commented-out(FALSE vs TRUE): deparse(f2) == "y1 ~ x2" + +m <- cbind(a=1:2,b=c(R=10,S=11)) +all(sapply(dimnames(m), length) == c(2,2)) +## [[ for matrix: +m[[1,2]] == m[[3]] && m[[3]] == m[3] && m[3] == m[1,2] + +## bug in R <= 1.1.1 : unclass(*) didn't drop the class! +## to be robust to S4 methods DON'T test for null class +## The test for attr(,"class") is valid, if essentially useless +d1 <- rbind(data.frame(a=1, b = I(TRUE)), new = c(7, "N")) +is.null(attr(unclass(d1$b), "class")) + +## bugs in R 1.2.0 +format(as.POSIXct(relR120 <- "2000-12-15 11:24:40")) == relR120 +format(as.POSIXct(substr(relR120,1,10))) == substr(relR120,1,10) + +## rank() with NAs (and ties) +x <- c(3:1,6,4,3,NA,5,0,NA) +rx <- rank(x) +all(rx == c(4.5, 3:2, 8, 6, 4.5, 9, 7, 1, 10)) +rxK <- rank(x, na.last = "keep") +all(rx [rx <= 8] == na.omit(rxK)) +all(rank(x, na.last = NA) == na.omit(rxK)) + +## as.list.function() instead of *.default(): +identical(as.list(as.list), + alist(x = , ... = , UseMethod("as.list"))) + +## startsWith() / endsWith() assertions +t1 <- c("Foobar", "bla bla", "something", "another", "blu", "brown", + "blau blüht der Enzian")# non-ASCII +t2 <- c("some text", "any text") +t3 <- c("Martin", "Zürich", "Mächler") + +all(endsWith(t1, "")); all(startsWith(t1, "")) +all(endsWith(t2, "")); all(startsWith(t2, "")) +all(endsWith(t3, "")); all(startsWith(t3, "")) +all(endsWith(t2, "text")) +all(endsWith(t2, " text")) +identical(startsWith(t1, "b" ), c(FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE)) +identical(startsWith(t1, "bl"), c(FALSE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE)) +identical(startsWith(t1, "bla"),c(FALSE, TRUE, FALSE, FALSE,FALSE, FALSE, TRUE)) +identical( endsWith(t1, "n"), c(FALSE,FALSE, FALSE, FALSE,FALSE, TRUE, TRUE)) +identical( endsWith(t1, "an"), c(FALSE,FALSE, FALSE, FALSE,FALSE, FALSE, TRUE)) +## +identical(startsWith(t3, "M" ), c( TRUE, FALSE, TRUE)) +identical(startsWith(t3, "Ma"), c( TRUE, FALSE, FALSE)) +identical(startsWith(t3, "Mä"), c(FALSE, FALSE, TRUE)) + diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/timezone.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/timezone.R new file mode 100644 index 0000000000..93d95ab6a9 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/timezone.R @@ -0,0 +1,9 @@ +## moved from reg-tests-1d.R and datetime.R as failure should not be fatal +## to make check-devel. + +## PR#17186 - Sys.timezone() on some Debian-derived platforms +# FastR commented-out(Warning: Your system is mis-configured: ‘/etc/localtime’ is not a symlink vs. unable to deduce timezone name from ‘/etc/localtime’): (S.t <- Sys.timezone()) +## NB: This will fail on non-standard platforms, or even standard new OSes. +## -- We are strict here, in order to *learn* about those and possibly work around: +# FastR commented-out(Error: could not get timezone): if(is.na(S.t) || !nzchar(S.t)) stop("could not get timezone") +## has been NA_character_ in Ubuntu 14.04.5 LTS diff --git a/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/utf8.R b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/utf8.R new file mode 100644 index 0000000000..27f90ef6a9 --- /dev/null +++ b/com.oracle.truffle.r.test.native/packages/gnurtests/gnurtests/tests/utf8.R @@ -0,0 +1,54 @@ +## This takes the definition of UTF-8 as RFC3629 (2003), +## but not all software does. +## See also https://en.wikipedia.org/wiki/UTF-8 + +x <- 1L:0x10FFFF +y <- intToUtf8(x, multiple = TRUE) +names(y) <- sprintf("U+%4x", x) +## values in the surrogate range: not handled in R < 3.4.3 +sr <- 0xD800:0xDFFF +# FastR commented-out(is.na(y[sr]) are not all TRUE): stopifnot(is.na(y[sr])) +stopifnot(!is.na(y[-sr])) +## too large values: originally handled by UTF-8, but not in RFC3629 +## R >= 3.4.3 conforms to RFC3629 +# FastR commented-out(illegal unicode code point): stopifnot(is.na(intToUtf8(c(0x200000, 0x10FFFF + 1:10)))) + +## next command is quite slow. +xx <- sapply(y, function(x) tryCatch(utf8ToInt(x), + error = function(e) NA_character_)) +invalid <- sr # previously included 0xFFFE and 0xFFFF + # but not other 'noncharacters'. +# FastR commented-out(is.na(xx[invalid]) are not all TRUE): stopifnot(is.na(xx[invalid]), !is.na(xx[!invalid])) +stopifnot(xx[!invalid] == x[!invalid]) + +## The pre-2003 UTF-8 standard converted larger code-points to 4-6 bytes, +## and was followed by intToUtf8 in earlier versions of R. +## Earlier conversion of 0x111111, 0x200001, 0x10000001) +x <- c("\xf4\x91\x84\x91", "\xf8\x80\x80\x80\x81", "\xfc\x90\x80\x80\x80\x81") +xx <- sapply(x, function(x) tryCatch(utf8ToInt(x), + error = function(e) NA_character_)) +# FastR commented-out(is.na(xx) are not all TRUE): stopifnot(is.na(xx)) # first was not in R < 3.4.3 + +### test surrogate pairs +surrogate_pair <- function(x) +{ + if(any(x < 0x10000 | x > 0x10FFFF)) + stop("Surrogate pairs apply only to supplementary planes") + x <- x - 0x10000 + as.vector(rbind(0xD800 + x %/% 1024, 0xDC00 + x %% 1024)) +} +## check the example: +xx <- surrogate_pair(0x10437) +sprintf("%X", xx) +stopifnot(xx == c(0xD801, 0xDC37)) + +## there are 2^20 surrogate pairs, but fast enough to check them all +x <- 0x10000:0x10FFFF +x1 <- intToUtf8(x) +x2 <- utf8ToInt(x1) +# FastR commented-out(x2 == x are not all TRUE): stopifnot(x2 == x) + +z <- surrogate_pair(x) +x1 <- intToUtf8(z, allow_surrogate_pairs = TRUE) +x2 <- utf8ToInt(x1) +# FastR commented-out(x2 == x are not all TRUE): stopifnot(x2 == x) diff --git a/com.oracle.truffle.r.test.native/packages/pkg-filelist b/com.oracle.truffle.r.test.native/packages/pkg-filelist index d638cd5faa..1703876bdd 100644 --- a/com.oracle.truffle.r.test.native/packages/pkg-filelist +++ b/com.oracle.truffle.r.test.native/packages/pkg-filelist @@ -1,3 +1,4 @@ vanilla testrffi tests4 +gnurtests From fa37cb903cf047c2e09b95b4ed5c2eb8153d0e6c Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Fri, 15 Mar 2019 02:36:46 +0100 Subject: [PATCH 13/71] - when running tests always print error stacktrace - .reportError needs RContext when internal error in tests --- .../truffle/r/runtime/RInternalError.java | 27 +++++++++++-------- .../truffle/r/test/generate/FastRSession.java | 4 ++- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java index aedd7655ce..708c580f5c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java @@ -161,28 +161,34 @@ static String createVerboseStackTrace() { @TruffleBoundary public static void reportErrorAndConsoleLog(Throwable throwable, int contextId) { - reportErrorDefault(throwable, contextId); + reportErrorDefault(throwable, null, contextId); } @TruffleBoundary public static void reportError(Throwable t) { - reportErrorDefault(t, 0); + reportErrorDefault(t, null, 0); } @TruffleBoundary - private static void reportErrorDefault(Throwable t, int contextId) { - RContext ctx = RContext.getInstance(); - boolean detailedMessage = ctx.getOption(PrintErrorStacktraces) || ctx.getOption(PrintErrorStacktracesToFile); + public static void reportError(Throwable t, RContext ctx) { + reportErrorDefault(t, ctx, 0); + } + + @TruffleBoundary + private static void reportErrorDefault(Throwable t, RContext ctx, int contextId) { + RContext context = ctx != null ? ctx : RContext.getInstance(); + boolean detailedMessage = context.getOption(PrintErrorStacktraces) || context.getOption(PrintErrorStacktracesToFile); + String errMsg = "."; if (detailedMessage) { errMsg = ": \""; errMsg += t instanceof RInternalError && t.getMessage() != null && !t.getMessage().isEmpty() ? t.getMessage() : t.getClass().getSimpleName(); errMsg += "\""; } - reportError(errMsg, t, contextId); + reportError(errMsg, t, context, contextId); } - private static void reportError(String errMsg, Throwable throwable, int contextId) { + private static void reportError(String errMsg, Throwable throwable, RContext ctx, int contextId) { try { Throwable t = throwable; ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -199,8 +205,8 @@ private static void reportError(String errMsg, Throwable throwable, int contextI verboseStackTrace = ""; } - boolean printErrorStacktraces = getOption(PrintErrorStacktraces); - boolean printErrorStacktracesToFile = getOption(PrintErrorStacktracesToFile); + boolean printErrorStacktraces = getOption(PrintErrorStacktraces, ctx); + boolean printErrorStacktracesToFile = getOption(PrintErrorStacktracesToFile, ctx); if (printErrorStacktraces) { System.err.println(out.toString()); System.err.println(verboseStackTrace); @@ -243,8 +249,7 @@ private static void reportError(String errMsg, Throwable throwable, int contextI } } - private static boolean getOption(OptionKey key) { - RContext ctx = RContext.getInstance(); + private static boolean getOption(OptionKey key, RContext ctx) { if (ctx != null) { return ctx.getOption(key); } else { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java index b2316bcf14..fb590b36e5 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java @@ -70,6 +70,7 @@ import com.oracle.truffle.r.runtime.context.Engine.IncompleteSourceException; import com.oracle.truffle.r.runtime.context.Engine.ParseException; import com.oracle.truffle.r.runtime.context.FastROptions; +import static com.oracle.truffle.r.runtime.context.FastROptions.PrintErrorStacktraces; import static com.oracle.truffle.r.runtime.context.FastROptions.PrintErrorStacktracesToFile; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.RContext.ContextKind; @@ -139,6 +140,7 @@ public static Context.Builder getContextBuilder(String... languages) { Context.Builder builder = Context.newBuilder(languages).allowExperimentalOptions(true); setCLIOptions(builder); builder.allowAllAccess(true); + builder.option(FastROptions.getName(PrintErrorStacktraces), "true"); // no point in printing errors to file when running tests (that contain errors on purpose) builder.option(FastROptions.getName(PrintErrorStacktracesToFile), "false"); return builder; @@ -279,7 +281,7 @@ public String eval(TestBase testClass, String expression, ContextKind contextKin } catch (Throwable t) { if (!TestBase.ProcessFailedTests || TestBase.ShowFailedTestsResults) { if (t instanceof RInternalError) { - RInternalError.reportError(t); + RInternalError.reportError(t, mainRContext); } t.printStackTrace(); } From f9b75797dac964ac6c204758a0abe98b7718de7f Mon Sep 17 00:00:00 2001 From: Miloslav Metelka Date: Fri, 15 Mar 2019 16:07:56 +0100 Subject: [PATCH 14/71] Additional change regarding promise visibility updating evaluation. --- .../src/com/oracle/truffle/r/nodes/builtin/base/Switch.java | 4 ++-- .../com/oracle/truffle/r/nodes/builtin/base/WithVisible.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java index 878d03c30d..8a0ac7bc10 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Switch.java @@ -125,13 +125,13 @@ private Object doSwitchString(VirtualFrame frame, String xStr, RArgsValuesAndNam throw RError.error(RError.NO_CALLER, RError.Message.ZERO_LENGTH_VARIABLE); } else if (xStr.equals(suppliedArgName)) { // match, evaluate the associated arg - Object optionalArgValue = promiseHelper.checkVisibleEvaluate(frame, optionalArgValues[i]); + Object optionalArgValue = promiseHelper.checkEvaluate(frame, optionalArgValues[i]); if (optionalArgValue == RMissing.instance) { matchedArgIsMissing.enter(); // Fall-through: If the matched value is missing, take the next non-missing for (int j = i + 1; j < optionalArgValues.length; j++) { - Object val = promiseHelper.checkVisibleEvaluate(frame, optionalArgValues[j]); + Object val = promiseHelper.checkEvaluate(frame, optionalArgValues[j]); if (val != RMissing.instance) { return val; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java index 9f2c688a8c..d88140eadf 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/WithVisible.java @@ -82,7 +82,7 @@ protected RList withVisible(VirtualFrame frame, RPromise x, if (x.isEvaluated()) { return RDataFactory.createList(new Object[]{x.getValue(), RRuntime.LOGICAL_TRUE}, LISTNAMES); } - Object value = promiseHelper.visibleEvaluate(frame, x); + Object value = promiseHelper.evaluate(frame, x); if (value == RMissing.instance) { CompilerDirectives.transferToInterpreter(); throw error(Message.ARGUMENT_MISSING, "x"); From e1e52656455854a95ec3a5e52d02807753c16eae Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 18 Mar 2019 11:58:08 +0100 Subject: [PATCH 15/71] make dependency on NFI explicit --- mx.fastr/native-image.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.fastr/native-image.properties b/mx.fastr/native-image.properties index bdd0105468..587f3f685d 100644 --- a/mx.fastr/native-image.properties +++ b/mx.fastr/native-image.properties @@ -3,7 +3,7 @@ ImageName = RMain -Requires = tool:truffle \ +Requires = tool:nfi \ tool:chromeinspector \ tool:profiler From f32ff4bce3a5dedd0d666df79aa623dd94c8b9eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bal=C3=ADn?= Date: Tue, 19 Mar 2019 17:04:59 +0100 Subject: [PATCH 16/71] Update of licenses to reflect latest 3rd party libs --- 3rd_party_licenses.txt | 17798 ++++++++++++++++++++++++++++++++++----- LICENSE | 2 +- 2 files changed, 15692 insertions(+), 2108 deletions(-) diff --git a/3rd_party_licenses.txt b/3rd_party_licenses.txt index 0a580df277..e733fe564f 100644 --- a/3rd_party_licenses.txt +++ b/3rd_party_licenses.txt @@ -2,59 +2,14 @@ LICENSES FOR THIRD-PARTY COMPONENTS The following sections contain licensing information for libraries that we have -included with the GraalVM Community Edition FastR source and components used to -test GraalVM Community Edition FastR. We are thankful to all individuals that -have created these. +included with the GraalVM Community Edition FastR source code. We are thankful +to all individuals that have created these. The following software may be included in this product: --------------------------------------------------------------------------------- - ANTLR 3.5 +================================================================================ -This product was build using ANTLR, which was provided to Oracle under the -following terms: - -Copyright (c) 2010 Terence Parr -All rights reserved. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this -list of conditions and the following disclaimer in the documentation and/or -other materials provided with the distribution. - -Neither the name of the author nor the names of its contributors may be used to -endorse or promote products derived from this software without specific prior -written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- - - xz -URL for License – -http://git.tukaani.org/?p=xz-java.git;a=blob;f=COPYING;h=c1d404dc7a6f06a0437bf10 -55fedaa4a4c89d728;hb=771cc594554d21f5279130b662105fd5dc8bfa88 -Licensing of XZ for Java - -All the files in this package have been written by Lasse Collin and/or Igor -Pavlov. All these files have been put into the public domain. You can do -whatever you want with these files. - -This software is provided "as is", without any warranty. --------------------------------------------------------------------------------- - JLine +JLine 2.14.6 Copyright (c) 2002-2016, the original author or authors. All rights reserved. @@ -90,398 +45,13861 @@ AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- +================================================================================ - GCC +XZ for Java 1.8 + +All XZ for Java files have been put into the public domain. - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +================================================================================ + +Jansi 1.17.1 + +(Copyright for Jansi; from URL: https://github.com/fusesource/jansi/blob/jansi- +project-1.17.1/jansi/pom.xml) + +Copyright (C) 2009-2017 the original author(s). +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +(Copyright for 4th party dependency hawtjni; from +https://github.com/fusesource/hawtjni/blob/master/pom.xml) + +Copyright (C) 2009-2011 FuseSource Corp. +http://fusesource.com + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at +http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +(License from http://www.apache.org/licenses/LICENSE-2.0) + +Apache License + +Version 2.0, January 2004 + +http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + +"License" shall mean the terms and conditions for use, reproduction, and +distribution as defined by Sections 1 through 9 of this document. + +"Licensor" shall mean the copyright owner or entity authorized by the copyright +owner that is granting the License. + +"Legal Entity" shall mean the union of the acting entity and all other entities +that control, are controlled by, or are under common control with that entity. +For the purposes of this definition, "control" means (i) the power, direct or +indirect, to cause the direction or management of such entity, whether by +contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the +outstanding shares, or (iii) beneficial ownership of such entity. + +"You" (or "Your") shall mean an individual or Legal Entity exercising +permissions granted by this License. + +"Source" form shall mean the preferred form for making modifications, including +but not limited to software source code, documentation source, and configuration +files. + +"Object" form shall mean any form resulting from mechanical transformation or +translation of a Source form, including but not limited to compiled object code, +generated documentation, and conversions to other media types. + +"Work" shall mean the work of authorship, whether in Source or Object form, made +available under the License, as indicated by a copyright notice that is +included in or attached to the work (an example is provided in the Appendix +below). + +"Derivative Works" shall mean any work, whether in Source or Object form, that +is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an +original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by +name) to the interfaces of, the Work and Derivative Works thereof. + +"Contribution" shall mean any work of authorship, including the original version +of the Work and any modifications or additions to that Work or Derivative Works +thereof, that is intentionally submitted to Licensor for inclusion in the Work +by the copyright owner or by an individual or Legal Entity authorized to submit +on behalf of the copyright owner. For the purposes of this definition, +"submitted" means any form of electronic, verbal, or written communication sent +to the Licensor or its representatives, including but not limited to +communication on electronic mailing lists, source code control systems, and +issue tracking systems that are managed by, or on behalf of, the Licensor for +the purpose of discussing and improving the Work, but excluding communication +that is conspicuously marked or otherwise designated in writing by the copyright +owner as "Not a Contribution." + +"Contributor" shall mean Licensor and any individual or Legal Entity on behalf +of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of this +License, each Contributor hereby grants to You a perpetual, worldwide, non- +exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, +prepare Derivative Works of, publicly display, publicly perform, sublicense, and +distribute the Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of this License, +each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, +no-charge, royalty-free, irrevocable (except as stated in this section) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer the Work, where such license applies only to those patent claims +licensable by such Contributor that are necessarily infringed by their +Contribution(s) alone or by combination of their Contribution(s) with the Work +to which such Contribution(s) was submitted. If You institute patent litigation +against any entity (including a cross-claim or counterclaim in a lawsuit) +alleging that the Work or a Contribution incorporated within the Work +constitutes direct or contributory patent infringement, then any patent licenses +granted to You under this License for that Work shall terminate as of the date +such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the Work or +Derivative Works thereof in any medium, with or without modifications, and in +Source or Object form, provided that You meet the following conditions: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +You must retain, in the Source form of any Derivative Works that You distribute, +all copyright, patent, trademark, and attribution notices from the Source form +of the Work, excluding those notices that do not pertain to any part of the +Derivative Works; and +If the Work includes a "NOTICE" text file as part of its distribution, then any +Derivative Works that You distribute must include a readable copy of the +attribution notices contained within such NOTICE file, excluding those notices +that do not pertain to any part of the Derivative Works, in at least one of the +following places: within a NOTICE text file distributed as part of the +Derivative Works; within the Source form or documentation, if provided along +with the Derivative Works; or, within a display generated by the Derivative +Works, if and wherever such third-party notices normally appear. The contents of +the NOTICE file are for informational purposes only and do not modify the +License. You may add Your own attribution notices within Derivative Works that +You distribute, alongside or as an addendum to the NOTICE text from the Work, +provided that such additional attribution notices cannot be construed as +modifying the License. + +You may add Your own copyright statement to Your modifications and may provide +additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, +provided Your use, reproduction, and distribution of the Work otherwise +complies with the conditions stated in this License. +5. Submission of Contributions. Unless You explicitly state otherwise, any +Contribution intentionally submitted for inclusion in the Work by You to the +Licensor shall be under the terms and conditions of this License, without any +additional terms or conditions. Notwithstanding the above, nothing herein shall +supersede or modify the terms of any separate license agreement you may have +executed with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade names, +trademarks, service marks, or product names of the Licensor, except as required +for reasonable and customary use in describing the origin of the Work and +reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or agreed to in +writing, Licensor provides the Work (and each Contributor provides its +Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied, including, without limitation, any warranties +or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A +PARTICULAR PURPOSE. You are solely responsible for determining the +appropriateness of using or redistributing the Work and assume any risks +associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, whether in +tort (including negligence), contract, or otherwise, unless required by +applicable law (such as deliberate and grossly negligent acts) or agreed to in +writing, shall any Contributor be liable to You for damages, including any +direct, indirect, special, incidental, or consequential damages of any character +arising as a result of this License or out of the use or inability to use the +Work (including but not limited to damages for loss of goodwill, work stoppage, +computer failure or malfunction, or any and all other commercial damages or +losses), even if such Contributor has been advised of the possibility of such +damages. + +9. Accepting Warranty or Additional Liability. While redistributing the Work or +Derivative Works thereof, You may choose to offer, and charge a fee for, +acceptance of support, warranty, indemnity, or other liability obligations +and/or rights consistent with this License. However, in accepting such +obligations, You may act only on Your own behalf and on Your sole +responsibility, not on behalf of any other Contributor, and only if You agree to +indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your +accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: HOW TO APPLY THE APACHE LICENSE TO YOUR WORK +To apply the Apache License to your work, attach the following boilerplate +notice, with the fields enclosed by brackets "[]" replaced with your own +identifying information. (Don't include the brackets!) The text should be +enclosed in the appropriate comment syntax for the file format. We also +recommend that a file or class name and description of purpose be included on +the same "printed page" as the copyright notice for easier identification within +third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +================================================================================ + +ANTLR 4.7.1 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble +Include the following verbatim in the documentation: - The GNU General Public License is a free, copyleft license for -software and other kinds of works. +Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +===== + +MIT License for codepointat.js from https://git.io/codepointat +MIT License for fromcodepoint.js from https://git.io/vDW1m + +Copyright Mathias Bynens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +================================================================================ + +PCRE - Perl Compatible Regular Expressions 8.42 + +PCRE LICENCE +------------ + +PCRE is a library of functions to support regular expressions whose syntax +and semantics are as close as possible to those of the Perl 5 language. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. +Release 8 of PCRE is distributed under the terms of the "BSD" licence, as +specified below. The documentation for PCRE, supplied in the "doc" +directory, is distributed under the same terms as the software itself. The data +in the testdata directory is not copyrighted and is in the public domain. - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. +The basic library functions are written in C and are freestanding. Also +included in the distribution is a set of C++ wrapper functions, and a +just-in-time compiler that can be used to optimize pattern matching. These +are both optional features that can be omitted when the library is built. - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. +THE BASIC LIBRARY FUNCTIONS +--------------------------- - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. +Written by: Philip Hazel +Email local part: ph10 +Email domain: cam.ac.uk - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. +University of Cambridge Computing Service, +Cambridge, England. - The precise terms and conditions for copying, distribution and -modification follow. +Copyright (c) 1997-2018 University of Cambridge +All rights reserved. - TERMS AND CONDITIONS - 0. Definitions. +PCRE JUST-IN-TIME COMPILATION SUPPORT +------------------------------------- - "This License" refers to version 3 of the GNU General Public License. +Written by: Zoltan Herczeg +Email local part: hzmester +Emain domain: freemail.hu - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. +Copyright(c) 2010-2018 Zoltan Herczeg +All rights reserved. - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. +STACK-LESS JUST-IN-TIME COMPILER +-------------------------------- - A "covered work" means either the unmodified Program or a work based -on the Program. +Written by: Zoltan Herczeg +Email local part: hzmester +Emain domain: freemail.hu - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. +Copyright(c) 2009-2018 Zoltan Herczeg +All rights reserved. - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. +THE C++ WRAPPER FUNCTIONS +------------------------- - 1. Source Code. +Contributed by: Google Inc. - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. +Copyright (c) 2007-2012, Google Inc. +All rights reserved. - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. +THE "BSD" LICENCE +----------------- - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. - The Corresponding Source for a work in source code form is that -same work. +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. - 2. Basic Permissions. +* Neither the name of the University of Cambridge nor the name of Google +Inc. nor the names of their contributors may be used to endorse or +promote products derived from this software without specific prior +written permission. - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +================================================================================ - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. +Zlib Data Compression Library 1.2.11 - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. +Include the following verbatim in the documentation: - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. +Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: - 4. Conveying Verbatim Copies. +1. The origin of this software must not be misrepresented; you must not +claim that you wrote the original software. If you use this software +in a product, an acknowledgment in the product documentation would be +appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be +misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. +Jean-loup Gailly Mark Adler +jloup@gzip.org madler@alumni.caltech.edu - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - 5. Conveying Modified Source Versions. +================================================================================ - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: +R 3.5.1 - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. +Preamble - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. - 6. Conveying Non-Source Forms. +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). +The precise terms and conditions for copying, distribution and +modification follow. - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". - 7. Additional Terms. +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +================================================= +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +==================================================== + +Some header files are distributed under LGPL-2.1: see file COPYRIGHTS (on the +SVN server). + +GNU LESSER GENERAL PUBLIC LICENSE +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts +as the successor of the GNU Library Public License, version 2, hence +the version number 2.1.] + +Preamble + +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + +To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + +Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + +When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + +We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + +For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + +Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + +GNU LESSER GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + +You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + +2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices +stating that you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no +charge to all third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a +table of data to be supplied by an application program that uses +the facility, other than as an argument passed when the facility +is invoked, then you must make a good faith effort to ensure that, +in the event an application does not supply such function or +table, the facility still operates, and performs whatever part of +its purpose remains meaningful. + +(For example, a function in a library to compute square roots has +a purpose that is entirely well-defined independent of the +application. Therefore, Subsection 2d requires that any +application-supplied function or table used by this function must +be optional: if the application does not supply it, the square +root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + +Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + +a) Accompany the work with the complete corresponding +machine-readable source code for the Library including whatever +changes were used in the work (which must be distributed under +Sections 1 and 2 above); and, if the work is an executable linked +with the Library, with the complete machine-readable "work that +uses the Library", as object code and/or source code, so that the +user can modify the Library and then relink to produce a modified +executable containing the modified Library. (It is understood +that the user who changes the contents of definitions files in the +Library will not necessarily be able to recompile the application +to use the modified definitions.) + +b) Use a suitable shared library mechanism for linking with the +Library. A suitable mechanism is one that (1) uses at run time a +copy of the library already present on the user's computer system, +rather than copying library functions into the executable, and (2) +will operate properly with a modified version of the library, if +the user installs one, as long as the modified version is +interface-compatible with the version that the work was made with. + +c) Accompany the work with a written offer, valid for at +least three years, to give the same user the materials +specified in Subsection 6a, above, for a charge no more +than the cost of performing this distribution. + +d) If distribution of the work is made by offering access to copy +from a designated place, offer equivalent access to copy the above +specified materials from the same place. + +e) Verify that the user has already received a copy of these +materials or that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + +It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + +7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work +based on the Library, uncombined with any other library +facilities. This must be distributed under the terms of the +Sections above. + +b) Give prominent notice with the combined library of the fact +that part of it is a work based on the Library, and explaining +where to find the accompanying uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + +11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + +To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the +library `Frob' (a library for tweaking knobs) written by James Random Hacker. + +, 1 April 1990 +Ty Coon, President of Vice + +That's all there is to it! +========================================================== + +COPYRIGHT STATUS + +The bulk of this code is copyright by members of or all of the R Core +Team. ('The R Core Team' in copyright statements in individual files +refers to some or all of the team.) + +See the file COPYING for the exact conditions under which you may +redistribute it. R as a whole is distributed under GPL version 2 or +3: most source files contain a copyright statement allowing use of +that file under GPL version 2 or later: the main exceptions are the +included versions of packages 'MASS', 'class', 'nnet', 'rpart' and +'spatial' (GPL-2 or GPL-3). (The auxiliary file m4/openmp.m4 is under +GPL-3, but its incorporation into 'configure' is not.) + +The status of files used only in the Windows port is in file +src/gnuwin32/COPYRIGHTS.win, which is appended to this file in binary +Windows distributions. + +Note that almost all the code *is* copyright and may only be +reproduced if the copyright notice (that in the file or this notice) +is preserved. The status of the included LINPACK routines is unclear: +they are said to be in the public domain in the USA. + +--------------------------------------------------- + +Some (but not all) of the public header files are distributed under +the more permissive terms of version 2.1 or later of the LGPL: see +files R_HOME/share/licenses/LGPL-2.1 and R_HOME/share/licenses/LGPL-3. +This applies only to the header files + +src/include/R.h +src/include/Rdefines.h +src/include/Rgraphics.h +src/include/Rinternals.h +src/include/Rmath.h +src/include/S.h +src/include/R_ext/*.h + +Note that it does not apply to the header files such as Rembedded.h +and Rinterface.h used for third-party front ends. + +From the announcement of the change (2001-Feb-05) + +It came to our attention that some projects are interpreting GPL to +mean that compiling against the header files or linking against a +Windows import library brings the compiled code under the scope of +GPL. This would mean it would be impossible to distribute binary +versions of non-GPL packages with compiled code which called entry +points in the R executable or DLL, of which there are many on CRAN. + +We encourage packages to be distributed under Open Source conditions, +but accept that this is not possible for some contributions. Our +intention is that export files and import libraries be 'accessors' +under clause 5 of the LGPL, so that in most cases no (additional) +restrictions are imposed by compiling a package using the LGPL-ed +components of R. + +To avoid any anomalies, the versions of the same files in R versions +1.0.0 to 1.2.1 may also be used under LGPL or GPL. + +Import libraries are no longer used under Windows. + +Some contributed files are also covered by the Library General Public License. +These include (see also below) + +src/library/stats/R/embed.R +src/library/stats/src/PPsum.c + +--------------------------------------------------- + + + + +Some of the code contains different copyright statements. It is used +here in accordance with the copyright conditions in that code. A +not-necessarily-complete list of such files is: + +src/library/grDevices/inst/afm/*___.afm + +Copyright (c) 1984 to 1992 Adobe Systems Incorporated. + +src/library/grDevices/inst/afm/MustRead.html +src/library/grDevices/inst/afm/Courier*.afm +src/library/grDevices/inst/afm/Helvetica*.afm +src/library/grDevices/inst/afm/Times*.afm +src/library/grDevices/inst/afm/Symbol.afm +src/library/grDevices/inst/afm/ZapfDingbats.afm + +Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems +Incorporated. All Rights Reserved. + +src/library/grDevices/inst/afm/*l.afm + +Copyright 1999 by (URW)++ Design & Development + +src/library/grDevices/inst/afm/CM_*.afm +src/library/grDevices/inst/afm/cm*.afm + +are derived from afms which are copyright by the American +Mathematical Society, but 'the AMS does require that the +AMS copyright notice be removed from any derivative versions +of the fonts which have been altered in any way'. + +doc/manual/R-intro.texi + +in part + +Copyright (C) 1990 W. N. Venables +Copyright (C) 1992 W. N. Venables & D. M. Smith +Copyright (C) 1997 R. Gentleman & R. Ihaka +Copyright (C) 1997, 1998 M. Maechler + + +src/library/graphics/R/mosaicplot.R + +Original code copyright (C) 1998 John W. Emerson + +src/library/graphics/R/pairs.R + +In part, Copyright 1999 Dr. Jens Oehlschlaegel-Akiyoshi + +src/library/graphics/R/polygon.R + +Copyright (C) 2001 by Kevin Buhr + +src/library/splines/R/splineClasses.R + +Copyright (C) 1998 Douglas M. Bates and William N. Venables. + +src/library/datasets/man/austres.Rd +src/library/datasets/man/beavers.Rd +src/library/datasets/man/lh.Rd +src/library/datasets/man/npk.Rd +src/library/datasets/man/rock.Rd +src/library/datasets/man/UKLungDeaths.Rd +src/library/datasets/man/USAccDeaths.Rd +src/library/stats/R/add.R +src/library/stats/R/bandwidths.R +src/library/stats/R/confint.R +src/library/stats/R/cpgram.R +src/library/stats/R/spectrum.R +src/library/stats/R/vcov.R +src/library/stats/src//bandwidths.c +src/appl/maxcol.c + +Copyright (C) various dates W. N. Venables and B. D. Ripley + + +src/appl/interv.c : moved to API from code originally in +src/library/stats/src/bvalue.f, see +src/library/stats/COPYRIGHTS.modreg + +src/library/stats: + +See the files src/library/stats/COPYRIGHTS.modreg and +src/library/stats/COPYRIGHTS.portsrc for further details + + +src/library/stats/R/diffinv.R +src/library/stats/R/embed.R +src/library/stats/R/kernel.R +src/library/stats/src/PPsum.c + +Copyright (C) 1997-1999 Adrian Trapletti + + +src/library/stats/R/nls.R + +In part, Copyright 1999-1999 Saikat DebRoy + + +src/library/stats/R/nlsFunc.R +src/library/stats/R/selfStart.R +src/library/stats/R/zzModels.R + +Copyright 1997,1999 Jose C. Pinheiro, Douglas M. Bates + +src/library/stats/R/runmed.R +src/library/stats/src/Trunmed.c + +In part Copyright (C) 1995 Berwin A. Turlach + +src/library/stats/src/loessc.c +src/library/stats/src/loessf.f + +In part Copyright (c) 1989, 1992 by AT&T + +src/library/stats/R/spline.R + +In part, Copyright (C) 2002 Simon N. Wood + +src/library/tcltk/exec/{hierarchy,util*,widget}.tcl + +Copyright (c) various dates Jeffrey Hobbs + + +src/modules/X11/rotated.[ch] + +Copyright (c) 1993 Alan Richardson + + +src/appl/loglin.c +src/library/stats/src/chisqsim.c +src/library/stats/src/nscor.c +src/library/stats/src/prho.c +src/library/stats/src/swilk.c +src/library/stats/src/kmns.f +src/library/stats/src/starma.c +src/nmath/pnbeta.c +src/nmath/pnchisq.c +src/nmath/pnt.c +src/nmath/qbeta.c +src/nmath/qgamma.c +src/nmath/qnorm.c +src/nmath/qtukey.c +are based in whole or in part on Applied Statistics algorithms +(C) Royal Statistical Society + +src/nmath/stirlerr.c +src/nmath/dbinom.c +src/nmath/dpois.c +are partly based on Catherine/Clive Loader's (1999) work, +(C) 1999-2000 Lucent Technologies, Bell Laboratories. + + +src/main/RNG.c + +The Mersenne-Twister part is +Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. + + +src/main/xspline.c + +* Copyright (c) 1985-1988 by Supoj Sutanthavibul +* Parts Copyright (c) 1989-2002 by Brian V. Smith +* Parts Copyright (c) 1991 by Paul King +* Parts Copyright (c) 1992 by James Tough +* Parts Copyright (c) 1998 by Georg Stemmer +* Parts Copyright (c) 1995 by C. Blanc and C. Schlick + +* Any party obtaining a copy of these files is granted, free of charge, a +* full and unrestricted irrevocable, world-wide, paid up, royalty-free, +* nonexclusive right and license to deal in this software and +* documentation files (the "Software"), including without limitation the +* rights to use, copy, modify, merge, publish and/or distribute copies of +* the Software, and to permit persons who receive copies from any such +* party to do so, with the only requirement being that this copyright +* notice remain intact. + + +src/modules/nano{ftp,http}.c + +Copyright (C) 1998-2001 Daniel Veillard. All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is fur- +nished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- +NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +src/modules/lapack/dlapack.f, cmplx.f, dlamc.f + +Extracted from +* -- LAPACK computational routine (version 3.8.0) -- +* -- LAPACK is a software package provided by Univ. of Tennessee, -- +* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- +* November 2017 + +where the version number, providers and date vary by subroutine. +For version 3.7.0, many of the copyright dates were updated +even for routines which have not been changed for years. + +LAPACK 3.8.0 contains a LICENSE file, copied to src/modules/lapack +(but many of these routines were originally copied from earlier +versions of LAPACK). For binary distributions it is reproduced here: + +--- src/modules/lapack/LICENSE --- +Copyright (c) 1992-2017 The University of Tennessee and The University +of Tennessee Research Foundation. All rights +reserved. +Copyright (c) 2000-2017 The University of California Berkeley. All +rights reserved. +Copyright (c) 2006-2017 The University of Colorado Denver. All rights +reserved. + +$COPYRIGHT$ + +Additional copyrights may follow + +$HEADER$ + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer listed +in this license in the documentation and/or other materials +provided with the distribution. + +- Neither the name of the copyright holders nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +The copyright holders provide no reassurances that the source code +provided does not infringe any patent, copyright, or any other +intellectual property rights of third parties. The copyright holders +disclaim any liability to any recipient for claims brought against +recipient by any third party for infringement of that parties +intellectual property rights. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- end of src/modules/lapack/LICENSE --- + +src/extra/xdr/* + +Copyright (undated) Sun Microsystems, Inc. + +See the file src/extra/xdr/copyrght.txt + +src/main/connections.c, src/main/gzio.h + +Contain code derived from the zlib 1.2.3 distribution +(C) 1995-2005 Jean-loup Gailly and Mark Adler + +src/main/dounzip.c, unzip.h + +Contain code Copyright (C) 1998-2010 Gilles Vollant from contrib/minizip +in the zlib 1.2.3 distribution with updates taken from 1.2.5. + + +src/main/valid_utf8.h + +Copyright (c) 1997-2012 University of Cambridge + +For binary builds of R that requires us to include + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials +provided with the distribution. + +* Neither the name of the University of Cambridge nor the name +of Google Inc. nor the names of their contributors may be used +to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +src/extra/tre/LICENSE +src/extra/tre/*.[ch] + +Copyright (c) 2001-2009 Ville Laurikari +All rights reserved. + +From tre-0.8.0 (http://laurikari.net/tre/). See file +src/extra/tre/LICENSE. For binary builds of R that requires us to +include + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* Neither the name of the University of Cambridge nor the name of Google +Inc. nor the names of their contributors may be used to endorse or +promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +src/extra/tzone/strftime.c +/* +Based on code from tzcode, which is turn said to be +'Based on the UCB version with the copyright notice appearing below.' + +** Copyright (c) 1989 The Regents of the University of California. +** All rights reserved. +** +** Redistribution and use in source and binary forms are permitted +** provided that the above copyright notice and this paragraph are +** duplicated in all such forms and that any documentation, +** advertising materials, and other materials related to such +** distribution and use acknowledge that the software was developed +** by the University of California, Berkeley. The name of the +** University may not be used to endorse or promote products derived +** from this software without specific prior written permission. +** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +*/ + + +src/extra/intl/* + +Based on gettextize from gettext 0.17 +Copyright (C) various dates Free Software Foundation, Inc. +Distributed under the GNU Library General Public License +version 2 or later. + +src/include/vg/memcheck.h +src/include/vg/valgrind.h + +From valgrind 3.10.1, + +Copyright (C) 2000-2013 Julian Seward. All rights reserved. + + +src/main/mkdtemp.c + +From glibc via +http://lists.gnu.org/archive/html/bug-gnulib/2003-02/msg00019.html + +Copyright (C) 1999, 2001-2003 Free Software Foundation, Inc. +Distributed under the GNU Library General Public License +version 2 or later. + +src/main/Rstrptime.h + +Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. +Distributed under the GNU Library General Public License +version 2 or later. + + +Some of the files in src/appl were originally taken from the Netlib +archive now at www.netlib.org and do not clearly state their +copyright status. + +src/appl/{dchdc,dpfa,dpbsl,dpoco,dpodi,dpofa,dposl,dqrdc, +dqrsl,dsvdc,dtrco,dtrsl}.f + +are part of LINPACK, with authors J.J. Dongarra, Cleve Moler and +G.W. Stewart + +src/appl/dqrdc2.f is based on dqrdc.f by G.W. Stewart. + +src/appl/lbfgsb.c is based on the work of Zhu, Byrd, Lu-Chen and +Nocedal, which does not state any copyright. + +src/main/radixsort.c is largely based on code from the data.table package, + +Copyright (C) 2006--2015 Matt Dowle and Arun Srinivasan + +doc/html/Rlogo.svg +doc/html/Rlogo.pdf +doc/html/logo.jpg +doc/html/favicon.ico +src/modules/X11/rlogo_icon.h +src/gnuwin32/front-ends/R.ico +src/gnuwin32/installer/R.bmp + +Copyright (C) 2015-2016 The R Foundation + +You can distribute the logo under the terms of the Creative +Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA +4.0) or (at your option) the GNU General Public License version 2 +(GPL-2). + +The design of the current logo is based on the previous logo that +was included in the R source from 1998 to 2016. + +--------------------------------------------------- +================================================================================ + +GCC - GNU Compiler Collection 4.9.2 + +Include the following verbatim in the documentation: + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +------------------------------------------------------ + +GCC RUNTIME LIBRARY EXCEPTION + +Version 3.1, 31 March 2009 + +Copyright � 2009 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +This GCC Runtime Library Exception ("Exception") is an additional permission +under section 7 of the GNU General Public License, version 3 ("GPLv3"). It +applies to a given file (the "Runtime Library") that bears a notice placed by +the copyright holder of the file stating that the file is governed by GPLv3 +along with this Exception. + +When you use GCC to compile a program, GCC may combine portions of certain GCC +header files and runtime libraries with the compiled program. The purpose of +this Exception is to allow compilation of non-GPL (including proprietary) +programs to use, in this way, the header files and runtime libraries covered by +this Exception. +0. Definitions. + +A file is an "Independent Module" if it either requires the Runtime Library for +execution after a Compilation Process, or makes use of an interface provided by +the Runtime Library, but is not otherwise based on the Runtime Library. + +"GCC" means a version of the GNU Compiler Collection, with or without +modifications, governed by version 3 (or a specified later version) of the GNU +General Public License (GPL) with the option of using any subsequent versions +published by the FSF. + +"GPL-compatible Software" is software whose conditions of propagation, +modification and use would permit combination with GCC in accord with the +license of GCC. + +"Target Code" refers to output from any compiler for a real or virtual target +processor architecture, in executable form or suitable for input to an +assembler, loader, linker and/or execution phase. Notwithstanding that, Target +Code does not include data in any format that is used as a compiler intermediate +representation, or used for producing a compiler intermediate representation. + +The "Compilation Process" transforms code entirely represented in non- +intermediate languages designed for human-written code, and/or in Java Virtual +Machine byte code, into Target Code. Thus, for example, use of source code +generators and preprocessors need not be considered part of the Compilation +Process, since the Compilation Process can be understood as starting with the +output of the generators or preprocessors. + +A Compilation Process is "Eligible" if it is done using GCC, alone or with other +GPL-compatible software, or if it is done without using any work based on GCC. +For example, using non-GPL-compatible Software to optimize any GCC intermediate +representations would not qualify as an Eligible Compilation Process. +1. Grant of Additional Permission. + +You have permission to propagate a work of Target Code formed by combining the +Runtime Library with Independent Modules, even if such propagation would +otherwise violate the terms of GPLv3, provided that all Target Code was +generated by Eligible Compilation Processes. You may then convey such a +combination under terms of your choice, consistent with the licensing of the +Independent Modules. +2. No Weakening of GCC Copyleft. + +The availability of this Exception does not imply any general presumption that +third-party software is unaffected by the copyleft requirements of the license +of GCC. + +================================================================================ + +rJava Fork 0.9-9 + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +data.table 1.10.4 + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +svglite 1.2.1 + +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +============================================================== +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +================================================== +Copyrights from .cpp source files +// (C) 2002 T Jake Luciani: SVG device, based on PicTex device +// (C) 2008 Tony Plate: Line type support from RSVGTipsDevice package +// (C) 2012 Matthieu Decorde: UTF-8 support, XML reserved characters and XML +header +// (C) 2015 RStudio (Hadley Wickham): modernisation & refactoring +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +======================================== +Authors list +Author: Hadley Wickham [aut], +Lionel Henry [aut, cre], +T Jake Luciani [aut], +Matthieu Decorde [aut], +Vaudor Lise [aut], +Tony Plate [ctb] (Early line dashing code), +David Gohel [ctb] (Line dashing code and raster code), +Yixuan Qiu [ctb] (Improved styles; polypath implementation), +H�kon Malmedal [ctb] (Opacity code), +RStudio [cph] +================================================================================ + +rlang 0.2.1 + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + +Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read + + +================================================================================ + +gridGraphics 0.3-0 + +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + +=================================================== +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +boot 1.3-20 + +Boot, version 1.3-20 (https://cran.r-project.org/web/packages/boot/index.html) + +# part of R package boot +# copyright (C) 1997-2001 Angelo J. Canty +# corrections (C) 1997-2014 B. D. Ripley +# +# Unlimited distribution is permitted + +==================================== + +UNLIMITED license is mentioned in sources of this package or on this web page +https://cran.r-project.org/web/packages/boot/index.html. It is part of the GNU-R +distro which is made available as a whole under GPLv3. Copying here GPL +licenses from GNU R, these are not part of boot package. + +=================================================================== + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +class 7.3-14 + +Software and datasets to support 'Modern Applied Statistics with S', +fourth edition, by W. N. Venables and B. D. Ripley. +Springer, 2002. + +From the text (pp. 464): + +These datasets and software are provided in good faith, but none of +the authors, publishers nor distributors warrant their accuracy +nor can be held responsible for the consequences of their use. + +This file is intended to clarify ownership and copyright: where +possible individual files also carry brief copyright notices. + + +Copyrights +========== + +All files are copyright (C) 1994-2013 W. N. Venables and +B. D. Ripley. Those parts which were distributed with the first +edition are also copyright (C) 1994 Springer-Verlag New York Inc, with +all rights assigned to W. N. Venables and B. D. Ripley. + + +Licence +======= + +This is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 or 3 of the License +(at your option). + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Files share/licenses/GPL-2 and share/licenses/GPL-3 in the R +(source or binary) distribution are copies of versions 2 and 3 +of the 'GNU General Public License'. +These can also be viewed at https://www.r-project.org/Licenses/ + +Bill.Venables@gmail.com +ripley@stats.ox.ac.uk + +===================================== + +Oracle elects GPLv3. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +Matrix 1.2-14 + +Matrix, version 1.2-14 (https://cran.r- +project.org/web/packages/Matrix/index.html) + +Copyrights +========== +The Matrix package, an R package, available from CRAN or R-forge, +consists of basically two parts. + +1. Matrix' own C code in src/*.[ch] (apart from cs.h and cs.c), +R code in R/*.R, including more in ./inst/ and ./tests/ and other +directories including vignettes, documentation etc. +All these have been created by Douglas Bates and Martin Maechler and +hence are + +Copyright (C) 1999-2016 Douglas Bates and Martin Maechler + +2. The Matrix package includes libraries AMD, CHOLMOD, +COLAMD, CSparse and SPQR from the SuiteSparse collection of Tim +Davis. All sections of that code are covered by the GPL or +LGPL licenses. See the directory (inst/) doc/SuiteSparse/ for details. + +Douglas M. Bates, University of Wisconsin, Madison, bates@stat.wisc.edu +Martin Maechler ETH Zurich, maechler@stat.math.ethz.ch | maechler@r-project.org + + +Licences +======== + +1. The Matrix package itself is licenced under "GPL-3", the GNU GENERAL +PUBLIC LICENCE Version 3, see "GPL-3" below. + +2. The licences of the libraries from the SuiteSparse collection mentioned +are included in the respective source directories. + +******************************************** +Oracle elects the GPLv3 for any code that is licensed under the GPLv2 or later. +Oracle elects the LGPLv3 for any code that is licensed under the LGPLv2 or +later. + +******************************************** + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +************************************************ + + + +================================================================================ + +MASS 7.3-50 + +Mass, version 7.3-50 (https://cran.r-project.org/web/packages/MASS/index.html) + +Copyrights +========== + +File MASS/R/profiles.R copyright (C) 1996 D. M. Bates and W. N. Venables. +port to R by B. D. Ripley copyright (C) 1998 +corrections copyright (C) 2000,3,6 B. D. Ripley + +Our understanding is that the dataset files MASS/data/*.rda are not copyright. + +All other files are copyright (C) 1994-2018 W. N. Venables and +B. D. Ripley. Those parts which were distributed with the first +edition are also copyright (C) 1994 Springer-Verlag New York Inc, with +all rights assigned to W. N. Venables and B. D. Ripley. + + +Licence +======= + +This is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 or 3 of the License +(at your option). + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Files share/licenses/GPL-2 and share/licenses/GPL-3 in the R +(source or binary) distribution are copies of versions 2 and 3 +of the 'GNU General Public License'. +These can also be viewed at https://www.r-project.org/Licenses/ + +Bill.Venables@gmail.com +ripley@stats.ox.ac.uk + +********************************* +Oracle elects the GPLv3 +********************************* + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +================================================================================ + +KernSmooth 2.23-15 + +By agreement with Dr Wand (1998-June-22), the R port can be used and +distributed freely, superseding the comments in orig/KernSmooth.tex. + +The original S code is copyright Matt Wand, the R port copyright +Brian Ripley + +================================================================================ + +nlme 3.1-137 + +nlme, version 3.1-137 (https://cran.r-project.org/web/packages/nlme/index.html) + +nlme is licensed under either the GPLv2 or the GPLv3 +Oracle elects the GPLv3. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +***************************************************************** +Copyright (C) 1999-2001 Jose C. Pinheiro and Douglas M. Bates +Copyright (C) 2006-2015 The R Core team + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this file. A copy of the GNU General Public License is +available at http://www.r-project.org/Licenses/ + +---------------------------------------------------------------------------- + +This package contains the nlme (nonlinear mixed effects) package +version 3.1 for R. + +Authors: Jose Pinheiro +Douglas Bates +Saikat DebRoy + +--------- + +Copyright (C) 2015 Quantitative Solutions, a Certara company + +Authors of 'fixed sigma option' of Nov. 2015: + +Siem Heisterkamp +Bert van Willigen +Paul Matthias Diderichsen (sponsor) + +/* +Basic matrix manipulations and QR decomposition + +Copyright 1997-2005 Douglas M. Bates , +Jose C. Pinheiro, +Saikat DebRoy +Copyright 2007-2016 The R Core Team + +This file is part of the nlme package for R and related languages +and is made available under the terms of the GNU General Public +License, version 2, or at your option, any later version, +incorporated herein by reference. + +This program is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License +along with this program; if not, a copy is available at +http://www.r-project.org/Licenses/ +==================================== + +================================================================================ + +lattice 0.20-35 + +This software is distributed under the terms of the GNU General Public +License as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +As of writing, this essentially boils down to two possible licenses, +GPL version 2 and version 3. Copies of these licenses are available +in files GPL-2 and GPL-3 in the sources of this package, as well as at + +http://www.r-project.org/Licenses/ + +They can also be viewed from within R using + +RShowDoc("GPL-2") +RShowDoc("GPL-3") + +Oracle elects the GPLv3. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +FastR 0.5 + +FastR -- a new R virtual machine +Copyright (C) 2013 Purdue University + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Oracle elects the GPLv3. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or + +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or + +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or + +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or + +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or + +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. + +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ + +foreign 0.8-71 + +Foreign, version 0.8-71 +Oracle elects the GPLv3 for any code that is licensed under the GPLv2 or later + +GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright � 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. +Preamble + +The GNU General Public License is a free, copyleft license for software and +other kinds of works. + +The licenses for most software and other practical works are designed to take +away your freedom to share and change the works. By contrast, the GNU General +Public License is intended to guarantee your freedom to share and change all +versions of a program--to make sure it remains free software for all its users. +We, the Free Software Foundation, use the GNU General Public License for most of +our software; it applies also to any other work released this way by its +authors. You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom to +distribute copies of free software (and charge for them if you wish), that you +receive source code or can get it if you want it, that you can change the +software or use pieces of it in new free programs, and that you know you can do +these things. + +To protect your rights, we need to prevent others from denying you these rights +or asking you to surrender the rights. Therefore, you have certain +responsibilities if you distribute copies of the software, or if you modify it: +responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether gratis or for a +fee, you must pass on to the recipients the same freedoms that you received. +You must make sure that they, too, receive or can get the source code. And you +must show them these terms so they know their rights. + +Developers that use the GNU GPL protect your rights with two steps: (1) assert +copyright on the software, and (2) offer you this License giving you legal +permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains that there +is no warranty for this free software. For both users' and authors' sake, the +GPL requires that modified versions be marked as changed, so that their problems +will not be attributed erroneously to authors of previous versions. + +Some devices are designed to deny users access to install or run modified +versions of the software inside them, although the manufacturer can do so. This +is fundamentally incompatible with the aim of protecting users' freedom to +change the software. The systematic pattern of such abuse occurs in the area of +products for individuals to use, which is precisely where it is most +unacceptable. Therefore, we have designed this version of the GPL to prohibit +the practice for those products. If such problems arise substantially in other +domains, we stand ready to extend this provision to those domains in future +versions of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. States +should not allow patents to restrict development and use of software on general- +purpose computers, but in those that do, we wish to avoid the special danger +that patents applied to a free program could make it effectively proprietary. To +prevent this, the GPL assures that patents cannot be used to render the program +non-free. + +The precise terms and conditions for copying, distribution and modification +follow. +TERMS AND CONDITIONS +0. Definitions. + +This License refers to version 3 of the GNU General Public License. + +Copyright also means copyright-like laws that apply to other kinds of works, +such as semiconductor masks. + +The Program refers to any copyrightable work licensed under this License. Each +licensee is addressed as you. Licensees and recipients may be individuals +or organizations. + +To modify a work means to copy from or adapt all or part of the work in a +fashion requiring copyright permission, other than the making of an exact copy. +The resulting work is called a modified version of the earlier work or a work +based on the earlier work. + +A covered work means either the unmodified Program or a work based on the +Program. + +To propagate a work means to do anything with it that, without permission, +would make you directly or secondarily liable for infringement under applicable +copyright law, except executing it on a computer or modifying a private copy. +Propagation includes copying, distribution (with or without modification), +making available to the public, and in some countries other activities as well. + +To convey a work means any kind of propagation that enables other parties to +make or receive copies. Mere interaction with a user through a computer network, +with no transfer of a copy, is not conveying. + +An interactive user interface displays Appropriate Legal Notices to the extent +that it includes a convenient and prominently visible feature that (1) displays +an appropriate copyright notice, and (2) tells the user that there is no +warranty for the work (except to the extent that warranties are provided), that +licensees may convey the work under this License, and how to view a copy of this +License. If the interface presents a list of user commands or options, such as +a menu, a prominent item in the list meets this criterion. +1. Source Code. + +The source code for a work means the preferred form of the work for making +modifications to it. Object code means any non-source form of a work. + +A Standard Interface means an interface that either is an official standard +defined by a recognized standards body, or, in the case of interfaces specified +for a particular programming language, one that is widely used among developers +working in that language. + +The System Libraries of an executable work include anything, other than the +work as a whole, that (a) is included in the normal form of packaging a Major +Component, but which is not part of that Major Component, and (b) serves only to +enable use of the work with that Major Component, or to implement a Standard +Interface for which an implementation is available to the public in source code +form. A Major Component, in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system (if any) on +which the executable work runs, or a compiler used to produce the work, or an +object code interpreter used to run it. + +The Corresponding Source for a work in object code form means all the source +code needed to generate, install, and (for an executable work) run the object +code and to modify the work, including scripts to control those activities. +However, it does not include the work's System Libraries, or general-purpose +tools or generally available free programs which are used unmodified in +performing those activities but which are not part of the work. For example, +Corresponding Source includes interface definition files associated with source +files for the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, such as by +intimate data communication or control flow between those subprograms and other +parts of the work. + +The Corresponding Source need not include anything that users can regenerate +automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. +2. Basic Permissions. + +All rights granted under this License are granted for the term of copyright on +the Program, and are irrevocable provided the stated conditions are met. This +License explicitly affirms your unlimited permission to run the unmodified +Program. The output from running a covered work is covered by this License only +if the output, given its content, constitutes a covered work. This License +acknowledges your rights of fair use or other equivalent, as provided by +copyright law. + +You may make, run and propagate covered works that you do not convey, without +conditions so long as your license otherwise remains in force. You may convey +covered works to others for the sole purpose of having them make modifications +exclusively for you, or provide you with facilities for running those works, +provided that you comply with the terms of this License in conveying all +material for which you do not control copyright. Those thus making or running +the covered works for you must do so exclusively on your behalf, under your +direction and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions +stated below. Sublicensing is not allowed; section 10 makes it unnecessary. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological measure under +any applicable law fulfilling obligations under article 11 of the WIPO +copyright treaty adopted on 20 December 1996, or similar laws prohibiting or +restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention is +effected by exercising rights under this License with respect to the covered +work, and you disclaim any intention to limit operation or modification of the +work as a means of enforcing, against the work's users, your or third parties' +legal rights to forbid circumvention of technological measures. +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you receive it, +in any medium, provided that you conspicuously and appropriately publish on each +copy an appropriate copyright notice; keep intact all notices stating that this +License and any non-permissive terms added in accord with section 7 apply to +the code; keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may +offer support or warranty protection for a fee. +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to produce it +from the Program, in the form of source code under the terms of section 4, +provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified it, and +giving a relevant date. +b) The work must carry prominent notices stating that it is released under this +License and any conditions added under section 7. This requirement modifies the +requirement in section 4 to keep intact all notices. +c) You must license the entire work, as a whole, under this License to anyone +who comes into possession of a copy. This License will therefore apply, along +with any applicable section 7 additional terms, to the whole of the work, and +all its parts, regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not invalidate such +permission if you have separately received it. +d) If the work has interactive user interfaces, each must display Appropriate +Legal Notices; however, if the Program has interactive interfaces that do not +display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which +are not by their nature extensions of the covered work, and which are not +combined with it such as to form a larger program, in or on a volume of a +storage or distribution medium, is called an aggregate if the compilation and +its resulting copyright are not used to limit the access or legal rights of the +compilation's users beyond what the individual works permit. Inclusion of a +covered work in an aggregate does not cause this License to apply to the other +parts of the aggregate. +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms of sections 4 +and 5, provided that you also convey the machine-readable Corresponding Source +under the terms of this License, in one of these ways: + +a) Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by the Corresponding Source fixed on +a durable physical medium customarily used for software interchange. +b) Convey the object code in, or embodied in, a physical product (including a +physical distribution medium), accompanied by a written offer, valid for at +least three years and valid for as long as you offer spare parts or customer +support for that product model, to give anyone who possesses the object code +either (1) a copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical medium +customarily used for software interchange, for a price no more than your +reasonable cost of physically performing this conveying of source, or (2) access +to copy the Corresponding Source from a network server at no charge. +c) Convey individual copies of the object code with a copy of the written offer +to provide the Corresponding Source. This alternative is allowed only +occasionally and noncommercially, and only if you received the object code with +such an offer, in accord with subsection 6b. +d) Convey the object code by offering access from a designated place (gratis or +for a charge), and offer equivalent access to the Corresponding Source in the +same way through the same place at no further charge. You need not require +recipients to copy the Corresponding Source along with the object code. If the +place to copy the object code is a network server, the Corresponding Source may +be on a different server (operated by you or a third party) that supports +equivalent copying facilities, provided you maintain clear directions next to +the object code saying where to find the Corresponding Source. Regardless of +what server hosts the Corresponding Source, you remain obligated to ensure that +it is available for as long as needed to satisfy these requirements. +e) Convey the object code using peer-to-peer transmission, provided you inform +other peers where the object code and Corresponding Source of the work are being +offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the +Corresponding Source as a System Library, need not be included in conveying the +object code work. + +A User Product is either (1) a consumer product, which means any tangible +personal property which is normally used for personal, family, or household +purposes, or (2) anything designed or sold for incorporation into a dwelling. In +determining whether a product is a consumer product, doubtful cases shall be +resolved in favor of coverage. For a particular product received by a particular +user, normally used refers to a typical or common use of that class of +product, regardless of the status of the particular user or of the way in which +the particular user actually uses, or expects or is expected to use, the +product. A product is a consumer product regardless of whether the product has +substantial commercial, industrial or non-consumer uses, unless such uses +represent the only significant mode of use of the product. + +Installation Information for a User Product means any methods, procedures, +authorization keys, or other information required to install and execute +modified versions of a covered work in that User Product from a modified version +of its Corresponding Source. The information must suffice to ensure that the +continued functioning of the modified object code is in no case prevented or +interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as part of a +transaction in which the right of possession and use of the User Product is +transferred to the recipient in perpetuity or for a fixed term (regardless of +how the transaction is characterized), the Corresponding Source conveyed under +this section must be accompanied by the Installation Information. But this +requirement does not apply if neither you nor any third party retains the +ability to install modified object code on the User Product (for example, the +work has been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates for a +work that has been modified or installed by the recipient, or for the User +Product in which it has been modified or installed. Access to a network may be +denied when the modification itself materially and adversely affects the +operation of the network or violates the rules and protocols for communication +across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord +with this section must be in a format that is publicly documented (and with an +implementation available to the public in source code form), and must require no +special password or key for unpacking, reading or copying. +7. Additional Terms. + +Additional permissions are terms that supplement the terms of this License by +making exceptions from one or more of its conditions. Additional permissions +that are applicable to the entire Program shall be treated as though they were +included in this License, to the extent that they are valid under applicable +law. If additional permissions apply only to part of the Program, that part may +be used separately under those permissions, but the entire Program remains +governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any +additional permissions from that copy, or from any part of it. (Additional +permissions may be written to require their own removal in certain cases when +you modify the work.) You may place additional permissions on material, added by +you to a covered work, for which you have or can give appropriate copyright +permission. + +Notwithstanding any other provision of this License, for material you add to a +covered work, you may (if authorized by the copyright holders of that material) +supplement the terms of this License with terms: + +a) Disclaiming warranty or limiting liability differently from the terms of +sections 15 and 16 of this License; or +b) Requiring preservation of specified reasonable legal notices or author +attributions in that material or in the Appropriate Legal Notices displayed by +works containing it; or +c) Prohibiting misrepresentation of the origin of that material, or requiring +that modified versions of such material be marked in reasonable ways as +different from the original version; or +d) Limiting the use for publicity purposes of names of licensors or authors of +the material; or +e) Declining to grant rights under trademark law for use of some trade names, +trademarks, or service marks; or +f) Requiring indemnification of licensors and authors of that material by anyone +who conveys the material (or modified versions of it) with contractual +assumptions of liability to the recipient, for any liability that these +contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered further restrictions +within the meaning of section 10. If the Program as you received it, or any part +of it, contains a notice stating that it is governed by this License along with +a term that is a further restriction, you may remove that term. If a license +document contains a further restriction but permits relicensing or conveying +under this License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does not +survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, +in the relevant source files, a statement of the additional terms that apply to +those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a +separately written license, or stated as exceptions; the above requirements +apply either way. +8. Termination. + +You may not propagate or modify a covered work except as expressly provided +under this License. Any attempt otherwise to propagate or modify it is void, and +will automatically terminate your rights under this License (including any +patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a +particular copyright holder is reinstated (a) provisionally, unless and until +the copyright holder explicitly and finally terminates your license, and (b) +permanently, if the copyright holder fails to notify you of the violation by +some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated +permanently if the copyright holder notifies you of the violation by some +reasonable means, this is the first time you have received notice of violation +of this License (for any work) from that copyright holder, and you cure the +violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of +parties who have received copies or rights from you under this License. If your +rights have been terminated and not permanently reinstated, you do not qualify +to receive new licenses for the same material under section 10. +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of +the Program. Ancillary propagation of a covered work occurring solely as a +consequence of using peer-to-peer transmission to receive a copy likewise does +not require acceptance. However, nothing other than this License grants you +permission to propagate or modify any covered work. These actions infringe +copyright if you do not accept this License. Therefore, by modifying or +propagating a covered work, you indicate your acceptance of this License to do +so. +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a +license from the original licensors, to run, modify and propagate that work, +subject to this License. You are not responsible for enforcing compliance by +third parties with this License. + +An entity transaction is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered work results +from an entity transaction, each party to that transaction who receives a copy +of the work also receives whatever licenses to the work the party's predecessor +in interest had or could give under the previous paragraph, plus a right to +possession of the Corresponding Source of the work from the predecessor in +interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights +granted or affirmed under this License. For example, you may not impose a +license fee, royalty, or other charge for exercise of rights granted under this +License, and you may not initiate litigation (including a cross-claim or +counterclaim in a lawsuit) alleging that any patent claim is infringed by +making, using, selling, offering for sale, or importing the Program or any +portion of it. +11. Patents. + +A contributor is a copyright holder who authorizes use under this License of +the Program or a work on which the Program is based. The work thus licensed is +called the contributor's contributor version. + +A contributor's essential patent claims are all patent claims owned or +controlled by the contributor, whether already acquired or hereafter acquired, +that would be infringed by some manner, permitted by this License, of making, +using, or selling its contributor version, but do not include claims that would +be infringed only as a consequence of further modification of the contributor +version. For purposes of this definition, control includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent +license under the contributor's essential patent claims, to make, use, sell, +offer for sale, import and otherwise run, modify and propagate the contents of +its contributor version. + +In the following three paragraphs, a patent license is any express agreement +or commitment, however denominated, not to enforce a patent (such as an express +permission to practice a patent or covenant not to sue for patent infringement). +To grant such a patent license to a party means to make such an agreement or +commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the +Corresponding Source of the work is not available for anyone to copy, free of +charge and under the terms of this License, through a publicly available network +server or other readily accessible means, then you must either (1) cause the +Corresponding Source to be so available, or (2) arrange to deprive yourself of +the benefit of the patent license for this particular work, or (3) arrange, in a +manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. Knowingly relying means you have actual +knowledge that, but for the patent license, your conveying the covered work in a +country, or your recipient's use of the covered work in a country, would +infringe one or more identifiable patents in that country that you have reason +to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you +convey, or propagate by procuring conveyance of, a covered work, and grant a +patent license to some of the parties receiving the covered work authorizing +them to use, propagate, modify or convey a specific copy of the covered work, +then the patent license you grant is automatically extended to all recipients of +the covered work and works based on it. + +A patent license is discriminatory if it does not include within the scope of +its coverage, prohibits the exercise of, or is conditioned on the non-exercise +of one or more of the rights that are specifically granted under this License. +You may not convey a covered work if you are a party to an arrangement with a +third party that is in the business of distributing software, under which you +make payment to the third party based on the extent of your activity of +conveying the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory patent +license (a) in connection with copies of the covered work conveyed by you (or +copies made from those copies), or (b) primarily for and in connection with +specific products or compilations that contain the covered work, unless you +entered into that arrangement, or that patent license was granted, prior to 28 +March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied +license or other defenses to infringement that may otherwise be available to you +under applicable patent law. +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not excuse +you from the conditions of this License. If you cannot convey a covered work so +as to satisfy simultaneously your obligations under this License and any other +pertinent obligations, then as a consequence you may not convey it at all. For +example, if you agree to terms that obligate you to collect a royalty for +further conveying from those to whom you convey the Program, the only way you +could satisfy both those terms and this License would be to refrain entirely +from conveying the Program. +13. Use with the GNU Affero General Public License. + +Notwithstanding any other provision of this License, you have permission to link +or combine any covered work with a work licensed under version 3 of the GNU +Affero General Public License into a single combined work, and to convey the +resulting work. The terms of this License will continue to apply to the part +which is the covered work, but the special requirements of the GNU Affero +General Public License, section 13, concerning interaction through a network +will apply to the combination as such. +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU +General Public License from time to time. Such new versions will be similar in +spirit to the present version, but may differ in detail to address new problems +or concerns. + +Each version is given a distinguishing version number. If the Program specifies +that a certain numbered version of the GNU General Public License or any later +version applies to it, you have the option of following the terms and +conditions either of that numbered version or of any later version published by +the Free Software Foundation. If the Program does not specify a version number +of the GNU General Public License, you may choose any version ever published by +the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the +GNU General Public License can be used, that proxy's public statement of +acceptance of a version permanently authorizes you to choose that version for +the Program. + +Later license versions may give you additional or different permissions. +However, no additional obligations are imposed on any author or copyright holder +as a result of your choosing to follow a later version. +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER +PARTIES PROVIDE THE PROGRAM AS IS WITHOUT WARRANTY OF ANY KIND, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE +QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE +DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY +COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS +PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, +INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE +THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED +INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE +PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY +HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot +be given local legal effect according to their terms, reviewing courts shall +apply local law that most closely approximates an absolute waiver of all civil +liability in connection with the Program, unless a warranty or assumption of +liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use +to the public, the best way to achieve this is to make it free software which +everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively state the exclusion of +warranty; and each file should have at least the copyright line and a pointer +to where the full notice is found. + + +Copyright (C) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If the program does terminal interaction, make it output a short notice like +this when it starts in an interactive mode: + + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands might be +different; for a GUI interface, you would use an about box. + +You should also get your employer (if you work as a programmer) or school, if +any, to sign a copyright disclaimer for the program, if necessary. For more +information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may consider +it more useful to permit linking proprietary applications with the library. If +this is what you want to do, use the GNU Lesser General Public License instead +of this License. But first, please read . + +************************************************************************* +The following copyright information is taken from https://cran.r- +project.org/src/contrib/foreign_0.8-71.tar.gz: + +Various files in this package have different copyrights. +The DFB read/write facilities are based on code originally written by Nicholas +Lewin-Koh and modified by Roger Bivand and Brian Ripley. + +R/dbf.R +src/Rdbfread.c +src/Rdbfwrite.c + +Copyright 2000-2001 (c) Nicholas Lewin-Koh +Changes for the foreign package (C) 2004-7 R Core Team + +src/dbfopen.c +src/shapefil.h + +Corrected versions of files from shapelib by Frank Warmerdam. The +original files were (c) 1999, Frank Warmerdam. His code is available +under the MIT or LGPL licence, and the latter is chosen here. + + +man/read.dbf.Rd +man/write.dbf.Rd +Nicholas Lewin-Koh and Roger Bivand, +Changes for the foreign package (C) 2004 R Core Team + + +R/R_systat.R +man/read.systat.Rd + +Copyright 2004 by Roger Bivand +Changes for the foreign package (C) 2004 R Core Team + + +src/R_systat.c + +Copyright (C) 1990-1992, 2004 Roger Bivand +Patches (C) 2004 B. D. Ripley + + +src/avl.c +src/avl.h + +Copyright (C) 1998-9, 2000 Free Software Foundation, Inc. +Written by Ben Pfaff (for libAVL: +then , now +) +Modified for R foreign package by Saikat DebRoy . + + +The following files are based on an early version of PSPP +(then , now +). + +src/file-handle.c +src/file-handle.h +src/format.c +src/format.h +src/pfm-read.c +src/pfm-h +src/sfm-read.c +src/sfm.h +src/sfmP.h + +Copyright (C) 1997-9, 2000 Free Software Foundation, Inc. +Written by Ben Pfaff . +Modified for R foreign package by Saikat DebRoy +and others. + + +src/minitab.c +src/SASxport.c + +Copyright 1999 Douglas M. Bates , +Saikat DebRoy + + +src/foreign.h +src/spss.c + +Copyright 2000 Saikat DebRoy +Thomas Lumley + + +src/stata.c + +(c) 1999, 2000, 2001, 2002 Thomas Lumley. +2000 Saikat DebRoy + + +man/read.dta.Rd +man/write.dta.Rd +man/write.foreign.Rd + +Thomas Lumley + + +man/read.mtp.Rd + +Douglas M. Bates + + +man/read.S.Rd + +Duncan Murdoch + + +man/read.spss.Rd +man/read.xport.Rd + +Saikat DebRoy + + +R/read.ssd.R +man/read.ssd.Rd + +(c) 2002 VJ Carey +(c) 2002-7 R Core Team + + +man/read.systat.Rd + +Roger Bivand + + +R/read.epiinfo.R +(c) 2002-4 Thomas Lumley +Patches (c) 2002 Mark Myatt + +src/minitab.c +Patches (c) 2004 Rajarshi Guha + + +R/octave.R +man/read.octave.Rd +(c) 2004 Stephen Eglen +Enhancements (c) 2004-7 R Core Team + + +R/writeForeignSAS.R +(c) 2004-5 R Core Team +Enhancements (c) 2006 Stephen Weigand +========================================== +Sample C file header: +/* libavl - manipulates AVL trees. +Copyright (C) 1998-9, 2000 Free Software Foundation, Inc. +Modified for R foreign library by Saikat DebRoy . + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, a copy is available at +http://www.r-project.org/Licenses/ + +The author may be contacted at on the +Internet, or as Ben Pfaff, 12167 Airport Rd, DeWitt MI 48820, USA +through more mundane means. */ + +/* This is file avl.c in libavl. */ + +========================================== +M.B. Re license: Source files and packege home says it is GPL2 or GPL3. Package +itself contains GPLv2 in GPL-2 file +========================================== +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + +We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + +Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and +modification follow. + +GNU GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + +a) You must cause the modified files to carry prominent notices +stating that you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in +whole or in part contains or is derived from the Program or any +part thereof, to be licensed as a whole at no charge to all third +parties under the terms of this License. + +c) If the modified program normally reads commands interactively +when run, you must cause it, when started running for such +interactive use in the most ordinary way, to print or display an +announcement including an appropriate copyright notice and a +notice that there is no warranty (or else, saying that you provide +a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this +License. (Exception: if the Program itself is interactive but +does not normally print such an announcement, your work based on +the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable +source code, which must be distributed under the terms of Sections +1 and 2 above on a medium customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three +years, to give any third party, for a charge no more than your +cost of physically performing source distribution, a complete +machine-readable copy of the corresponding source code, to be +distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer +to distribute corresponding source code. (This alternative is +allowed only for noncommercial distribution and only if you +received the program in object code or executable form with such +an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + +5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + +7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + +10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + +Copyright (C) + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program +`Gnomovision' (which makes passes at compilers) written by James Hacker. + +, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. + + +================================================================================ + +cluster 2.0.7-1 + +cluster 2.0.7-1 (https://cran.r-project.org/web/packages/cluster/index.html) + +# Part of the R package, https://www.R-project.org +# +# Copyright (C) 1995-2017 The R Core Team +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# https://www.R-project.org/Licenses/ + +Oracle elects the GPLv3. + +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + +4. Conveying Verbatim Copies. + +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. + +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. + +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". + +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. + +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. + +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + +6. Conveying Non-Source Forms. + +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + +7. Additional Terms. + +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - When you convey a copy of a covered work, you may at your option +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - Notwithstanding any other provision of this License, for material you +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. - All other non-permissive additional terms are considered "further +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further @@ -491,46 +13909,46 @@ License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - If you add terms to a covered work in accord with this section, you +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - Additional terms, permissive or non-permissive, may be stated in the +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - 8. Termination. +8. Termination. - You may not propagate or modify a covered work except as expressly +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - However, if you cease all violation of this License, then your +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - Moreover, your license from a particular copyright holder is +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - Termination of your rights under this section does not terminate the +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - 9. Acceptance Not Required for Having Copies. +9. Acceptance Not Required for Having Copies. - You are not required to accept this License in order to receive or +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, @@ -539,14 +13957,14 @@ modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - 10. Automatic Licensing of Downstream Recipients. +10. Automatic Licensing of Downstream Recipients. - Each time you convey a covered work, the recipient automatically +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - An "entity transaction" is a transaction transferring control of an +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that @@ -556,7 +13974,7 @@ give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - You may not impose any further restrictions on the exercise of the +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation @@ -564,13 +13982,13 @@ rights granted under this License, and you may not initiate litigation any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - 11. Patents. +11. Patents. - A "contributor" is a copyright holder who authorizes use under this +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". - A contributor's "essential patent claims" are all patent claims +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, @@ -580,19 +13998,19 @@ purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - In the following three paragraphs, a "patent license" is any express +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - If you convey a covered work, knowingly relying on a patent license, +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, @@ -606,7 +14024,7 @@ covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - If, pursuant to or in connection with a single transaction or +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify @@ -614,7 +14032,7 @@ or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - A patent license is "discriminatory" if it does not include within +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered @@ -629,13 +14047,13 @@ for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - Nothing in this License shall be construed as excluding or limiting +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - 12. No Surrender of Others' Freedom. +12. No Surrender of Others' Freedom. - If conditions are imposed on you (whether by court order, agreement or +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this @@ -645,9 +14063,9 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. +13. Use with the GNU Affero General Public License. - Notwithstanding any other provision of this License, you have +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this @@ -656,14 +14074,14 @@ but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. - 14. Revised Versions of this License. +14. Revised Versions of this License. - The Free Software Foundation may publish revised and/or new versions of +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered @@ -672,19 +14090,19 @@ Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - If the Program specifies that a proxy can decide which future +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - Later license versions may give you additional or different +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - 15. Disclaimer of Warranty. +15. Disclaimer of Warranty. - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, @@ -693,9 +14111,9 @@ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 16. Limitation of Liability. +16. Limitation of Liability. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE @@ -705,236 +14123,151 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - 17. Interpretation of Sections 15 and 16. +17. Interpretation of Sections 15 and 16. - If the disclaimer of warranty and limitation of liability provided +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS +END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs +How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - To do so, attach the following notices to the program. It is safest +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + +Copyright (C) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . +You should have received a copy of the GNU General Public License +along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. - ------------------------------------------------------- - -GCC RUNTIME LIBRARY EXCEPTION - -Version 3.1, 31 March 2009 - -Copyright © 2009 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -This GCC Runtime Library Exception ("Exception") is an additional permission -under section 7 of the GNU General Public License, version 3 ("GPLv3"). It -applies to a given file (the "Runtime Library") that bears a notice placed by -the copyright holder of the file stating that the file is governed by GPLv3 -along with this Exception. - -When you use GCC to compile a program, GCC may combine portions of certain GCC -header files and runtime libraries with the compiled program. The purpose of -this Exception is to allow compilation of non-GPL (including proprietary) -programs to use, in this way, the header files and runtime libraries covered by -this Exception. -0. Definitions. - -A file is an "Independent Module" if it either requires the Runtime Library for -execution after a Compilation Process, or makes use of an interface provided by -the Runtime Library, but is not otherwise based on the Runtime Library. - -"GCC" means a version of the GNU Compiler Collection, with or without -modifications, governed by version 3 (or a specified later version) of the GNU -General Public License (GPL) with the option of using any subsequent versions -published by the FSF. - -"GPL-compatible Software" is software whose conditions of propagation, -modification and use would permit combination with GCC in accord with the -license of GCC. - -"Target Code" refers to output from any compiler for a real or virtual target -processor architecture, in executable form or suitable for input to an -assembler, loader, linker and/or execution phase. Notwithstanding that, Target -Code does not include data in any format that is used as a compiler -intermediate representation, or used for producing a compiler intermediate -representation. - -The "Compilation Process" transforms code entirely represented in -non-intermediate languages designed for human-written code, and/or in Java -Virtual Machine byte code, into Target Code. Thus, for example, use of source -code generators and preprocessors need not be considered part of the -Compilation Process, since the Compilation Process can be understood as -starting with the output of the generators or preprocessors. - -A Compilation Process is "Eligible" if it is done using GCC, alone or with -other GPL-compatible software, or if it is done without using any work based on -GCC. For example, using non-GPL-compatible Software to optimize any GCC -intermediate representations would not qualify as an Eligible Compilation -Process. -1. Grant of Additional Permission. - -You have permission to propagate a work of Target Code formed by combining the -Runtime Library with Independent Modules, even if such propagation would -otherwise violate the terms of GPLv3, provided that all Target Code was -generated by Eligible Compilation Processes. You may then convey such a -combination under terms of your choice, consistent with the licensing of the -Independent Modules. -2. No Weakening of GCC Copyleft. - -The availability of this Exception does not imply any general presumption that -third-party software is unaffected by the copyleft requirements of the license -of GCC. --------------------------------------------------------------------------------- +might be different; for a GUI interface, you would use an "about box". - PCRE +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. -/* PCRE is a library of functions to support regular expressions whose syntax -and semantics are as close as possible to those of the Perl 5 language. +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. - Written by Philip Hazel - Copyright (c) 1997-2012 University of Cambridge +================================================================================ ------------------------------------------------------------------------------ -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +nnet 7.3-12 - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +Software and datasets to support 'Modern Applied Statistics with S', +fourth edition, by W. N. Venables and B. D. Ripley. +Springer, 2002. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +From the text (pp. 464): - * Neither the name of the University of Cambridge nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. +These datasets and software are provided in good faith, but none of +the authors, publishers nor distributors warrant their accuracy +nor can be held responsible for the consequences of their use. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. --------------------------------------------------------------------------------- +This file is intended to clarify ownership and copyright: where +possible individual files also carry brief copyright notices. - zlib -Include the following verbatim in the documentation: +Copyrights +========== - Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler +All files are copyright (C) 1994-2013 W. N. Venables and +B. D. Ripley. Those parts which were distributed with the first +edition are also copyright (C) 1994 Springer-Verlag New York Inc, with +all rights assigned to W. N. Venables and B. D. Ripley. - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: +Licence +======= - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. +This is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 or 3 of the License +(at your option). - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. --------------------------------------------------------------------------------- +Files share/licenses/GPL-2 and share/licenses/GPL-3 in the R +(source or binary) distribution are copies of versions 2 and 3 +of the 'GNU General Public License'. +These can also be viewed at https://www.r-project.org/Licenses/ -FastR -- a new R virtual machine -Copyright (C) 2013 Purdue University - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2 of the License, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., 51 -Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +Bill.Venables@gmail.com +ripley@stats.ox.ac.uk +===================================== +# file nnet/vcovmultinom.R +# copyright (c) 2003-2016 B. D. Ripley +# Use of analytic Fisher information contributed by David Firth +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 or 3 of the License +# (at your option). +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# A copy of the GNU General Public License is available at +# http://www.r-project.org/Licenses/ +====================================== -Oracle elects the GPLv3. +Oracle elects the GPLv3. - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. - Preamble +Preamble - The GNU General Public License is a free, copyleft license for +The GNU General Public License is a free, copyleft license for software and other kinds of works. - The licenses for most software and other practical works are designed +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free @@ -943,35 +14276,35 @@ GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - When we speak of free software, we are referring to freedom, not +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - To protect your rights, we need to prevent others from denying you +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - For example, if you distribute copies of such a program, whether +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - Developers that use the GNU GPL protect your rights with two steps: +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - For the developers' and authors' protection, the GPL clearly explains +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - Some devices are designed to deny users access to install or run +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic @@ -982,49 +14315,49 @@ products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - Finally, every program is threatened constantly by software patents. +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - The precise terms and conditions for copying, distribution and +The precise terms and conditions for copying, distribution and modification follow. - TERMS AND CONDITIONS +TERMS AND CONDITIONS - 0. Definitions. +0. Definitions. - "This License" refers to version 3 of the GNU General Public License. +"This License" refers to version 3 of the GNU General Public License. - "Copyright" also means copyright-like laws that apply to other kinds of +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - "The Program" refers to any copyrightable work licensed under this +"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. - To "modify" a work means to copy from or adapt all or part of the work +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. - A "covered work" means either the unmodified Program or a work based +A "covered work" means either the unmodified Program or a work based on the Program. - To "propagate" a work means to do anything with it that, without +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - To "convey" a work means any kind of propagation that enables other +To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - An interactive user interface displays "Appropriate Legal Notices" +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the @@ -1033,18 +14366,18 @@ work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - 1. Source Code. +1. Source Code. - The "source code" for a work means the preferred form of the work +The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. - A "Standard Interface" means an interface that either is an official +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that @@ -1055,7 +14388,7 @@ implementation is available to the public in source code form. A (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - The "Corresponding Source" for a work in object code form means all +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's @@ -1068,16 +14401,16 @@ linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - The Corresponding Source need not include anything that users +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - The Corresponding Source for a work in source code form is that +The Corresponding Source for a work in source code form is that same work. - 2. Basic Permissions. +2. Basic Permissions. - All rights granted under this License are granted for the term of +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a @@ -1085,7 +14418,7 @@ covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - You may make, run and propagate covered works that you do not +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you @@ -1096,19 +14429,19 @@ for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - Conveying under any other circumstances is permitted solely under +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. - No covered work shall be deemed part of an effective technological +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - When you convey a covered work, you waive any legal power to forbid +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or @@ -1116,9 +14449,9 @@ modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - 4. Conveying Verbatim Copies. +4. Conveying Verbatim Copies. - You may convey verbatim copies of the Program's source code as you +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any @@ -1126,37 +14459,37 @@ non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - You may charge any price or no price for each copy that you convey, +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - 5. Conveying Modified Source Versions. +5. Conveying Modified Source Versions. - You may convey a work based on the Program, or the modifications to +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. - A compilation of a covered work with other separate and independent +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an @@ -1166,59 +14499,59 @@ beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - 6. Conveying Non-Source Forms. +6. Conveying Non-Source Forms. - You may convey a covered work in object code form under the terms +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - A "User Product" is either (1) a "consumer product", which means any +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, @@ -1231,7 +14564,7 @@ is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - "Installation Information" for a User Product means any methods, +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must @@ -1239,7 +14572,7 @@ suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - If you convey an object code work under this section in, or with, or +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a @@ -1250,7 +14583,7 @@ if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - The requirement to provide Installation Information does not include a +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a @@ -1258,15 +14591,15 @@ network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - Corresponding Source conveyed, and Installation Information provided, +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - 7. Additional Terms. +7. Additional Terms. - "Additional permissions" are terms that supplement the terms of this +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent @@ -1275,41 +14608,41 @@ apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - When you convey a copy of a covered work, you may at your option +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - Notwithstanding any other provision of this License, for material you +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. - All other non-permissive additional terms are considered "further +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further @@ -1319,46 +14652,46 @@ License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - If you add terms to a covered work in accord with this section, you +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - Additional terms, permissive or non-permissive, may be stated in the +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - 8. Termination. +8. Termination. - You may not propagate or modify a covered work except as expressly +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - However, if you cease all violation of this License, then your +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - Moreover, your license from a particular copyright holder is +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - Termination of your rights under this section does not terminate the +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - 9. Acceptance Not Required for Having Copies. +9. Acceptance Not Required for Having Copies. - You are not required to accept this License in order to receive or +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, @@ -1367,14 +14700,14 @@ modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - 10. Automatic Licensing of Downstream Recipients. +10. Automatic Licensing of Downstream Recipients. - Each time you convey a covered work, the recipient automatically +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - An "entity transaction" is a transaction transferring control of an +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that @@ -1384,7 +14717,7 @@ give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - You may not impose any further restrictions on the exercise of the +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation @@ -1392,13 +14725,13 @@ rights granted under this License, and you may not initiate litigation any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - 11. Patents. +11. Patents. - A "contributor" is a copyright holder who authorizes use under this +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". - A contributor's "essential patent claims" are all patent claims +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, @@ -1408,19 +14741,19 @@ purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - In the following three paragraphs, a "patent license" is any express +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - If you convey a covered work, knowingly relying on a patent license, +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, @@ -1434,7 +14767,7 @@ covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - If, pursuant to or in connection with a single transaction or +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify @@ -1442,7 +14775,7 @@ or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - A patent license is "discriminatory" if it does not include within +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered @@ -1457,13 +14790,13 @@ for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - Nothing in this License shall be construed as excluding or limiting +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - 12. No Surrender of Others' Freedom. +12. No Surrender of Others' Freedom. - If conditions are imposed on you (whether by court order, agreement or +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this @@ -1473,9 +14806,9 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. +13. Use with the GNU Affero General Public License. - Notwithstanding any other provision of this License, you have +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this @@ -1484,14 +14817,14 @@ but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. - 14. Revised Versions of this License. +14. Revised Versions of this License. - The Free Software Foundation may publish revised and/or new versions of +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered @@ -1500,19 +14833,19 @@ Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - If the Program specifies that a proxy can decide which future +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - Later license versions may give you additional or different +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - 15. Disclaimer of Warranty. +15. Disclaimer of Warranty. - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, @@ -1521,9 +14854,9 @@ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 16. Limitation of Liability. +16. Limitation of Liability. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE @@ -1533,429 +14866,269 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - 17. Interpretation of Sections 15 and 16. +17. Interpretation of Sections 15 and 16. - If the disclaimer of warranty and limitation of liability provided +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS +END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs +How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - To do so, attach the following notices to the program. It is safest +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + +Copyright (C) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . +You should have received a copy of the GNU General Public License +along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". - You should also get your employer (if you work as a programmer) or school, +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . - The GNU General Public License does not permit incorporating your program +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. - --------------------------------------------------------------------------------- - - FastR - R language implementation copyright notices - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. +. +================================================================================ - END OF TERMS AND CONDITIONS +survival 2.42-3 - How to Apply These Terms to Your New Programs +Survival, version 2.42-3 (https://cran.r-project.org/web/packages/survival/) - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. +Copyright 2000 Mayo Foundation for Medical Education and Research. This +software is accepted by users "as is" and without warranties or guarantees +of any kind. - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. +Survival is licensed under either the LGPL version 2, version 2.1 or version 3. +Oracle elects the LGPL version 3 - - Copyright (C) +GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. +0. Additional Definitions. -Also add information on how to contact you by electronic and paper mail. +As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: +"The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. +An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: +The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. +The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. - , 1 April 1989 - Ty Coon, President of Vice +1. Exception to Section 3 of the GNU GPL. -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. -================================================= - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 +2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + +a) under this License, provided that you make a good faith effort to +ensure that, in the event an Application does not supply the +function or data, the facility still operates, and performs +whatever part of its purpose remains meaningful, or + +b) under the GNU GPL, with none of the additional permissions of +this License applicable to that copy. + +3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + +a) Give prominent notice with each copy of the object code that the +Library is used in it and that the Library and its use are +covered by this License. + +b) Accompany the object code with a copy of the GNU GPL and this license +document. + +4. Combined Works. + +You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + +a) Give prominent notice with each copy of the Combined Work that +the Library is used in it and that the Library and its use are +covered by this License. + +b) Accompany the Combined Work with a copy of the GNU GPL and this license +document. + +c) For a Combined Work that displays copyright notices during +execution, include the copyright notice for the Library among +these notices, as well as a reference directing the user to the +copies of the GNU GPL and this license document. + +d) Do one of the following: + +0) Convey the Minimal Corresponding Source under the terms of this +License, and the Corresponding Application Code in a form +suitable for, and under terms that permit, the user to +recombine or relink the Application with a modified version of +the Linked Version to produce a modified Combined Work, in the +manner specified by section 6 of the GNU GPL for conveying +Corresponding Source. + +1) Use a suitable shared library mechanism for linking with the +Library. A suitable mechanism is one that (a) uses at run time +a copy of the Library already present on the user's computer +system, and (b) will operate properly with a modified version +of the Library that is interface-compatible with the Linked +Version. + +e) Provide Installation Information, but only if you would otherwise +be required to provide such information under section 6 of the +GNU GPL, and only to the extent that such information is +necessary to install and execute a modified version of the +Combined Work produced by recombining or relinking the +Application with a modified version of the Linked Version. (If +you use option 4d0, the Installation Information must accompany +the Minimal Corresponding Source and Corresponding Application +Code. If you use option 4d1, you must provide the Installation +Information in the manner specified by section 6 of the GNU GPL +for conveying Corresponding Source.) + +5. Combined Libraries. + +You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based +on the Library, uncombined with any other library facilities, +conveyed under the terms of this License. + +b) Give prominent notice with the combined library that part of it +is a work based on the Library, and explaining where to find the +accompanying uncombined form of the same work. + +6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. +================================================================================ + +rpart 4.1-13 + +rpart, version 4.1-13 (https://cran.r-project.org/web/packages/rpart/index.html) + +rpart is licensed under either the GPLv2 or the GPLv3. +Oracle elects the GPLv3 - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 - Preamble +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. - The GNU General Public License is a free, copyleft license for +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. - The licenses for most software and other practical works are designed +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free @@ -1964,35 +15137,35 @@ GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - When we speak of free software, we are referring to freedom, not +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - To protect your rights, we need to prevent others from denying you +To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - For example, if you distribute copies of such a program, whether +For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - Developers that use the GNU GPL protect your rights with two steps: +Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - For the developers' and authors' protection, the GPL clearly explains +For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - Some devices are designed to deny users access to install or run +Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic @@ -2003,49 +15176,49 @@ products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - Finally, every program is threatened constantly by software patents. +Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - The precise terms and conditions for copying, distribution and +The precise terms and conditions for copying, distribution and modification follow. - TERMS AND CONDITIONS +TERMS AND CONDITIONS - 0. Definitions. +0. Definitions. - "This License" refers to version 3 of the GNU General Public License. +"This License" refers to version 3 of the GNU General Public License. - "Copyright" also means copyright-like laws that apply to other kinds of +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - "The Program" refers to any copyrightable work licensed under this +"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. - To "modify" a work means to copy from or adapt all or part of the work +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. - A "covered work" means either the unmodified Program or a work based +A "covered work" means either the unmodified Program or a work based on the Program. - To "propagate" a work means to do anything with it that, without +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - To "convey" a work means any kind of propagation that enables other +To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - An interactive user interface displays "Appropriate Legal Notices" +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the @@ -2054,18 +15227,18 @@ work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - 1. Source Code. +1. Source Code. - The "source code" for a work means the preferred form of the work +The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. - A "Standard Interface" means an interface that either is an official +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - The "System Libraries" of an executable work include anything, other +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that @@ -2076,7 +15249,7 @@ implementation is available to the public in source code form. A (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - The "Corresponding Source" for a work in object code form means all +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's @@ -2089,16 +15262,16 @@ linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - The Corresponding Source need not include anything that users +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - The Corresponding Source for a work in source code form is that +The Corresponding Source for a work in source code form is that same work. - 2. Basic Permissions. +2. Basic Permissions. - All rights granted under this License are granted for the term of +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a @@ -2106,7 +15279,7 @@ covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - You may make, run and propagate covered works that you do not +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you @@ -2117,19 +15290,19 @@ for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - Conveying under any other circumstances is permitted solely under +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. +3. Protecting Users' Legal Rights From Anti-Circumvention Law. - No covered work shall be deemed part of an effective technological +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - When you convey a covered work, you waive any legal power to forbid +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or @@ -2137,9 +15310,9 @@ modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - 4. Conveying Verbatim Copies. +4. Conveying Verbatim Copies. - You may convey verbatim copies of the Program's source code as you +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any @@ -2147,37 +15320,37 @@ non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - You may charge any price or no price for each copy that you convey, +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - 5. Conveying Modified Source Versions. +5. Conveying Modified Source Versions. - You may convey a work based on the Program, or the modifications to +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. - A compilation of a covered work with other separate and independent +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an @@ -2187,59 +15360,59 @@ beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - 6. Conveying Non-Source Forms. +6. Conveying Non-Source Forms. - You may convey a covered work in object code form under the terms +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - A "User Product" is either (1) a "consumer product", which means any +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, @@ -2252,7 +15425,7 @@ is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - "Installation Information" for a User Product means any methods, +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must @@ -2260,7 +15433,7 @@ suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - If you convey an object code work under this section in, or with, or +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a @@ -2271,7 +15444,7 @@ if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - The requirement to provide Installation Information does not include a +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a @@ -2279,15 +15452,15 @@ network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - Corresponding Source conveyed, and Installation Information provided, +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - 7. Additional Terms. +7. Additional Terms. - "Additional permissions" are terms that supplement the terms of this +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent @@ -2296,41 +15469,41 @@ apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - When you convey a copy of a covered work, you may at your option +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - Notwithstanding any other provision of this License, for material you +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. - All other non-permissive additional terms are considered "further +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further @@ -2340,46 +15513,46 @@ License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - If you add terms to a covered work in accord with this section, you +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - Additional terms, permissive or non-permissive, may be stated in the +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - 8. Termination. +8. Termination. - You may not propagate or modify a covered work except as expressly +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - However, if you cease all violation of this License, then your +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - Moreover, your license from a particular copyright holder is +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - Termination of your rights under this section does not terminate the +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - 9. Acceptance Not Required for Having Copies. +9. Acceptance Not Required for Having Copies. - You are not required to accept this License in order to receive or +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, @@ -2388,14 +15561,14 @@ modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. - 10. Automatic Licensing of Downstream Recipients. +10. Automatic Licensing of Downstream Recipients. - Each time you convey a covered work, the recipient automatically +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - An "entity transaction" is a transaction transferring control of an +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that @@ -2405,7 +15578,7 @@ give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - You may not impose any further restrictions on the exercise of the +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation @@ -2413,13 +15586,13 @@ rights granted under this License, and you may not initiate litigation any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - 11. Patents. +11. Patents. - A "contributor" is a copyright holder who authorizes use under this +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". - A contributor's "essential patent claims" are all patent claims +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, @@ -2429,19 +15602,19 @@ purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - Each contributor grants you a non-exclusive, worldwide, royalty-free +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - In the following three paragraphs, a "patent license" is any express +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - If you convey a covered work, knowingly relying on a patent license, +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, @@ -2455,7 +15628,7 @@ covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - If, pursuant to or in connection with a single transaction or +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify @@ -2463,7 +15636,7 @@ or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - A patent license is "discriminatory" if it does not include within +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered @@ -2478,13 +15651,13 @@ for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - Nothing in this License shall be construed as excluding or limiting +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - 12. No Surrender of Others' Freedom. +12. No Surrender of Others' Freedom. - If conditions are imposed on you (whether by court order, agreement or +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this @@ -2494,9 +15667,9 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. +13. Use with the GNU Affero General Public License. - Notwithstanding any other provision of this License, you have +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this @@ -2505,14 +15678,14 @@ but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. - 14. Revised Versions of this License. +14. Revised Versions of this License. - The Free Software Foundation may publish revised and/or new versions of +The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - Each version is given a distinguishing version number. If the +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered @@ -2521,19 +15694,19 @@ Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - If the Program specifies that a proxy can decide which future +If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - Later license versions may give you additional or different +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - 15. Disclaimer of Warranty. +15. Disclaimer of Warranty. - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, @@ -2542,9 +15715,9 @@ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - 16. Limitation of Liability. +16. Limitation of Liability. - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE @@ -2554,1098 +15727,1509 @@ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - 17. Interpretation of Sections 15 and 16. +17. Interpretation of Sections 15 and 16. - If the disclaimer of warranty and limitation of liability provided +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - END OF TERMS AND CONDITIONS +END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs +How to Apply These Terms to Your New Programs - If you develop a new program, and you want it to be of the greatest +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - To do so, attach the following notices to the program. It is safest +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - Copyright (C) + +Copyright (C) - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . +You should have received a copy of the GNU General Public License +along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short +If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". - You should also get your employer (if you work as a programmer) or school, +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see -. +. - The GNU General Public License does not permit incorporating your program +The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read -. + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + +The precise terms and conditions for copying, distribution and +modification follow. + +TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based +on the Program. + +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + +1. Source Code. + +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + +The Corresponding Source for a work in source code form is that +same work. + +2. Basic Permissions. + +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. + +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. +4. Conveying Verbatim Copies. - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. +5. Conveying Modified Source Versions. - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". - a) The modified work must itself be a software library. +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. +6. Conveying Non-Source Forms. - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. +7. Additional Terms. - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. +8. Termination. - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. +10. Automatic Licensing of Downstream Recipients. -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. +11. Patents. -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. - NO WARRANTY +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. - END OF TERMS AND CONDITIONS +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. - How to Apply These Terms to Your New Libraries +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. +12. No Surrender of Others' Freedom. - - Copyright (C) +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. +13. Use with the GNU Affero General Public License. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +14. Revised Versions of this License. -Also add information on how to contact you by electronic and paper mail. +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. - , 1 April 1990 - Ty Coon, President of Vice +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. -That's all there is to it! -========================================================== +15. Disclaimer of Warranty. -COPYRIGHT STATUS +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -The bulk of this code is copyright by members of or all of the R Core -Team. ('The R Core Team' in copyright statements in individual files -refers to some or all of the team.) +16. Limitation of Liability. -See the file COPYING for the exact conditions under which you may -redistribute it. R as a whole is distributed under GPL version 2 or -3: most source files contain a copyright statement allowing use of -that file under GPL version 2 or later: the main exceptions are the -included versions of packages 'MASS', 'class', 'nnet', 'rpart' and -'spatial' (GPL-2 or GPL-3). (The auxiliary file m4/openmp.m4 is under -GPL-3, but its incorporation into 'configure' is not.) +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. -The status of files used only in the Windows port is in file -src/gnuwin32/COPYRIGHTS.win, which is appended to this file in binary -Windows distributions. +17. Interpretation of Sections 15 and 16. -Note that almost all the code *is* copyright and may only be -reproduced if the copyright notice (that in the file or this notice) -is preserved. The status of the included LINPACK routines is unclear: -they are said to be in the public domain in the USA. +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. - --------------------------------------------------- +END OF TERMS AND CONDITIONS -Some (but not all) of the public header files are distributed under -the more permissive terms of version 2.1 or later of the LGPL: see -files R_HOME/share/licenses/LGPL-2.1 and R_HOME/share/licenses/LGPL-3. -This applies only to the header files +How to Apply These Terms to Your New Programs -src/include/R.h -src/include/Rdefines.h -src/include/Rgraphics.h -src/include/Rinternals.h -src/include/Rmath.h -src/include/S.h -src/include/R_ext/*.h +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. -Note that it does not apply to the header files such as Rembedded.h -and Rinterface.h used for third-party front ends. +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. -From the announcement of the change (2001-Feb-05) + +Copyright (C) - It came to our attention that some projects are interpreting GPL to - mean that compiling against the header files or linking against a - Windows import library brings the compiled code under the scope of - GPL. This would mean it would be impossible to distribute binary - versions of non-GPL packages with compiled code which called entry - points in the R executable or DLL, of which there are many on CRAN. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. - We encourage packages to be distributed under Open Source conditions, - but accept that this is not possible for some contributions. Our - intention is that export files and import libraries be 'accessors' - under clause 5 of the LGPL, so that in most cases no (additional) - restrictions are imposed by compiling a package using the LGPL-ed - components of R. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. - To avoid any anomalies, the versions of the same files in R versions - 1.0.0 to 1.2.1 may also be used under LGPL or GPL. +You should have received a copy of the GNU General Public License +along with this program. If not, see . -Import libraries are no longer used under Windows. +Also add information on how to contact you by electronic and paper mail. -Some contributed files are also covered by the Library General Public License. -These include (see also below) +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: -src/library/stats/R/embed.R -src/library/stats/src/PPsum.c + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. +================================================================================ - --------------------------------------------------- +codetools 0.2-15 +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. +Preamble -Some of the code contains different copyright statements. It is used -here in accordance with the copyright conditions in that code. A -not-necessarily-complete list of such files is: +The GNU General Public License is a free, copyleft license for +software and other kinds of works. -src/library/grDevices/inst/afm/*___.afm +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. - Copyright (c) 1984 to 1992 Adobe Systems Incorporated. +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. -src/library/grDevices/inst/afm/MustRead.html -src/library/grDevices/inst/afm/Courier*.afm -src/library/grDevices/inst/afm/Helvetica*.afm -src/library/grDevices/inst/afm/Times*.afm -src/library/grDevices/inst/afm/Symbol.afm -src/library/grDevices/inst/afm/ZapfDingbats.afm +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. - Copyright (c) 1985, 1987, 1989, 1990, 1993, 1997 Adobe Systems - Incorporated. All Rights Reserved. +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. -src/library/grDevices/inst/afm/*l.afm +Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - Copyright 1999 by (URW)++ Design & Development +For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. -src/library/grDevices/inst/afm/CM_*.afm -src/library/grDevices/inst/afm/cm*.afm +Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. - are derived from afms which are copyright by the American - Mathematical Society, but 'the AMS does require that the - AMS copyright notice be removed from any derivative versions - of the fonts which have been altered in any way'. +Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. -doc/manual/R-intro.texi +The precise terms and conditions for copying, distribution and +modification follow. -in part +TERMS AND CONDITIONS - Copyright (C) 1990 W. N. Venables - Copyright (C) 1992 W. N. Venables & D. M. Smith - Copyright (C) 1997 R. Gentleman & R. Ihaka - Copyright (C) 1997, 1998 M. Maechler +0. Definitions. +"This License" refers to version 3 of the GNU General Public License. -src/library/graphics/R/mosaicplot.R +"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - Original code copyright (C) 1998 John W. Emerson +"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. -src/library/graphics/R/pairs.R +To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - In part, Copyright 1999 Dr. Jens Oehlschlaegel-Akiyoshi +A "covered work" means either the unmodified Program or a work based +on the Program. -src/library/graphics/R/polygon.R +To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. - Copyright (C) 2001 by Kevin Buhr +To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. -src/library/splines/R/splineClasses.R +An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. - Copyright (C) 1998 Douglas M. Bates and William N. Venables. +1. Source Code. -src/library/datasets/man/austres.Rd -src/library/datasets/man/beavers.Rd -src/library/datasets/man/lh.Rd -src/library/datasets/man/npk.Rd -src/library/datasets/man/rock.Rd -src/library/datasets/man/UKLungDeaths.Rd -src/library/datasets/man/USAccDeaths.Rd -src/library/stats/R/add.R -src/library/stats/R/bandwidths.R -src/library/stats/R/confint.R -src/library/stats/R/cpgram.R -src/library/stats/R/spectrum.R -src/library/stats/R/vcov.R -src/library/stats/src//bandwidths.c -src/appl/maxcol.c +The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - Copyright (C) various dates W. N. Venables and B. D. Ripley +A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. +The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. -src/appl/interv.c : moved to API from code originally in - src/library/stats/src/bvalue.f, see - src/library/stats/COPYRIGHTS.modreg +The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. -src/library/stats: +The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. - See the files src/library/stats/COPYRIGHTS.modreg and - src/library/stats/COPYRIGHTS.portsrc for further details +The Corresponding Source for a work in source code form is that +same work. +2. Basic Permissions. -src/library/stats/R/diffinv.R -src/library/stats/R/embed.R -src/library/stats/R/kernel.R -src/library/stats/src/PPsum.c +All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. - Copyright (C) 1997-1999 Adrian Trapletti +You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. +Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. -src/library/stats/R/nls.R +3. Protecting Users' Legal Rights From Anti-Circumvention Law. - In part, Copyright 1999-1999 Saikat DebRoy +No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. +When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. -src/library/stats/R/nlsFunc.R -src/library/stats/R/selfStart.R -src/library/stats/R/zzModels.R +4. Conveying Verbatim Copies. - Copyright 1997,1999 Jose C. Pinheiro, Douglas M. Bates +You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. -src/library/stats/R/runmed.R -src/library/stats/src/Trunmed.c +You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. - In part Copyright (C) 1995 Berwin A. Turlach +5. Conveying Modified Source Versions. -src/library/stats/src/loessc.c -src/library/stats/src/loessf.f +You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: - In part Copyright (c) 1989, 1992 by AT&T +a) The work must carry prominent notices stating that you modified +it, and giving a relevant date. -src/library/stats/R/spline.R +b) The work must carry prominent notices stating that it is +released under this License and any conditions added under section +7. This requirement modifies the requirement in section 4 to +"keep intact all notices". - In part, Copyright (C) 2002 Simon N. Wood +c) You must license the entire work, as a whole, under this +License to anyone who comes into possession of a copy. This +License will therefore apply, along with any applicable section 7 +additional terms, to the whole of the work, and all its parts, +regardless of how they are packaged. This License gives no +permission to license the work in any other way, but it does not +invalidate such permission if you have separately received it. -src/library/tcltk/exec/{hierarchy,util*,widget}.tcl +d) If the work has interactive user interfaces, each must display +Appropriate Legal Notices; however, if the Program has interactive +interfaces that do not display Appropriate Legal Notices, your +work need not make them do so. - Copyright (c) various dates Jeffrey Hobbs +A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. +6. Conveying Non-Source Forms. -src/modules/X11/rotated.[ch] +You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: - Copyright (c) 1993 Alan Richardson +a) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by the +Corresponding Source fixed on a durable physical medium +customarily used for software interchange. + +b) Convey the object code in, or embodied in, a physical product +(including a physical distribution medium), accompanied by a +written offer, valid for at least three years and valid for as +long as you offer spare parts or customer support for that product +model, to give anyone who possesses the object code either (1) a +copy of the Corresponding Source for all the software in the +product that is covered by this License, on a durable physical +medium customarily used for software interchange, for a price no +more than your reasonable cost of physically performing this +conveying of source, or (2) access to copy the +Corresponding Source from a network server at no charge. + +c) Convey individual copies of the object code with a copy of the +written offer to provide the Corresponding Source. This +alternative is allowed only occasionally and noncommercially, and +only if you received the object code with such an offer, in accord +with subsection 6b. + +d) Convey the object code by offering access from a designated +place (gratis or for a charge), and offer equivalent access to the +Corresponding Source in the same way through the same place at no +further charge. You need not require recipients to copy the +Corresponding Source along with the object code. If the place to +copy the object code is a network server, the Corresponding Source +may be on a different server (operated by you or a third party) +that supports equivalent copying facilities, provided you maintain +clear directions next to the object code saying where to find the +Corresponding Source. Regardless of what server hosts the +Corresponding Source, you remain obligated to ensure that it is +available for as long as needed to satisfy these requirements. + +e) Convey the object code using peer-to-peer transmission, provided +you inform other peers where the object code and Corresponding +Source of the work are being offered to the general public at no +charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. +A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. -src/appl/loglin.c -src/library/stats/src/chisqsim.c -src/library/stats/src/nscor.c -src/library/stats/src/prho.c -src/library/stats/src/swilk.c -src/library/stats/src/kmns.f -src/library/stats/src/starma.c -src/nmath/pnbeta.c -src/nmath/pnchisq.c -src/nmath/pnt.c -src/nmath/qbeta.c -src/nmath/qgamma.c -src/nmath/qnorm.c -src/nmath/qtukey.c - are based in whole or in part on Applied Statistics algorithms - (C) Royal Statistical Society +"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. -src/nmath/stirlerr.c -src/nmath/dbinom.c -src/nmath/dpois.c - are partly based on Catherine/Clive Loader's (1999) work, - (C) 1999-2000 Lucent Technologies, Bell Laboratories. +If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). +The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. -src/main/RNG.c +Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. - The Mersenne-Twister part is - Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. +7. Additional Terms. +"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. -src/main/xspline.c +When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. - * Copyright (c) 1985-1988 by Supoj Sutanthavibul - * Parts Copyright (c) 1989-2002 by Brian V. Smith - * Parts Copyright (c) 1991 by Paul King - * Parts Copyright (c) 1992 by James Tough - * Parts Copyright (c) 1998 by Georg Stemmer - * Parts Copyright (c) 1995 by C. Blanc and C. Schlick - - * Any party obtaining a copy of these files is granted, free of charge, a - * full and unrestricted irrevocable, world-wide, paid up, royalty-free, - * nonexclusive right and license to deal in this software and - * documentation files (the "Software"), including without limitation the - * rights to use, copy, modify, merge, publish and/or distribute copies of - * the Software, and to permit persons who receive copies from any such - * party to do so, with the only requirement being that this copyright - * notice remain intact. +Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: +a) Disclaiming warranty or limiting liability differently from the +terms of sections 15 and 16 of this License; or -src/modules/nano{ftp,http}.c +b) Requiring preservation of specified reasonable legal notices or +author attributions in that material or in the Appropriate Legal +Notices displayed by works containing it; or - Copyright (C) 1998-2001 Daniel Veillard. All Rights Reserved. +c) Prohibiting misrepresentation of the origin of that material, or +requiring that modified versions of such material be marked in +reasonable ways as different from the original version; or -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is fur- -nished to do so, subject to the following conditions: +d) Limiting the use for publicity purposes of names of licensors or +authors of the material; or -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +e) Declining to grant rights under trademark law for use of some +trade names, trademarks, or service marks; or -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- -NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +f) Requiring indemnification of licensors and authors of that +material by anyone who conveys the material (or modified versions of +it) with contractual assumptions of liability to the recipient, for +any liability that these contractual assumptions directly impose on +those licensors and authors. +All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. -src/modules/lapack/dlapack.f, cmplx.f, dlamc.f +If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. - Extracted from - * -- LAPACK computational routine (version 3.8.0) -- - * -- LAPACK is a software package provided by Univ. of Tennessee, -- - * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- - * November 2017 - - where the version number, providers and date vary by subroutine. - For version 3.7.0, many of the copyright dates were updated - even for routines which have not been changed for years. - - LAPACK 3.8.0 contains a LICENSE file, copied to src/modules/lapack - (but many of these routines were originally copied from earlier - versions of LAPACK). For binary distributions it is reproduced here: - - --- src/modules/lapack/LICENSE --- - Copyright (c) 1992-2017 The University of Tennessee and The University - of Tennessee Research Foundation. All rights - reserved. - Copyright (c) 2000-2017 The University of California Berkeley. All - rights reserved. - Copyright (c) 2006-2017 The University of Colorado Denver. All rights - reserved. - - $COPYRIGHT$ - - Additional copyrights may follow - - $HEADER$ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - - Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer listed - in this license in the documentation and/or other materials - provided with the distribution. - - - Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - The copyright holders provide no reassurances that the source code - provided does not infringe any patent, copyright, or any other - intellectual property rights of third parties. The copyright holders - disclaim any liability to any recipient for claims brought against - recipient by any third party for infringement of that parties - intellectual property rights. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - --- end of src/modules/lapack/LICENSE --- +Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. -src/extra/xdr/* +8. Termination. - Copyright (undated) Sun Microsystems, Inc. +You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). - See the file src/extra/xdr/copyrght.txt +However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. -src/main/connections.c, src/main/gzio.h +Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. - Contain code derived from the zlib 1.2.3 distribution - (C) 1995-2005 Jean-loup Gailly and Mark Adler +Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. -src/main/dounzip.c, unzip.h +9. Acceptance Not Required for Having Copies. - Contain code Copyright (C) 1998-2010 Gilles Vollant from contrib/minizip - in the zlib 1.2.3 distribution with updates taken from 1.2.5. +You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. +10. Automatic Licensing of Downstream Recipients. -src/main/valid_utf8.h +Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. - Copyright (c) 1997-2012 University of Cambridge +An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. -For binary builds of R that requires us to include +You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - - * Neither the name of the University of Cambridge nor the name - of Google Inc. nor the names of their contributors may be used - to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. +11. Patents. +A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". -src/extra/tre/LICENSE -src/extra/tre/*.[ch] +A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. -Copyright (c) 2001-2009 Ville Laurikari -All rights reserved. +Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. -From tre-0.8.0 (http://laurikari.net/tre/). See file -src/extra/tre/LICENSE. For binary builds of R that requires us to -include +In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: +If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + +A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. +Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. +12. No Surrender of Others' Freedom. - * Neither the name of the University of Cambridge nor the name of Google - Inc. nor the names of their contributors may be used to endorse or - promote products derived from this software without specific prior - written permission. +If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. +13. Use with the GNU Affero General Public License. -src/extra/tzone/strftime.c -/* - Based on code from tzcode, which is turn said to be - 'Based on the UCB version with the copyright notice appearing below.' +Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. -** Copyright (c) 1989 The Regents of the University of California. -** All rights reserved. -** -** Redistribution and use in source and binary forms are permitted -** provided that the above copyright notice and this paragraph are -** duplicated in all such forms and that any documentation, -** advertising materials, and other materials related to such -** distribution and use acknowledge that the software was developed -** by the University of California, Berkeley. The name of the -** University may not be used to endorse or promote products derived -** from this software without specific prior written permission. -** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -*/ +14. Revised Versions of this License. +The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. -src/extra/intl/* +Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. -Based on gettextize from gettext 0.17 - Copyright (C) various dates Free Software Foundation, Inc. - Distributed under the GNU Library General Public License - version 2 or later. +If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. -src/include/vg/memcheck.h -src/include/vg/valgrind.h +Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. -From valgrind 3.10.1, +15. Disclaimer of Warranty. - Copyright (C) 2000-2013 Julian Seward. All rights reserved. +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +16. Limitation of Liability. -src/main/mkdtemp.c +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. -From glibc via -http://lists.gnu.org/archive/html/bug-gnulib/2003-02/msg00019.html +17. Interpretation of Sections 15 and 16. - Copyright (C) 1999, 2001-2003 Free Software Foundation, Inc. - Distributed under the GNU Library General Public License - version 2 or later. +If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. -src/main/Rstrptime.h -Version 2, June 1991 - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - Distributed under the GNU Library General Public License - version 2 or later. +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs -Some of the files in src/appl were originally taken from the Netlib -archive now at www.netlib.org and do not clearly state their -copyright status. +If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. -src/appl/{dchdc,dpfa,dpbsl,dpoco,dpodi,dpofa,dposl,dqrdc, - dqrsl,dsvdc,dtrco,dtrsl}.f +To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. -are part of LINPACK, with authors J.J. Dongarra, Cleve Moler and -G.W. Stewart + +Copyright (C) -src/appl/dqrdc2.f is based on dqrdc.f by G.W. Stewart. +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. -src/appl/lbfgsb.c is based on the work of Zhu, Byrd, Lu-Chen and -Nocedal, which does not state any copyright. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. -src/main/radixsort.c is largely based on code from the data.table package, +You should have received a copy of the GNU General Public License +along with this program. If not, see . - Copyright (C) 2006--2015 Matt Dowle and Arun Srinivasan +Also add information on how to contact you by electronic and paper mail. -doc/html/Rlogo.svg -doc/html/Rlogo.pdf -doc/html/logo.jpg -doc/html/favicon.ico -src/modules/X11/rlogo_icon.h -src/gnuwin32/front-ends/R.ico -src/gnuwin32/installer/R.bmp +If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Copyright (C) 2015-2016 The R Foundation - - You can distribute the logo under the terms of the Creative - Commons Attribution-ShareAlike 4.0 International license (CC-BY-SA - 4.0) or (at your option) the GNU General Public License version 2 - (GPL-2). + Copyright (C) +This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. +This is free software, and you are welcome to redistribute it +under certain conditions; type `show c' for details. - The design of the current logo is based on the previous logo that - was included in the R source from 1998 to 2016. +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". --------------------------------------------------------------------- +You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. +The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/LICENSE b/LICENSE index 38f8f23da5..54975fbea0 100644 --- a/LICENSE +++ b/LICENSE @@ -4,7 +4,7 @@ This is a release of GraalVM Community Edition 1.0 R Language Component. This particular copy of the software is released under version 3 of GNU General Public License. -Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved +Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved =========================================================================== From b90dff57613386472380ec605bae4656a3597ee5 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 15 Mar 2019 18:13:08 +0100 Subject: [PATCH 17/71] Use inner Truffle contexts for unit tests execution --- .../truffle/r/launcher/ConsoleHandler.java | 3 + .../r/nodes/builtin/base/BasePackage.java | 4 +- .../r/nodes/builtin/fastr/FastRContext.java | 60 +++++++++++++- .../truffle/r/nodes/test/ChimneySweeping.java | 11 +-- .../r/nodes/test/DefaultArgsExtractor.java | 7 +- .../oracle/truffle/r/nodes/test/TestBase.java | 7 +- .../com/oracle/truffle/r/test/TestBase.java | 3 +- .../truffle/r/test/generate/FastRContext.java | 82 +++++++++++++++++++ .../truffle/r/test/generate/FastRSession.java | 22 +++-- .../r/test/library/fastr/TestInterop.java | 11 +-- .../r/test/library/fastr/TestJavaInterop.java | 6 ++ .../library/utils/TestFastrErrorsLog.java | 3 +- .../r/test/runtime/TestRSerialize.java | 3 +- .../truffle/r/test/tck/JavaEmbeddingTest.java | 4 +- 14 files changed, 188 insertions(+), 38 deletions(-) create mode 100644 com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRContext.java diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/ConsoleHandler.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/ConsoleHandler.java index e6ce906652..0944a0a5cf 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/ConsoleHandler.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/ConsoleHandler.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.charset.MalformedInputException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.util.List; @@ -61,6 +62,8 @@ public static ConsoleHandler createConsoleHandler(RCmdOptions options, Delegatin */ File file = fileArgument.startsWith("~") ? new File(System.getProperty("user.home") + fileArgument.substring(1)) : new File(fileArgument); lines = Files.readAllLines(file.toPath()); + } catch (MalformedInputException e) { + throw RMain.fatal("cannot open file '%s': Invalid byte sequence for given charset", fileArgument); } catch (IOException e) { throw RMain.fatal("cannot open file '%s': No such file or directory", fileArgument); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java index 519d88a536..7fb5f1d7e4 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java @@ -457,7 +457,9 @@ public BasePackage() { add(FastRContext.CreateChannel.class, FastRContextFactory.CreateChannelNodeGen::create); add(FastRContext.CreateForkChannel.class, FastRContextFactory.CreateForkChannelNodeGen::create); add(FastRContext.Eval.class, FastRContextFactory.EvalNodeGen::create); - add(FastRContext.Get.class, FastRContextFactory.GetNodeGen::create); + add(FastRContext.Get.class, FastRContext.Get::new); + add(FastRContext.FastRContextNew.class, FastRContext.FastRContextNew::new); + add(FastRContext.FastRContextClose.class, FastRContext.FastRContextClose::new); add(FastRContext.GetChannel.class, FastRContextFactory.GetChannelNodeGen::create); add(FastRContext.ChannelPoll.class, FastRContextFactory.ChannelPollNodeGen::create); add(FastRContext.ChannelReceive.class, FastRContextFactory.ChannelReceiveNodeGen::create); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java index 6a9e5c86b7..4c4de15f9c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java @@ -43,6 +43,9 @@ import com.oracle.truffle.r.nodes.builtin.NodeWithArgumentCasts.Casts; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import static com.oracle.truffle.r.runtime.context.FastROptions.SharedContexts; + +import org.graalvm.polyglot.Context; + import com.oracle.truffle.r.runtime.RChannel; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; @@ -90,15 +93,64 @@ private static void id(Casts casts) { } @RBuiltin(name = ".fastr.context.get", kind = PRIMITIVE, parameterNames = {}, behavior = READS_STATE) - public abstract static class Get extends RBuiltinNode.Arg0 { - @Specialization - @TruffleBoundary - protected TruffleObject get() { + public static final class Get extends RBuiltinNode.Arg0 { + @Override + public Object execute(VirtualFrame frame) { RContext context = RContext.getInstance(); return (TruffleObject) context.getEnv().asGuestValue(context); } } + /** + * Creates a new internal context for the unit tests. Intended to be used only for unit tests. + */ + @RBuiltin(name = ".fastr.context.testing.new", kind = PRIMITIVE, parameterNames = {"info"}, behavior = READS_STATE) + public static final class FastRContextNew extends RBuiltinNode.Arg1 { + static { + Casts.noCasts(FastRContextNew.class); + } + + @Override + public Object execute(VirtualFrame frame, Object info) { + RContext context = RContext.getInstance(); + ChildContextInfo ctxInfo = (ChildContextInfo) context.getEnv().asHostObject(info); + TruffleContext truffleCtx = ctxInfo.createTruffleContext(); + Object prev = truffleCtx.enter(); + Context hostContext = Context.getCurrent(); + truffleCtx.leave(prev); + return context.getEnv().asGuestValue(new ContextData(truffleCtx, hostContext)); + } + } + + /** + * Closes an internal context used for the unit test evaluation. Intended to be used only for + * unit tests. + */ + @RBuiltin(name = ".fastr.context.testing.close", kind = PRIMITIVE, parameterNames = {"info"}, behavior = READS_STATE) + public static final class FastRContextClose extends RBuiltinNode.Arg1 { + static { + Casts.noCasts(FastRContextClose.class); + } + + @Override + public Object execute(VirtualFrame frame, Object info) { + RContext context = RContext.getInstance(); + ContextData data = (ContextData) context.getEnv().asHostObject(info); + data.truffleContext.close(); + return RNull.instance; + } + } + + public static final class ContextData { + public final TruffleContext truffleContext; + public final Context context; + + public ContextData(TruffleContext truffleContext, Context context) { + this.truffleContext = truffleContext; + this.context = context; + } + } + private static void handleSharedContexts(ContextKind contextKind) { if (contextKind == ContextKind.SHARE_ALL && EvalThread.threadCnt.get() == 0) { RContext current = RContext.getInstance(); diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java index c85deed4cf..cdf2e52f8b 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/ChimneySweeping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,11 +58,12 @@ import com.oracle.truffle.r.runtime.data.RMissing; import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; import com.oracle.truffle.r.test.generate.GnuROneShotRSession; import com.oracle.truffle.r.test.generate.TestOutputManager; import com.oracle.truffle.r.test.generate.TestOutputManager.TestInfo; -import org.graalvm.polyglot.Context; + import org.graalvm.polyglot.Value; import static org.junit.Assert.fail; import static com.oracle.truffle.r.test.generate.FastRSession.execInContext; @@ -226,7 +227,7 @@ private static TestOutputManager loadTestOutputManager() throws IOException { @Override SingleBuiltinDiagnostics init() throws Throwable { super.init(); - try (Context context = diagSuite.fastRSession.createContext(ContextKind.SHARE_PARENT_RW)) { + try (FastRContext context = diagSuite.fastRSession.createContext(ContextKind.SHARE_PARENT_RW)) { execInContext(context, () -> { this.castNodes = builtinFactory.getCastNodes(); print(0, "\n*** Chimney-sweeping of '" + builtinName + "' (" + builtinFactory.getBuiltinMetaClass().getName() + ") ***"); @@ -361,7 +362,7 @@ private void testPipeline(CastNode cn, Samples samples) { } } - private Set extractValidArgsForBuiltin(Context context) { + private Set extractValidArgsForBuiltin(FastRContext context) { String snippetAnchor; switch (kind) { case INTERNAL: @@ -385,7 +386,7 @@ private Set extractValidArgsForBuiltin(Context context) { return args; } - private RList evalValidArgs(String argsExpr, Context context) { + private RList evalValidArgs(String argsExpr, FastRContext context) { try { Value eval = context.eval(FastRSession.createSource(argsExpr, RSource.Internal.UNIT_TEST.string)); Object res = FastRSession.getReceiver(eval); diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java index 95d49e636f..18787052b7 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/DefaultArgsExtractor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,8 +37,9 @@ import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.data.model.RAbstractContainer; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; -import org.graalvm.polyglot.Context; + import org.graalvm.polyglot.Source; import org.graalvm.polyglot.Value; @@ -56,7 +57,7 @@ class DefaultArgsExtractor { } Map> extractDefaultArgs(String functionName) { - final Context context = fastRSession.createContext(ContextKind.SHARE_PARENT_RW); + final FastRContext context = fastRSession.createContext(ContextKind.SHARE_PARENT_RW); HashMap> samplesMap = new HashMap<>(); try { diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java index 59a5ca18c5..d5632dee35 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/TestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,8 +29,9 @@ import org.junit.AfterClass; import org.junit.BeforeClass; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; -import org.graalvm.polyglot.Context; + import org.graalvm.polyglot.Source; import java.util.concurrent.Callable; import org.junit.internal.AssumptionViolatedException; @@ -41,7 +42,7 @@ public class TestBase { // clear out warnings (which are stored in shared base env) private static final Source CLEAR_WARNINGS = FastRSession.createSource("assign('last.warning', NULL, envir = baseenv())", RSource.Internal.CLEAR_WARNINGS.string); - private static Context context; + private static FastRContext context; @BeforeClass public static void setupClass() { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java index e0cfb65848..ecaee33d77 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/TestBase.java @@ -61,6 +61,7 @@ import com.oracle.truffle.r.runtime.context.FastROptions; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.RContext.ContextKind; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; import com.oracle.truffle.r.test.generate.GnuROneShotRSession; import static com.oracle.truffle.r.test.generate.RSession.USE_DEFAULT_TIMEOUT; @@ -1203,7 +1204,7 @@ protected static String[] join(String[]... arrays) { * Tests that require additional {@link Engine} global symbols should override this, which will * be called just prior to the evaluation. */ - public void addPolyglotSymbols(@SuppressWarnings("unused") org.graalvm.polyglot.Context context) { + public void addPolyglotSymbols(@SuppressWarnings("unused") FastRContext context) { } private static final LocalDiagnosticHandler localDiagnosticHandler = new LocalDiagnosticHandler(); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRContext.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRContext.java new file mode 100644 index 0000000000..b5464791a8 --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRContext.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.test.generate; + +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.Engine; +import org.graalvm.polyglot.Source; +import org.graalvm.polyglot.Value; + +import com.oracle.truffle.r.runtime.context.ChildContextInfo; + +/** + * Abstraction of the {@link Context}. + * + * This class wraps {@link Context} produced by the internal builtin + * {@code .fastr.context.testing.new} and calls {@code .fastr.context.testing.close} in + * {@link #close()} to properly dispose it. + */ +public final class FastRContext implements AutoCloseable { + + private final Context mainContext; + private final Context context; + private final Object internalContext; + + private FastRContext(Context mainContext, Context context, Object internalContext) { + this.context = context; + this.internalContext = internalContext; + this.mainContext = mainContext; + } + + public static FastRContext create(Context mainContext, ChildContextInfo childContextInfo) { + Value contextData = mainContext.eval("R", ".fastr.context.testing.new").execute(childContextInfo); + return new FastRContext(mainContext, contextData.getMember("context").as(Context.class), contextData); + } + + public Value eval(Source source) { + return context.eval(source); + } + + public Value eval(String languageId, CharSequence source) { + return context.eval(languageId, source); + } + + public Value getPolyglotBindings() { + return context.getPolyglotBindings(); + } + + public Engine getEngine() { + return context.getEngine(); + } + + public Context getContext() { + return context; + } + + @Override + public void close() { + if (internalContext != null) { + mainContext.eval("R", ".fastr.context.testing.close").execute(internalContext); + } + } +} diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java index fb590b36e5..25bd4ac7fc 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java @@ -122,18 +122,16 @@ public static Source createSource(String txt, String name) { return Source.newBuilder("R", txt, name).internal(true).interactive(true).buildLiteral(); } - public Context createContext(ContextKind contextKind) { + public FastRContext createContext(ContextKind contextKind) { return createContext(contextKind, true); } - public Context createContext(ContextKind contextKind, boolean allowHostAccess) { + public FastRContext createContext(ContextKind contextKind, boolean allowHostAccess) { RStartParams params = new RStartParams(RCmdOptions.parseArguments(new String[]{Client.R.argumentName(), "--vanilla", "--slave", "--silent", "--no-restore"}, false), false); Map env = new HashMap<>(); env.put("TZ", "GMT"); - ChildContextInfo ctx = ChildContextInfo.create(params, env, contextKind, contextKind == ContextKind.SHARE_NOTHING ? null : mainRContext, input, output, output); - RContext.childInfo = ctx; - - return getContextBuilder("R", "llvm").allowHostAccess(allowHostAccess).engine(mainEngine).build(); + ChildContextInfo info = ChildContextInfo.create(params, env, contextKind, contextKind == ContextKind.SHARE_NOTHING ? null : mainRContext, input, output, output); + return FastRContext.create(mainContext, info); } public static Context.Builder getContextBuilder(String... languages) { @@ -240,7 +238,7 @@ public String eval(TestBase testClass, String expression, ContextKind contextKin Timer timer = null; output.reset(); input.setContents(expression); - try (Context evalContext = createContext(contextKind, allowHostAccess)) { + try (FastRContext evalContext = createContext(contextKind, allowHostAccess)) { // set up some interop objects used by fastr-specific tests: if (testClass != null) { testClass.addPolyglotSymbols(evalContext); @@ -258,7 +256,7 @@ public String eval(TestBase testClass, String expression, ContextKind contextKin // ParseException, etc Throwable wt = getWrappedThrowable(e); if (wt instanceof RError) { - REPL.handleError(null, evalContext, e); + REPL.handleError(null, evalContext.getContext(), e); } throw wt; } @@ -304,13 +302,13 @@ public String evalInREPL(TestBase testClass, String expression, ContextKind cont Timer timer = null; output.reset(); input.setContents(expression); - try (Context evalContext = createContext(contextKind, allowHostAccess)) { + try (FastRContext evalContext = createContext(contextKind, allowHostAccess)) { // set up some interop objects used by fastr-specific tests: if (testClass != null) { testClass.addPolyglotSymbols(evalContext); } timer = scheduleTimeBoxing(evalContext.getEngine(), timeout == USE_DEFAULT_TIMEOUT ? timeoutValue : timeout); - REPL.readEvalPrint(evalContext, new StringConsoleHandler(Arrays.asList(expression.split("\n")), output), null, false); + REPL.readEvalPrint(evalContext.getContext(), new StringConsoleHandler(Arrays.asList(expression.split("\n")), output), null, false); String consoleInput = readLine(); while (consoleInput != null) { consoleInput = readLine(); @@ -417,11 +415,11 @@ private static Method maybeGetAddOpensMethod(Class moduleClass, Class modu } } - public static void execInContext(Context context, Callable c) { + public static void execInContext(FastRContext context, Callable c) { execInContext(context, c, (Class[]) null); } - public static void execInContext(Context context, Callable c, Class... acceptExceptions) { + public static void execInContext(FastRContext context, Callable c, Class... acceptExceptions) { context.eval(FastRSession.GET_CONTEXT); // ping creation of TruffleRLanguage context.getPolyglotBindings().putMember("testSymbol", (ProxyExecutable) (Value... args) -> { try { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java index f0564e93b7..250f6dddc9 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ import com.oracle.truffle.r.runtime.conn.SeekableMemoryByteChannel; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; import java.io.File; import org.graalvm.polyglot.Value; @@ -187,7 +188,7 @@ private TestJavaObject(String name, Object object) { // TODO: export/importSymbol @Override - public void addPolyglotSymbols(org.graalvm.polyglot.Context context) { + public void addPolyglotSymbols(FastRContext context) { FastRSession.execInContext(context, () -> { RContext rContext = RContext.getInstance(); for (TestJavaObject t : TestInterop.testJavaObjects) { @@ -195,10 +196,10 @@ public void addPolyglotSymbols(org.graalvm.polyglot.Context context) { context.getPolyglotBindings().putMember(t.name, tobj); } for (TestVariable t : TestInterop.testVariables) { - context.getBindings("R").putMember(t.name, t.value); + context.getContext().getBindings("R").putMember(t.name, t.value); context.getPolyglotBindings().putMember(t.name, t.value); - context.getBindings("R").putMember(t.name + "Read", (ProxyExecutable) (Value... args) -> { - assertEquals(context.getBindings("R").getMember(t.name).as(t.clazz), t.value); + context.getContext().getBindings("R").putMember(t.name + "Read", (ProxyExecutable) (Value... args) -> { + assertEquals(context.getContext().getBindings("R").getMember(t.name).as(t.clazz), t.value); return true; }); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index 56e288deb2..c09688547b 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -277,7 +277,13 @@ public void testNew() { assertEvalFastR("to <- new('" + TEST_CLASS + "'); new(to)", errorIn(".fastr.interop.new(Class, ...)", "error during Java object instantiation")); assertEvalFastR("to <- new('__bogus_class_name__');", errorIn("getClass(Class, where = topenv(parent.frame()))", "“__bogus_class_name__” is not a defined class")); + } + @Test + @Ignore + public void testNoJavaInterop() { + // TODO: create a brand new non-shared context to test this or find out how to configure + // host access in ".fastr.context.testing.new" built-in assertEvalFastR(Context.NoJavaInterop, "new('integer'); ", "cat('integer(0)'"); assertEvalFastR(Context.NoJavaInterop, "new('" + Boolean.class.getName() + "');", errorIn("getClass(Class, where = topenv(parent.frame()))", "“" + Boolean.class.getName() + "” is not a defined class")); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java index 5b32bec634..4772204d5a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java @@ -33,6 +33,7 @@ import org.junit.Test; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -47,7 +48,7 @@ public class TestFastrErrorsLog extends TestBase { - private static org.graalvm.polyglot.Context context; + private static FastRContext context; @BeforeClass public static void setupClass() { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/TestRSerialize.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/TestRSerialize.java index 505153c976..848c430fe7 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/TestRSerialize.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/runtime/TestRSerialize.java @@ -37,13 +37,14 @@ import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RStringVector; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; public class TestRSerialize extends TestBase { // Buffer enlargement tests - private static org.graalvm.polyglot.Context context; + private static FastRContext context; private static RContext rContext; @BeforeClass diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java index 53ab8643ec..13014d4627 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java @@ -28,20 +28,20 @@ import java.io.ByteArrayOutputStream; -import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Value; import org.junit.After; import org.junit.Before; import org.junit.Test; import com.oracle.truffle.r.runtime.context.RContext.ContextKind; +import com.oracle.truffle.r.test.generate.FastRContext; import com.oracle.truffle.r.test.generate.FastRSession; /** * Tests various aspects of the Java embedding interface. */ public class JavaEmbeddingTest { - private Context context; + private FastRContext context; protected final ByteArrayOutputStream out = new ByteArrayOutputStream(); protected final ByteArrayOutputStream err = new ByteArrayOutputStream(); From a10ce7641016d79ecd02f8e10e8e305338955537 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 15 Mar 2019 18:26:48 +0100 Subject: [PATCH 18/71] Add missing TruffleBoundaries --- .../r/nodes/builtin/fastr/FastRContext.java | 31 +++++++++++++------ .../truffle/r/test/generate/FastRSession.java | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java index 4c4de15f9c..7d8951ec36 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java @@ -33,19 +33,17 @@ import static com.oracle.truffle.r.runtime.builtins.RBehavior.COMPLEX; import static com.oracle.truffle.r.runtime.builtins.RBehavior.READS_STATE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE; +import static com.oracle.truffle.r.runtime.context.FastROptions.SharedContexts; + +import org.graalvm.polyglot.Context; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.TruffleContext; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.interop.TruffleObject; import com.oracle.truffle.r.launcher.RCmdOptions.Client; import com.oracle.truffle.r.nodes.builtin.NodeWithArgumentCasts.Casts; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; -import static com.oracle.truffle.r.runtime.context.FastROptions.SharedContexts; - -import org.graalvm.polyglot.Context; - import com.oracle.truffle.r.runtime.RChannel; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RRuntime; @@ -95,9 +93,14 @@ private static void id(Casts casts) { @RBuiltin(name = ".fastr.context.get", kind = PRIMITIVE, parameterNames = {}, behavior = READS_STATE) public static final class Get extends RBuiltinNode.Arg0 { @Override - public Object execute(VirtualFrame frame) { + public Object execute(@SuppressWarnings("unused") VirtualFrame frame) { + return getContext(); + } + + @TruffleBoundary + private static Object getContext() { RContext context = RContext.getInstance(); - return (TruffleObject) context.getEnv().asGuestValue(context); + return context.getEnv().asGuestValue(context); } } @@ -111,7 +114,12 @@ public static final class FastRContextNew extends RBuiltinNode.Arg1 { } @Override - public Object execute(VirtualFrame frame, Object info) { + public Object execute(@SuppressWarnings("unused") VirtualFrame frame, Object info) { + return createNewContext(info); + } + + @TruffleBoundary + private static Object createNewContext(Object info) { RContext context = RContext.getInstance(); ChildContextInfo ctxInfo = (ChildContextInfo) context.getEnv().asHostObject(info); TruffleContext truffleCtx = ctxInfo.createTruffleContext(); @@ -134,10 +142,15 @@ public static final class FastRContextClose extends RBuiltinNode.Arg1 { @Override public Object execute(VirtualFrame frame, Object info) { + closeContext(info); + return RNull.instance; + } + + @TruffleBoundary + private static void closeContext(Object info) { RContext context = RContext.getInstance(); ContextData data = (ContextData) context.getEnv().asHostObject(info); data.truffleContext.close(); - return RNull.instance; } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java index 25bd4ac7fc..b12a0f3c62 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/generate/FastRSession.java @@ -126,7 +126,7 @@ public FastRContext createContext(ContextKind contextKind) { return createContext(contextKind, true); } - public FastRContext createContext(ContextKind contextKind, boolean allowHostAccess) { + public FastRContext createContext(ContextKind contextKind, @SuppressWarnings("unused") boolean allowHostAccess) { RStartParams params = new RStartParams(RCmdOptions.parseArguments(new String[]{Client.R.argumentName(), "--vanilla", "--slave", "--silent", "--no-restore"}, false), false); Map env = new HashMap<>(); env.put("TZ", "GMT"); From b944dfa8a8f254b00d9e76eacd2d566dfb1db3ad Mon Sep 17 00:00:00 2001 From: stepan Date: Sun, 17 Mar 2019 20:41:24 +0100 Subject: [PATCH 19/71] Add Require tool:nfi to native-image.properties --- mx.fastr/native-image.properties | 1 + 1 file changed, 1 insertion(+) diff --git a/mx.fastr/native-image.properties b/mx.fastr/native-image.properties index 587f3f685d..cd825365b6 100644 --- a/mx.fastr/native-image.properties +++ b/mx.fastr/native-image.properties @@ -5,6 +5,7 @@ ImageName = RMain Requires = tool:nfi \ tool:chromeinspector \ + tool:nfi \ tool:profiler JavaArgs = \ From e08e2b19571479dddb6167d9a1d492a14cb4c7b2 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Mon, 18 Mar 2019 19:21:49 +0100 Subject: [PATCH 20/71] fix interop tests to pass with Truffle Library --- .../r/engine/interop/ActiveBindingMR.java | 12 ++------- .../oracle/truffle/r/runtime/env/RScope.java | 12 ++++++++- .../engine/interop/ActiveBindingMRTest.java | 7 +---- .../r/test/engine/interop/ListMRTest.java | 4 +-- .../interop/RArgsValuesAndNamesMRTest.java | 6 ++--- .../engine/interop/REnvironmentMRTest.java | 27 +++++++++---------- .../test/engine/interop/RLanguageMRTest.java | 4 +-- .../fastr/R/interop-array-conversion-test.R | 6 ++--- mx.fastr/suite.py | 2 +- 9 files changed, 37 insertions(+), 43 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ActiveBindingMR.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ActiveBindingMR.java index 42844c7983..7f05dfac78 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ActiveBindingMR.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/ActiveBindingMR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,15 +34,7 @@ public class ActiveBindingMR { @Resolve(message = "IS_BOXED") public abstract static class ActiveBindingIsBoxedNode extends Node { protected Object access(@SuppressWarnings("unused") ActiveBinding receiver) { - return true; - } - } - - @Resolve(message = "UNBOX") - public abstract static class ActiveBindingUnboxNode extends Node { - - protected Object access(ActiveBinding receiver) { - return receiver.readValue(); + return false; } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java index 6cff161d80..c9b7e62d2f 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/RScope.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -243,6 +243,16 @@ public abstract static class VarMapsKeyInfoNode extends Node { @TruffleBoundary protected Object access(VariablesObject receiver, String identifier) { + boolean exists = false; + for (String key : receiver.ls()) { + if (identifier.equals(key)) { + exists = true; + break; + } + } + if (!exists) { + return KeyInfo.INSERTABLE; + } int result = KeyInfo.READABLE; if (!receiver.frameAccess.bindingIsLocked(identifier)) { result |= KeyInfo.MODIFIABLE; diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ActiveBindingMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ActiveBindingMRTest.java index 83c9c47657..df5a0c1a7f 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ActiveBindingMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ActiveBindingMRTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -39,11 +39,6 @@ public void testIsNull() throws Exception { super.testIsNull(); // force inherited tests from AbstractMRTest } - @Override - protected Object getUnboxed(TruffleObject obj) { - return ((ActiveBinding) obj).readValue(); - } - @Override protected TruffleObject[] createTruffleObjects() throws Exception { Source src = Source.newBuilder("R", "f=function() {}", "").internal(true).buildLiteral(); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java index 8bc1499d29..8443451bd2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/ListMRTest.java @@ -75,13 +75,13 @@ private void testKeysRead(String createFun) throws Exception { assertTrue(ForeignAccess.sendRead(Message.READ.createNode(), l, "n") instanceof RNull); assertSingletonVector(1, ForeignAccess.sendRead(Message.READ.createNode(), l, 0)); + assertSingletonVector(1, ForeignAccess.sendRead(Message.READ.createNode(), l, 0f)); assertSingletonVector(2.1, ForeignAccess.sendRead(Message.READ.createNode(), l, 1)); assertSingletonVector(4d, ForeignAccess.sendRead(Message.READ.createNode(), l, 5d)); assertSingletonVector(true, ForeignAccess.sendRead(Message.READ.createNode(), l, 2)); assertTrue(ForeignAccess.sendRead(Message.READ.createNode(), l, 4) instanceof RNull); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), l, -1), UnknownIdentifierException.class); - assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), l, 0f), UnknownIdentifierException.class); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), l, "nnnoooonnne"), UnknownIdentifierException.class); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), l, 100), UnknownIdentifierException.class); @@ -124,7 +124,7 @@ public void testKeysInfo(String createFun) { assertFalse(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), l, 1f); - assertFalse(KeyInfo.isExisting(info)); + assertTrue(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), l, 0); assertTrue(KeyInfo.isExisting(info)); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RArgsValuesAndNamesMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RArgsValuesAndNamesMRTest.java index 6740066fa3..8894859365 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RArgsValuesAndNamesMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RArgsValuesAndNamesMRTest.java @@ -51,13 +51,13 @@ protected boolean canRead(@SuppressWarnings("unused") TruffleObject obj) { public void testReadIdx() throws Exception { TruffleObject args = createTruffleObjects()[0]; - assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), args, 1f), UnknownIdentifierException.class); - assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), args, 1d), UnknownIdentifierException.class); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), args, -1), UnknownIdentifierException.class); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), args, 100), UnknownIdentifierException.class); assertSingletonVector("abc", ForeignAccess.sendRead(Message.READ.createNode(), args, 0)); assertSingletonVector(123, ForeignAccess.sendRead(Message.READ.createNode(), args, 1)); + assertSingletonVector(123, ForeignAccess.sendRead(Message.READ.createNode(), args, 1d)); + assertSingletonVector(123, ForeignAccess.sendRead(Message.READ.createNode(), args, 1f)); assertSingletonVector(1.1, ForeignAccess.sendRead(Message.READ.createNode(), args, 2)); assertSingletonVector(true, ForeignAccess.sendRead(Message.READ.createNode(), args, 3)); assertTrue(ForeignAccess.sendRead(Message.READ.createNode(), args, 4) instanceof RFunction); @@ -91,7 +91,7 @@ public void testKeysInfo() throws Exception { assertFalse(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), e, 1f); - assertFalse(KeyInfo.isExisting(info)); + assertTrue(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), e, 0); assertTrue(KeyInfo.isExisting(info)); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/REnvironmentMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/REnvironmentMRTest.java index 049c39afb9..4fb05495fa 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/REnvironmentMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/REnvironmentMRTest.java @@ -37,8 +37,6 @@ import com.oracle.truffle.r.runtime.env.REnvironment; import com.oracle.truffle.r.test.generate.FastRSession; import org.graalvm.polyglot.Source; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -65,20 +63,20 @@ public void testReadWrite() throws Exception { assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), e, "nnnoooonnne"), UnknownIdentifierException.class); - TruffleObject obj = (TruffleObject) ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "s", "abc"); - Object value = ForeignAccess.sendRead(Message.READ.createNode(), obj, "s"); + ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "s", "abc"); + Object value = ForeignAccess.sendRead(Message.READ.createNode(), e, "s"); assertSingletonVector("abc", value); - obj = (TruffleObject) ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "b", false); - value = ForeignAccess.sendRead(Message.READ.createNode(), obj, "b"); + ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "b", false); + value = ForeignAccess.sendRead(Message.READ.createNode(), e, "b"); assertSingletonVector(false, value); - obj = (TruffleObject) ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "i", (short) 1234); - value = ForeignAccess.sendRead(Message.READ.createNode(), obj, "i"); + ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "i", (short) 1234); + value = ForeignAccess.sendRead(Message.READ.createNode(), e, "i"); assertSingletonVector(1234, value); - obj = (TruffleObject) ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "newnew", "nneeww"); - value = ForeignAccess.sendRead(Message.READ.createNode(), obj, "newnew"); + ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "newnew", "nneeww"); + value = ForeignAccess.sendRead(Message.READ.createNode(), e, "newnew"); assertSingletonVector("nneeww", value); assertInteropException(() -> ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "l", 667), UnsupportedMessageException.class); @@ -160,13 +158,12 @@ public void testRemove() throws Exception { public void testReadingNAAndWritingNABackKeepsNA() throws Exception { final TruffleObject e = createEnv("e <- new.env(); e$i <- 42; e$na <- NA_integer_; e")[0]; Object naInteropValue = ForeignAccess.sendRead(Message.READ.createNode(), e, "na"); - Object result = ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "i", naInteropValue); - assertThat(result, instanceOf(REnvironment.class)); - assertTrue("index 0 is NA in the updated vector", RRuntime.isNA(getEnvIntValue(result, "i"))); + ForeignAccess.sendWrite(Message.WRITE.createNode(), e, "i", naInteropValue); + Object result = ForeignAccess.sendRead(Message.READ.createNode(), e, "i"); + assertTrue("index 0 is NA in the updated vector", RRuntime.isNA(getEnvIntValue(result))); } - private static int getEnvIntValue(Object result, String name) { - Object value = ((REnvironment) result).get(name); + private static int getEnvIntValue(Object value) { if (value instanceof Integer) { return (int) value; } else if (value instanceof RAbstractIntVector) { diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RLanguageMRTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RLanguageMRTest.java index 76110af9f1..12fbbf21ec 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RLanguageMRTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/engine/interop/RLanguageMRTest.java @@ -53,7 +53,7 @@ public void testKeysInfo() throws Exception { assertFalse(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), rl, 1f); - assertFalse(KeyInfo.isExisting(info)); + assertTrue(KeyInfo.isExisting(info)); info = ForeignAccess.sendKeyInfo(Message.KEY_INFO.createNode(), rl, rl.getLength()); assertFalse(KeyInfo.isExisting(info)); @@ -87,7 +87,7 @@ public void testRead() throws Exception { assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), rl, "nnnoooonnne"), UnknownIdentifierException.class); assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), rl, rl.getLength()), UnknownIdentifierException.class); assertTrue(ForeignAccess.sendRead(Message.READ.createNode(), rl, 0d) == RDataFactory.createSymbolInterned("+")); - assertInteropException(() -> ForeignAccess.sendRead(Message.READ.createNode(), rl, 0f), UnknownIdentifierException.class); + assertTrue(ForeignAccess.sendRead(Message.READ.createNode(), rl, 0f) == RDataFactory.createSymbolInterned("+")); // TODO add some meaningful read tests Assert.assertNotNull(ForeignAccess.sendRead(Message.READ.createNode(), rl, 0)); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/R/interop-array-conversion-test.R b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/R/interop-array-conversion-test.R index 7c17d8415d..4bb7cba522 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/R/interop-array-conversion-test.R +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/R/interop-array-conversion-test.R @@ -1,4 +1,4 @@ -# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -608,12 +608,12 @@ if(any(R.version$engine == "FastR")) { checkAllEqual( actual=as.data.frame(mixedArray), - expected=as.data.frame(list(1, 'a', '1')), + expected=as.data.frame(list(1L, 'a', '1')), desc='as.data.frame(Object[] {1, "a", "1"})') checkAllEqual( actual=as.data.frame(mixed2DArray), - expected=as.data.frame(list(c(1, 2, 3), c('a', 'b', 'c'))), + expected=as.data.frame(list(c(1L, 2L, 3L), c('a', 'b', 'c'))), desc='as.data.frame(Object[][] {{1, 2, 3}, {"a", "b", "c"}})') checkError( diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 35f0582eee..dcd6f7915c 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -7,7 +7,7 @@ { "name" : "truffle", "subdir" : True, - "version" : "c4bb8ed4ab9708486745b69ccb3f9f68a1bbf488", + "version" : "dab657b214eaabb8e44029c97b4397d1addd0689", "urls" : [ {"url" : "https://github.com/graalvm/graal", "kind" : "git"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, From f3b9869d45bab4ad13ac7497a0d7e5685e0dee1b Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 15:38:48 +0100 Subject: [PATCH 21/71] added f2c folder to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index aa489dce5e..f8958b0e41 100644 --- a/.gitignore +++ b/.gitignore @@ -147,3 +147,4 @@ documentation/.pydevproject com.oracle.truffle.r.native/gnur/patch-build com.oracle.truffle.r.test.native/embedded/embedded.actual.output com.oracle.truffle.r.test.native/embedded/main.actual.output +f2c \ No newline at end of file From 845fcc235b549da12c7db9f11ba6816219a97bd8 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 14:55:35 +0100 Subject: [PATCH 22/71] Truffle Libraries/LLVM expects NativeXXXArray-s to be a pointer --- .../truffle/r/runtime/ffi/VectorRFFIWrapper.java | 16 ++++++++++++++++ .../r/runtime/ffi/interop/NativeCharArrayMR.java | 16 +++++++++++++++- .../runtime/ffi/interop/NativeDoubleArrayMR.java | 16 +++++++++++++++- .../ffi/interop/NativeIntegerArrayMR.java | 16 +++++++++++++++- .../r/runtime/ffi/interop/NativeRawArrayMR.java | 16 +++++++++++++++- 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java index 31d9d6138c..235fc969c2 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java @@ -258,6 +258,22 @@ protected Object access(VectorRFFIWrapper receiver) { } } + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") VectorRFFIWrapper receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + @Child private VectorRFFIWrapperNativePointer.DispatchAllocate dispatch = DispatchAllocateNodeGen.create(); + + protected Object access(VectorRFFIWrapper receiver) { + return dispatch.execute(receiver.vector); + } + } + @Resolve(message = "HAS_SIZE") public abstract static class VectorWrapperHasSizeNode extends Node { protected Object access(@SuppressWarnings("unused") VectorRFFIWrapper receiver) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeCharArrayMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeCharArrayMR.java index b3da7ce6c6..362f57ab0f 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeCharArrayMR.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeCharArrayMR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -76,6 +76,20 @@ protected Object access(NativeCharArray receiver) { } } + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") NativeCharArray receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + protected Object access(NativeCharArray receiver) { + return receiver.convertToNative(); + } + } + @Resolve(message = "EXECUTE") public abstract static class NCAToStringNode extends Node { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeDoubleArrayMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeDoubleArrayMR.java index 7ff3e8f62b..68bee1fc44 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeDoubleArrayMR.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeDoubleArrayMR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,6 +82,20 @@ protected Object access(NativeDoubleArray receiver) { } } + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") NativeDoubleArray receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + protected Object access(NativeDoubleArray receiver) { + return receiver.convertToNative(); + } + } + @CanResolve public abstract static class NDACheck extends Node { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeIntegerArrayMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeIntegerArrayMR.java index 9014c4fd02..7f75916695 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeIntegerArrayMR.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeIntegerArrayMR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -62,6 +62,20 @@ protected Object access(NativeIntegerArray receiver) { } } + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") NativeIntegerArray receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + protected Object access(NativeIntegerArray receiver) { + return receiver.convertToNative(); + } + } + @CanResolve public abstract static class NIACheck extends Node { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeRawArrayMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeRawArrayMR.java index 22d4549bef..6b25755fd2 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeRawArrayMR.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/interop/NativeRawArrayMR.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,6 +59,20 @@ protected Object access(NativeRawArray receiver) { } } + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") NativeRawArray receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + protected Object access(NativeRawArray receiver) { + return receiver.convertToNative(); + } + } + @CanResolve public abstract static class NRACheck extends Node { From a353985f644e40230c18ed5cfeef82105c31d882 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 22:16:20 +0100 Subject: [PATCH 23/71] ignored failing mclapply tests --- .../parallel/TestBuiltin_mclapply.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/parallel/TestBuiltin_mclapply.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/parallel/TestBuiltin_mclapply.java index 496e4abccf..10f89008da 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/parallel/TestBuiltin_mclapply.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/parallel/TestBuiltin_mclapply.java @@ -29,25 +29,28 @@ public class TestBuiltin_mclapply extends TestBase { @Test public void testMCLapply() { - assertEval("l <- list(list(x=1, y=2)); parallel:::mclapply(l, function(ll) { ll$y })"); - assertEval("l <- list(list(x=1, y=2), list(x=11, y=22)); parallel:::mclapply(l, function(ll) { ll$y })"); + // race-conditions, easilly reproducible with LLVM + assertEval(Ignored.ImplementationError, "l <- list(list(x=1, y=2)); parallel:::mclapply(l, function(ll) { ll$y })"); + assertEval(Ignored.ImplementationError, "l <- list(list(x=1, y=2), list(x=11, y=22)); parallel:::mclapply(l, function(ll) { ll$y })"); String[] cores = {"1", "2", "3", "4", "5", "6"}; - assertEval(template("l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); " + + assertEval(Ignored.ImplementationError, template("l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); " + "parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=%0)", cores)); - assertEval("f <- function() { res <- parallel:::mclapply(1:2, function(i) i); print(res)}; f()"); - assertEval("f <- function() { res <- parallel:::mclapply(1:3, function(i) i); print(res)}; f()"); - assertEval("f <- function() { res <- parallel:::mclapply(1:10, function(i) i); print(res)}; f()"); + assertEval(Ignored.ImplementationError, "f <- function() { res <- parallel:::mclapply(1:2, function(i) i); print(res)}; f()"); + assertEval(Ignored.ImplementationError, "f <- function() { res <- parallel:::mclapply(1:3, function(i) i); print(res)}; f()"); + assertEval(Ignored.ImplementationError, "f <- function() { res <- parallel:::mclapply(1:10, function(i) i); print(res)}; f()"); // we are checking for functions env being properly unserialized in the second run // so yes, the test executes function f() twice - assertEval("f <- function() { res <- parallel:::mclapply(1:3, function(i) i)}; f() ; f()"); + assertEval(Ignored.ImplementationError, "f <- function() { res <- parallel:::mclapply(1:3, function(i) i)}; f() ; f()"); } @Test public void testMCLapplyNested() { - assertEval("parallel:::mclapply(1:3, function(i) { Sys.sleep(.2); parallel:::mclapply(1:3, function(ii) {ii}) })"); - assertEval("parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) {i}) }) })"); + // race-conditions, easilly reproducible with LLVM + assertEval(Ignored.ImplementationError, "parallel:::mclapply(1:3, function(i) { Sys.sleep(.2); parallel:::mclapply(1:3, function(ii) {ii}) })"); + assertEval(Ignored.ImplementationError, + "parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) {i}) }) })"); } } From 4e85becd251d08c15802322c5a70f187f62d1e28 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 23:00:00 +0100 Subject: [PATCH 24/71] generated test output --- .../truffle/r/test/ExpectedTestOutput.test | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 135b6e9350..5068b5000f 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -157444,25 +157444,11 @@ $class Error in .fastr.interop.new(Class, ...) : error during Java object instantiation -##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNew#Context.NoJavaInterop# -#if (!any(R.version$engine == "FastR")) { cat('Error in getClass(Class, where = topenv(parent.frame())) : ', '<<>>', '“__bogus_class_name__” is not a defined class', '<<>>', sep=' ') } else { new('__bogus_class_name__'); } -Error in getClass(Class, where = topenv(parent.frame())) : - “__bogus_class_name__” is not a defined class - ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNew# #if (!any(R.version$engine == "FastR")) { cat('Error in getClass(Class, where = topenv(parent.frame())) : ', '<<>>', '“__bogus_class_name__” is not a defined class', '<<>>', sep=' ') } else { to <- new('__bogus_class_name__'); } Error in getClass(Class, where = topenv(parent.frame())) : “__bogus_class_name__” is not a defined class -##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNew#Context.NoJavaInterop# -#if (!any(R.version$engine == "FastR")) { cat('Error in getClass(Class, where = topenv(parent.frame())) : ', '<<>>', '“java.lang.Boolean” is not a defined class', '<<>>', sep=' ') } else { new('java.lang.Boolean'); } -Error in getClass(Class, where = topenv(parent.frame())) : - “java.lang.Boolean” is not a defined class - -##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNew#Context.NoJavaInterop# -#if (!any(R.version$engine == "FastR")) { cat('integer(0)' } else { new('integer'); } -Error: unexpected '}' in "if (!any(R.version$engine == "FastR")) { cat('integer(0)' }" - ##com.oracle.truffle.r.test.library.fastr.TestJavaInterop.testNewArray# #if (!any(R.version$engine == "FastR")) { '[B' } else { a <- new(java.type('byte[]'), 10L); a$getClass()$getName(); } [1] "[B" @@ -159503,7 +159489,7 @@ Error in cleanFunction && is.function(value) : Error in cleanFunction && is.function(value) : invalid 'x' type in 'x && y' -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #f <- function() { res <- parallel:::mclapply(1:10, function(i) i); print(res)}; f() [[1]] [1] 1 @@ -159536,7 +159522,7 @@ Error in cleanFunction && is.function(value) : [1] 10 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #f <- function() { res <- parallel:::mclapply(1:2, function(i) i); print(res)}; f() [[1]] [1] 1 @@ -159545,7 +159531,7 @@ Error in cleanFunction && is.function(value) : [1] 2 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #f <- function() { res <- parallel:::mclapply(1:3, function(i) i); print(res)}; f() [[1]] [1] 1 @@ -159557,16 +159543,16 @@ Error in cleanFunction && is.function(value) : [1] 3 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #f <- function() { res <- parallel:::mclapply(1:3, function(i) i)}; f() ; f() -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2)); parallel:::mclapply(l, function(ll) { ll$y }) [[1]] [1] 2 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22)); parallel:::mclapply(l, function(ll) { ll$y }) [[1]] [1] 2 @@ -159575,7 +159561,7 @@ Error in cleanFunction && is.function(value) : [1] 22 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=1) [[1]] [1] 2 @@ -159596,7 +159582,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=2) [[1]] [1] 2 @@ -159617,7 +159603,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=3) [[1]] [1] 2 @@ -159638,7 +159624,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=4) [[1]] [1] 2 @@ -159659,7 +159645,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=5) [[1]] [1] 2 @@ -159680,7 +159666,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapply#Ignored.ImplementationError# #l <- list(list(x=1, y=2), list(x=11, y=22), list(x=111, y=222), list(x=1111, y=2222), list(x=11111, y=22222), list(x=111111, y=222222)); parallel:::mclapply(l, function(ll) { ll$y }, mc.cores=6) [[1]] [1] 2 @@ -159701,7 +159687,7 @@ Error in cleanFunction && is.function(value) : [1] 222222 -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapplyNested# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapplyNested#Ignored.ImplementationError# #parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) { Sys.sleep(.1); parallel:::mclapply(1:3, function(i) {i}) }) }) [[1]] [[1]][[1]] @@ -159809,7 +159795,7 @@ Error in cleanFunction && is.function(value) : -##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapplyNested# +##com.oracle.truffle.r.test.library.parallel.TestBuiltin_mclapply.testMCLapplyNested#Ignored.ImplementationError# #parallel:::mclapply(1:3, function(i) { Sys.sleep(.2); parallel:::mclapply(1:3, function(ii) {ii}) }) [[1]] [[1]][[1]] From f4ae3f366b3d800d7d2a393eb70f8ae1f8e5318e Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 23:45:13 +0100 Subject: [PATCH 25/71] hotfixed frame with null RootName in interop exception when running with LLVM --- .../src/com/oracle/truffle/r/launcher/REPL.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/REPL.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/REPL.java index dcff03c8eb..76821d3ebe 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/REPL.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/REPL.java @@ -319,6 +319,10 @@ private static String getErrorText(PolyglotException eIn) { PolyglotException.StackFrame s = iterator.previous(); if (s.isHostFrame()) { iterator.remove(); + } else if (s.getLanguage().getId().equals("R") && s.getRootName() == null) { + // TODO: HOTFIX when LLVM + // first frame is " null(:1:0-13)" ???!!! + iterator.remove(); } else { break; } From 440357b17273e70486293a28d467b20b4be22488 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 21 Mar 2019 22:05:11 +0100 Subject: [PATCH 26/71] Foreign access factories moved to static final fields --- .../interop/RAbstractVectorAccessFactory.java | 1 + .../interop/RForeignAccessFactoryImpl.java | 4 +- .../r/runtime/ffi/VectorRFFIWrapper.java | 90 ++++++++++--------- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RAbstractVectorAccessFactory.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RAbstractVectorAccessFactory.java index ff46a16158..9731cbab46 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RAbstractVectorAccessFactory.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RAbstractVectorAccessFactory.java @@ -365,6 +365,7 @@ public Object execute(VirtualFrame frame) { } public static final Supplier CHECK_FACTORY = new CheckFactory(); + public static final ForeignAccess ACCESS = ForeignAccess.createAccess(new RAbstractVectorAccessFactory(), RAbstractVectorAccessFactory.CHECK_FACTORY); private static final class CheckFactory implements Supplier { @Override diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java index 80776e0ba0..61d0535f45 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RForeignAccessFactoryImpl.java @@ -22,7 +22,6 @@ */ package com.oracle.truffle.r.engine.interop; -import com.oracle.truffle.api.CompilerAsserts; import com.oracle.truffle.api.interop.ForeignAccess; import com.oracle.truffle.r.ffi.impl.interop.FFI_RForeignAccessFactoryImpl; import com.oracle.truffle.r.runtime.RInternalError; @@ -71,7 +70,6 @@ public final class RForeignAccessFactoryImpl implements RForeignAccessFactory { @Override public ForeignAccess getForeignAccess(RTruffleObject obj) { - CompilerAsserts.neverPartOfCompilation("getForeignAccess"); if (obj instanceof RNull) { return RNullMRForeign.ACCESS; } else if (obj instanceof RList) { @@ -121,7 +119,7 @@ public ForeignAccess getForeignAccess(RTruffleObject obj) { } else if (obj instanceof RInteropNA) { return RInteropNAMRForeign.ACCESS; } else if (obj instanceof RAbstractAtomicVector) { - return ForeignAccess.createAccess(new RAbstractVectorAccessFactory(), RAbstractVectorAccessFactory.CHECK_FACTORY); + return RAbstractVectorAccessFactory.ACCESS; } else { ForeignAccess access = FFI_RForeignAccessFactoryImpl.getForeignAccess(obj); if (access != null) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java index 235fc969c2..d9344691c7 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/VectorRFFIWrapper.java @@ -105,6 +105,51 @@ public int hashCode() { public static class VectorRFFIWrapperNativePointer implements TruffleObject { + public static final ForeignAccess ACCESS = ForeignAccess.create(VectorRFFIWrapperNativePointer.class, new StandardFactory() { + @Override + public CallTarget accessIsNull() { + return Truffle.getRuntime().createCallTarget(new InteropRootNode() { + @Override + public Object execute(VirtualFrame frame) { + return false; + } + }); + } + + @Override + public CallTarget accessIsPointer() { + return Truffle.getRuntime().createCallTarget(new InteropRootNode() { + @Override + public Object execute(VirtualFrame frame) { + return true; + } + }); + } + + @Override + public CallTarget accessAsPointer() { + return Truffle.getRuntime().createCallTarget(new InteropRootNode() { + @Child private DispatchAllocate dispatch = DispatchAllocateNodeGen.create(); + + @Override + public Object execute(VirtualFrame frame) { + VectorRFFIWrapperNativePointer receiver = (VectorRFFIWrapperNativePointer) ForeignAccess.getReceiver(frame); + return dispatch.execute(receiver.vector); + } + }); + } + + @Override + public CallTarget accessToNative() { + return Truffle.getRuntime().createCallTarget(new InteropRootNode() { + @Override + public Object execute(VirtualFrame frame) { + return ForeignAccess.getReceiver(frame); + } + }); + } + }); + private final TruffleObject vector; VectorRFFIWrapperNativePointer(TruffleObject vector) { @@ -194,50 +239,7 @@ protected static long get(Object vector) { @Override public ForeignAccess getForeignAccess() { - return ForeignAccess.create(VectorRFFIWrapperNativePointer.class, new StandardFactory() { - @Override - public CallTarget accessIsNull() { - return Truffle.getRuntime().createCallTarget(new InteropRootNode() { - @Override - public Object execute(VirtualFrame frame) { - return false; - } - }); - } - - @Override - public CallTarget accessIsPointer() { - return Truffle.getRuntime().createCallTarget(new InteropRootNode() { - @Override - public Object execute(VirtualFrame frame) { - return true; - } - }); - } - - @Override - public CallTarget accessAsPointer() { - return Truffle.getRuntime().createCallTarget(new InteropRootNode() { - @Child private DispatchAllocate dispatch = DispatchAllocateNodeGen.create(); - - @Override - public Object execute(VirtualFrame frame) { - VectorRFFIWrapperNativePointer receiver = (VectorRFFIWrapperNativePointer) ForeignAccess.getReceiver(frame); - return dispatch.execute(receiver.vector); - } - }); - } - - @Override - public CallTarget accessToNative() { - return Truffle.getRuntime().createCallTarget(new InteropRootNode() { - @Override - public Object execute(VirtualFrame frame) { - return ForeignAccess.getReceiver(frame); - } - }); - } - }); + return ACCESS; } } From f94a2b41e0788bf95f921aabcc17fe38c4ad0e1d Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Fri, 22 Mar 2019 10:43:10 +0100 Subject: [PATCH 27/71] upgrade to last truffle version --- mx.fastr/suite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index dcd6f7915c..ed54843ab2 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -7,7 +7,7 @@ { "name" : "truffle", "subdir" : True, - "version" : "dab657b214eaabb8e44029c97b4397d1addd0689", + "version" : "4deb681aaaa79c248115037fc8e399c9876619fd", "urls" : [ {"url" : "https://github.com/graalvm/graal", "kind" : "git"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, From 987c8ed312f72172edff6c391702137aae902122 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:37:32 +0100 Subject: [PATCH 28/71] add package testing output and release project contents to .gitignore --- .gitignore | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f8958b0e41..24f4b2fd01 100644 --- a/.gitignore +++ b/.gitignore @@ -147,4 +147,12 @@ documentation/.pydevproject com.oracle.truffle.r.native/gnur/patch-build com.oracle.truffle.r.test.native/embedded/embedded.actual.output com.oracle.truffle.r.test.native/embedded/main.actual.output -f2c \ No newline at end of file +f2c +test.fastr +test.gnur +test.diffs +install.tmp.fastr +install.tmp.gnur +lib.install.packages.fastr +lib.install.packages.gnur +/com.oracle.truffle.r.release/doc/ From 7df7882f35b8c529fa0df922609d94ca6ad50c57 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:54:22 +0100 Subject: [PATCH 29/71] fix OOB string access in TruffleRLanguageImpl --- .../src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index 856d8eb882..314a677cb8 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -173,7 +173,7 @@ protected String toString(RContext context, Object value) { stateStdConnections.setBuffer(buffer); RContext.getEngine().evalFunction((RFunction) printObj, callingFrame, RCaller.topLevel, false, ArgumentsSignature.empty(1), asVector); // remove the last "\n", which is useful for REPL, but not here - if (buffer.charAt(buffer.length() - 1) == '\n') { + if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) == '\n') { buffer.setLength(buffer.length() - 1); } return buffer.toString(); From 86548b6bef026a95c7b587c2b90adcc5435aa76c Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:56:04 +0100 Subject: [PATCH 30/71] fix FFIUpCallsIndexCodeGen to not consider members of UpCallsRFFI itself --- .../r/ffi/codegen/FFIUpCallsIndexCodeGen.java | 12 +++++++----- .../truffle/r/ffi/impl/upcalls/UpCallsRFFI.java | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java index 268daf7433..f4c07b6f7c 100644 --- a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java +++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java @@ -23,6 +23,7 @@ package com.oracle.truffle.r.ffi.codegen; import java.lang.reflect.Method; +import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -47,19 +48,20 @@ private void run(String[] args) { out.append("#ifndef RFFI_UPCALLSINDEX_H\n"); out.append("#define RFFI_UPCALLSINDEX_H\n"); out.append('\n'); - Method[] methods = UpCallsRFFI.class.getMethods(); - Arrays.sort(methods, new Comparator() { + ArrayList methods = new ArrayList<>(Arrays.asList(UpCallsRFFI.class.getMethods())); + methods.removeAll(Arrays.asList(UpCallsRFFI.class.getDeclaredMethods())); + methods.sort(new Comparator() { @Override public int compare(Method e1, Method e2) { return e1.getName().toString().compareTo(e2.getName().toString()); } }); - for (int i = 0; i < methods.length; i++) { - Method method = methods[i]; + for (int i = 0; i < methods.size(); i++) { + Method method = methods.get(i); out.append("#define ").append(method.getName()).append("_x ").append(Integer.toString(i)).append('\n'); } out.append('\n'); - out.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.length)).append('\n'); + out.append("#define ").append("UPCALLS_TABLE_SIZE ").append(Integer.toString(methods.size())).append('\n'); out.append('\n'); out.append("#endif // RFFI_UPCALLSINDEX_H\n"); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/UpCallsRFFI.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/UpCallsRFFI.java index 6a2e2fd884..4d4dab4729 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/UpCallsRFFI.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/UpCallsRFFI.java @@ -32,6 +32,8 @@ @RFFIUpCallRoot public interface UpCallsRFFI extends StdUpCallsRFFI, IDEUpCallsRFFI, VariableUpCallsRFFI, DLLUpCallsRFFI, MemoryUpCallsRFFI, FastRUpCalls { + // methods in here are not considered by FFIUpCallsIndexCodeGen + interface HandleUpCallExceptionNode extends NodeInterface { void execute(Throwable ex); } From 3cbd747867b45bacafb98c014bd00da1cedd21b5 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:56:17 +0100 Subject: [PATCH 31/71] handle NULL in complete.cases --- .../src/com/oracle/truffle/r/library/stats/CompleteCases.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java index d8b94c4118..8972430b79 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java @@ -166,6 +166,8 @@ private void iterateAbstractVectorContents(int len, byte[] result, Object obj) { result[e % len] = RRuntime.LOGICAL_FALSE; } } + } else if (entry == RNull.instance) { + // ignore NULL values } else { throw invalidType(entry); } From 1b797ee5421f51bee68545a4d5b7a4e69bfe50b7 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:57:03 +0100 Subject: [PATCH 32/71] make "unimplemented .Internal" an R error that can be handled, e.g., by testthat --- .../src/com/oracle/truffle/r/nodes/builtin/InternalNode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java index 73c013063e..cec5e44312 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/InternalNode.java @@ -140,7 +140,7 @@ public Object execute(VirtualFrame frame) { if (factory == null || factory.getKind() != RBuiltinKind.INTERNAL) { // determine whether we're supposed to implement this builtin if (factory == null && NOT_IMPLEMENTED.contains(name)) { - throw RInternalError.unimplemented(".Internal " + name); + throw RError.error(RError.SHOW_CALLER, RError.Message.GENERIC, "unimplemented .Internal " + name); } throw RError.error(RError.SHOW_CALLER, RError.Message.NO_SUCH_INTERNAL, name); } From 18c02222080406cd5d96b5c7058d822ee5e220cf Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:57:38 +0100 Subject: [PATCH 33/71] handle NaN in signif --- .../src/com/oracle/truffle/r/nodes/builtin/base/Signif.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Signif.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Signif.java index b8ca93f5b4..40fbc780c6 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Signif.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Signif.java @@ -111,7 +111,9 @@ protected RAbstractDoubleVector signifDouble(RAbstractDoubleVector x, RAbstractI digitCount = 1; } double val = xAccess.getDouble(xIter); - if (infProfile.profile(Double.isInfinite(val))) { + if (infProfile.profile(Double.isNaN(val))) { + res = Double.NaN; + } else if (infProfile.profile(Double.isInfinite(val))) { res = Double.POSITIVE_INFINITY; } else { res = bigIntegerSignif(digitCount, val); From 8b260581c73baec96ee09184438c0220957a4479 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:58:16 +0100 Subject: [PATCH 34/71] intern strings for attribute accesses in some more places --- .../truffle/r/ffi/impl/nodes/AttributesAccessNodes.java | 6 ++++-- .../truffle/r/nodes/attributes/SetAttributeNode.java | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java index 6ab96a543d..a7d4259232 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/AttributesAccessNodes.java @@ -106,8 +106,9 @@ public static RfSetAttribNode create() { @Specialization(guards = "!isNull(value)") protected Object setValue(RAttributable target, Object name, Object value, + @Cached("create()") InternStringNode intern, @Cached("create()") SetAttributeNode setAttribNode) { - setAttribNode.execute(target, (String) getCastNameNode().doCast(name), value); + setAttribNode.execute(target, intern.execute((String) getCastNameNode().doCast(name)), value); return RNull.instance; } @@ -118,8 +119,9 @@ protected Object setValue(@SuppressWarnings("unused") RNull target, @SuppressWar @Specialization protected Object unsetValue(RAttributable target, Object name, @SuppressWarnings("unused") RNull nullVal, + @Cached("create()") InternStringNode intern, @Cached("create()") RemoveAttributeNode removeAttributeNode) { - removeAttributeNode.execute(target, (String) getCastNameNode().doCast(name)); + removeAttributeNode.execute(target, intern.execute((String) getCastNameNode().doCast(name))); return RNull.instance; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java index 5a843800dc..f72ad3a96a 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SetAttributeNode.java @@ -25,6 +25,7 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.ImportStatic; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.object.DynamicObject; import com.oracle.truffle.api.object.FinalLocationException; @@ -36,6 +37,7 @@ import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.function.opt.ShareObjectNode; import com.oracle.truffle.r.runtime.RInternalError; +import com.oracle.truffle.r.runtime.Utils; import com.oracle.truffle.r.runtime.data.RAttributable; import com.oracle.truffle.r.runtime.data.RAttributeStorage; @@ -49,6 +51,7 @@ * initialized. Then the recursive instance of this class is used to set the attribute value to the * attributes. */ +@ImportStatic(Utils.class) public abstract class SetAttributeNode extends AttributeAccessNode { @Child private SetAttributeNode recursive; @@ -124,13 +127,13 @@ protected static SpecialAttributesFunctions.SetSpecialAttributeNode createSpecAt @Specialization(limit = "getCacheSize(3)", // guards = { - "isSpecialAttributeNode.execute(name)", + "isSpecialAttributeNode.execute(cachedName)", "cachedName.equals(name)" }) @SuppressWarnings("unused") protected void setSpecAttrInAttributable(RAttributable x, String name, Object value, @Cached("create()") SpecialAttributesFunctions.IsSpecialAttributeNode isSpecialAttributeNode, - @Cached("name") String cachedName, + @Cached("intern(name)") String cachedName, @Cached("createSpecAttrNode(cachedName)") SpecialAttributesFunctions.SetSpecialAttributeNode setSpecAttrNode) { setSpecAttrNode.execute(x, value); } From 7b5df0344310229cfc681bb1b5add54250a0c556 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:58:53 +0100 Subject: [PATCH 35/71] allow string sequences in bind --- .../src/com/oracle/truffle/r/nodes/builtin/base/Bind.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java index 003c9b4fa4..668a2e26da 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Bind.java @@ -341,7 +341,7 @@ protected int getDimResultNamesFromVectors(RArgsValuesAndNames promiseArgs, RAbs if (resDimNames instanceof String) { dimNamesArray[ind++] = (String) resDimNames; } else { - RStringVector names = (RStringVector) resDimNames; + RAbstractStringVector names = (RAbstractStringVector) resDimNames; assert names.getLength() == resDim; for (int i = 0; i < names.getLength(); i++) { dimNamesArray[ind++] = names.getDataAt(i); From 48e8db9997db56485f11eb96861fa4905142acc7 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 13:59:28 +0100 Subject: [PATCH 36/71] better approximation of GNU R behavior when parsing timestamps --- .../oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java index f019d1f0e2..d10511292c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java @@ -763,6 +763,8 @@ private static DateTimeFormatterBuilder createFormatter(String format, boolean f } else { if (c == '%') { escaped = true; + } else if (forInput && Character.isWhitespace(c)) { + builder.appendPattern("['\t'][' '][' '][' ']['\t']"); } else { builder.appendLiteral(c); } From 9a1b49f361e502e88f02a95f148d2c3d4b13fe1e Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 14:01:40 +0100 Subject: [PATCH 37/71] allow NULL in Rf_lengthgets --- .../oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index 36b0bf13f3..7f21580aa1 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -375,6 +375,9 @@ public Object Rf_installChar(Object name) { @Override @TruffleBoundary public Object Rf_lengthgets(Object x, int newSize) { + if (x == RNull.instance) { + return RNull.instance; + } RAbstractVector vec = (RAbstractVector) RRuntime.asAbstractVector(x); return vec.resize(newSize); } From 18b90dec14701ff3639d2fc5a49fb3aa2cccdd61 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 14:09:06 +0100 Subject: [PATCH 38/71] add initial support for weak ref API --- .../ffi/impl/common/JavaUpCallsRFFIImpl.java | 27 + .../FFI_RForeignAccessFactoryImpl.java | 4 + .../r/ffi/impl/upcalls/MemoryUpCallsRFFI.java | 8 + .../fficall/src/common/rffi_upcallsindex.h | 562 +++++++++--------- .../Rinternals_truffle_common.h | 16 +- .../r/nodes/function/ClassHierarchyNode.java | 6 + .../com/oracle/truffle/r/runtime/RType.java | 3 + .../truffle/r/runtime/data/RWeakRef.java | 65 ++ .../truffle/r/runtime/data/RWeakRefMR.java | 62 ++ 9 files changed, 470 insertions(+), 283 deletions(-) create mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRef.java create mode 100644 com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index 7f21580aa1..d58008cc3b 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -97,6 +97,7 @@ import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.data.RUnboundValue; import com.oracle.truffle.r.runtime.data.RVector; +import com.oracle.truffle.r.runtime.data.RWeakRef; import com.oracle.truffle.r.runtime.data.model.RAbstractAtomicVector; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import com.oracle.truffle.r.runtime.data.model.RAbstractVector; @@ -1548,6 +1549,32 @@ public Object R_MethodsNamespace() { return REnvironment.getRegisteredNamespace("methods"); } + // basic support for weak reference API - they are not actually weak and don't call finalizers + + @Override + @TruffleBoundary + public Object R_MakeWeakRef(Object key, Object val, Object fin, long onexit) { + return new RWeakRef(key, val, fin, onexit != 0); + } + + @Override + @TruffleBoundary + public Object R_MakeWeakRefC(Object key, Object val, long fin, long onexit) { + return new RWeakRef(key, val, fin, onexit != 0); + } + + @Override + @TruffleBoundary + public Object R_WeakRefKey(Object w) { + return guaranteeInstanceOf(w, RWeakRef.class).getKey(); + } + + @Override + @TruffleBoundary + public Object R_WeakRefValue(Object w) { + return guaranteeInstanceOf(w, RWeakRef.class).getValue(); + } + @Override @TruffleBoundary public void R_PreserveObject(Object obj) { diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java index 9fa51ec25c..90b0adb815 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java @@ -26,6 +26,8 @@ import com.oracle.truffle.r.runtime.data.CharSXPWrapper; import com.oracle.truffle.r.runtime.data.CharSXPWrapperMRForeign; import com.oracle.truffle.r.runtime.data.RTruffleObject; +import com.oracle.truffle.r.runtime.data.RWeakRef; +import com.oracle.truffle.r.runtime.data.RWeakRefMRForeign; import com.oracle.truffle.r.runtime.ffi.DLL; public class FFI_RForeignAccessFactoryImpl { @@ -36,6 +38,8 @@ public static ForeignAccess getForeignAccess(RTruffleObject obj) { return DLLDotSymbolMRForeign.ACCESS; } else if (obj instanceof CharSXPWrapper) { return CharSXPWrapperMRForeign.ACCESS; + } else if (obj instanceof RWeakRef) { + return RWeakRefMRForeign.ACCESS; } else { return null; } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java index 9eb395b5c0..4c5db5b2f0 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java @@ -27,6 +27,14 @@ public interface MemoryUpCallsRFFI { // Checkstyle: stop method name check + Object R_MakeWeakRef(Object key, Object val, Object fin, long onexit); + + Object R_MakeWeakRefC(Object key, Object val, long fin, long onexit); + + Object R_WeakRefKey(Object w); + + Object R_WeakRefValue(Object w); + void R_PreserveObject(Object obj); void R_ReleaseObject(Object obj); diff --git a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h index 066cbd6048..4676f7d3cd 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h +++ b/com.oracle.truffle.r.native/fficall/src/common/rffi_upcallsindex.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -81,284 +81,288 @@ #define R_LockBinding_x 52 #define R_MakeActiveBinding_x 53 #define R_MakeExternalPtr_x 54 -#define R_MethodsNamespace_x 55 -#define R_NamespaceRegistry_x 56 -#define R_NewHashedEnv_x 57 -#define R_ParseVector_x 58 -#define R_PreserveObject_x 59 -#define R_PromiseExpr_x 60 -#define R_ProtectWithIndex_x 61 -#define R_ReadConnection_x 62 -#define R_ReleaseObject_x 63 -#define R_Reprotect_x 64 -#define R_SetExternalPtrAddr_x 65 -#define R_SetExternalPtrProtected_x 66 -#define R_SetExternalPtrTag_x 67 -#define R_TempDir_x 68 -#define R_ToplevelExec_x 69 -#define R_WriteConnection_x 70 -#define R_alloc_x 71 -#define R_compute_identical_x 72 -#define R_do_MAKE_CLASS_x 73 -#define R_do_new_object_x 74 -#define R_do_slot_x 75 -#define R_do_slot_assign_x 76 -#define R_forceAndCall_x 77 -#define R_getClassDef_x 78 -#define R_getContextCall_x 79 -#define R_getContextEnv_x 80 -#define R_getContextFun_x 81 -#define R_getContextSrcRef_x 82 -#define R_getGlobalFunctionContext_x 83 -#define R_getParentFunctionContext_x 84 -#define R_has_slot_x 85 -#define R_insideBrowser_x 86 -#define R_isEqual_x 87 -#define R_isGlobal_x 88 -#define R_lsInternal3_x 89 -#define R_nchar_x 90 -#define R_new_custom_connection_x 91 -#define R_tryEval_x 92 -#define R_unLockBinding_x 93 -#define Rf_GetOption1_x 94 -#define Rf_NonNullStringMatch_x 95 -#define Rf_PairToVectorList_x 96 -#define Rf_PrintValue_x 97 -#define Rf_ScalarComplex_x 98 -#define Rf_ScalarInteger_x 99 -#define Rf_ScalarLogical_x 100 -#define Rf_ScalarRaw_x 101 -#define Rf_ScalarReal_x 102 -#define Rf_ScalarString_x 103 -#define Rf_VectorToPairList_x 104 -#define Rf_allocArray_x 105 -#define Rf_allocList_x 106 -#define Rf_allocMatrix_x 107 -#define Rf_allocSExp_x 108 -#define Rf_allocVector_x 109 -#define Rf_any_duplicated_x 110 -#define Rf_any_duplicated3_x 111 -#define Rf_asChar_x 112 -#define Rf_asCharacterFactor_x 113 -#define Rf_asInteger_x 114 -#define Rf_asLogical_x 115 -#define Rf_asReal_x 116 -#define Rf_bessel_i_x 117 -#define Rf_bessel_i_ex_x 118 -#define Rf_bessel_j_x 119 -#define Rf_bessel_j_ex_x 120 -#define Rf_bessel_k_x 121 -#define Rf_bessel_k_ex_x 122 -#define Rf_bessel_y_x 123 -#define Rf_bessel_y_ex_x 124 -#define Rf_beta_x 125 -#define Rf_choose_x 126 -#define Rf_classgets_x 127 -#define Rf_coerceVector_x 128 -#define Rf_cons_x 129 -#define Rf_copyListMatrix_x 130 -#define Rf_copyMatrix_x 131 -#define Rf_copyMostAttrib_x 132 -#define Rf_cospi_x 133 -#define Rf_dbeta_x 134 -#define Rf_dbinom_x 135 -#define Rf_dcauchy_x 136 -#define Rf_dchisq_x 137 -#define Rf_defineVar_x 138 -#define Rf_dexp_x 139 -#define Rf_df_x 140 -#define Rf_dgamma_x 141 -#define Rf_dgeom_x 142 -#define Rf_dhyper_x 143 -#define Rf_digamma_x 144 -#define Rf_dlnorm_x 145 -#define Rf_dlogis_x 146 -#define Rf_dnbeta_x 147 -#define Rf_dnbinom_x 148 -#define Rf_dnbinom_mu_x 149 -#define Rf_dnchisq_x 150 -#define Rf_dnf_x 151 -#define Rf_dnorm4_x 152 -#define Rf_dnt_x 153 -#define Rf_dpois_x 154 -#define Rf_dpsifn_x 155 -#define Rf_dsignrank_x 156 -#define Rf_dt_x 157 -#define Rf_dunif_x 158 -#define Rf_duplicate_x 159 -#define Rf_duplicated_x 160 -#define Rf_dweibull_x 161 -#define Rf_dwilcox_x 162 -#define Rf_error_x 163 -#define Rf_errorcall_x 164 -#define Rf_eval_x 165 -#define Rf_findFun_x 166 -#define Rf_findVar_x 167 -#define Rf_findVarInFrame_x 168 -#define Rf_findVarInFrame3_x 169 -#define Rf_fprec_x 170 -#define Rf_ftrunc_x 171 -#define Rf_gammafn_x 172 -#define Rf_getAttrib_x 173 -#define Rf_gsetVar_x 174 -#define Rf_inherits_x 175 -#define Rf_install_x 176 -#define Rf_installChar_x 177 -#define Rf_isNull_x 178 -#define Rf_isObject_x 179 -#define Rf_isString_x 180 -#define Rf_lbeta_x 181 -#define Rf_lchoose_x 182 -#define Rf_lengthgets_x 183 -#define Rf_lgamma1p_x 184 -#define Rf_lgammafn_x 185 -#define Rf_lgammafn_sign_x 186 -#define Rf_log1pexp_x 187 -#define Rf_log1pmx_x 188 -#define Rf_logspace_add_x 189 -#define Rf_logspace_sub_x 190 -#define Rf_match_x 191 -#define Rf_mkCharLenCE_x 192 -#define Rf_namesgets_x 193 -#define Rf_ncols_x 194 -#define Rf_nrows_x 195 -#define Rf_pbeta_x 196 -#define Rf_pbinom_x 197 -#define Rf_pcauchy_x 198 -#define Rf_pchisq_x 199 -#define Rf_pentagamma_x 200 -#define Rf_pexp_x 201 -#define Rf_pf_x 202 -#define Rf_pgamma_x 203 -#define Rf_pgeom_x 204 -#define Rf_phyper_x 205 -#define Rf_plnorm_x 206 -#define Rf_plogis_x 207 -#define Rf_pnbeta_x 208 -#define Rf_pnbinom_x 209 -#define Rf_pnbinom_mu_x 210 -#define Rf_pnchisq_x 211 -#define Rf_pnf_x 212 -#define Rf_pnorm5_x 213 -#define Rf_pnorm_both_x 214 -#define Rf_pnt_x 215 -#define Rf_ppois_x 216 -#define Rf_protect_x 217 -#define Rf_psigamma_x 218 -#define Rf_psignrank_x 219 -#define Rf_pt_x 220 -#define Rf_ptukey_x 221 -#define Rf_punif_x 222 -#define Rf_pweibull_x 223 -#define Rf_pwilcox_x 224 -#define Rf_qbeta_x 225 -#define Rf_qbinom_x 226 -#define Rf_qcauchy_x 227 -#define Rf_qchisq_x 228 -#define Rf_qexp_x 229 -#define Rf_qf_x 230 -#define Rf_qgamma_x 231 -#define Rf_qgeom_x 232 -#define Rf_qhyper_x 233 -#define Rf_qlnorm_x 234 -#define Rf_qlogis_x 235 -#define Rf_qnbeta_x 236 -#define Rf_qnbinom_x 237 -#define Rf_qnbinom_mu_x 238 -#define Rf_qnchisq_x 239 -#define Rf_qnf_x 240 -#define Rf_qnorm5_x 241 -#define Rf_qnt_x 242 -#define Rf_qpois_x 243 -#define Rf_qsignrank_x 244 -#define Rf_qt_x 245 -#define Rf_qtukey_x 246 -#define Rf_qunif_x 247 -#define Rf_qweibull_x 248 -#define Rf_qwilcox_x 249 -#define Rf_rbeta_x 250 -#define Rf_rbinom_x 251 -#define Rf_rcauchy_x 252 -#define Rf_rchisq_x 253 -#define Rf_rexp_x 254 -#define Rf_rf_x 255 -#define Rf_rgamma_x 256 -#define Rf_rgeom_x 257 -#define Rf_rhyper_x 258 -#define Rf_rlnorm_x 259 -#define Rf_rlogis_x 260 -#define Rf_rmultinom_x 261 -#define Rf_rnbinom_x 262 -#define Rf_rnbinom_mu_x 263 -#define Rf_rnchisq_x 264 -#define Rf_rnorm_x 265 -#define Rf_rpois_x 266 -#define Rf_rsignrank_x 267 -#define Rf_rt_x 268 -#define Rf_runif_x 269 -#define Rf_rweibull_x 270 -#define Rf_rwilcox_x 271 -#define Rf_setAttrib_x 272 -#define Rf_setVar_x 273 -#define Rf_sign_x 274 -#define Rf_sinpi_x 275 -#define Rf_str2type_x 276 -#define Rf_tanpi_x 277 -#define Rf_tetragamma_x 278 -#define Rf_trigamma_x 279 -#define Rf_unprotect_x 280 -#define Rf_unprotect_ptr_x 281 -#define Rf_warning_x 282 -#define Rf_warningcall_x 283 -#define Rprintf_x 284 -#define SETCAD4R_x 285 -#define SETCADDDR_x 286 -#define SETCADDR_x 287 -#define SETCADR_x 288 -#define SETCAR_x 289 -#define SETCDR_x 290 -#define SETLENGTH_x 291 -#define SETLEVELS_x 292 -#define SET_ATTRIB_x 293 -#define SET_BODY_x 294 -#define SET_CLOENV_x 295 -#define SET_ENCLOS_x 296 -#define SET_FORMALS_x 297 -#define SET_NAMED_FASTR_x 298 -#define SET_OBJECT_x 299 -#define SET_RDEBUG_x 300 -#define SET_RSTEP_x 301 -#define SET_S4_OBJECT_x 302 -#define SET_STRING_ELT_x 303 -#define SET_SYMVALUE_x 304 -#define SET_TAG_x 305 -#define SET_TRUELENGTH_x 306 -#define SET_TYPEOF_x 307 -#define SET_VECTOR_ELT_x 308 -#define STRING_ELT_x 309 -#define SYMVALUE_x 310 -#define TAG_x 311 -#define TRUELENGTH_x 312 -#define TYPEOF_x 313 -#define UNSET_S4_OBJECT_x 314 -#define VECTOR_ELT_x 315 -#define exp_rand_x 316 -#define forceSymbols_x 317 -#define getCCallable_x 318 -#define getConnectionClassString_x 319 -#define getEmbeddingDLLInfo_x 320 -#define getOpenModeString_x 321 -#define getSummaryDescription_x 322 -#define isSeekable_x 323 -#define norm_rand_x 324 -#define octsize_x 325 -#define registerCCallable_x 326 -#define registerRoutines_x 327 -#define restoreHandlerStacks_x 328 -#define setDotSymbolValues_x 329 -#define unif_rand_x 330 -#define useDynamicSymbols_x 331 +#define R_MakeWeakRef_x 55 +#define R_MakeWeakRefC_x 56 +#define R_MethodsNamespace_x 57 +#define R_NamespaceRegistry_x 58 +#define R_NewHashedEnv_x 59 +#define R_ParseVector_x 60 +#define R_PreserveObject_x 61 +#define R_PromiseExpr_x 62 +#define R_ProtectWithIndex_x 63 +#define R_ReadConnection_x 64 +#define R_ReleaseObject_x 65 +#define R_Reprotect_x 66 +#define R_SetExternalPtrAddr_x 67 +#define R_SetExternalPtrProtected_x 68 +#define R_SetExternalPtrTag_x 69 +#define R_TempDir_x 70 +#define R_ToplevelExec_x 71 +#define R_WeakRefKey_x 72 +#define R_WeakRefValue_x 73 +#define R_WriteConnection_x 74 +#define R_alloc_x 75 +#define R_compute_identical_x 76 +#define R_do_MAKE_CLASS_x 77 +#define R_do_new_object_x 78 +#define R_do_slot_x 79 +#define R_do_slot_assign_x 80 +#define R_forceAndCall_x 81 +#define R_getClassDef_x 82 +#define R_getContextCall_x 83 +#define R_getContextEnv_x 84 +#define R_getContextFun_x 85 +#define R_getContextSrcRef_x 86 +#define R_getGlobalFunctionContext_x 87 +#define R_getParentFunctionContext_x 88 +#define R_has_slot_x 89 +#define R_insideBrowser_x 90 +#define R_isEqual_x 91 +#define R_isGlobal_x 92 +#define R_lsInternal3_x 93 +#define R_nchar_x 94 +#define R_new_custom_connection_x 95 +#define R_tryEval_x 96 +#define R_unLockBinding_x 97 +#define Rf_GetOption1_x 98 +#define Rf_NonNullStringMatch_x 99 +#define Rf_PairToVectorList_x 100 +#define Rf_PrintValue_x 101 +#define Rf_ScalarComplex_x 102 +#define Rf_ScalarInteger_x 103 +#define Rf_ScalarLogical_x 104 +#define Rf_ScalarRaw_x 105 +#define Rf_ScalarReal_x 106 +#define Rf_ScalarString_x 107 +#define Rf_VectorToPairList_x 108 +#define Rf_allocArray_x 109 +#define Rf_allocList_x 110 +#define Rf_allocMatrix_x 111 +#define Rf_allocSExp_x 112 +#define Rf_allocVector_x 113 +#define Rf_any_duplicated_x 114 +#define Rf_any_duplicated3_x 115 +#define Rf_asChar_x 116 +#define Rf_asCharacterFactor_x 117 +#define Rf_asInteger_x 118 +#define Rf_asLogical_x 119 +#define Rf_asReal_x 120 +#define Rf_bessel_i_x 121 +#define Rf_bessel_i_ex_x 122 +#define Rf_bessel_j_x 123 +#define Rf_bessel_j_ex_x 124 +#define Rf_bessel_k_x 125 +#define Rf_bessel_k_ex_x 126 +#define Rf_bessel_y_x 127 +#define Rf_bessel_y_ex_x 128 +#define Rf_beta_x 129 +#define Rf_choose_x 130 +#define Rf_classgets_x 131 +#define Rf_coerceVector_x 132 +#define Rf_cons_x 133 +#define Rf_copyListMatrix_x 134 +#define Rf_copyMatrix_x 135 +#define Rf_copyMostAttrib_x 136 +#define Rf_cospi_x 137 +#define Rf_dbeta_x 138 +#define Rf_dbinom_x 139 +#define Rf_dcauchy_x 140 +#define Rf_dchisq_x 141 +#define Rf_defineVar_x 142 +#define Rf_dexp_x 143 +#define Rf_df_x 144 +#define Rf_dgamma_x 145 +#define Rf_dgeom_x 146 +#define Rf_dhyper_x 147 +#define Rf_digamma_x 148 +#define Rf_dlnorm_x 149 +#define Rf_dlogis_x 150 +#define Rf_dnbeta_x 151 +#define Rf_dnbinom_x 152 +#define Rf_dnbinom_mu_x 153 +#define Rf_dnchisq_x 154 +#define Rf_dnf_x 155 +#define Rf_dnorm4_x 156 +#define Rf_dnt_x 157 +#define Rf_dpois_x 158 +#define Rf_dpsifn_x 159 +#define Rf_dsignrank_x 160 +#define Rf_dt_x 161 +#define Rf_dunif_x 162 +#define Rf_duplicate_x 163 +#define Rf_duplicated_x 164 +#define Rf_dweibull_x 165 +#define Rf_dwilcox_x 166 +#define Rf_error_x 167 +#define Rf_errorcall_x 168 +#define Rf_eval_x 169 +#define Rf_findFun_x 170 +#define Rf_findVar_x 171 +#define Rf_findVarInFrame_x 172 +#define Rf_findVarInFrame3_x 173 +#define Rf_fprec_x 174 +#define Rf_ftrunc_x 175 +#define Rf_gammafn_x 176 +#define Rf_getAttrib_x 177 +#define Rf_gsetVar_x 178 +#define Rf_inherits_x 179 +#define Rf_install_x 180 +#define Rf_installChar_x 181 +#define Rf_isNull_x 182 +#define Rf_isObject_x 183 +#define Rf_isString_x 184 +#define Rf_lbeta_x 185 +#define Rf_lchoose_x 186 +#define Rf_lengthgets_x 187 +#define Rf_lgamma1p_x 188 +#define Rf_lgammafn_x 189 +#define Rf_lgammafn_sign_x 190 +#define Rf_log1pexp_x 191 +#define Rf_log1pmx_x 192 +#define Rf_logspace_add_x 193 +#define Rf_logspace_sub_x 194 +#define Rf_match_x 195 +#define Rf_mkCharLenCE_x 196 +#define Rf_namesgets_x 197 +#define Rf_ncols_x 198 +#define Rf_nrows_x 199 +#define Rf_pbeta_x 200 +#define Rf_pbinom_x 201 +#define Rf_pcauchy_x 202 +#define Rf_pchisq_x 203 +#define Rf_pentagamma_x 204 +#define Rf_pexp_x 205 +#define Rf_pf_x 206 +#define Rf_pgamma_x 207 +#define Rf_pgeom_x 208 +#define Rf_phyper_x 209 +#define Rf_plnorm_x 210 +#define Rf_plogis_x 211 +#define Rf_pnbeta_x 212 +#define Rf_pnbinom_x 213 +#define Rf_pnbinom_mu_x 214 +#define Rf_pnchisq_x 215 +#define Rf_pnf_x 216 +#define Rf_pnorm5_x 217 +#define Rf_pnorm_both_x 218 +#define Rf_pnt_x 219 +#define Rf_ppois_x 220 +#define Rf_protect_x 221 +#define Rf_psigamma_x 222 +#define Rf_psignrank_x 223 +#define Rf_pt_x 224 +#define Rf_ptukey_x 225 +#define Rf_punif_x 226 +#define Rf_pweibull_x 227 +#define Rf_pwilcox_x 228 +#define Rf_qbeta_x 229 +#define Rf_qbinom_x 230 +#define Rf_qcauchy_x 231 +#define Rf_qchisq_x 232 +#define Rf_qexp_x 233 +#define Rf_qf_x 234 +#define Rf_qgamma_x 235 +#define Rf_qgeom_x 236 +#define Rf_qhyper_x 237 +#define Rf_qlnorm_x 238 +#define Rf_qlogis_x 239 +#define Rf_qnbeta_x 240 +#define Rf_qnbinom_x 241 +#define Rf_qnbinom_mu_x 242 +#define Rf_qnchisq_x 243 +#define Rf_qnf_x 244 +#define Rf_qnorm5_x 245 +#define Rf_qnt_x 246 +#define Rf_qpois_x 247 +#define Rf_qsignrank_x 248 +#define Rf_qt_x 249 +#define Rf_qtukey_x 250 +#define Rf_qunif_x 251 +#define Rf_qweibull_x 252 +#define Rf_qwilcox_x 253 +#define Rf_rbeta_x 254 +#define Rf_rbinom_x 255 +#define Rf_rcauchy_x 256 +#define Rf_rchisq_x 257 +#define Rf_rexp_x 258 +#define Rf_rf_x 259 +#define Rf_rgamma_x 260 +#define Rf_rgeom_x 261 +#define Rf_rhyper_x 262 +#define Rf_rlnorm_x 263 +#define Rf_rlogis_x 264 +#define Rf_rmultinom_x 265 +#define Rf_rnbinom_x 266 +#define Rf_rnbinom_mu_x 267 +#define Rf_rnchisq_x 268 +#define Rf_rnorm_x 269 +#define Rf_rpois_x 270 +#define Rf_rsignrank_x 271 +#define Rf_rt_x 272 +#define Rf_runif_x 273 +#define Rf_rweibull_x 274 +#define Rf_rwilcox_x 275 +#define Rf_setAttrib_x 276 +#define Rf_setVar_x 277 +#define Rf_sign_x 278 +#define Rf_sinpi_x 279 +#define Rf_str2type_x 280 +#define Rf_tanpi_x 281 +#define Rf_tetragamma_x 282 +#define Rf_trigamma_x 283 +#define Rf_unprotect_x 284 +#define Rf_unprotect_ptr_x 285 +#define Rf_warning_x 286 +#define Rf_warningcall_x 287 +#define Rprintf_x 288 +#define SETCAD4R_x 289 +#define SETCADDDR_x 290 +#define SETCADDR_x 291 +#define SETCADR_x 292 +#define SETCAR_x 293 +#define SETCDR_x 294 +#define SETLENGTH_x 295 +#define SETLEVELS_x 296 +#define SET_ATTRIB_x 297 +#define SET_BODY_x 298 +#define SET_CLOENV_x 299 +#define SET_ENCLOS_x 300 +#define SET_FORMALS_x 301 +#define SET_NAMED_FASTR_x 302 +#define SET_OBJECT_x 303 +#define SET_RDEBUG_x 304 +#define SET_RSTEP_x 305 +#define SET_S4_OBJECT_x 306 +#define SET_STRING_ELT_x 307 +#define SET_SYMVALUE_x 308 +#define SET_TAG_x 309 +#define SET_TRUELENGTH_x 310 +#define SET_TYPEOF_x 311 +#define SET_VECTOR_ELT_x 312 +#define STRING_ELT_x 313 +#define SYMVALUE_x 314 +#define TAG_x 315 +#define TRUELENGTH_x 316 +#define TYPEOF_x 317 +#define UNSET_S4_OBJECT_x 318 +#define VECTOR_ELT_x 319 +#define exp_rand_x 320 +#define forceSymbols_x 321 +#define getCCallable_x 322 +#define getConnectionClassString_x 323 +#define getEmbeddingDLLInfo_x 324 +#define getOpenModeString_x 325 +#define getSummaryDescription_x 326 +#define isSeekable_x 327 +#define norm_rand_x 328 +#define octsize_x 329 +#define registerCCallable_x 330 +#define registerRoutines_x 331 +#define restoreHandlerStacks_x 332 +#define setDotSymbolValues_x 333 +#define unif_rand_x 334 +#define useDynamicSymbols_x 335 -#define UPCALLS_TABLE_SIZE 332 +#define UPCALLS_TABLE_SIZE 336 #endif // RFFI_UPCALLSINDEX_H diff --git a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h index 49be1bd080..afe2b5715b 100644 --- a/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h +++ b/com.oracle.truffle.r.native/fficall/src/truffle_common/Rinternals_truffle_common.h @@ -1543,22 +1543,30 @@ void R_RunPendingFinalizers(void) { SEXP R_MakeWeakRef(SEXP key, SEXP val, SEXP fin, Rboolean onexit) { TRACE0(); - unimplemented("R_MakeWeakRef"); + SEXP result = ((call_R_MakeWeakRef) callbacks[R_MakeWeakRef_x])(key, val, fin, onexit); + checkExitCall(); + return result; } SEXP R_MakeWeakRefC(SEXP key, SEXP val, R_CFinalizer_t fin, Rboolean onexit) { TRACE0(); - unimplemented("R_MakeWeakRefC"); + SEXP result = ((call_R_MakeWeakRefC) callbacks[R_MakeWeakRefC_x])(key, val, fin, onexit); + checkExitCall(); + return result; } SEXP R_WeakRefKey(SEXP w) { TRACE0(); - unimplemented("R_WeakRefKey"); + SEXP result = ((call_R_WeakRefKey) callbacks[R_WeakRefKey_x])(w); + checkExitCall(); + return result; } SEXP R_WeakRefValue(SEXP w) { TRACE0(); - unimplemented("R_WeakRefValue"); + SEXP result = ((call_R_WeakRefValue) callbacks[R_WeakRefValue_x])(w); + checkExitCall(); + return result; } void R_RunWeakRefFinalizer(SEXP w) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java index 4c0ecb5fcf..e46e4cacf8 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java @@ -54,6 +54,7 @@ import com.oracle.truffle.r.runtime.data.RNull; import com.oracle.truffle.r.runtime.data.RRaw; import com.oracle.truffle.r.runtime.data.RStringVector; +import com.oracle.truffle.r.runtime.data.RWeakRef; import com.oracle.truffle.r.runtime.env.REnvironment; import com.oracle.truffle.r.runtime.nodes.RBaseNode; @@ -147,6 +148,11 @@ protected RStringVector getClassHr(@SuppressWarnings("unused") CharSXPWrapper ar return withImplicitTypes ? ImplicitClassHierarchyNode.getImplicitClass(RType.Character, forDispatch) : null; } + @Specialization + protected RStringVector getClassHr(@SuppressWarnings("unused") RWeakRef arg) { + return withImplicitTypes ? ImplicitClassHierarchyNode.getImplicitClass(RType.WeakRef, forDispatch) : null; + } + @Specialization protected RStringVector getClassHr(@SuppressWarnings("unused") int arg) { return withImplicitTypes ? ImplicitClassHierarchyNode.getImplicitClass(RType.Integer, forDispatch) : null; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java index 73c74b1982..87f27b61f9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java @@ -54,6 +54,7 @@ public enum RType { DefunctReal("real", -1), DefunctSingle("single", -1), ExternalPtr("externalptr", -1), + WeakRef("weakref", -1), S4Object("S4", -1), Connection("connection", -1), Dots("...", -1), @@ -218,6 +219,8 @@ public static RType fromMode(String mode, boolean includeNumeric) { return DefunctSingle; case "externalptr": return ExternalPtr; + case "weakref": + return WeakRef; case "S4": return S4Object; case "connection": diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRef.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRef.java new file mode 100644 index 0000000000..153c7d8d00 --- /dev/null +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRef.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.runtime.data; + +import com.oracle.truffle.r.runtime.RType; + +public final class RWeakRef extends RObject implements RTruffleObject, RTypedValue { + + private int typedValueInfo = ASCII_MASK_SHIFTED; + + private final Object key; + private final Object value; + @SuppressWarnings("unused") private final Object fin; + @SuppressWarnings("unused") private final boolean onexit; + + public RWeakRef(Object key, Object value, Object fin, boolean onexit) { + this.key = key; + this.value = value; + this.fin = fin; + this.onexit = onexit; + } + + public Object getKey() { + return key; + } + + public Object getValue() { + return value; + } + + @Override + public RType getRType() { + return RType.WeakRef; + } + + @Override + public int getTypedValueInfo() { + return typedValueInfo; + } + + @Override + public void setTypedValueInfo(int value) { + typedValueInfo = value; + } +} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java new file mode 100644 index 0000000000..ac984d384e --- /dev/null +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.runtime.data; + +import com.oracle.truffle.api.interop.CanResolve; +import com.oracle.truffle.api.interop.MessageResolution; +import com.oracle.truffle.api.interop.Resolve; +import com.oracle.truffle.api.interop.TruffleObject; +import com.oracle.truffle.api.nodes.Node; + +@MessageResolution(receiverType = CharSXPWrapper.class) +public class RWeakRefMR { + + @Resolve(message = "IS_POINTER") + public abstract static class IsPointerNode extends Node { + protected boolean access(@SuppressWarnings("unused") Object receiver) { + return true; + } + } + + @Resolve(message = "AS_POINTER") + public abstract static class AsPointerNode extends Node { + protected Object access(Object receiver) { + return NativeDataAccess.asPointer(receiver); + } + } + + @Resolve(message = "TO_NATIVE") + public abstract static class ToNativeNode extends Node { + protected Object access(Object receiver) { + return receiver; + } + } + + @CanResolve + public abstract static class CharSXPWrapperCheck extends Node { + + protected static boolean test(TruffleObject receiver) { + return receiver instanceof RWeakRef; + } + } +} \ No newline at end of file From 4d1bcd1bc18ad4429cad3aee9eb82f83892b34b2 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 14:10:26 +0100 Subject: [PATCH 39/71] add implementation of i1mach API --- .../fficall/src/common/arithmetic_fastr.c | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/com.oracle.truffle.r.native/fficall/src/common/arithmetic_fastr.c b/com.oracle.truffle.r.native/fficall/src/common/arithmetic_fastr.c index 9b72c5eca6..a8c3373da5 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/arithmetic_fastr.c +++ b/com.oracle.truffle.r.native/fficall/src/common/arithmetic_fastr.c @@ -223,6 +223,43 @@ double Rf_logspace_sum (const double* logx, int n) return Mx + (double) LOG(s); } +#include + +attribute_hidden int Rf_i1mach(int i) +{ + switch(i) { + + case 1: return 5; + case 2: return 6; + case 3: return 0; + case 4: return 0; + + case 5: return CHAR_BIT * sizeof(int); + case 6: return sizeof(int)/sizeof(char); + + case 7: return 2; + case 8: return CHAR_BIT * sizeof(int) - 1; + case 9: return INT_MAX; + + case 10: return FLT_RADIX; + + case 11: return FLT_MANT_DIG; + case 12: return FLT_MIN_EXP; + case 13: return FLT_MAX_EXP; + + case 14: return DBL_MANT_DIG; + case 15: return DBL_MIN_EXP; + case 16: return DBL_MAX_EXP; + + default: return 0; + } +} + +int F77_NAME(i1mach)(int *i) +{ + return Rf_i1mach(*i); +} + attribute_hidden double Rf_d1mach(int i) { switch(i) { @@ -243,10 +280,6 @@ attribute_hidden double Rf_d1mach(int i) } } -#ifdef __cplusplus -extern "C" -#endif - double F77_NAME(d1mach)(int *i) { return Rf_d1mach(*i); From 6f5390ed4bfa6b135cc02879ee9ad8a3392765e2 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 14:12:54 +0100 Subject: [PATCH 40/71] minor style fixes in native code --- .../fficall/src/common/Rinternals_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c b/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c index 89df73bb84..c74e83fb9d 100644 --- a/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c +++ b/com.oracle.truffle.r.native/fficall/src/common/Rinternals_common.c @@ -118,7 +118,7 @@ void *DATAPTR(SEXP x) { } else if (type == CPLXSXP) { return COMPLEX(x); } else if (type == CHARSXP) { - return R_CHAR(x); + return (void*) R_CHAR(x); } else { return FASTR_DATAPTR(x); } From 7fdb35d86a5103aaba92a0e63a9a1e26955b4e1e Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 14:15:18 +0100 Subject: [PATCH 41/71] warn, but not crash, on unbalanced protect/unprotect --- .../r/ffi/impl/common/JavaUpCallsRFFIImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index d58008cc3b..4250930fe9 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -1617,11 +1617,20 @@ public Object Rf_protect(Object x) { public void Rf_unprotect(int x) { RFFIContext context = getContext(); ArrayList stack = context.rffiContextState.protectStack; - for (int i = 0; i < x; i++) { - context.registerReferenceUsedInNative(stack.remove(stack.size() - 1)); + try { + for (int i = 0; i < x; i++) { + context.registerReferenceUsedInNative(stack.remove(stack.size() - 1)); + } + } catch (ArrayIndexOutOfBoundsException e) { + debugWarning("mismatched protect/unprotect (unprotect with empty protect stack)"); } } + private static boolean debugWarning(String message) { + RError.warning(RError.SHOW_CALLER, RError.Message.GENERIC, message); + return true; + } + @Override @TruffleBoundary public int R_ProtectWithIndex(Object x) { From ed5f13a5821d43ea65ee8c6bcef11f852e08bf29 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Mon, 11 Mar 2019 18:03:16 +0100 Subject: [PATCH 42/71] style fix --- .../src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java index ac984d384e..4debf3758a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RWeakRefMR.java @@ -59,4 +59,4 @@ protected static boolean test(TruffleObject receiver) { return receiver instanceof RWeakRef; } } -} \ No newline at end of file +} From abfad99949b00b32d93cfedd5e19c3dc790f4e22 Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Thu, 21 Mar 2019 09:53:24 +0100 Subject: [PATCH 43/71] update copyright years --- .../oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java | 2 +- .../r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java | 2 +- .../oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java | 2 +- .../src/com/oracle/truffle/r/library/stats/CompleteCases.java | 2 +- .../com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java | 2 +- .../src/com/oracle/truffle/r/runtime/RType.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java index f4c07b6f7c..1814212e8d 100644 --- a/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java +++ b/com.oracle.truffle.r.ffi.codegen/src/com/oracle/truffle/r/ffi/codegen/FFIUpCallsIndexCodeGen.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java index 90b0adb815..1acbaab258 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/interop/FFI_RForeignAccessFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java index 4c5db5b2f0..f2009943ec 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/upcalls/MemoryUpCallsRFFI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java index 8972430b79..78d727fcdf 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/CompleteCases.java @@ -1,7 +1,7 @@ /* * Copyright (c) 1995, 1996 Robert Gentleman and Ross Ihaka * Copyright (c) 1997-2013, The R Core Team - * Copyright (c) 2015, 2018, Oracle and/or its affiliates + * Copyright (c) 2015, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java index e46e4cacf8..9248e20a69 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ClassHierarchyNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java index 87f27b61f9..aae74d3483 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RType.java @@ -1,7 +1,7 @@ /* * Copyright (c) 1995-2012, The R Core Team * Copyright (c) 2003, The R Foundation - * Copyright (c) 2013, 2018, Oracle and/or its affiliates + * Copyright (c) 2013, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 078ab96b7ec3e68d91964fc9c49c2373acae4f94 Mon Sep 17 00:00:00 2001 From: Tomas Zezula Date: Thu, 21 Mar 2019 13:33:33 +0100 Subject: [PATCH 44/71] [GR-14628] Update RFileTypeDetector to implement TruffleFile.FileTypeDectector. --- .../java.nio.file.spi.FileTypeDetector | 1 - .../truffle/r/engine/RFileTypeDetector.java | 23 +++++++++++-------- .../r/engine/TruffleRLanguageImpl.java | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) delete mode 100644 com.oracle.truffle.r.engine/src/META-INF/services/java.nio.file.spi.FileTypeDetector diff --git a/com.oracle.truffle.r.engine/src/META-INF/services/java.nio.file.spi.FileTypeDetector b/com.oracle.truffle.r.engine/src/META-INF/services/java.nio.file.spi.FileTypeDetector deleted file mode 100644 index 0c8fae7e2a..0000000000 --- a/com.oracle.truffle.r.engine/src/META-INF/services/java.nio.file.spi.FileTypeDetector +++ /dev/null @@ -1 +0,0 @@ -com.oracle.truffle.r.engine.RFileTypeDetector diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RFileTypeDetector.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RFileTypeDetector.java index 33f4ddeab4..b945a57067 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RFileTypeDetector.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RFileTypeDetector.java @@ -23,21 +23,24 @@ package com.oracle.truffle.r.engine; import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.spi.FileTypeDetector; +import java.nio.charset.Charset; +import com.oracle.truffle.api.TruffleFile; import com.oracle.truffle.r.runtime.RRuntime; -public final class RFileTypeDetector extends FileTypeDetector { +public final class RFileTypeDetector implements TruffleFile.FileTypeDetector { + @Override - public String probeContentType(Path path) throws IOException { - Path fileNamePath = path.getFileName(); - if (fileNamePath != null) { - String fileName = fileNamePath.toString(); - if (fileName.endsWith(".R") || fileName.endsWith(".r")) { - return RRuntime.R_TEXT_MIME; - } + public String findMimeType(TruffleFile file) throws IOException { + String fileName = file.getName(); + if (fileName != null && (fileName.endsWith(".R") || fileName.endsWith(".r"))) { + return RRuntime.R_TEXT_MIME; } return null; } + + @Override + public Charset findEncoding(TruffleFile file) throws IOException { + return null; + } } diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index 856d8eb882..8861c162bb 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -69,7 +69,7 @@ import com.oracle.truffle.r.runtime.nodes.RBaseNode; import org.graalvm.options.OptionDescriptors; -@TruffleLanguage.Registration(name = "R", id = "R", version = "3.5.1", mimeType = {RRuntime.R_APP_MIME, RRuntime.R_TEXT_MIME}, interactive = true) +@TruffleLanguage.Registration(name = "R", id = "R", version = "3.5.1", mimeType = {RRuntime.R_APP_MIME, RRuntime.R_TEXT_MIME}, interactive = true, fileTypeDetectors = RFileTypeDetector.class) @ProvidedTags({StandardTags.CallTag.class, StandardTags.StatementTag.class, StandardTags.RootTag.class, RSyntaxTags.LoopTag.class, FunctionBodyBlockTag.class}) public final class TruffleRLanguageImpl extends TruffleRLanguage { From 2b17f53e99f55d82c1e8f57019ede8e51344d477 Mon Sep 17 00:00:00 2001 From: stepan Date: Sun, 17 Mar 2019 21:51:23 +0100 Subject: [PATCH 45/71] Fix: rep.int with zero length value argument --- CHANGELOG.md | 6 ++++++ .../truffle/r/nodes/builtin/base/RepeatInternal.java | 12 ++++++++---- .../oracle/truffle/r/test/ExpectedTestOutput.test | 12 ++++++++++++ .../truffle/r/test/builtins/TestBuiltin_repint.java | 6 +++++- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff6cce1745..7c2361d120 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 1.0 RC 15 + +Bug fixes: + +* `rep.int` with value argument of length 0 just returns the value argument + # 1.0 RC 14 * all FastR specific options (NOT those GNU-R compatible like `--save`) are experimental except for `--R.PrintErrorStacktracesToFile`, diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java index 11c9eda485..008a88a35e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/RepeatInternal.java @@ -23,7 +23,6 @@ package com.oracle.truffle.r.nodes.builtin.base; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.abstractVectorValue; -import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.notEmpty; import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.typeName; import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; @@ -48,19 +47,24 @@ public abstract class RepeatInternal extends RBuiltinNode.Arg2 { private final ConditionProfile timesOneProfile = ConditionProfile.createBinaryProfile(); + private final ConditionProfile valueLen0Profile = ConditionProfile.createBinaryProfile(); static { Casts casts = new Casts(RepeatInternal.class); casts.arg("x").mustBe(abstractVectorValue(), RError.Message.ATTEMPT_TO_REPLICATE, typeName()); - casts.arg("times").defaultError(RError.Message.INVALID_TYPE, typeName(), "times", "vector").mustBe(abstractVectorValue()).asIntegerVector().mustBe(notEmpty(), - RError.Message.INVALID_VALUE, "times"); + casts.arg("times").defaultError(RError.Message.INVALID_TYPE, typeName(), "times", "vector").mustBe(abstractVectorValue()).asIntegerVector(); } private RAbstractVector performRep(RAbstractVector value, RAbstractIntVector times, VectorFactory factory, VectorAccess valueAccess, VectorAccess timesAccess, VectorAccess resultAccess) { try (SequentialIterator valueIter = valueAccess.access(value); SequentialIterator timesIter = timesAccess.access(times)) { int valueLength = valueAccess.getLength(valueIter); int timesLength = timesAccess.getLength(timesIter); - + if (valueLen0Profile.profile(valueLength == 0)) { + return factory.createVector(valueAccess.getType(), 0, false); + } + if (timesLength == 0) { + throw error(RError.Message.INVALID_VALUE, "times"); + } RVector result; if (timesOneProfile.profile(timesLength == 1)) { timesAccess.next(timesIter); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 5068b5000f..2a99777264 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -59547,6 +59547,18 @@ Error in rep_len(function() 42, 7) : attempt to replicate non-vector #x<-as.raw(16); y<-as.raw(5); rep_len(c(x, y), 5) [1] 10 05 10 05 10 +##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testRepInt# +#rep.int(character(0), numeric(0)) +character(0) + +##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testRepInt# +#rep.int(integer(0), character(0)) +integer(0) + +##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testRepInt# +#rep.int(integer(0), numeric(0)) +integer(0) + ##com.oracle.truffle.r.test.builtins.TestBuiltin_repint.testRepInt# #{ rep.int("a",3) } [1] "a" "a" "a" diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java index 3ba3d42e84..a43febb16b 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_repint.java @@ -14,7 +14,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2012-2014, Purdue University - * Copyright (c) 2013, 2018, Oracle and/or its affiliates + * Copyright (c) 2013, 2019, Oracle and/or its affiliates * * All rights reserved. */ @@ -188,6 +188,10 @@ public void testRepInt() { assertEval("{ rep.int(7, -4) }"); assertEval("{ rep.int(c(7,1), c(1,-4)) }"); assertEval("{ rep.int(c(7,1), c(1,4,5)) }"); + + assertEval("rep.int(integer(0), character(0))"); + assertEval("rep.int(integer(0), numeric(0))"); + assertEval("rep.int(character(0), numeric(0))"); } @Test From 79f4d401ad9e13b133bba54820e27deba5a7a391 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 28 Mar 2019 13:07:05 +0100 Subject: [PATCH 46/71] adjusted FastRDebugTest to changes in DebugValue.as(String.class) --- .../src/com/oracle/truffle/r/test/tck/FastRDebugTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java index 531c6f0b19..8d2f1abe82 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java @@ -850,7 +850,6 @@ private void assertMetaObjectsOrStringValues(final Source expectedSource, boolea if (metaObjects) { DebugValue moDV = value.getMetaObject(); if (moDV != null || expectedValue != null) { - expectedValue = "[1] \"" + expectedValue + "\""; String mo = moDV.as(String.class); Assert.assertEquals("MetaObjects of '" + name + "' differ:", expectedValue, mo); } From a7f79d5063c2d584384907c48ee9b1a7e5cf34ec Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Thu, 28 Mar 2019 13:29:24 +0100 Subject: [PATCH 47/71] upgrading to last truffle version --- mx.fastr/suite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index ed54843ab2..9a8b84f144 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -7,7 +7,7 @@ { "name" : "truffle", "subdir" : True, - "version" : "4deb681aaaa79c248115037fc8e399c9876619fd", + "version" : "982c4186d869613d1e4fd00040b5bad86338ce2a", "urls" : [ {"url" : "https://github.com/graalvm/graal", "kind" : "git"}, {"url" : "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind" : "binary"}, From a4cb7b9689c2241abcc2f065d7393ffe95823d58 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Tue, 12 Feb 2019 23:13:15 +0100 Subject: [PATCH 48/71] removed large body workaround in FunctionBodyNode --- .../r/nodes/function/FunctionBodyNode.java | 34 ------------------- 1 file changed, 34 deletions(-) diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionBodyNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionBodyNode.java index 0822e7c471..b4a1a684ed 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionBodyNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/FunctionBodyNode.java @@ -23,17 +23,13 @@ package com.oracle.truffle.r.nodes.function; import com.oracle.truffle.api.CompilerDirectives; -import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; -import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.frame.FrameDescriptor; import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotKind; -import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.profiles.BranchProfile; import com.oracle.truffle.api.source.SourceSection; -import com.oracle.truffle.r.nodes.control.BlockNode; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RArguments.DispatchArgs; import com.oracle.truffle.r.runtime.RArguments.S3Args; @@ -45,14 +41,10 @@ public final class FunctionBodyNode extends Node implements RootBodyNode { - private static final int LARGE_BODY_LINES_COUNT = 200; - private static final int LARGE_BODY_STMTS_COUNT = 50; - @Child private RNode body; @Child private SaveArgumentsNode saveArguments; @Child private SetupS3ArgsNode setupS3Args; @Child private SetupS4ArgsNode setupS4Args; - @CompilationFinal private Boolean hasLargeBody; public FunctionBodyNode(SaveArgumentsNode saveArguments, RNode body) { this.body = body; @@ -63,15 +55,6 @@ public FunctionBodyNode(SaveArgumentsNode saveArguments, RNode body) { public Object visibleExecute(VirtualFrame frame) { setupDispatchSlots(frame); saveArguments.execute(frame); - if (hasLargeBody()) { - return executeLargeBody(frame.materialize()); - } else { - return body.visibleExecute(frame); - } - } - - @TruffleBoundary - private Object executeLargeBody(MaterializedFrame frame) { return body.visibleExecute(frame); } @@ -85,23 +68,6 @@ public SourceSection getSourceSection() { return body.getSourceSection(); } - private boolean hasLargeBody() { - if (hasLargeBody == null) { - CompilerDirectives.transferToInterpreterAndInvalidate(); - SourceSection sourceSection = body.getSourceSection(); - // Very basic heuristic for "large" body - if (sourceSection != null) { - hasLargeBody = sourceSection.getEndLine() - sourceSection.getStartLine() >= LARGE_BODY_LINES_COUNT; - } else if (body instanceof BlockNode) { - BlockNode block = (BlockNode) body; - hasLargeBody = block.getSequence().length >= LARGE_BODY_STMTS_COUNT; - } else { - hasLargeBody = false; - } - } - return hasLargeBody; - } - private void setupDispatchSlots(VirtualFrame frame) { DispatchArgs dispatchArgs = RArguments.getDispatchArgs(frame); if (dispatchArgs == null) { From a85c1a857f3fa4c4cd42ce390428afdb4a2ae641 Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Fri, 15 Feb 2019 12:36:16 +0100 Subject: [PATCH 49/71] split BlockNode sequence into smaller chunks if too many nodes --- .../r/engine/RRuntimeASTAccessImpl.java | 12 +- .../oracle/truffle/r/library/utils/Rprof.java | 4 + .../builtin/base/ConditionFunctions.java | 10 +- .../nodes/builtin/helpers/DebugHandling.java | 4 +- .../oracle/truffle/r/nodes/RASTBuilder.java | 2 +- .../r/nodes/control/AbstractBlockNode.java | 37 ++ .../truffle/r/nodes/control/BlockNode.java | 362 +++++++++++++++++- .../r/runtime/AnonymousFrameVariable.java | 4 +- .../r/runtime/context/FastROptions.java | 4 + 9 files changed, 423 insertions(+), 16 deletions(-) create mode 100644 com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/control/AbstractBlockNode.java diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java index f54b3db243..6fad9bcef6 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/RRuntimeASTAccessImpl.java @@ -47,8 +47,9 @@ import com.oracle.truffle.r.nodes.builtin.base.printer.DoubleVectorPrinter; import com.oracle.truffle.r.nodes.builtin.helpers.DebugHandling; import com.oracle.truffle.r.nodes.builtin.helpers.TraceHandling; +import com.oracle.truffle.r.nodes.control.AbstractBlockNode; import com.oracle.truffle.r.nodes.control.AbstractLoopNode; -import com.oracle.truffle.r.nodes.control.BlockNode; +import com.oracle.truffle.r.nodes.control.BlockNode.HugeBlockRootNode; import com.oracle.truffle.r.nodes.control.IfNode; import com.oracle.truffle.r.nodes.control.ReplacementDispatchNode; import com.oracle.truffle.r.nodes.function.ClassHierarchyNode; @@ -281,13 +282,13 @@ public boolean isTaggedWith(Node node, Class tag) { return node instanceof RCallNode; } if (tag == FunctionBodyBlockTag.class) { - return node instanceof BlockNode && ((BlockNode) node).unwrapParent() instanceof RootBodyNode; + return node instanceof AbstractBlockNode && ((AbstractBlockNode) node).unwrapParent() instanceof RootBodyNode; } if (tag == LoopTag.class) { return node instanceof AbstractLoopNode; } if (tag == StatementTag.class) { - if (node instanceof BlockNode) { + if (node instanceof AbstractBlockNode) { // so that the stepping location is not the block itself, but the first statement in // the block, note that the FastR's own debugging and tracing mechanism uses // FunctionBodyBlockTag to recognize function bodies. @@ -295,14 +296,15 @@ public boolean isTaggedWith(Node node, Class tag) { } // How to recognize statement from some node inside a statement (e.g. expression)? Node parent = ((RInstrumentableNode) node).unwrapParent(); - if (parent instanceof BlockNode) { + if (parent instanceof AbstractBlockNode) { // It's in a block of statements return true; } else { // single statement block: as function body, if/else body, loop body // note: RepeatingNode is not a RSyntaxElement but the body of a loop is // under the repeating node ! - return parent instanceof RootBodyNode || parent instanceof IfNode || AbstractLoopNode.isLoopBody(node) || EngineRootNode.isEngineBody(parent); + return parent instanceof RootBodyNode || parent instanceof IfNode || AbstractLoopNode.isLoopBody(node) || + EngineRootNode.isEngineBody(parent) || parent instanceof HugeBlockRootNode; } } // TODO: ExpressionTag: (!statement && !loop && !if && !call && !root)?? diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java index 0ce7b2451a..2a791e8fec 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/utils/Rprof.java @@ -46,6 +46,7 @@ import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.r.nodes.builtin.RExternalBuiltinNode; +import com.oracle.truffle.r.nodes.control.BlockNode.HugeBlockRootNode; import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; import com.oracle.truffle.r.nodes.instrumentation.RInstrumentation; import com.oracle.truffle.r.runtime.RArguments; @@ -347,6 +348,9 @@ public void cleanup(int status) { } for (RSyntaxElement node : intervalStack) { RootNode rootNode = ((RSyntaxNode) node).asRNode().getRootNode(); + if (rootNode instanceof HugeBlockRootNode) { + rootNode = ((HugeBlockRootNode) rootNode).getOriginalRootNode(); + } if (rootNode instanceof FunctionDefinitionNode) { String name = rootNode.getName(); if (this.lineProfiling) { diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java index 9ed0a6b7ee..8216e3853e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java @@ -1,7 +1,7 @@ /* * Copyright (c) 1995-2015, The R Core Team * Copyright (c) 2003, The R Foundation - * Copyright (c) 2015, 2018, Oracle and/or its affiliates + * Copyright (c) 2015, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,8 +34,10 @@ import com.oracle.truffle.api.frame.FrameSlot; import com.oracle.truffle.api.frame.FrameSlotTypeException; import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.nodes.RootNode; import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; import com.oracle.truffle.r.nodes.function.FunctionDefinitionNode; +import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RErrorHandling; import com.oracle.truffle.r.runtime.RInternalError; @@ -69,7 +71,8 @@ protected Object addCondHands(Object classes, Object handlers, Object parentEnv, } protected FrameSlot createHandlerFrameSlot(VirtualFrame frame) { - return ((FunctionDefinitionNode) getRootNode()).getHandlerFrameSlot(frame); + RootNode rootNode = RArguments.getFunction(frame).getRootNode(); + return ((FunctionDefinitionNode) rootNode).getHandlerFrameSlot(frame); } @Specialization @@ -121,7 +124,8 @@ public abstract static class AddRestart extends RBuiltinNode.Arg1 { } protected FrameSlot createRestartFrameSlot(VirtualFrame frame) { - return ((FunctionDefinitionNode) getRootNode()).getRestartFrameSlot(frame); + RootNode rootNode = RArguments.getFunction(frame).getRootNode(); + return ((FunctionDefinitionNode) rootNode).getRestartFrameSlot(frame); } @Specialization diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java index 0600d00e6b..d648737707 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/helpers/DebugHandling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -779,7 +779,7 @@ private static class StepIntoInstrumentListener implements ExecutionEventListene public void onEnter(EventContext context, VirtualFrame frame) { if (!RContext.getInstance().stateInstrumentation.debugGloballyDisabled()) { CompilerDirectives.transferToInterpreter(); - RootNode rootNode = context.getInstrumentedNode().getRootNode(); + Node rootNode = RArguments.getFunction(frame).getRootNode(); if (rootNode instanceof FunctionDefinitionNode) { FunctionDefinitionNode fdn = (FunctionDefinitionNode) rootNode; FunctionStatementsEventListener ensureSingleStep = ensureSingleStep(fdn, null); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java index ccf95d1683..742ce68adc 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/RASTBuilder.java @@ -190,7 +190,7 @@ private RSyntaxNode createCall(SourceSection source, RSyntaxNode lhs, List 0) { + int blockSequenceSizeLimit = RContext.getInstance().getOption(FastROptions.BlockSequenceSizeLimit); + int[] sizes = isHugeBlock(src, sequence, blockSequenceSizeLimit, blockSizeLimit); + if (sizes != null) { + return createHugeBlockNode(src, operator, sequence, sizes, blockSizeLimit); + } + } + return new BlockNode(src, operator, sequence); + } + @Override @ExplodeLoop public Object execute(VirtualFrame frame) { @@ -97,4 +128,329 @@ public RSyntaxNode[] getSyntaxArguments() { public ArgumentsSignature getSyntaxSignature() { return ArgumentsSignature.empty(sequence.length); } + + private static int[] isHugeBlock(SourceSection src, RNode[] sequence, int blockSequenceSizeLimit, int blockSizeLimit) { + if (sequence.length <= blockSequenceSizeLimit) { + if (LOGGER.isLoggable(Level.FINER)) { + LOGGER.log(Level.FINER, "{0} sequence.length < blockSequenceSizeLimit : {1} < {2}", new Object[]{classNameAndHash(src), sequence.length, blockSequenceSizeLimit}); + } + return null; + } + CompilerAsserts.neverPartOfCompilation(); + NodeCounter counter = new NodeCounter(); + + if (LOGGER.isLoggable(Level.FINER)) { + LOGGER.log(Level.FINER, "{0} sequence:", classNameAndHash(src)); + } + + int[] sizes = new int[sequence.length]; + int size = 0; + long t = System.currentTimeMillis(); + for (int i = 0; i < sizes.length; i++) { + Node ch = sequence[i]; + ch.accept(counter); + sizes[i] = counter.size; + size += sizes[i]; + counter.size = 0; + + if (LOGGER.isLoggable(Level.FINER)) { + LOGGER.log(Level.FINER, " {0}, size {1}", new Object[]{classNameAndHash(ch), sizes[i]}); + } + } + if (size >= blockSizeLimit) { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "sequence for {0} is huge: sequence size {1}, nodes size {2}, eval took {3} millis", + new Object[]{classNameAndHash(src), sequence.length, size, (System.currentTimeMillis() - t)}); + } + return sizes; + } + if (LOGGER.isLoggable(Level.FINEST)) { + LOGGER.log(Level.FINEST, "{0} sequence size {1}, nodes size {2}, eval took {3} millis", + new Object[]{classNameAndHash(src), sequence.length, size, (System.currentTimeMillis() - t)}); + } + return null; + } + + private static HugeBlockNode createHugeBlockNode(SourceSection src, RSyntaxLookup operator, RNode[] sequence, int[] sizes, int blockSizeLimitOption) { + assert sizes.length == sequence.length; + long t = System.currentTimeMillis(); + try { + CompilerAsserts.neverPartOfCompilation(); + List rootNodes = new ArrayList<>(sequence.length); + + int cumSize = 0; + int idxFrom = 0; + int blockIdx = 0; + for (int i = 0; i < sequence.length; i++) { + if (cumSize + sizes[i] > blockSizeLimitOption || i == sequence.length - 1) { + final RNode[] subSequence = new RNode[i - idxFrom + 1]; + for (int j = 0; j < subSequence.length; j++) { + subSequence[j] = sequence[idxFrom + j]; + } + HugeBlockRootNode blockNode; + if (i < sequence.length - 1) { + blockNode = new VoidRootNode(src, ":BLOCK" + blockIdx++, subSequence); + blockNode.adoptChildren(); + rootNodes.add(blockNode); + } else { + blockNode = new BlockRootNode(src, ":BLOCK" + blockIdx++, subSequence); + blockNode.adoptChildren(); + rootNodes.add(blockNode); + } + + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, " sub-block: {0}, sequence size {1}, node size {2}", new Object[]{blockNode.toString(), subSequence.length, cumSize + sizes[i]}); + } + + idxFrom = i + 1; + cumSize = 0; + } else { + cumSize += sizes[i]; + } + } + // the original sequence isn't held like @Children in HugeBlockNode, and used only to + // compute getSyntaxArguments/Signature. + return new HugeBlockNode(src, operator, sequence, rootNodes.toArray(new HugeBlockRootNode[rootNodes.size()])); + } finally { + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, "{0} creating huge block node took {1} millis", new Object[]{classNameAndHash(src), (System.currentTimeMillis() - t)}); + } + } + } + + public static final class HugeBlockNode extends AbstractBlockNode { + private static final int VOID_EXECUTE = 0; + private static final int EXECUTE = 1; + private static final int VISIBLE_EXECUTE = 2; + + @Child private SetVisibilityNode visibility; + @Children protected final DirectCallNode[] calls; + private final RNode[] originalSequence; + private final HugeBlockRootNode[] rootNodes; + @CompilationFinal private boolean firstExecution; + + private HugeBlockNode(SourceSection src, RSyntaxLookup operator, RNode[] sequence, HugeBlockRootNode[] rootNodes) { + super(src, operator); + this.originalSequence = sequence; + this.rootNodes = rootNodes; + // this.callTargets = new CallTarget[rootNodes.length]; + this.calls = new DirectCallNode[rootNodes.length]; + for (int i = 0; i < rootNodes.length; i++) { + HugeBlockRootNode rootNode = rootNodes[i]; + calls[i] = Truffle.getRuntime().createDirectCallNode(Truffle.getRuntime().createCallTarget(rootNode)); + } + } + + @Override + @ExplodeLoop + public Object execute(VirtualFrame frame) { + if (!firstExecution) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + firstExecution = true; + setOriginalRootNode(); + } + + if (calls.length == 0) { + return RNull.instance; + } + MaterializedFrame materializedFrame = frame.materialize(); + for (int i = 0; i < calls.length - 1; i++) { + calls[i].call(materializedFrame, VOID_EXECUTE); + } + return calls[calls.length - 1].call(materializedFrame, EXECUTE); + } + + @Override + @ExplodeLoop + public void voidExecute(VirtualFrame frame) { + if (!firstExecution) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + firstExecution = true; + setOriginalRootNode(); + } + + MaterializedFrame materializedFrame = frame.materialize(); + for (int i = 0; i < calls.length; i++) { + calls[i].call(materializedFrame, VOID_EXECUTE); + } + } + + @Override + @ExplodeLoop + public Object visibleExecute(VirtualFrame frame) { + if (!firstExecution) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + firstExecution = true; + setOriginalRootNode(); + } + MaterializedFrame materializedFrame = frame.materialize(); + if (calls.length == 0) { + if (visibility == null) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + visibility = insert(SetVisibilityNode.create()); + } + visibility.execute(materializedFrame, true); + return RNull.instance; + } + for (int i = 0; i < calls.length - 1; i++) { + calls[i].call(materializedFrame, VOID_EXECUTE); + } + return calls[calls.length - 1].call(materializedFrame, VISIBLE_EXECUTE); + } + + @Override + public RSyntaxNode[] getSyntaxArguments() { + return RASTUtils.asSyntaxNodes(originalSequence); + } + + @Override + public ArgumentsSignature getSyntaxSignature() { + return ArgumentsSignature.empty(originalSequence.length); + } + + private void setOriginalRootNode() { + RootNode fdn = getRootNode(); + for (HugeBlockRootNode brn : rootNodes) { + String oldName = null; + if (LOGGER.isLoggable(Level.FINE)) { + oldName = brn.toString(); + } + brn.setOriginalRootNode(fdn); + if (LOGGER.isLoggable(Level.FINE)) { + LOGGER.log(Level.FINE, " setting fdn {0} for {1} -> {2}", new Object[]{fdn, oldName, brn}); + } + } + } + } + + public abstract static class HugeBlockRootNode extends RootNode { + + @Children protected RNode[] nodes; + + private final SourceSection src; + private final String nameSuffix; + @CompilationFinal private RootNode originalRoot; + + protected HugeBlockRootNode(SourceSection src, String nameSuffix, RNode[] nodes) { + super(RContext.getInstance().getLanguage()); + this.nameSuffix = nameSuffix; + this.src = src; + this.nodes = nodes; + } + + @Override + public SourceSection getSourceSection() { + return src; + } + + protected MaterializedFrame materializeFrame(VirtualFrame frame) { + return (MaterializedFrame) frame.getArguments()[0]; + } + + private void setOriginalRootNode(RootNode fdn) { + CompilerDirectives.transferToInterpreterAndInvalidate(); + this.originalRoot = fdn; + } + + public RootNode getOriginalRootNode() { + return originalRoot; + } + + @Override + public String getName() { + return (originalRoot != null ? originalRoot.getRootNode().getName() : getClass().getSimpleName()) + nameSuffix; + } + + @Override + public String toString() { + return getName() + "@" + Integer.toHexString(hashCode()); + } + + @ExplodeLoop + protected Object voidExecute(VirtualFrame frame) { + MaterializedFrame materializedFrame = materializeFrame(frame); + for (int i = 0; i < nodes.length; i++) { + nodes[i].voidExecute(materializedFrame); + } + return null; + } + + } + + private static final class VoidRootNode extends HugeBlockRootNode { + private VoidRootNode(SourceSection src, String name, RNode[] nodes) { + super(src, name, nodes); + } + + @Override + public Object execute(VirtualFrame frame) { + return voidExecute(frame); + } + } + + private static final class BlockRootNode extends HugeBlockRootNode { + final IntValueProfile executeKindProfile = IntValueProfile.createIdentityProfile(); + + private BlockRootNode(SourceSection src, String name, RNode[] nodes) { + super(src, name, nodes); + } + + @Override + public Object execute(VirtualFrame frame) { + int executeKind = executeKindProfile.profile((int) frame.getArguments()[1]); + switch (executeKind) { + case HugeBlockNode.VOID_EXECUTE: + return voidExecute(frame); + case HugeBlockNode.EXECUTE: + return exec(frame); + case HugeBlockNode.VISIBLE_EXECUTE: + return visibleExec(frame); + default: + throw RInternalError.shouldNotReachHere(); + } + } + + @ExplodeLoop + private Object exec(VirtualFrame frame) { + if (nodes.length == 0) { + return RNull.instance; + } + MaterializedFrame materializedFrame = materializeFrame(frame); + for (int i = 0; i < nodes.length - 1; i++) { + nodes[i].voidExecute(materializedFrame); + } + return nodes[nodes.length - 1].execute(materializedFrame); + } + + @ExplodeLoop + public Object visibleExec(VirtualFrame frame) { + if (nodes.length == 0) { + return RNull.instance; + } + MaterializedFrame materializedFrame = materializeFrame(frame); + for (int i = 0; i < nodes.length - 1; i++) { + nodes[i].voidExecute(materializedFrame); + } + return nodes[nodes.length - 1].visibleExecute(materializedFrame); + } + } + + private static final class NodeCounter implements NodeVisitor { + public int size; + + @Override + public boolean visit(Node node) { + if (!node.getCost().isTrivial()) { + size++; + } + if (node instanceof ReplacementDispatchNode) { + size += 2; + } + return true; + } + } + + private static String classNameAndHash(Object o) { + return o.getClass().getSimpleName() + "@" + Integer.toHexString(o.hashCode()); + } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/AnonymousFrameVariable.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/AnonymousFrameVariable.java index aa2c639b93..9f158abab9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/AnonymousFrameVariable.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/AnonymousFrameVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ */ public final class AnonymousFrameVariable { private static final String BASE_NAME = "*anonymous-"; - private static int id; + private static long id; public static String create(String name) { return BASE_NAME + name + "-" + id++; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/FastROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/FastROptions.java index 2f49c54311..041d918f6a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/FastROptions.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/FastROptions.java @@ -101,6 +101,10 @@ public class FastROptions { public static final OptionKey PromiseCacheSize = new OptionKey<>(3); @Option(category = OptionCategory.INTERNAL, help = "Factor by which are multiplied all DSL 'limit' values where applicable.") // public static final OptionKey DSLCacheSizeFactor = new OptionKey<>(1.0); + @Option(category = OptionCategory.EXPERT, help = "Aproximate block size limit given in AST nodes. Bigger blocks will be split into smaller units.") // + public static final OptionKey BlockSizeLimit = new OptionKey<>(400); + @Option(category = OptionCategory.EXPERT, help = "Skip block size evaluation if amount of direct children nodes is <= than the given value.") // + public static final OptionKey BlockSequenceSizeLimit = new OptionKey<>(5); // Miscellaneous @Option(category = OptionCategory.INTERNAL, help = "Silently ignore unimplemented functions from graphics package") // From 1e3d3181f35f809dd3780265dfe893cc1ae093bf Mon Sep 17 00:00:00 2001 From: stepan Date: Thu, 28 Mar 2019 15:09:46 +0100 Subject: [PATCH 50/71] Update CHANGELOG --- CHANGELOG.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c2361d120..3840e7b8e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,19 @@ # 1.0 RC 15 +* `ActiveBinding` objects do not support the `UNBOX` message anymore +* new Truffle interop converts `double` values to `int` values if they fit in the integer range + * see the changes in the [spec tests](https://github.com/oracle/fastr/commit/e08e2b19571479dddb6167d9a1d492a14cb4c7b2#diff-c842fa11097793b19bd410589c36af99) + Bug fixes: * `rep.int` with value argument of length 0 just returns the value argument +* `tcrossprod` called from `apply` did not give correct result #60 +* `Rf_lengthgets` can accept `NULL` argument + +Added missing R builtins and C APIa + +* simple support for the weak reference API functions (`R_MakeWeakRef`, `R_MakeWeakRefC`, `R_WeakRefKey`, `R_WeakRefValue`) +* `Rf_i1mach` # 1.0 RC 14 From 7e03cb4d56aeb144e52fd293261e5cdcd31b904d Mon Sep 17 00:00:00 2001 From: stepan Date: Thu, 28 Mar 2019 15:10:05 +0100 Subject: [PATCH 51/71] Update MD5 checksums for FastR data.table fork --- com.oracle.truffle.r.pkgs/data.table/MD5 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.oracle.truffle.r.pkgs/data.table/MD5 b/com.oracle.truffle.r.pkgs/data.table/MD5 index 62496cd534..9884b56421 100644 --- a/com.oracle.truffle.r.pkgs/data.table/MD5 +++ b/com.oracle.truffle.r.pkgs/data.table/MD5 @@ -139,10 +139,10 @@ a2a4eb530691106fb68f4851182b66fb *man/transpose.Rd 4d71404f8c7d5b3a9aa93195c22e8f97 *man/truelength.Rd 142dc7a616c9c546ffb9f0bea81cc2d7 *man/tstrsplit.Rd b0073cd226e7dd5777da230830b48587 *src/Makevars -359027a5655626317b2a5e36d25c0c4b *src/assign.c +80e31d31132f3fbbf7e8202848972492 *src/assign.c 059a1ee027698e97d5757cdc6493ba2d *src/between.c 576274f3c51b47a561450f00e8a66999 *src/bmerge.c -9904b8421ce1aa902e0f565034d0965c *src/chmatch.c +ececaa24c7459263f0eb853940e4c2a3 *src/chmatch.c c330f42d232fba7e1871c589457092a2 *src/data.table.h d89a571cb1ac3548042db13a43fab6bc *src/dogroups.c e3d5b289ef4b511e4f89c9838b86cbd0 *src/fastmean.c From 76c97069fc5579188eaa763e5159c8ae1b916305 Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 13 Feb 2019 18:58:56 +0100 Subject: [PATCH 52/71] Some code simplifications --- .../com/oracle/truffle/r/engine/REngine.java | 2 +- .../r/ffi/impl/common/JavaUpCallsRFFIImpl.java | 18 ++++++------------ .../r/ffi/impl/nodes/FFIUpCallNode.java | 4 ++-- .../truffle/r/ffi/impl/nodes/MiscNodes.java | 2 +- .../r/nodes/builtin/RBuiltinPackages.java | 5 +---- .../r/nodes/builtin/base/CompileFunctions.java | 6 ++---- .../nodes/builtin/base/ConditionFunctions.java | 5 ++--- .../builtin/base/ConnectionFunctions.java | 7 ++----- .../nodes/builtin/base/DatePOSIXFunctions.java | 2 +- .../builtin/base/printer/ListPrinter.java | 2 +- .../builtin/base/printer/PrintParameters.java | 2 +- .../truffle/r/nodes/casts/CastUtils.java | 3 +-- .../r/nodes/test/BinaryArithmeticNodeTest.java | 8 +++----- .../r/nodes/test/BinaryBooleanNodeTest.java | 8 +++----- .../access/vector/AccessForeignObjectNode.java | 5 ++--- .../access/vector/RecursiveSubscriptNode.java | 7 ++----- .../attributes/CopyOfRegAttributesNode.java | 2 +- .../attributes/RemoveRegAttributesNode.java | 2 +- .../attributes/SpecialAttributesFunctions.java | 2 +- .../r/nodes/binary/BinaryBooleanNode.java | 4 +--- .../nodes/binary/BinaryBooleanScalarNode.java | 4 +--- .../truffle/r/nodes/builtin/CastBuilder.java | 11 ++++------- .../truffle/r/nodes/builtin/RBuiltinNode.java | 4 ++-- .../r/nodes/function/CallMatcherNode.java | 3 +-- .../r/nodes/objects/DispatchGeneric.java | 6 +----- .../r/nodes/unary/CastDoubleBaseNode.java | 4 ++-- .../r/nodes/unary/CastIntegerBaseNode.java | 6 +++--- .../truffle/r/nodes/unary/CastRawNode.java | 6 +++--- .../unary/UnaryArithmeticBuiltinNode.java | 4 ++-- .../truffle/r/runtime/ArgumentsSignature.java | 5 +---- .../com/oracle/truffle/r/runtime/RDeparse.java | 7 ++----- .../truffle/r/runtime/RInternalError.java | 2 +- .../com/oracle/truffle/r/runtime/ROptions.java | 2 +- .../com/oracle/truffle/r/runtime/RRuntime.java | 2 +- .../com/oracle/truffle/r/runtime/Utils.java | 6 +++--- .../truffle/r/runtime/data/RAttributable.java | 4 ++-- .../truffle/r/runtime/data/RPairList.java | 2 +- .../truffle/r/runtime/data/RRawVector.java | 2 +- .../truffle/r/runtime/env/REnvironment.java | 5 +---- .../com/oracle/truffle/r/runtime/ffi/DLL.java | 10 ++++------ .../oracle/truffle/r/runtime/ffi/DLLRFFI.java | 2 +- .../truffle/r/runtime/ffi/LapackRFFI.java | 3 ++- .../interop/ConvertForeignObjectNode.java | 4 ++-- .../truffle/r/runtime/nmath/Arithmetic.java | 3 ++- .../truffle/r/runtime/nodes/RCodeBuilder.java | 2 +- .../truffle/r/runtime/nodes/RSyntaxUtils.java | 8 ++++---- .../truffle/r/runtime/ops/BinaryLogic.java | 8 ++------ .../com/oracle/truffle/r/runtime/rng/RRNG.java | 5 +++-- .../test/library/utils/TestFastrErrorsLog.java | 2 +- 49 files changed, 90 insertions(+), 138 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java index 679055d494..bf9c8c3df5 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java @@ -685,7 +685,7 @@ private static void printValue(RContext ctx, MaterializedFrame callingFrame, Obj if (result == null) { str = "[polyglot value (null)]"; } else if (result instanceof CharSequence) { - str = "[1] \"" + String.valueOf(result) + "\""; + str = "[1] \"" + result + "\""; } else { str = String.valueOf(result); } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index 4250930fe9..30b022aa69 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -575,8 +575,7 @@ public int TRUELENGTH(Object x) { @Override public int LEVELS(Object x) { if (x instanceof RTypedValue) { - int gpBits = ((RTypedValue) x).getGPBits(); - return gpBits; + return ((RTypedValue) x).getGPBits(); } throw RInternalError.shouldNotReachHere(); } @@ -870,8 +869,7 @@ public void R_unLockBinding(Object sym, Object env) { @Override @TruffleBoundary public Object R_FindNamespace(Object name) { - Object result = RContext.getInstance().stateREnvironment.getNamespaceRegistry().get(RRuntime.asString(name)); - return result; + return RContext.getInstance().stateREnvironment.getNamespaceRegistry().get(RRuntime.asString(name)); } @Override @@ -889,8 +887,7 @@ public Object Rf_findFun(Object symbolObj, Object envObj) { // Works but not remotely efficient Source source = RSource.fromTextInternal("get(\"" + symbol.getName() + "\", mode=\"function\")", RSource.Internal.RF_FINDFUN); try { - Object result = RContext.getEngine().parseAndEval(source, env.getFrame(), false); - return result; + return RContext.getEngine().parseAndEval(source, env.getFrame(), false); } catch (ParseException ex) { throw RInternalError.shouldNotReachHere(ex); } @@ -900,8 +897,7 @@ public Object Rf_findFun(Object symbolObj, Object envObj) { @TruffleBoundary public Object Rf_GetOption1(Object tag) { guaranteeInstanceOf(tag, RSymbol.class); - Object result = RContext.getInstance().stateROptions.getValue(((RSymbol) tag).getName()); - return result; + return RContext.getInstance().stateROptions.getValue(((RSymbol) tag).getName()); } @Override @@ -1282,7 +1278,7 @@ public Object R_getContextEnv(Object c) { if (RArguments.getCall(frame) == rCaller) { return REnvironment.frameToEnvironment(frame.materialize()); } else { - Object result = Utils.iterateRFrames(FrameAccess.READ_ONLY, new Function() { + return Utils.iterateRFrames(FrameAccess.READ_ONLY, new Function() { @Override public Object apply(Frame f) { @@ -1294,7 +1290,6 @@ public Object apply(Frame f) { } } }); - return result; } } @@ -1309,7 +1304,7 @@ public Object R_getContextFun(Object c) { if (RArguments.getCall(frame) == rCaller) { return RArguments.getFunction(frame); } else { - Object result = Utils.iterateRFrames(FrameAccess.READ_ONLY, new Function() { + return Utils.iterateRFrames(FrameAccess.READ_ONLY, new Function() { @Override public Object apply(Frame f) { @@ -1321,7 +1316,6 @@ public Object apply(Frame f) { } } }); - return result; } } diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallNode.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallNode.java index b5726a116d..eef8891b48 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallNode.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/FFIUpCallNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ public abstract class FFIUpCallNode extends Node { protected abstract int numArgs(); @TruffleBoundary - protected static final RError unsupportedTypes(String name, Object... args) { + protected static RError unsupportedTypes(String name, Object... args) { assert args.length > 0; StringBuilder sb = new StringBuilder(args.length * 15); sb.append("wrong argument types provided to ").append(name).append(": ").append(Utils.getTypeName(args[0])); diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java index caf65efa12..aa15d4deea 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/MiscNodes.java @@ -519,7 +519,7 @@ protected Object doIt(RTypedValue target, int flag) { RStringVector clazz = getClass((RSharingAttributeStorage) target); if (clazz != null && clazz.getLength() != 0) { CompilerDirectives.transferToInterpreter(); - throw RError.error(RError.NO_CALLER, Message.GENERIC, String.format("SET_OBJECT(SEXP, 0) not implemented for SEXP with 'class' attribute")); + throw RError.error(RError.NO_CALLER, Message.GENERIC, "SET_OBJECT(SEXP, 0) not implemented for SEXP with 'class' attribute"); } } return RNull.instance; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java index 97b7b1745a..1e492ee082 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/RBuiltinPackages.java @@ -200,9 +200,6 @@ public RBuiltinFactory lookupBuiltinDescriptor(String name) { public boolean isPrimitiveBuiltin(String name) { RBuiltinPackage pkg = basePackage; RBuiltinDescriptor rbf = pkg.lookupByName(name); - if (rbf != null && rbf.getKind() != RBuiltinKind.INTERNAL) { - return true; - } - return false; + return rbf != null && rbf.getKind() != RBuiltinKind.INTERNAL; } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CompileFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CompileFunctions.java index ea9d84f3b4..a19ac7341e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CompileFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/CompileFunctions.java @@ -188,8 +188,7 @@ public abstract static class Growconst extends RBuiltinNode.Arg1 { @Specialization protected RList growconst(RList constBuf) { int n = constBuf.getLength(); - RList ret = (RList) constBuf.copyResized(n << 1, true); - return ret; + return (RList) constBuf.copyResized(n << 1, true); } } @@ -240,8 +239,7 @@ protected RList getconst(RAbstractVector constBuf, int n) { if (n < 0 || n > constBuf.getLength()) { throw RError.error(this, RError.Message.BAD_CONSTANT_COUNT); } - RList ret = (RList) constBuf.copyResized(n, false); - return ret; + return (RList) constBuf.copyResized(n, false); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java index 9ed0a6b7ee..8852275dc2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConditionFunctions.java @@ -1,7 +1,7 @@ /* * Copyright (c) 1995-2015, The R Core Team * Copyright (c) 2003, The R Foundation - * Copyright (c) 2015, 2018, Oracle and/or its affiliates + * Copyright (c) 2015, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,8 +152,7 @@ public abstract static class GetRestart extends RBuiltinNode.Arg1 { @Specialization protected Object getRestart(int index) { - Object result = RErrorHandling.getRestart(index); - return result; + return RErrorHandling.getRestart(index); } } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java index 31d5c3aede..da0d65bd49 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java @@ -1277,9 +1277,7 @@ public abstract static class Fifo extends RBuiltinNode.Arg4 { @Specialization @TruffleBoundary - protected RAbstractIntVector fifo(String path, String openArg, boolean blocking, String encoding) { - - String open = openArg; + protected RAbstractIntVector fifo(String path, String open, boolean blocking, String encoding) { try { return new FifoRConnection(RContext.getInstance().getEnv(), path, open, blocking, encoding).asVector(); } catch (IOException ex) { @@ -1305,9 +1303,8 @@ public abstract static class Pipe extends RBuiltinNode.Arg3 { @TruffleBoundary protected RAbstractIntVector pipe(String path, String openArg, String encoding) { - String open = openArg; try { - return new PipeRConnection(path, open, encoding).asVector(); + return new PipeRConnection(path, openArg, encoding).asVector(); } catch (IOException ex) { warning(RError.Message.CANNOT_OPEN_FIFO, path); throw error(RError.Message.CANNOT_OPEN_CONNECTION); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java index d10511292c..b3934212aa 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DatePOSIXFunctions.java @@ -471,7 +471,7 @@ protected RList strptime(RAbstractStringVector x, RAbstractStringVector format, LocalTime tm = LocalTime.from(parse); time = LocalDateTime.of(LocalDate.now(), tm); } - double ms = (time.toInstant(ZoneOffset.UTC).toEpochMilli() % 1000) / 1000; + double ms = (time.toInstant(ZoneOffset.UTC).toEpochMilli() % 1000) / 1000.0; builder.setEntry(i, time.getSecond() + ms, time.getMinute(), time.getHour(), time.getDayOfMonth(), time.getMonthValue() - 1, time.getYear() - 1900, time.getDayOfWeek().ordinal(), time.getDayOfYear(), 0); continue; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/ListPrinter.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/ListPrinter.java index bca9d4618f..37779d466e 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/ListPrinter.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/ListPrinter.java @@ -56,7 +56,7 @@ private ListPrinter() { // singleton } - private static int TAGBUFLEN = 256; + private static final int TAGBUFLEN = 256; @Override @TruffleBoundary diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/PrintParameters.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/PrintParameters.java index 26a21bbafe..a529b6c536 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/PrintParameters.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/printer/PrintParameters.java @@ -90,7 +90,7 @@ public PrintParameters() { if (printGap != RNull.instance) { this.gap = RRuntime.asInteger(printGap); if (this.gap == RRuntime.INT_NA || this.gap < 0) { - throw new IllegalArgumentException(String.format("'gap' must be non-negative integer")); + throw new IllegalArgumentException("'gap' must be non-negative integer"); } } diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java index 92130328ac..101f3219e5 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/casts/CastUtils.java @@ -360,8 +360,7 @@ public static Cast.Coverage isConvertible(Type actualInputType, Type formalInput UpperBoundsConjunction from = UpperBoundsConjunction.fromType(actualInputType); UpperBoundsConjunction to = UpperBoundsConjunction.fromType(formalInputType); - Cast.Coverage result = to.coverageFrom(from, includeImplicits); - return result; + return to.coverageFrom(from, includeImplicits); } public static boolean hasImplicitCast(Type actualInputCls, Type formalInputCls) { diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryArithmeticNodeTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryArithmeticNodeTest.java index e2f9e06895..f6b18d6293 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryArithmeticNodeTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryArithmeticNodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -173,9 +173,7 @@ private static boolean isShareable(RAbstractVector a, RType resultType) { } if (a instanceof RShareable) { - if (((RShareable) a).isTemporary()) { - return true; - } + return ((RShareable) a).isTemporary(); } return false; } @@ -261,7 +259,7 @@ public void testCompleteness(BinaryArithmeticFactory factory, RAbstractVector aO Object result = executeArithmetic(factory, a, b); - boolean resultComplete = isPrimitive(result) ? true : ((RAbstractVector) result).isComplete(); + boolean resultComplete = isPrimitive(result) || ((RAbstractVector) result).isComplete(); if (a.getLength() == 0 || b.getLength() == 0) { Assert.assertTrue(resultComplete); diff --git a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryBooleanNodeTest.java b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryBooleanNodeTest.java index b7db7d5b52..262c501f36 100644 --- a/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryBooleanNodeTest.java +++ b/com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/BinaryBooleanNodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,9 +171,7 @@ private static boolean isShareable(RAbstractVector a, RType resultType) { } if (a instanceof RShareable) { - if (((RShareable) a).isTemporary()) { - return true; - } + return ((RShareable) a).isTemporary(); } return false; } @@ -249,7 +247,7 @@ public void testCompleteness(BooleanOperationFactory factory, RAbstractVector aO Object result = executeArithmetic(factory, a, b); - boolean resultComplete = isPrimitive(result) ? true : ((RAbstractVector) result).isComplete(); + boolean resultComplete = isPrimitive(result) || ((RAbstractVector) result).isComplete(); if (a.getLength() == 0 || b.getLength() == 0) { Assert.assertTrue(resultComplete); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/AccessForeignObjectNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/AccessForeignObjectNode.java index fdaa95a7dd..b88c7d6ec4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/AccessForeignObjectNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/AccessForeignObjectNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -174,12 +174,11 @@ protected Object writeField(TruffleObject object, Object[] positions, Object val @Cached("create()") ReadElementNode readElement, @Cached("create()") WriteElementNode writeElement, @Cached("create()") VectorLengthProfile lengthProfile) { - Object writtenValue = value; TruffleObject result = object; for (int i = 0; i < lengthProfile.profile(positions.length) - 1; i++) { result = (TruffleObject) readElement.execute(positions[i], result); } - writeElement.execute(positions[positions.length - 1], result, writtenValue); + writeElement.execute(positions[positions.length - 1], result, value); return object; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/RecursiveSubscriptNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/RecursiveSubscriptNode.java index f7017fd3b9..607146e658 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/RecursiveSubscriptNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/access/vector/RecursiveSubscriptNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,10 +40,7 @@ abstract class RecursiveSubscriptNode extends RBaseNode { } public final boolean isSupported(Object vector, Object[] positions) { - if (vector.getClass() == vectorClass && positions.length == 1 && positions[0].getClass() == positionClass) { - return true; - } - return false; + return vector.getClass() == vectorClass && positions.length == 1 && positions[0].getClass() == positionClass; } protected final RError indexingFailed(int i) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java index 8904ed3caf..8d0c42a0e0 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/CopyOfRegAttributesNode.java @@ -68,7 +68,7 @@ protected void copyNoAttributes(@SuppressWarnings("unused") RAttributeStorage so // nothing to do } - protected static final boolean emptyAttributes(RAttributeStorage source) { + protected static boolean emptyAttributes(RAttributeStorage source) { DynamicObject attributes = source.getAttributes(); return attributes == null || attributes.isEmpty(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveRegAttributesNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveRegAttributesNode.java index fcfa3430c6..5ddd853ea2 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveRegAttributesNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/RemoveRegAttributesNode.java @@ -65,7 +65,7 @@ protected void copyNoAttributes(@SuppressWarnings("unused") RAttributeStorage so // nothing to do } - protected static final boolean emptyAttributes(RAttributeStorage source) { + protected static boolean emptyAttributes(RAttributeStorage source) { DynamicObject attributes = source.getAttributes(); return attributes == null || attributes.isEmpty(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java index bf5b22dd55..4e82eb7e3d 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/attributes/SpecialAttributesFunctions.java @@ -1269,7 +1269,7 @@ public final RStringVector getClassAttr(Object x) { } public final boolean isObject(Object x) { - return getClassAttr(x) != null ? true : false; + return getClassAttr(x) != null; } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java index 254efa6527..7a7f8537e3 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanNode.java @@ -139,10 +139,8 @@ protected boolean isSupported(Object left, Object right) { if (isLogicOp(factory) && left instanceof RAbstractRawVector && right instanceof RAbstractRawVector) { // for logic ops only both raw vectors are supported return true; - } else if (isSupportedVector(left) && isSupportedVector(right)) { - return true; } - return false; + return isSupportedVector(left) && isSupportedVector(right); } protected boolean isSupportedVector(Object value) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java index 69d0b60788..3aefe9567b 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/binary/BinaryBooleanScalarNode.java @@ -64,14 +64,12 @@ public abstract class BinaryBooleanScalarNode extends RBuiltinNode.Arg2 { @Child private BoxPrimitiveNode rightBox; @Child private PromiseCheckHelperNode promiseHelper; - private final BooleanOperation booleanLogic; - static { Casts.noCasts(BinaryBooleanScalarNode.class); } BinaryBooleanScalarNode(BooleanOperationFactory factory) { - this.booleanLogic = factory.createOperation(); + BooleanOperation booleanLogic = factory.createOperation(); logic = new BinaryMapBooleanFunctionNode(booleanLogic); leftCast = LogicalScalarCastNodeGen.create(booleanLogic.opName(), "x", logic.getLeftNACheck()); leftBox = BoxPrimitiveNodeGen.create(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java index a28127dffd..63ad662d1f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/CastBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -704,14 +704,12 @@ public static TypeFilter anyValue() { */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Filter validVarArgs() { - Filter f = integerValue().or(doubleValue()).or(logicalValue()); - return f; + return (Filter) integerValue().or(doubleValue()).or(logicalValue()); } @SuppressWarnings({"rawtypes", "unchecked"}) public static Filter numericValue() { - Filter f = integerValue().or(doubleValue()).or(logicalValue()); - return f; + return (Filter) integerValue().or(doubleValue()).or(logicalValue()); } /** @@ -720,8 +718,7 @@ public static Filter numericValue() { */ @SuppressWarnings({"rawtypes", "unchecked"}) public static Filter abstractVectorValue() { - Filter f = numericValue().or(stringValue()).or(complexValue()).or(rawValue()).or(instanceOf(RAbstractListVector.class)); - return f; + return (Filter) numericValue().or(stringValue()).or(complexValue()).or(rawValue()).or(instanceOf(RAbstractListVector.class)); } public static Filter atomicIntegerValue() { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java index 60c60d6f14..a80151231f 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/RBuiltinNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ public Object[] getDefaultParameterValues() { return EMPTY_OBJECT_ARRAY; } - public static final RBuiltinNode inline(RBuiltinDescriptor factory) { + public static RBuiltinNode inline(RBuiltinDescriptor factory) { // static number of arguments return ((RBuiltinFactory) factory).getConstructor().get(); } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java index 8f4109bb79..5a5364dd35 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java @@ -464,8 +464,7 @@ public static RArgsValuesAndNames reorderArguments(Object[] args, RFunction func RArgsValuesAndNames evaledArgs = new RArgsValuesAndNames(argValues, signature); // ...to match them against the chosen function's formal arguments - RArgsValuesAndNames evaluated = ArgumentMatcher.matchArgumentsEvaluated((RRootNode) function.getRootNode(), evaledArgs, null, callingNode); - return evaluated; + return ArgumentMatcher.matchArgumentsEvaluated((RRootNode) function.getRootNode(), evaledArgs, null, callingNode); } protected static Object checkMissing(Object value) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/DispatchGeneric.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/DispatchGeneric.java index 16e0def044..99602c1f18 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/DispatchGeneric.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/DispatchGeneric.java @@ -120,11 +120,7 @@ protected boolean equalClasses(RStringVector classes, RStringVector cachedClasse // anwyay if (!Utils.fastPathIdentityEquals(cachedClasses.getDataAt(i), classes.getDataAt(i))) { equalsMethodRequired.enter(); - if (cachedClasses.getDataAt(i).equals(classes.getDataAt(i))) { - return true; - } else { - return false; - } + return cachedClasses.getDataAt(i).equals(classes.getDataAt(i)); } } return true; diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleBaseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleBaseNode.java index dee35f5efb..c389c6e568 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleBaseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastDoubleBaseNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -116,7 +116,7 @@ protected double doString(String operand, } double result = RRuntime.string2doubleNoCheck(operand); if (RRuntime.isNA(result)) { - warning(warningContext() != null ? warningContext() : null, RError.Message.NA_INTRODUCED_COERCION); + warning(warningContext(), RError.Message.NA_INTRODUCED_COERCION); } return result; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerBaseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerBaseNode.java index 549c1c8b8a..13844f92b4 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerBaseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastIntegerBaseNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -130,14 +130,14 @@ protected int doCharacter(String operand, naCheck.enable(d); if (naCheck.checkNAorNaN(d)) { if (naCheck.check(d)) { - warning(warningContext() != null ? warningContext() : null, RError.Message.NA_INTRODUCED_COERCION); + warning(warningContext(), RError.Message.NA_INTRODUCED_COERCION); } return RRuntime.INT_NA; } int result = naCheck.convertDoubleToInt(d); naCheck.enable(result); if (naCheck.check(result)) { - warning(warningContext() != null ? warningContext() : null, RError.Message.NA_INTRODUCED_COERCION_INT); + warning(warningContext(), RError.Message.NA_INTRODUCED_COERCION_INT); } return result; } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java index 265bd3e30a..7020937d4c 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/CastRawNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -177,14 +177,14 @@ protected RRaw doString(String operand, naCheck.enable(d); if (naCheck.checkNAorNaN(d)) { if (naCheck.check(d)) { - warning(warningContext() != null ? warningContext() : null, RError.Message.NA_INTRODUCED_COERCION); + warning(warningContext(), RError.Message.NA_INTRODUCED_COERCION); } intValue = RRuntime.INT_NA; } else { intValue = naCheck.convertDoubleToInt(d); naCheck.enable(intValue); if (naCheck.check(intValue)) { - warning(warningContext() != null ? warningContext() : null, RError.Message.NA_INTRODUCED_COERCION_INT); + warning(warningContext(), RError.Message.NA_INTRODUCED_COERCION_INT); } } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticBuiltinNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticBuiltinNode.java index e2c752836f..916999001e 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticBuiltinNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/UnaryArithmeticBuiltinNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ public final class UnaryArithmeticBuiltinNode extends RBuiltinNode.Arg1 { - { + static { Casts casts = new Casts(UnaryArithmeticBuiltinNode.class); casts.arg(0).boxPrimitive(); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ArgumentsSignature.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ArgumentsSignature.java index 82e60a580e..22723e53c3 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ArgumentsSignature.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ArgumentsSignature.java @@ -232,10 +232,7 @@ public boolean equals(Object obj) { if (length != other.length) { return false; } - if (!Arrays.equals(names, other.names)) { - return false; - } - return true; + return Arrays.equals(names, other.names); } @Override diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java index 2487e5d155..fcf79a4b5d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RDeparse.java @@ -904,7 +904,7 @@ private DeparseVisitor appendValue(Object v) { } if (v instanceof CharSXPWrapper) { - sb.append(""); + sb.append(""); return this; } @@ -1303,10 +1303,7 @@ public static boolean isValidName(String name) { if (name.equals("...")) { return true; } - if (keywords.contains(name)) { - return false; - } - return true; + return !keywords.contains(name); } private static char safeCharAt(String s, int i) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java index 708c580f5c..276edd0530 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RInternalError.java @@ -258,7 +258,7 @@ private static boolean getOption(OptionKey key, RContext ctx) { } private static String getLogFileName(int contextId) { - return contextId == 0 ? FASTR_ERRORS_LOG : FASTR_ERRORS_LOG + "-" + Integer.toString(contextId); + return contextId == 0 ? FASTR_ERRORS_LOG : FASTR_ERRORS_LOG + "-" + contextId; } @Override diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ROptions.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ROptions.java index d629f3bcf0..4e767f53e8 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ROptions.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ROptions.java @@ -170,7 +170,7 @@ private static void applyDefaults(HashMap map, RStartParams star map.put("continue", RDataFactory.createSharedStringVectorFromScalar("+ ")); map.put("deparse.cutoff", RDataFactory.createSharedIntVectorFromScalar(60)); map.put("digits", RDataFactory.createSharedIntVectorFromScalar(7)); - map.put("echo", RDataFactory.createSharedLogicalVectorFromScalar(startParams.isSlave() ? false : true)); + map.put("echo", RDataFactory.createSharedLogicalVectorFromScalar(!startParams.isSlave())); map.put("encoding", RDataFactory.createSharedStringVectorFromScalar("native.enc")); map.put("expressions", RDataFactory.createSharedIntVectorFromScalar(5000)); boolean keepPkgSource = optionFromEnvVar("R_KEEP_PKG_SOURCE", envVars); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index 504026ad52..713dd328f4 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -838,7 +838,7 @@ public static String escapeString(String value, boolean encodeNonASCII, boolean if (codepoint < 32 || codepoint == 0x7f) { str.append("\\").append(codepoint >>> 6).append((codepoint >>> 3) & 0x7).append(codepoint & 0x7); } else if (encodeNonASCII && codepoint > 0x7f && codepoint <= 0xff) { - str.append("\\x" + Integer.toHexString(codepoint)); + str.append("\\x").append(Integer.toHexString(codepoint)); } else if (codepoint > 64967) { // determined by experimentation if (codepoint < 0x10000) { str.append("\\u").append(String.format("%04x", codepoint)); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java index 045290cdbc..e73c84d0d9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java @@ -259,7 +259,7 @@ public static Path getLogPath(String fileNamePrefix) { } int pid = RContext.getInitialPid(); // Do not use PID if it was not set yet (logging/error during initialization) - String pidStr = pid == 0 ? "" : "_pid" + Integer.toString(pid); + String pidStr = pid == 0 ? "" : "_pid" + pid; String baseName = fileNamePrefix + pidStr + ".log"; while (true) { if (dir != null) { @@ -394,13 +394,13 @@ public static String getDebugInfo(Object value) { */ public static void printDebugInfo(StringBuilder sb, Object arg) { if (arg instanceof RSymbol) { - sb.append("\"" + arg.toString() + "\""); + sb.append("\"").append(arg.toString()).append("\""); } else if (arg instanceof RAbstractVector) { RAbstractVector vec = (RAbstractVector) arg; if (vec.getLength() == 0) { sb.append("empty"); } else { - sb.append("len:" + vec.getLength() + ";data:"); + sb.append("len:").append(vec.getLength()).append(";data:"); for (int i = 0; i < Math.min(3, vec.getLength()); i++) { String str = ((RAbstractVector) arg).getDataAtAsObject(0).toString(); str = str.length() > 30 ? str.substring(0, 27) + "..." : str; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java index c72d546450..76a69fba25 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RAttributable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -126,7 +126,7 @@ default RStringVector getClassAttr() { * Returns {@code true} if and only if the value has a {@code class} attribute added explicitly. */ default boolean isObject() { - return getClassAttr() != null ? true : false; + return getClassAttr() != null; } static void copyAttributes(RAttributable obj, DynamicObject attrs) { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java index a019f30aaa..6acd7dbcf9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RPairList.java @@ -441,7 +441,7 @@ public RAbstractContainer resize(int size) { @Override public boolean hasDimensions() { - return isLanguage() ? false : true; + return !isLanguage(); } @Override diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java index b48844d3a1..eb4cb2cd05 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/data/RRawVector.java @@ -194,7 +194,7 @@ protected RRawVector internalCopyResized(int size, boolean fillNA, int[] dimensi @Override public RRawVector createEmptySameType(int newLength, boolean newIsComplete) { - assert newIsComplete == true; + assert newIsComplete; return RDataFactory.createRawVector(new byte[newLength]); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java index 7108e1e6f7..86ce55f672 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/env/REnvironment.java @@ -1147,10 +1147,7 @@ public static boolean includeName(String nameToMatch, boolean allNames, Pattern if (pattern != null && !pattern.matcher(nameToMatch).matches()) { return false; } - if (AnonymousFrameVariable.isAnonymous(nameToMatch)) { - return false; - } - return true; + return !AnonymousFrameVariable.isAnonymous(nameToMatch); } /** diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java index e01e706872..18a36f3e18 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLL.java @@ -617,8 +617,7 @@ public DLLInfo execute(String path, boolean local, boolean now) throws DLLExcept private synchronized DLLInfo doLoad(String absPath, boolean local, boolean now, boolean addToList) throws DLLException { try { LibHandle handle = dlOpenNode.execute(absPath, local, now); - DLLInfo dllInfo = DLLInfo.create(libName(absPath), absPath, true, handle, addToList); - return dllInfo; + return DLLInfo.create(libName(absPath), absPath, true, handle, addToList); } catch (UnsatisfiedLinkError ex) { String dlError = ex.getMessage(); if (RContext.isInitialContextInitialized()) { @@ -803,8 +802,7 @@ public SymbolHandle execute(DLLInfo dllInfo, String name, RegisteredNativeSymbol if (dllInfo.unsuccessfulLookups.contains(mName)) { return SYMBOL_NOT_FOUND; } - SymbolHandle symValue = dlSymNode.execute(dllInfo.handle, mName); - return symValue; + return dlSymNode.execute(dllInfo.handle, mName); } catch (UnsatisfiedLinkError ex) { dllInfo.unsuccessfulLookups.add(mName); return SYMBOL_NOT_FOUND; @@ -870,13 +868,13 @@ public static SymbolHandle findSymbol(String name, DLLInfo dllInfo) { public static int useDynamicSymbols(DLLInfo dllInfo, int value) { int old = dllInfo.dynamicLookup ? 1 : 0; - dllInfo.dynamicLookup = value == 0 ? false : true; + dllInfo.dynamicLookup = value != 0; return old; } public static int forceSymbols(DLLInfo dllInfo, int value) { int old = dllInfo.forceSymbols ? 1 : 0; - dllInfo.forceSymbols = value == 0 ? false : true; + dllInfo.forceSymbols = value != 0; return old; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLLRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLLRFFI.java index 461448b911..3686da711c 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLLRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/DLLRFFI.java @@ -123,7 +123,7 @@ public static RootCallTarget create(RContext context) { } } - public interface LibHandle { + interface LibHandle { RFFIFactory.Type getRFFIType(); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java index cf729fced3..93c33ea8fd 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ffi/LapackRFFI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,7 @@ private IlaverNode(DownCallNodeFactory factory) { } public void execute(int[] version) { + // Note: primitive array is not treated as varagrs call(version); } } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ConvertForeignObjectNode.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ConvertForeignObjectNode.java index 904d9eaf39..55ab0bb925 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ConvertForeignObjectNode.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ConvertForeignObjectNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -417,7 +417,7 @@ protected Object convertObjectToList(TruffleObject truffleObject, boolean recurs } RStringVector names = (RStringVector) namesObj; List elements = new ArrayList<>(); - List elementNames = new ArrayList<>(); + List elementNames = new ArrayList<>(); for (int i = 0; i < names.getLength(); i++) { String name = names.getDataAt(i); try { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Arithmetic.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Arithmetic.java index 69da068437..2d98358000 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Arithmetic.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nmath/Arithmetic.java @@ -2,7 +2,7 @@ * Copyright (c) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka * Copyright (c) 1998-2013, The R Core Team * Copyright (c) 2003-2015, The R Foundation - * Copyright (c) 2016, 2018, Oracle and/or its affiliates + * Copyright (c) 2016, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,6 +133,7 @@ public static double powDi(double initialX, int initialN) { n = -n; } for (;;) { + // Note: the octal literal is intentional if ((n & 01) != 0) { xn *= x; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java index 9cd72974bd..aea6329b70 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RCodeBuilder.java @@ -207,7 +207,7 @@ protected T visit(RSyntaxFunction element) { static ArrayList> createArgumentList(ArgumentsSignature signature, T[] arguments) { ArrayList> args = new ArrayList<>(arguments.length); for (int i = 0; i < arguments.length; i++) { - args.add(RCodeBuilder.argument(null, signature.getName(i), arguments[i] == null ? null : arguments[i])); + args.add(RCodeBuilder.argument(null, signature.getName(i), arguments[i])); } return args; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxUtils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxUtils.java index 676325c2e2..2107d90a90 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxUtils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/nodes/RSyntaxUtils.java @@ -54,14 +54,14 @@ protected String visit(RSyntaxCall element) { RSyntaxElement[] arguments = element.getSyntaxArguments(); ArgumentsSignature callSignature = element.getSyntaxSignature(); if (lhs instanceof RSyntaxLookup && "{".equals(((RSyntaxLookup) lhs).getIdentifier())) { - str.append("\n" + space() + "{"); + str.append("\n").append(space()).append("{"); level++; for (int i = 0; i < arguments.length; i++) { RSyntaxElement child = arguments[i]; - str.append("\n" + space() + accept(child)); + str.append("\n").append(space()).append(accept(child)); } level--; - str.append("\n" + space() + "}\n" + space()); + str.append("\n").append(space()).append("}\n").append(space()); } else { str.append(accept(lhs)); printArguments(str, arguments, callSignature); @@ -73,7 +73,7 @@ private void printArguments(StringBuilder str, RSyntaxElement[] arguments, Argum str.append('('); for (int i = 0; i < arguments.length; i++) { RSyntaxElement child = arguments[i]; - str.append((i > 0 ? ", " : "") + (callSignature.getName(i) == null ? "" : callSignature.getName(i) + "=") + (child == null ? "" : accept(child))); + str.append(i > 0 ? ", " : "").append(callSignature.getName(i) == null ? "" : callSignature.getName(i) + "=").append(child == null ? "" : accept(child)); } str.append(')'); } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryLogic.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryLogic.java index 290a793fca..72bf0acd30 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryLogic.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/ops/BinaryLogic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,11 +98,7 @@ public String opName() { @Override public boolean requiresRightOperand(byte leftOperand) { - if (leftOperand == RRuntime.LOGICAL_TRUE) { - return true; - } else { - return false; - } + return leftOperand == RRuntime.LOGICAL_TRUE; } @Override diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java index e15cdb1aaa..d23245dcf6 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/rng/RRNG.java @@ -1,7 +1,7 @@ /* * Copyright (c) 1995-2012, The R Core Team * Copyright (c) 2003, The R Foundation - * Copyright (c) 2014, 2018, Oracle and/or its affiliates + * Copyright (c) 2014, 2019, Oracle and/or its affiliates * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ package com.oracle.truffle.r.runtime.rng; import java.lang.ref.WeakReference; +import java.util.Objects; import java.util.function.Supplier; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; @@ -289,7 +290,7 @@ private static void changeKindsAndInitGenerator(Integer newSeed, int kindAsInt, // re-read unconditionally since it may change in updateCurrentGenerator rng = getContextState().currentGenerator; - if (newSeed != SAME_SEED) { + if (!Objects.equals(newSeed, SAME_SEED)) { initGenerator(rng, newSeed); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java index 4772204d5a..70ced39410 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/utils/TestFastrErrorsLog.java @@ -71,7 +71,7 @@ public void testThrowInternalError() throws Exception { String fastrErrorsLog = "fastr_errors"; // Copy of // RInternalError.FASTR_ERRORS_LOG int pid = RContext.getInitialPid(); - String baseName = fastrErrorsLog + "_pid" + Integer.toString(pid) + ".log"; + String baseName = fastrErrorsLog + "_pid" + pid + ".log"; if (RContext.isEmbedded()) { String dir1 = System.getProperty("java.io.tmpdir"); Path path1 = FileSystems.getDefault().getPath(dir1, baseName); From e605dbb9ab49f2a6764f9309fdea7b7ba8a75b28 Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Fri, 29 Mar 2019 07:49:56 +0100 Subject: [PATCH 53/71] Pkgtest: fix default numbers for testfiles. --- com.oracle.truffle.r.test.packages/pkgtest/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.test.packages/pkgtest/__init__.py b/com.oracle.truffle.r.test.packages/pkgtest/__init__.py index 85ff62f84a..34b316758e 100644 --- a/com.oracle.truffle.r.test.packages/pkgtest/__init__.py +++ b/com.oracle.truffle.r.test.packages/pkgtest/__init__.py @@ -317,7 +317,15 @@ class TestFileStatus: def __init__(self, status, abspath): self.status = status self.abspath = abspath - self.report = 0, 1, 0 + if status == "OK": + # At this point, status == "OK" means that we had no '.fail' output file and we will investigate the single + # test cases. So, initially we claim the test was skipped because if GnuR failed on the test, we state that + # we skipped it. + self.report = 0, 1, 0 + elif status == "FAILED": + self.report = 0, 0, 1 + else: + raise ValueError('Invalid test file status: %s (allowed: "OK", "FAILED")' % status) class TestStatus: From 6a678e7a8bf0748404d39f1c37ef0f1a8ea4f68c Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Fri, 29 Mar 2019 07:51:14 +0100 Subject: [PATCH 54/71] Pkgtest: do not clean package on error (improves package caching). --- com.oracle.truffle.r.test.packages/r/install.cache.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/com.oracle.truffle.r.test.packages/r/install.cache.R b/com.oracle.truffle.r.test.packages/r/install.cache.R index 05aaa8d3ed..03578a4dfa 100644 --- a/com.oracle.truffle.r.test.packages/r/install.cache.R +++ b/com.oracle.truffle.r.test.packages/r/install.cache.R @@ -719,11 +719,11 @@ pkg.cache.full.install <- function(install.candidate.names, contriburl, lib.inst # override packages need to be installed differently if (length(pkgs.in.overrides) > 0) { - install.fastr.packages(as.character(pkgs.in.overrides), lib=lib.install, INSTALL_opts="--install-tests") + install.fastr.packages(as.character(pkgs.in.overrides), lib=lib.install, INSTALL_opts="--install-tests --no-clean-on-error") } if (length(pkgs.not.in.overrides) > 0) { - install.packages(as.character(pkgs.not.in.overrides), contriburl=contriburl, type="source", lib=lib.install, INSTALL_opts="--install-tests") + install.packages(as.character(pkgs.not.in.overrides), contriburl=contriburl, type="source", lib=lib.install, INSTALL_opts="--install-tests --no-clean-on-error") } } From 295b52c6b74e6390cbe5df6cd28e1ddd73251c36 Mon Sep 17 00:00:00 2001 From: Miloslav Metelka Date: Fri, 22 Mar 2019 12:04:29 +0100 Subject: [PATCH 55/71] Proper implementation of the Sys.localeconv. --- .../r/nodes/builtin/base/LocaleFunctions.java | 81 ++++++++++++++++++- .../truffle/r/test/ExpectedTestOutput.test | 9 +++ .../builtins/TestBuiltin_Syssetlocale.java | 8 +- 3 files changed, 93 insertions(+), 5 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java index 6a81975872..6bed5af011 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/LocaleFunctions.java @@ -36,6 +36,9 @@ import java.nio.charset.Charset; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; +import java.text.NumberFormat; +import java.util.Currency; +import java.util.Locale; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.dsl.Specialization; @@ -127,10 +130,80 @@ public abstract static class LocaleConv extends RBuiltinNode.Arg0 { @Specialization @TruffleBoundary protected Object localeconv() { - DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(); - DecimalFormatSymbols symbols = format.getDecimalFormatSymbols(); - char sep = symbols.getDecimalSeparator(); - return RDataFactory.createList(new Object[]{sep}, RDataFactory.createStringVectorFromScalar("decimal_point")); + RLocale.ContextStateImpl stateRLocale = RContext.getInstance().stateRLocale; + Locale numericLocale = stateRLocale.getLocale(RLocale.NUMERIC); + Locale monetaryLocale = stateRLocale.getLocale(RLocale.MONETARY); + NumberFormat numericFormat = NumberFormat.getNumberInstance(numericLocale); + NumberFormat monetaryFormat = NumberFormat.getInstance(monetaryLocale); + DecimalFormatSymbols decimalSymbols = DecimalFormatSymbols.getInstance(numericLocale); + DecimalFormatSymbols monetarySymbols = DecimalFormatSymbols.getInstance(monetaryLocale); + Currency currency = monetarySymbols.getCurrency(); + + int len = 18; + int i = 0; + String[] values = new String[len]; + String[] names = new String[len]; + names[i] = "decimal_point"; + values[i++] = String.valueOf(decimalSymbols.getDecimalSeparator()); + names[i] = "thousands_sep"; // for non-monetary quantities + values[i++] = numericFormat.isGroupingUsed() ? String.valueOf(decimalSymbols.getGroupingSeparator()) : ""; + names[i] = "grouping"; + StringBuilder grouping = new StringBuilder(2); + if (numericFormat.isGroupingUsed() && (numericFormat instanceof DecimalFormat)) { + int groupingSize = ((DecimalFormat) numericFormat).getGroupingSize(); + for (int j = 2; j > 0; j--) { + grouping.append((char) groupingSize); + } + grouping.setLength(0); + } + values[i++] = grouping.toString(); + names[i] = "int_curr_symbol"; + values[i++] = monetarySymbols.getInternationalCurrencySymbol() + ' '; // Appears + // space-terminated + // in GNU-R + names[i] = "currency_symbol"; + values[i++] = monetarySymbols.getCurrencySymbol(); + names[i] = "mon_decimal_point"; + values[i++] = String.valueOf(monetarySymbols.getMonetaryDecimalSeparator()); + names[i] = "mon_thousands_sep"; + values[i++] = String.valueOf(monetarySymbols.getGroupingSeparator()); + names[i] = "mon_grouping"; + if (monetaryFormat.isGroupingUsed() && (monetaryFormat instanceof DecimalFormat)) { + int groupingSize = ((DecimalFormat) monetaryFormat).getGroupingSize(); + for (int j = 2; j > 0; j--) { + grouping.append((char) groupingSize); + } + grouping.setLength(0); + } + values[i++] = grouping.toString(); + names[i] = "positive_sign"; + values[i++] = ""; // TODO not found a corresponding java method yet + names[i] = "negative_sign"; + values[i++] = String.valueOf(monetarySymbols.getMinusSign()); + names[i] = "int_frac_digits"; + values[i++] = String.valueOf(currency.getDefaultFractionDigits()); + names[i] = "frac_digits"; + values[i++] = String.valueOf(currency.getDefaultFractionDigits()); + names[i] = "p_cs_precedes"; // "1" if currency symbol precedes positive value or "0" + // otherwise + values[i++] = "1"; // No corresponding java method found yet - best match found: + // (DecimalFormat.getPositivePrefix() != null) + names[i] = "p_sep_by_space"; // "1" if a space separates currency symbol from a positive + // value or "0" otherwise + values[i++] = "0"; // No corresponding java method found yet + names[i] = "n_cs_precedes"; // "1" if currency symbol precedes negative value or "0" + // otherwise + values[i++] = "1"; // No corresponding java method found yet + names[i] = "n_sep_by_space"; // "1" if a space separates currency symbol from a negative + // value or "0" otherwise + values[i++] = "0"; // No corresponding java method found yet + names[i] = "p_sign_posn"; // value indicating the positioning of the positive sign for a + // non-negative internationally formatted monetary quantity + values[i++] = "1"; // No corresponding java method found yet + names[i] = "n_sign_posn"; // value indicating the positioning of the negative sign for a + // negative internationally formatted monetary quantity + values[i++] = "1"; // No corresponding java method found yet + return RDataFactory.createStringVector(values, true, RDataFactory.createStringVector(names, true)); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 2a99777264..95ed706e63 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -1915,6 +1915,15 @@ character(0) ##com.oracle.truffle.r.test.builtins.TestBuiltin_Syssetenv.testSyssetenv5#Ignored.SideEffects# #argv <- structure(list(TZ = 'EST5EDT'), .Names = 'TZ');do.call('Sys.setenv', argv) +##com.oracle.truffle.r.test.builtins.TestBuiltin_Syssetlocale.testSyslocaleconv# +#names(Sys.localeconv()) + [1] "decimal_point" "thousands_sep" "grouping" + [4] "int_curr_symbol" "currency_symbol" "mon_decimal_point" + [7] "mon_thousands_sep" "mon_grouping" "positive_sign" +[10] "negative_sign" "int_frac_digits" "frac_digits" +[13] "p_cs_precedes" "p_sep_by_space" "n_cs_precedes" +[16] "n_sep_by_space" "p_sign_posn" "n_sign_posn" + ##com.oracle.truffle.r.test.builtins.TestBuiltin_Syssetlocale.testSyssetlocale1# #argv <- list(3L, 'C'); Sys.setlocale(argv[[1]], argv[[2]]) Error in Sys.setlocale(argv[[1]], argv[[2]]) : diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Syssetlocale.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Syssetlocale.java index 6e074e8f3c..4b13f5cb11 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Syssetlocale.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_Syssetlocale.java @@ -14,7 +14,7 @@ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * Copyright (c) 2014, Purdue University - * Copyright (c) 2014, 2018, Oracle and/or its affiliates + * Copyright (c) 2014, 2019, Oracle and/or its affiliates * * All rights reserved. */ @@ -45,4 +45,10 @@ public void testSyssetlocaleInvalidArgs() { assertEval("Sys.setlocale(4, 42)"); assertEval("Sys.setlocale('3L', 'C')"); } + + @Test + public void testSyslocaleconv() { + assertEval("names(Sys.localeconv())"); + } + } From 18d035203c040dc229fff17f1ee1b041a835c6ff Mon Sep 17 00:00:00 2001 From: Zbynek Slajchrt Date: Thu, 14 Mar 2019 17:17:31 +0100 Subject: [PATCH 56/71] GetCallerFrameNode refactored --- .../truffle/r/ffi/impl/nodes/RfEvalNode.java | 22 ++- .../nodes/builtin/base/BrowserFunctions.java | 2 +- .../truffle/r/nodes/builtin/base/DoCall.java | 25 ++-- .../r/nodes/builtin/base/EnvFunctions.java | 4 +- .../r/nodes/builtin/base/FrameFunctions.java | 2 +- .../r/nodes/builtin/base/MatchFun.java | 2 +- .../r/nodes/builtin/base/PosToEnv.java | 4 +- .../truffle/r/nodes/builtin/base/Recall.java | 4 +- .../builtin/base/S3DispatchFunctions.java | 30 +++- .../r/nodes/function/CallMatcherNode.java | 11 +- .../r/nodes/function/GetCallerFrameNode.java | 138 +++++++++++++----- .../r/nodes/function/PromiseHelperNode.java | 11 +- .../function/call/CallRBuiltinCachedNode.java | 4 +- .../call/CallRFunctionCachedNode.java | 4 +- .../function/call/CallRFunctionNode.java | 2 +- ...e.java => CallerFrameClosureProvider.java} | 2 +- .../oracle/truffle/r/runtime/RArguments.java | 3 + .../com/oracle/truffle/r/runtime/RCaller.java | 20 +++ .../com/oracle/truffle/r/runtime/Utils.java | 38 +++++ .../builtins/TestBuiltin_environment.java | 1 + .../r/test/builtins/TestBuiltin_parse.java | 16 +- documentation/dev/arcane.md | 55 +++++++ 22 files changed, 312 insertions(+), 88 deletions(-) rename com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/{CallRFunctionBaseNode.java => CallerFrameClosureProvider.java} (98%) diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java index 6fed3162f1..a6cba9d6bb 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/nodes/RfEvalNode.java @@ -32,6 +32,8 @@ import com.oracle.truffle.api.dsl.Fallback; import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.Frame; +import com.oracle.truffle.api.frame.FrameInstance.FrameAccess; +import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.access.variables.ReadVariableNode; @@ -41,12 +43,13 @@ import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.Utils; +import com.oracle.truffle.r.runtime.VirtualEvalFrame; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.RExpression; import com.oracle.truffle.r.runtime.data.RFunction; -import com.oracle.truffle.r.runtime.data.RPairList; import com.oracle.truffle.r.runtime.data.RList; import com.oracle.truffle.r.runtime.data.RNull; +import com.oracle.truffle.r.runtime.data.RPairList; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RSymbol; import com.oracle.truffle.r.runtime.env.REnvironment; @@ -64,7 +67,22 @@ public static RfEvalNode create() { private static RCaller createCall(REnvironment env) { // TODO: getActualCurrentFrame causes deopt Frame frame = Utils.getActualCurrentFrame(); - RCaller originalCaller = RArguments.getCall(env.getFrame()); + final MaterializedFrame envFrame = env.getFrame(); + RCaller originalCaller = RArguments.getCall(envFrame); + if (!RCaller.isValidCaller(originalCaller) && env instanceof REnvironment.NewEnv) { + // Try to find the valid original caller stored in the original frame of a + // VirtualEvalFrame that is the same as envFrame + RCaller validOrigCaller = Utils.iterateRFrames(FrameAccess.READ_ONLY, (f) -> { + if (f instanceof VirtualEvalFrame && ((VirtualEvalFrame) f).getOriginalFrame() == envFrame) { + return RArguments.getCall(f); + } else { + return null; + } + }); + if (validOrigCaller != null) { + originalCaller = validOrigCaller; + } + } RCaller currentCaller = RArguments.getCall(frame); if (env == REnvironment.globalEnv(RContext.getInstance())) { return RCaller.createForPromise(originalCaller, currentCaller); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java index ed3f0cd30f..00305606d2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BrowserFunctions.java @@ -104,7 +104,7 @@ protected RNull browser(VirtualFrame frame, Object text, Object condition, RProm if (fun != null && fun.isBuiltin() && fun.getRBuiltin().getBuiltinNodeClass() == BrowserNode.class) { if (getCallerFrame == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - getCallerFrame = insert(new GetCallerFrameNode()); + getCallerFrame = insert(GetCallerFrameNode.create()); } actualFrame = getCallerFrame.execute(mFrame); caller = caller.getPrevious(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java index 7504a28694..dfcacf8d88 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java @@ -131,10 +131,10 @@ protected Object doCall(VirtualFrame frame, RFunction func, RList argsAsList, bo * GNU-R translates {@code do.call} simply to {@code eval}, which has consequences w.r.t. how * the stack should look like. The stack frame of {@code do.call} and all the frames underneath * it should be visible to {@code sys.frame}, so the caller frame passed to the callee via - * arguments (see {@link com.oracle.truffle.r.nodes.function.call.CallRFunctionBaseNode}) should - * be the execution frame of do.call (not the frame where the function should be evaluated given - * as an argument to do.call) so that the stack walking via caller frames does not skip - * {@code do.call}. + * arguments (see {@link com.oracle.truffle.r.nodes.function.call.CallerFrameClosureProvider}) + * should be the execution frame of do.call (not the frame where the function should be + * evaluated given as an argument to do.call) so that the stack walking via caller frames does + * not skip {@code do.call}. */ @ImportStatic(DSLConfig.class) protected abstract static class DoCallInternal extends Node { @@ -174,9 +174,10 @@ public Object doFastPathInEvalFrame(VirtualFrame virtualFrame, String funcName, MaterializedFrame promiseFrame = frameProfile.profile(env.getFrame(frameAccessProfile)).materialize(); RArgsValuesAndNames args = getArguments(languagesClosureCache, symbolsClosureCache, promiseFrame, quote, quoteProfile, containsRSymbolProfile, argsAsList); RCaller caller = getExplicitCaller(virtualFrame, promiseFrame, env, funcName, func, args); - MaterializedFrame evalFrame = getEvalFrame(virtualFrame, promiseFrame); + MaterializedFrame materializedFrame = virtualFrame.materialize(); + MaterializedFrame evalFrame = getEvalFrame(materializedFrame, promiseFrame); - Object resultValue = explicitCallNode.execute(evalFrame, func, args, caller, virtualFrame.materialize()); + Object resultValue = explicitCallNode.execute(evalFrame, func, args, caller, materializedFrame); setVisibility(virtualFrame, getVisibilityNode.execute(evalFrame)); return resultValue; } @@ -194,9 +195,10 @@ public Object doSlowPathInEvalFrame(VirtualFrame virtualFrame, String funcName, RArgsValuesAndNames args = getArguments(null, null, promiseFrame, quote, quoteProfile, containsRSymbolProfile, argsAsList); RCaller caller = getExplicitCaller(virtualFrame, promiseFrame, env, funcName, func, args); - MaterializedFrame evalFrame = getEvalFrame(virtualFrame, promiseFrame); + MaterializedFrame materializedFrame = virtualFrame.materialize(); + MaterializedFrame evalFrame = getEvalFrame(materializedFrame, promiseFrame); - Object resultValue = slowPathExplicitCall.execute(evalFrame, virtualFrame.materialize(), caller, func, args); + Object resultValue = slowPathExplicitCall.execute(evalFrame, materializedFrame, caller, func, args); setVisibility(virtualFrame, getVisibilitySlowPath(evalFrame)); return resultValue; } @@ -206,9 +208,12 @@ public Object doSlowPathInEvalFrame(VirtualFrame virtualFrame, String funcName, * the same time some primitives expect to see {@code do.call(foo, ...)} as the caller, so * we create a frame the fakes caller, but otherwise delegates to the frame backing the * explicitly given environment. + * + * @param currentFrame the current materialized frame, which is set as the caller frame + * @param envFrame the frame from which the clone is made */ - private static MaterializedFrame getEvalFrame(VirtualFrame virtualFrame, MaterializedFrame envFrame) { - return VirtualEvalFrame.create(envFrame, RArguments.getFunction(virtualFrame), RArguments.getCall(virtualFrame)); + private static MaterializedFrame getEvalFrame(VirtualFrame currentFrame, MaterializedFrame envFrame) { + return VirtualEvalFrame.create(envFrame, RArguments.getFunction(currentFrame), currentFrame, RArguments.getCall(currentFrame)); } /** diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java index a90ce123bb..3b8a29ca2d 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/EnvFunctions.java @@ -118,7 +118,7 @@ protected REnvironment asEnvironment(REnvironment env) { @Specialization protected Object asEnvironmentInt(VirtualFrame frame, RAbstractIntVector pos, - @Cached("new()") GetCallerFrameNode getCallerFrame) { + @Cached("create()") GetCallerFrameNode getCallerFrame) { if (pos.getLength() == 0) { CompilerDirectives.transferToInterpreter(); throw error(Message.INVALID_ARGUMENT, "pos"); @@ -346,7 +346,7 @@ public abstract static class Environment extends RBuiltinNode.Arg1 { @Specialization protected Object environment(VirtualFrame frame, @SuppressWarnings("unused") RNull fun, - @Cached("new()") GetCallerFrameNode callerFrame, + @Cached("create()") GetCallerFrameNode callerFrame, @Cached("new()") PromiseDeoptimizeFrameNode deoptFrameNode) { MaterializedFrame matFrame = callerFrame.execute(frame); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java index de36185653..26f616240f 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/FrameFunctions.java @@ -1000,7 +1000,7 @@ private FrameHelper getFrameHelper() { private GetCallerFrameNode getCallerFrameNode() { if (getCaller == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); - getCaller = insert(new GetCallerFrameNode()); + getCaller = insert(GetCallerFrameNode.create()); } return getCaller; } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java index e2d3b477b7..2a3c19d807 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/MatchFun.java @@ -93,7 +93,7 @@ abstract static class MatchFunInternal extends RBaseNode { private final MatchFun outer; private final BranchProfile needsMaterialize = BranchProfile.create(); - @Child private GetCallerFrameNode getCallerFrame = new GetCallerFrameNode(); + @Child private GetCallerFrameNode getCallerFrame = GetCallerFrameNode.create(); MatchFunInternal(MatchFun outer) { this.outer = outer; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PosToEnv.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PosToEnv.java index df5bdd8681..0562ab9bb7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PosToEnv.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/PosToEnv.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,7 +50,7 @@ public static PosToEnv create() { @Specialization(guards = "isMinusOne(x)") protected Object doPosToEnvMinusOne(VirtualFrame frame, @SuppressWarnings("unused") int x, - @Cached("new()") GetCallerFrameNode callerFrameNode) { + @Cached("create()") GetCallerFrameNode callerFrameNode) { if (REnvironment.isGlobalEnvFrame(frame)) { throw error(Message.NO_ENCLOSING_ENVIRONMENT); } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Recall.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Recall.java index f77ee50fd9..dbea9d2b63 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Recall.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Recall.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -48,7 +48,7 @@ public abstract class Recall extends RBuiltinNode.Arg1 { @Child private LocalReadVariableNode readArgs = LocalReadVariableNode.create(ArgumentsSignature.VARARG_NAME, false); - @Child private GetCallerFrameNode callerFrame = new GetCallerFrameNode(); + @Child private GetCallerFrameNode callerFrame = GetCallerFrameNode.create(); @Child private RExplicitCallNode call = RExplicitCallNode.create(); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java index 2d9ff59ab5..625ef9e5af 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/S3DispatchFunctions.java @@ -75,10 +75,12 @@ private static final class Helper extends RBaseNode { private final ConditionProfile isOpsGeneric = ConditionProfile.createBinaryProfile(); @CompilationFinal private ValueProfile dotMethodClassProfile; @Child private LocalReadVariableNode rvnMethod; + private final boolean nextMethod; protected Helper(boolean nextMethod) { - methodLookup = S3FunctionLookupNode.create(true, nextMethod); - callMatcher = CallMatcherNode.create(false); + this.nextMethod = nextMethod; + this.methodLookup = S3FunctionLookupNode.create(true, nextMethod); + this.callMatcher = CallMatcherNode.create(false); } protected Object dispatch(VirtualFrame frame, RCaller parentCaller, String generic, RStringVector type, String group, MaterializedFrame callerFrame, MaterializedFrame genericDefFrame, @@ -90,7 +92,27 @@ protected Object dispatch(VirtualFrame frame, RCaller parentCaller, String gener dotMethod = patchDotMethod(frame, lookupResult, dotMethod); } S3Args s3Args = lookupResult.createS3Args(dotMethod, callerFrame, genericDefFrame, group); - Object result = callMatcher.execute(frame, parentCaller, RArguments.getCall(callerFrame), suppliedSignature, suppliedArguments, lookupResult.function, lookupResult.targetFunctionName, + RCaller dispatchCaller = RArguments.getCall(callerFrame); + + if (!RCaller.isValidCaller(dispatchCaller)) { + // If callerFrame does not contain a valid caller, take the logical grand-parent of + // parentCaller as the dispatch parent + RCaller tmpCaller = parentCaller.getLogicalParent(); + tmpCaller = tmpCaller != null ? tmpCaller.getLogicalParent() : null; + dispatchCaller = tmpCaller != null ? tmpCaller : dispatchCaller; + } + RCaller actualParentCaller = parentCaller; + if (!nextMethod && actualParentCaller.getPrevious() != dispatchCaller && + RCaller.isValidCaller(dispatchCaller) && !actualParentCaller.isPromise()) { + // If dispatchCaller differs from the previous caller of actualParentCaller, create + // a new actualParentCaller with the dispatchCaller as the logical parent. It + // guarantees that the S3 generic method and a specific method have the same logical + // parents. NB: In the case of NextMethod, the logical parent of parentCaller should + // be the same as dispatchCaller thanks to using + // RCaller.createForGenericFunctionCall. + actualParentCaller = actualParentCaller.withLogicalParent(dispatchCaller); + } + Object result = callMatcher.execute(frame, actualParentCaller, dispatchCaller, suppliedSignature, suppliedArguments, lookupResult.function, lookupResult.targetFunctionName, s3Args); return result; } @@ -145,7 +167,7 @@ public abstract static class UseMethod extends RBuiltinNode.Arg2 { @Child private ClassHierarchyNode classHierarchyNode = ClassHierarchyNode.createForDispatch(true); @Child private PromiseCheckHelperNode promiseCheckHelper; - @Child private GetCallerFrameNode getCallerFrameNode = new GetCallerFrameNode(); + @Child private GetCallerFrameNode getCallerFrameNode = GetCallerFrameNode.create(); @Child private Helper helper = new Helper(false); private final BranchProfile firstArgMissing = BranchProfile.create(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java index 8f4109bb79..f48fe4a595 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/CallMatcherNode.java @@ -21,12 +21,13 @@ package com.oracle.truffle.r.nodes.function; +import static com.oracle.truffle.r.runtime.context.FastROptions.RestrictForceSplitting; + import java.util.function.Supplier; import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; -import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.frame.VirtualFrame; import com.oracle.truffle.api.nodes.ExplodeLoop; import com.oracle.truffle.api.nodes.NodeCost; @@ -43,10 +44,8 @@ import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.DSLConfig; -import static com.oracle.truffle.r.runtime.context.FastROptions.RestrictForceSplitting; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RArguments.DispatchArgs; -import com.oracle.truffle.r.runtime.RArguments.S3Args; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.RVisibility; @@ -291,9 +290,8 @@ public Object execute(VirtualFrame frame, RCaller parentCaller, RCaller dispatch } else { caller = RCaller.createForGenericFunctionCall(parent, argsSupplier, parentCaller != null ? parentCaller : RArguments.getCall(frame)); } - MaterializedFrame callerFrame = dispatchArgs instanceof S3Args ? ((S3Args) dispatchArgs).callEnv : null; try { - return call.execute(frame, cachedFunction, caller, callerFrame, reorderedArgs, matchedArgs.getSignature(), cachedFunction.getEnclosingFrame(), dispatchArgs); + return call.execute(frame, cachedFunction, caller, null, reorderedArgs, matchedArgs.getSignature(), cachedFunction.getEnclosingFrame(), dispatchArgs); } finally { visibility.executeAfterCall(frame, caller); } @@ -381,11 +379,10 @@ public Object execute(VirtualFrame frame, RCaller parentCaller, RCaller dispatch caller = RCaller.createForGenericFunctionCall(parent, argsSupplier, parentCaller != null ? parentCaller : RArguments.getCall(frame)); } - MaterializedFrame callerFrame = (dispatchArgs instanceof S3Args) ? ((S3Args) dispatchArgs).callEnv : null; if (function.isBuiltin()) { return callRBuiltin.execute(frame, function, reorderedArgs.getArguments()); } else { - return call.execute(frame, function, caller, callerFrame, reorderedArgs.getArguments(), reorderedArgs.getSignature(), function.getEnclosingFrame(), dispatchArgs); + return call.execute(frame, function, caller, null, reorderedArgs.getArguments(), reorderedArgs.getSignature(), function.getEnclosingFrame(), dispatchArgs); } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/GetCallerFrameNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/GetCallerFrameNode.java index a2da92df34..b0de6545fa 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/GetCallerFrameNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/GetCallerFrameNode.java @@ -25,36 +25,77 @@ import com.oracle.truffle.api.CompilerDirectives; import com.oracle.truffle.api.CompilerDirectives.CompilationFinal; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Fallback; +import com.oracle.truffle.api.dsl.Specialization; import com.oracle.truffle.api.frame.Frame; import com.oracle.truffle.api.frame.FrameInstance.FrameAccess; import com.oracle.truffle.api.frame.MaterializedFrame; +import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.nodes.Node; import com.oracle.truffle.api.nodes.NodeCost; import com.oracle.truffle.api.profiles.BranchProfile; +import com.oracle.truffle.api.profiles.ConditionProfile; +import com.oracle.truffle.r.nodes.function.GetCallerFrameNodeFactory.GetCallerFrameInternalNodeGen; import com.oracle.truffle.r.runtime.CallerFrameClosure; import com.oracle.truffle.r.runtime.RArguments; import com.oracle.truffle.r.runtime.RCaller; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.Utils; +import com.oracle.truffle.r.runtime.VirtualEvalFrame; import com.oracle.truffle.r.runtime.nodes.RBaseNode; +/** + * This node returns the logical parent of the current frame. In other words, it works as + * {@code parent.frame(1)}. + */ public final class GetCallerFrameNode extends RBaseNode { - private final BranchProfile frameAvailableProfile = BranchProfile.create(); - private final BranchProfile closureProfile = BranchProfile.create(); - @CompilationFinal private boolean slowPathInitialized; + @Child private GetCallerFrameInternalNode getCallerFrameInternal = GetCallerFrameInternalNodeGen.create(); + + private GetCallerFrameNode() { + } + + public static GetCallerFrameNode create() { + return new GetCallerFrameNode(); + } @Override public NodeCost getCost() { return NodeCost.NONE; } - public MaterializedFrame execute(Frame frame) { + public MaterializedFrame execute(VirtualFrame frame) { Object callerFrameObject = RArguments.getCallerFrame(frame); - if (callerFrameObject instanceof MaterializedFrame) { - frameAvailableProfile.enter(); - return (MaterializedFrame) callerFrameObject; + RCaller parent = RArguments.getCall(frame); + RCaller grandParent = RCaller.unwrapPromiseCaller(parent).getPrevious(); + return getCallerFrameInternal.execute(frame, callerFrameObject, grandParent); + } + + abstract static class GetCallerFrameInternalNode extends Node { + + private final BranchProfile closureProfile = BranchProfile.create(); + @CompilationFinal private boolean slowPathInitialized; + + public abstract MaterializedFrame execute(VirtualFrame frame, Object callerFrameObject, RCaller grandParent); + + static boolean isInPromiseFrame(VirtualFrame frame) { + return frame instanceof VirtualEvalFrame; + } + + static boolean hasEnvOverride(RCaller grandParent) { + return grandParent != null && grandParent.hasEnvOverride(); + } + + @Specialization(guards = "hasEnvOverride(grandParent)") + protected MaterializedFrame handleMaterializedFrameInPromiseFrame(@SuppressWarnings("unused") VirtualFrame frame, @SuppressWarnings("unused") Object callerFrame, RCaller grandParent) { + return grandParent.getEnvOverride().getFrame(); } - if (callerFrameObject instanceof CallerFrameClosure) { + + @Specialization(guards = "!hasEnvOverride(grandParent)") + protected MaterializedFrame handleFrameClosure(VirtualFrame frame, CallerFrameClosure callerFrameClosure, RCaller grandParent, + @Cached("createBinaryProfile()") ConditionProfile notInPromiseFrameProfile, + @Cached("createBinaryProfile()") ConditionProfile nonNullCallerFrameProfile) { if (slowPathInitialized) { closureProfile.enter(); } else { @@ -62,40 +103,67 @@ public MaterializedFrame execute(Frame frame) { CompilerDirectives.transferToInterpreterAndInvalidate(); slowPathInitialized = true; } - CallerFrameClosure closure = (CallerFrameClosure) callerFrameObject; - RCaller parent = RArguments.getCall(frame); - // TODO: caller frame is explicitly set by S3 dispatch, should we handle that here? - MaterializedFrame slowPathFrame = notifyCallers(closure, parent); - if (slowPathFrame != null) { - return slowPathFrame; + + // inform the responsible call node to create a caller frame + callerFrameClosure.setNeedsCallerFrame(); + + if (notInPromiseFrameProfile.profile(!isInPromiseFrame(frame))) { + // if interpreted, we will have a materialized frame in the closure + MaterializedFrame materializedCallerFrame = callerFrameClosure.getMaterializedCallerFrame(); + if (nonNullCallerFrameProfile.profile(materializedCallerFrame != null)) { + return materializedCallerFrame; + } } + + return searchForFrameByCaller(frame, grandParent, nonNullCallerFrameProfile); } - assert callerFrameObject instanceof CallerFrameClosure || callerFrameObject == null; - // S3 method can be dispatched from top-level where there is no caller frame - // Since RArguments does not allow to create arguments with a 'null' caller frame, this - // must be the top level case. - return frame.materialize(); - } + @Specialization(guards = {"!hasEnvOverride(grandParent)", "!isInPromiseFrame(frame)"}) + protected MaterializedFrame handleMaterializedFrameInRegularFrame(@SuppressWarnings("unused") VirtualFrame frame, MaterializedFrame callerFrame, + @SuppressWarnings("unused") RCaller grandParent) { + return callerFrame; + } - @TruffleBoundary - private static MaterializedFrame notifyCallers(CallerFrameClosure closure, RCaller parent) { + @Specialization(guards = {"!hasEnvOverride(grandParent)", "isInPromiseFrame(frame)"}) + protected MaterializedFrame handleMaterializedFrameInPromiseFrame(VirtualFrame frame, @SuppressWarnings("unused") MaterializedFrame callerFrame, RCaller grandParent, + @Cached("createBinaryProfile()") ConditionProfile nonNullCallerFrameProfile) { + return searchForFrameByCaller(frame, grandParent, nonNullCallerFrameProfile); + } + + @Fallback + protected MaterializedFrame handleOthers(VirtualFrame frame, Object callerFrameObject, @SuppressWarnings("unused") RCaller grandParent) { + assert callerFrameObject == null; + // S3 method can be dispatched from top-level where there is no caller frame + // Since RArguments does not allow to create arguments with a 'null' caller frame, this + // must be the top level case. + return frame.materialize(); + } - // inform the responsible call node to create a caller frame - closure.setNeedsCallerFrame(); + private static MaterializedFrame searchForFrameByCaller(Frame frame, RCaller grandParent, ConditionProfile nonNullCallerFrameProfile) { + RCaller regularGrandParent = RCaller.unwrapPromiseCaller(grandParent); - // if interpreted, we will have a materialized frame in the closure - MaterializedFrame materializedCallerFrame = closure.getMaterializedCallerFrame(); - if (materializedCallerFrame != null) { - return materializedCallerFrame; + Frame frameFromChain = Utils.getStackFrame(frame.materialize(), regularGrandParent); + if (nonNullCallerFrameProfile.profile(frameFromChain != null)) { + return frameFromChain.materialize(); + } + MaterializedFrame slowPathFrame = searchForFrameByCallerAndNotify(regularGrandParent); + if (slowPathFrame != null) { + return slowPathFrame; + } else { + return frame.materialize(); + } } - RError.performanceWarning("slow caller frame access"); - // for now, get it on the very slow path - Frame callerFrame = Utils.getCallerFrame(parent, FrameAccess.MATERIALIZE); - if (callerFrame != null) { - return callerFrame.materialize(); + + @TruffleBoundary + private static MaterializedFrame searchForFrameByCallerAndNotify(RCaller parent) { + RError.performanceWarning("slow caller frame access"); + // for now, get it on the very slow path + Frame callerFrame = parent == null ? null : Utils.getStackFrame(FrameAccess.MATERIALIZE, parent); + if (callerFrame != null) { + return callerFrame.materialize(); + } + return null; } - return null; - } + } } diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java index e204aed26e..d3c5a162f2 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/PromiseHelperNode.java @@ -43,6 +43,7 @@ import com.oracle.truffle.api.profiles.ValueProfile; import com.oracle.truffle.r.nodes.InlineCacheNode; import com.oracle.truffle.r.nodes.function.PromiseHelperNodeFactory.GenerateValueNonDefaultOptimizedNodeGen; +import com.oracle.truffle.r.nodes.function.call.CallerFrameClosureProvider; import com.oracle.truffle.r.nodes.function.opt.ShareObjectNode; import com.oracle.truffle.r.nodes.function.visibility.GetVisibilityNode; import com.oracle.truffle.r.nodes.function.visibility.SetVisibilityNode; @@ -63,7 +64,7 @@ * Holds {@link RPromise}-related functionality that cannot be implemented in * "com.oracle.truffle.r.runtime.data" due to package import restrictions. */ -public final class PromiseHelperNode extends RBaseNode { +public final class PromiseHelperNode extends CallerFrameClosureProvider { public static final class PromiseCheckHelperNode extends RBaseNode { @@ -220,7 +221,7 @@ private Object generateValueDefault(VirtualFrame frame, RPromise promise, boolea // TODO: no wrapping of arguments here?, why we do not have to set visibility here? promise.setUnderEvaluation(); boolean inOrigin = inOriginProfile.profile(isInOriginFrame(frame, promise)); - Frame execFrame = inOrigin ? frame : wrapPromiseFrame(frame, promiseFrameProfile.profile(promise.getFrame())); + Frame execFrame = inOrigin ? frame : wrapPromiseFrame(frame, promiseFrameProfile.profile(promise.getFrame()), getCallerFrameObject(frame)); Object value = promiseClosureCache.execute(execFrame, promise.getClosure()); if (visibleExec && !inOrigin && frame != null) { if (setVisibility == null) { @@ -318,16 +319,16 @@ private static Object generateValueDefaultSlowPath(VirtualFrame frame, RPromise if (promise.isInOriginFrame(frame)) { return promise.getClosure().eval(frame.materialize()); } else { - return promise.getClosure().eval(wrapPromiseFrame(frame, promise.getFrame())); + return promise.getClosure().eval(wrapPromiseFrame(frame, promise.getFrame(), frame != null ? frame.materialize() : null)); } } finally { promise.resetUnderEvaluation(); } } - private static VirtualEvalFrame wrapPromiseFrame(VirtualFrame frame, MaterializedFrame promiseFrame) { + private static VirtualEvalFrame wrapPromiseFrame(VirtualFrame frame, MaterializedFrame promiseFrame, Object callerFrameObject) { assert promiseFrame != null; - return VirtualEvalFrame.create(promiseFrame, RArguments.getFunction(promiseFrame), RCaller.createForPromise(RArguments.getCall(promiseFrame), RArguments.getCall(frame))); + return VirtualEvalFrame.create(promiseFrame, RArguments.getFunction(promiseFrame), callerFrameObject, RCaller.createForPromise(RArguments.getCall(promiseFrame), RArguments.getCall(frame))); } private static Object generateValueEagerSlowPath(VirtualFrame frame, int state, EagerPromise promise) { diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRBuiltinCachedNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRBuiltinCachedNode.java index 3831c8a14f..81b6b80b20 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRBuiltinCachedNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRBuiltinCachedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -40,7 +40,7 @@ * matching, dispatch etc. */ @NodeInfo(cost = NodeCost.NONE) -public abstract class CallRBuiltinCachedNode extends CallRFunctionBaseNode { +public abstract class CallRBuiltinCachedNode extends CallerFrameClosureProvider { @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionCachedNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionCachedNode.java index 5e36b3087a..656de9f708 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionCachedNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionCachedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -45,7 +45,7 @@ * instead. */ @NodeInfo(cost = NodeCost.NONE) -public abstract class CallRFunctionCachedNode extends CallRFunctionBaseNode { +public abstract class CallRFunctionCachedNode extends CallerFrameClosureProvider { @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionNode.java index 83a13d075e..184bb1fafa 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionNode.java @@ -41,7 +41,7 @@ * node). Using {@link DirectCallNode} enables to inline the callee's AST. */ @NodeInfo(cost = NodeCost.NONE) -public final class CallRFunctionNode extends CallRFunctionBaseNode { +public final class CallRFunctionNode extends CallerFrameClosureProvider { @Child private DirectCallNode callNode; @Child private SetVisibilityNode visibility = SetVisibilityNode.create(); diff --git a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionBaseNode.java b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallerFrameClosureProvider.java similarity index 98% rename from com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionBaseNode.java rename to com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallerFrameClosureProvider.java index e652f34682..bcd561f367 100644 --- a/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallRFunctionBaseNode.java +++ b/com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/call/CallerFrameClosureProvider.java @@ -43,7 +43,7 @@ * the {@link CallerFrameClosure}, where we invalidate the assumption that we do not have to * materialize the current frame and pass it to the callee. */ -public abstract class CallRFunctionBaseNode extends Node { +public abstract class CallerFrameClosureProvider extends Node { protected final Assumption needsNoCallerFrame = Truffle.getRuntime().createAssumption("no caller frame"); protected final CallerFrameClosure invalidateNoCallerFrame = new InvalidateNoCallerFrame(needsNoCallerFrame); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java index d79538ef9b..7cff166b2d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java @@ -87,6 +87,9 @@ * the call stack without calling {@link com.oracle.truffle.api.TruffleRuntime#iterateFrames( FrameInstanceVisitor)}, * which would case deopts. * + * The INDEX_CALL slot contains the {@link RCaller caller} of the current frame. It corresponds to the caller frame + * stored in INDEX_CALLER_FRAME. + * * @see RCaller */ // @formatter:on diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java index 1783518839..269fefc577 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java @@ -349,6 +349,21 @@ public boolean isNonFunctionSysParent() { return false; } + public boolean hasEnvOverride() { + return payload instanceof PromiseLogicalParent && ((PromiseLogicalParent) payload).envOverride != null; + } + + public REnvironment getEnvOverride() { + if (payload instanceof PromiseLogicalParent) { + return ((PromiseLogicalParent) payload).envOverride; + } + return null; + } + + public boolean hasPreviousOverridden() { + return payload instanceof NonPromiseLogicalParent && ((NonPromiseLogicalParent) payload).parent != null; + } + public static RCaller createInvalid(Frame callingFrame) { return new RCaller(callingFrame, null); } @@ -437,6 +452,11 @@ public void setVisibility(boolean visibility) { this.visibility = visibility; } + public RCaller withLogicalParent(RCaller logicalParent) { + assert !isPromise(); + return new RCaller(this.depth, this.previous, new NonPromiseLogicalParent(logicalParent, this.payload)); + } + /** * An instance of one of two subclasses of this class is held in the {@link RCaller#payload} * field. Let's call such an {@link RCaller} instance the owner of this instance. The diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java index 045290cdbc..6ecfdd36e9 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/Utils.java @@ -47,6 +47,7 @@ import com.oracle.truffle.api.frame.FrameInstance.FrameAccess; import com.oracle.truffle.api.frame.FrameInstanceVisitor; import com.oracle.truffle.api.frame.FrameSlot; +import com.oracle.truffle.api.frame.MaterializedFrame; import com.oracle.truffle.api.profiles.ConditionProfile; import com.oracle.truffle.api.source.Source; import com.oracle.truffle.api.source.SourceSection; @@ -447,6 +448,43 @@ public Frame visitFrame(FrameInstance frameInstance) { }); } + /** + * Searches for the frame on the call stack whose caller is the same as the {@code target} + * argument. It uses the {@link RArguments#INDEX_CALLER_FRAME} frame argument to traverse the + * chain of frames, instead of iterating the stack using + * {@link TruffleRuntime#iterateFrames(FrameInstanceVisitor)}. A benefit of so doing is that + * this method does not have to be put beyond the Truffle boundary. This method returns null if + * no such frame is found or if the search loop encounters a frame not containing a frame in the + * {@link RArguments#INDEX_CALLER_FRAME} argument. + * + * @param frame the current frame + * @param target the target caller + */ + public static Frame getStackFrame(Frame frame, RCaller target) { + Frame f = frame; + RCaller call = RArguments.getCall(f); + while (call != target) { + Object fObj = RArguments.getCallerFrame(f); + if (fObj instanceof Frame) { + assert fObj instanceof MaterializedFrame; + f = (Frame) fObj; + } else if (fObj instanceof CallerFrameClosure) { + CallerFrameClosure fc = (CallerFrameClosure) fObj; + fc.setNeedsCallerFrame(); + f = fc.getMaterializedCallerFrame(); + if (f == null) { + return null; + } + } else { + assert fObj == null; + return null; + } + call = RArguments.getCall(f); + } + + return f; + } + /** * Like {@link #getStackFrame(FrameAccess, RCaller)}, but identifying the stack with its depth. * Along the way it invalidates the assumptions that the caller frame is needed. diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_environment.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_environment.java index f1914ac26a..6cfff2ad39 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_environment.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_environment.java @@ -58,5 +58,6 @@ public void testEnvironment() { assertEval("environment(NULL)"); assertEval("{ f <- y~z; class(f) <- c('myclass', class(f)); environment(f) }"); assertEval("{ x <- as.pairlist(c(1,2,3)); e <- as.environment(list(x=x)); print(x); print(e$x) }"); + assertEval("{ env <- list2env(list(customenvvar = 42)); fst <- function(fstvar) do.call(environment, list(), envir = env); a <- fst(0); ls(a) }"); } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_parse.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_parse.java index de70b3ef2e..08675a7b6e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_parse.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/builtins/TestBuiltin_parse.java @@ -30,16 +30,12 @@ public class TestBuiltin_parse extends TestBase { @Test public void testSource() { - // FIXME - // FastR repeats file name twice in the warning in this way: - // cannot open file 'test/r/simple/data/tree2/setx.r': test/r/simple/data/tree2/setx.r (No - // such file or directory) - assertEval(Output.IgnoreWarningMessage, "{ source(\"test/r/simple/data/tree2/setx.r\") ; x }"); - assertEval(Output.IgnoreWarningMessage, "{ source(\"test/r/simple/data/tree2/setx.r\", local=TRUE) ; x }"); - assertEval(Output.IgnoreWarningMessage, "{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/setx.r\", local=TRUE) ; x } ; c(f(), x) }"); - assertEval(Output.IgnoreWarningMessage, "{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/setx.r\", local=FALSE) ; x } ; c(f(), x) }"); - assertEval(Output.IgnoreWarningMessage, "{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/incx.r\", local=FALSE) ; x } ; c(f(), x) }"); - assertEval(Output.IgnoreWarningMessage, "{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/incx.r\", local=TRUE) ; x } ; c(f(), x) }"); + assertEval("{ source(\"test/r/simple/data/tree2/setx.r\") ; x }"); + assertEval("{ source(\"test/r/simple/data/tree2/setx.r\", local=TRUE) ; x }"); + assertEval("{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/setx.r\", local=TRUE) ; x } ; c(f(), x) }"); + assertEval("{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/setx.r\", local=FALSE) ; x } ; c(f(), x) }"); + assertEval("{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/incx.r\", local=FALSE) ; x } ; c(f(), x) }"); + assertEval("{ x <- 1; f <- function() { source(\"test/r/simple/data/tree2/incx.r\", local=TRUE) ; x } ; c(f(), x) }"); } @Test diff --git a/documentation/dev/arcane.md b/documentation/dev/arcane.md index 85079e08b7..18eeb1de62 100644 --- a/documentation/dev/arcane.md +++ b/documentation/dev/arcane.md @@ -194,3 +194,58 @@ by RASTBuilder and passed to the FunctionDefinitionNode constructor. RNode // increments the ref count of a shareable argument and registers the request for decrementing ArgumentStatePush + + + +### `CALLER_FRAME` argument life-cycle +(see `CallerFrameClosureProvider`) + +``` + Legend: + (*) - a caller frame closure holding a materialised frame; it never occurs in the compiler + ( ) - a caller frame closure with no frame; it never occurs in the interpreter + * - a materialised closure + ^ - a stack introspection + - optimisation; the boundary between interpreted and compiled code + - deoptimisation; the boundary between compiled and interpreted code +``` + +#### The caller frame is available on the first call +``` + a) no stack introspection + + time + -------------------------------------> + + (*) (*) (*) ( ) ( ) ( ) + + + b) early stack introspection (i.e. in the interpreter) + + (*) (*) * * * * + ^ + + c) late stack introspection (i.e. in the compiler) + + (*) (*) (*) ( ) ( ) * * +``` + +#### The caller frame is not available on the first call +``` + time + -------------------------------------> + + a) no stack introspection + + ( ) ( ) ( ) ( ) ( ) ( ) + + + b) early stack introspection (i.e. in the interpreter) + + ( ) ( ) * * * * + ^ + + c) late stack introspection (i.e. in the compiler) + + ( ) ( ) ( ) ( ) ( ) * * +``` From bafaa597cc6ff011efd3217b50ab86fdc0250d85 Mon Sep 17 00:00:00 2001 From: Zbynek Slajchrt Date: Mon, 18 Mar 2019 11:30:13 +0100 Subject: [PATCH 57/71] NFI tool added to native-image.properties --- .../com/oracle/truffle/r/runtime/RCaller.java | 2 +- documentation/dev/arcane.md | 61 +++++++++---------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java index 269fefc577..5d7571fcf2 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RCaller.java @@ -360,7 +360,7 @@ public REnvironment getEnvOverride() { return null; } - public boolean hasPreviousOverridden() { + public boolean hasParentOverridden() { return payload instanceof NonPromiseLogicalParent && ((NonPromiseLogicalParent) payload).parent != null; } diff --git a/documentation/dev/arcane.md b/documentation/dev/arcane.md index 18eeb1de62..a4c8802f44 100644 --- a/documentation/dev/arcane.md +++ b/documentation/dev/arcane.md @@ -200,52 +200,51 @@ by RASTBuilder and passed to the FunctionDefinitionNode constructor. ### `CALLER_FRAME` argument life-cycle (see `CallerFrameClosureProvider`) -``` - Legend: - (*) - a caller frame closure holding a materialised frame; it never occurs in the compiler - ( ) - a caller frame closure with no frame; it never occurs in the interpreter - * - a materialised closure - ^ - a stack introspection - - optimisation; the boundary between interpreted and compiled code - - deoptimisation; the boundary between compiled and interpreted code -``` + Legend: + (*) - a caller frame closure holding a materialised frame; it never occurs in the interpreter + ( ) - a caller frame closure with no frame; it never occurs in the compiler + * - a materialised closure + ^ - a request for the frame, e.g. stack introspection + - optimisation; the boundary between interpreted and compiled code + - deoptimisation; the boundary between compiled and interpreted code #### The caller frame is available on the first call -``` - a) no stack introspection - time - -------------------------------------> + a) no stack introspection - (*) (*) (*) ( ) ( ) ( ) + time + -------------------------------------> + (*) (*) (*) ( ) ( ) ( ) - b) early stack introspection (i.e. in the interpreter) - (*) (*) * * * * - ^ + b) early stack introspection (i.e. in the interpreter) - c) late stack introspection (i.e. in the compiler) + (*) (*) * * * * + ^ + + c) late stack introspection (i.e. in the compiler) + + (*) (*) (*) ( ) ( ) * * + ^ - (*) (*) (*) ( ) ( ) * * -``` #### The caller frame is not available on the first call -``` - time - -------------------------------------> - a) no stack introspection + time + -------------------------------------> + + a) no stack introspection - ( ) ( ) ( ) ( ) ( ) ( ) + ( ) ( ) ( ) ( ) ( ) ( ) - b) early stack introspection (i.e. in the interpreter) + b) early stack introspection (i.e. in the interpreter) - ( ) ( ) * * * * - ^ + ( ) ( ) * * * * + ^ - c) late stack introspection (i.e. in the compiler) + c) late stack introspection (i.e. in the compiler) - ( ) ( ) ( ) ( ) ( ) * * -``` + ( ) ( ) ( ) ( ) ( ) * * + ^ From 729443e176e0518a176364e390e3522b77fa115e Mon Sep 17 00:00:00 2001 From: Tomas Stupka Date: Fri, 29 Mar 2019 12:40:56 +0100 Subject: [PATCH 58/71] basic implementation of gzcon + url connection --- .../ffi/impl/common/JavaUpCallsRFFIImpl.java | 2 +- .../r/nodes/builtin/base/BasePackage.java | 1 + .../builtin/base/ConnectionFunctions.java | 2 +- .../truffle/r/nodes/builtin/base/GZCon.java | 70 ++++++++++++ .../com/oracle/truffle/r/runtime/RError.java | 3 +- .../r/runtime/conn/ConnectionSupport.java | 22 +++- .../r/runtime/conn/DelegateRConnection.java | 81 +++++++++++++- .../r/runtime/conn/FileConnections.java | 103 +++--------------- .../r/runtime/conn/NativeConnections.java | 9 +- .../r/runtime/conn/URLConnections.java | 48 +++++++- .../truffle/r/test/ExpectedTestOutput.test | 12 ++ .../r/test/library/base/connections/R/gzcon.R | 9 ++ 12 files changed, 258 insertions(+), 104 deletions(-) create mode 100644 com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GZCon.java create mode 100644 com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/connections/R/gzcon.R diff --git a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java index 4250930fe9..0729c167e4 100644 --- a/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java +++ b/com.oracle.truffle.r.ffi.impl/src/com/oracle/truffle/r/ffi/impl/common/JavaUpCallsRFFIImpl.java @@ -1516,7 +1516,7 @@ public Object getSummaryDescription(Object x) { @TruffleBoundary public Object getConnectionClassString(Object x) { BaseRConnection conn = guaranteeInstanceOf(x, BaseRConnection.class); - return wrapString(conn.getConnectionClass()); + return wrapString(conn.getConnectionClassName()); } @Override diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java index 7fb5f1d7e4..7327be5de2 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/BasePackage.java @@ -580,6 +580,7 @@ public BasePackage() { add(GrepFunctions.Regexec.class, GrepFunctionsFactory.RegexecNodeGen::create); add(GrepFunctions.Strsplit.class, GrepFunctionsFactory.StrsplitNodeGen::create); add(GrepFunctions.Sub.class, GrepFunctionsFactory.SubNodeGen::create); + add(GZCon.class, GZConNodeGen::create); add(HiddenInternalFunctions.GetRegisteredRoutines.class, HiddenInternalFunctionsFactory.GetRegisteredRoutinesNodeGen::create); add(HiddenInternalFunctions.ImportIntoEnv.class, HiddenInternalFunctionsFactory.ImportIntoEnvNodeGen::create); add(HiddenInternalFunctions.LazyLoadDBFetch.class, HiddenInternalFunctionsFactory.LazyLoadDBFetchNodeGen::create); diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java index 31d5c3aede..7ca66dbcd7 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/ConnectionFunctions.java @@ -506,7 +506,7 @@ protected RList summary(int object) { BaseRConnection baseCon = RConnection.fromIndex(object); Object[] data = new Object[NAMES.getLength()]; data[0] = baseCon.getSummaryDescription(); - data[1] = baseCon.getConnectionClass(); + data[1] = baseCon.getConnectionClassName(); data[2] = baseCon.getOpenMode().summaryString(); data[3] = baseCon.isTextMode() ? "text" : "binary"; data[4] = baseCon.isOpen() ? "opened" : "closed"; diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GZCon.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GZCon.java new file mode 100644 index 0000000000..ba51e44d40 --- /dev/null +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/GZCon.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.nodes.builtin.base; + +import com.oracle.truffle.api.dsl.Cached; +import com.oracle.truffle.api.dsl.Specialization; +import com.oracle.truffle.api.profiles.ConditionProfile; +import static com.oracle.truffle.r.nodes.builtin.CastBuilder.Predef.toBoolean; +import com.oracle.truffle.r.nodes.builtin.RBuiltinNode; +import static com.oracle.truffle.r.runtime.RCompression.Type.GZIP; +import com.oracle.truffle.r.runtime.RError; +import static com.oracle.truffle.r.runtime.builtins.RBehavior.PURE; +import com.oracle.truffle.r.runtime.builtins.RBuiltin; +import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL; +import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BaseRConnection; +import com.oracle.truffle.r.runtime.conn.ConnectionSupport.ConnectionClass; +import static com.oracle.truffle.r.runtime.conn.ConnectionSupport.ConnectionClass.GZCon; +import com.oracle.truffle.r.runtime.conn.RConnection; +import com.oracle.truffle.r.runtime.data.model.RAbstractIntVector; +import java.io.IOException; + +@RBuiltin(name = "gzcon", kind = INTERNAL, parameterNames = {"con", "level", "allowNonCompressed", "text"}, behavior = PURE) +public abstract class GZCon extends RBuiltinNode.Arg4 { + + static { + Casts casts = new Casts(GZCon.class); + casts.arg("con").defaultError(RError.Message.NOT_CONNECTION, "con").mustNotBeNull().asIntegerVector().findFirst(); + casts.arg("level").asIntegerVector().findFirst(); + casts.arg("allowNonCompressed").asLogicalVector().findFirst().map(toBoolean()); + casts.arg("text").asLogicalVector().findFirst().map(toBoolean()); + } + + @Specialization + public RAbstractIntVector gzcon(int conIndex, @SuppressWarnings("unused") int level, @SuppressWarnings("unused") boolean allowNonCompressed, @SuppressWarnings("unused") boolean text, + @Cached("createBinaryProfile()") ConditionProfile gzConProfile) { + BaseRConnection base = RConnection.fromIndex(conIndex); + if (gzConProfile.profile(base.getConnectionClass() == ConnectionClass.GZCon)) { + RError.warning(this, RError.Message.IS_GZCON); + return base.asVector(); + } + try { + base.setCompressiontype(GZIP); + base.updateConnectionClass(GZCon); + } catch (IOException ex) { + throw error(RError.Message.GENERIC, ex.getMessage()); + } + return base.asVector(); + } + +} diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java index 9129496408..a5a7cde7ac 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java @@ -1045,7 +1045,8 @@ public enum Message { DATE_TIME_CONVERSION_SPEC_NOT_IMPLEMENTED("Date time conversion format '%s' is not implemented in FastR yet. Please submit an issue at https://github.com/oracle/fastr."), CANNOT_ALLOCATE_VECTOR_GB("cannot allocate vector of size %.1f Gb"), INVALID_POLYNOMIAL_COEFFICIENT("invalid polynomial coefficient"), - ROOT_FINDING_FAILED("root finding code failed"); + ROOT_FINDING_FAILED("root finding code failed"), + IS_GZCON("this is already a 'gzcon' connection"); public final String message; final boolean hasArgs; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java index f30f2e5333..c19326ec3a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/ConnectionSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.object.DynamicObject; +import com.oracle.truffle.r.runtime.RCompression; import com.oracle.truffle.r.runtime.RError; import com.oracle.truffle.r.runtime.RError.Message; import com.oracle.truffle.r.runtime.RInternalError; @@ -317,6 +318,7 @@ public enum ConnectionClass { Terminal("terminal"), File("file"), GZFile("gzfile"), + GZCon("gzcon"), BZFile("bzfile"), XZFile("xzfile"), Socket("sockconn"), @@ -641,7 +643,11 @@ private BaseRConnection(ConnectionClass conClass, OpenMode mode) { this.openMode = mode; } - public String getConnectionClass() { + public ConnectionClass getConnectionClass() { + return conClass; + } + + public String getConnectionClassName() { return conClass.getPrintName(); } @@ -743,8 +749,12 @@ protected void checkOpen() { } protected void setDelegate(DelegateRConnection conn) { + setDelegate(conn, true); + } + + protected void setDelegate(DelegateRConnection conn, boolean opened) { this.theConnection = conn; - opened = true; + this.opened = opened; } protected String[] readLinesInternal(int n, EnumSet warn, boolean skipNul) throws IOException { @@ -865,6 +875,10 @@ public boolean isSeekable() { */ protected abstract void createDelegateConnection() throws IOException; + public void setCompressiontype(@SuppressWarnings("unused") RCompression.Type cType) throws IOException { + throw new IOException(); + } + /** * Return the value that is used in the "description" field by {@code summary.connection}. */ @@ -1061,7 +1075,7 @@ protected void setIncomplete(boolean b) { } public final RAbstractIntVector asVector() { - String[] classes = new String[]{ConnectionSupport.getBaseConnection(this).getConnectionClass(), "connection"}; + String[] classes = new String[]{ConnectionSupport.getBaseConnection(this).getConnectionClassName(), "connection"}; RAbstractIntVector result = RDataFactory.createIntVector(new int[]{getDescriptor()}, true); diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java index f70faa12e1..17b859b399 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/DelegateRConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,8 @@ import com.oracle.truffle.r.runtime.data.RDataFactory; import com.oracle.truffle.r.runtime.data.RObject; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; /** * Actually performs the I/O operations for a connections.
@@ -628,4 +630,81 @@ public void closeAndDestroy() throws IOException { base.closed = true; close(); } + + private static final int GZIP_BUFFER_SIZE = (2 << 20); + + static DelegateRConnection createGZIPDelegateOutputConnection(BaseRConnection base, OutputStream os) throws IOException { + assert base.getOpenMode().canWrite(); + return new CompressedOutputRConnection(base, new GZIPOutputStream(os, GZIP_BUFFER_SIZE), true); + } + + static DelegateRConnection createGZIPDelegateInputConnection(BaseRConnection base, InputStream is) throws IOException { + assert base.getOpenMode().canRead(); + return new CompressedInputRConnection(base, new GZIPInputStream(is, GZIP_BUFFER_SIZE)); + } + + static class CompressedOutputRConnection extends DelegateWriteRConnection { + protected ByteChannel channel; + private final boolean seekable; + private long seekPosition = 0L; + + protected CompressedOutputRConnection(BaseRConnection base, OutputStream os, boolean seekable) { + super(base); + this.seekable = seekable; + this.channel = ConnectionSupport.newChannel(os); + } + + @Override + public void closeAndDestroy() throws IOException { + base.closed = true; + close(); + } + + @Override + protected long seekInternal(long offset, RConnection.SeekMode seekMode, RConnection.SeekRWMode seekRWMode) throws IOException { + if (seekable) { + // TODO GZIP is basically seekable; however, the output stream does not allow any + // seeking + long oldPos = seekPosition; + seekPosition = offset; + return oldPos; + } + return super.seek(offset, seekMode, seekRWMode); + } + + @Override + public boolean isSeekable() { + return seekable; + } + + @Override + public ByteChannel getChannel() { + return channel; + } + + @Override + public void truncate() throws IOException { + throw RError.nyi(RError.SHOW_CALLER, "truncating compressed file not"); + } + } + + static class CompressedInputRConnection extends DelegateReadRConnection { + private final ByteChannel channel; + + protected CompressedInputRConnection(BaseRConnection base, InputStream is) { + super(base); + channel = ConnectionSupport.newChannel(is); + } + + @Override + public ByteChannel getChannel() { + return channel; + } + + @Override + public boolean isSeekable() { + return false; + } + } + } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java index 4be04cca52..92941347be 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/FileConnections.java @@ -25,16 +25,12 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.channels.ByteChannel; import java.nio.file.OpenOption; import java.nio.file.StandardOpenOption; import java.util.EnumSet; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; import org.tukaani.xz.LZMA2Options; import org.tukaani.xz.XZ; @@ -50,6 +46,8 @@ import com.oracle.truffle.r.runtime.conn.ConnectionSupport.AbstractOpenMode; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BasePathRConnection; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.ConnectionClass; +import com.oracle.truffle.r.runtime.conn.DelegateRConnection.CompressedInputRConnection; +import com.oracle.truffle.r.runtime.conn.DelegateRConnection.CompressedOutputRConnection; import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector; import java.nio.channels.SeekableByteChannel; @@ -58,7 +56,6 @@ import java.util.Set; public class FileConnections { - public static final int GZIP_BUFFER_SIZE = (2 << 20); /** * Base class for all modes of file connections. @@ -166,24 +163,6 @@ private static DelegateRConnection createUncompressedDelegateConnection(BasePath return delegate; } - private static DelegateRConnection createGZIPDelegateConnection(BasePathRConnection base) throws IOException { - - switch (base.getOpenMode().abstractOpenMode) { - case Read: - case ReadBinary: - return new CompressedInputRConnection(base, new GZIPInputStream(RContext.getInstance().getEnv().getTruffleFile(base.path).newInputStream(), GZIP_BUFFER_SIZE)); - case Append: - case AppendBinary: - return new CompressedOutputRConnection(base, - new GZIPOutputStream(RContext.getInstance().getEnv().getTruffleFile(base.path).newOutputStream(StandardOpenOption.APPEND), GZIP_BUFFER_SIZE), true); - case Write: - case WriteBinary: - return new CompressedOutputRConnection(base, new GZIPOutputStream(RContext.getInstance().getEnv().getTruffleFile(base.path).newOutputStream(), GZIP_BUFFER_SIZE), true); - default: - throw RError.nyi(RError.SHOW_CALLER2, "open mode: " + base.getOpenMode()); - } - } - private static DelegateRConnection createXZDelegateConnection(BasePathRConnection base) throws IOException { switch (base.getOpenMode().abstractOpenMode) { @@ -248,7 +227,19 @@ private static DelegateRConnection createDelegateConnection(BasePathRConnection case NONE: return createUncompressedDelegateConnection(base); case GZIP: - return createGZIPDelegateConnection(base); + switch (base.getOpenMode().abstractOpenMode) { + case Read: + case ReadBinary: + return DelegateRConnection.createGZIPDelegateInputConnection(base, RContext.getInstance().getEnv().getTruffleFile(base.path).newInputStream()); + case Append: + case AppendBinary: + return DelegateRConnection.createGZIPDelegateOutputConnection(base, RContext.getInstance().getEnv().getTruffleFile(base.path).newOutputStream(StandardOpenOption.APPEND)); + case Write: + case WriteBinary: + return DelegateRConnection.createGZIPDelegateOutputConnection(base, RContext.getInstance().getEnv().getTruffleFile(base.path).newOutputStream()); + default: + throw RError.nyi(RError.SHOW_CALLER2, "open mode: " + base.getOpenMode()); + } case XZ: return createXZDelegateConnection(base); case BZIP2: @@ -720,76 +711,12 @@ public void truncate() throws IOException { } } - private static class CompressedInputRConnection extends DelegateReadRConnection { - private final ByteChannel channel; - - protected CompressedInputRConnection(BasePathRConnection base, InputStream is) { - super(base); - channel = ConnectionSupport.newChannel(is); - } - - @Override - public ByteChannel getChannel() { - return channel; - } - - @Override - public boolean isSeekable() { - return false; - } - } - private static class ByteStreamCompressedInputRConnection extends CompressedInputRConnection { ByteStreamCompressedInputRConnection(BasePathRConnection base, ByteArrayInputStream is) { super(base, is); } } - private static class CompressedOutputRConnection extends DelegateWriteRConnection { - protected ByteChannel channel; - private final boolean seekable; - private long seekPosition = 0L; - - protected CompressedOutputRConnection(BasePathRConnection base, OutputStream os, boolean seekable) { - super(base); - this.seekable = seekable; - this.channel = ConnectionSupport.newChannel(os); - } - - @Override - public void closeAndDestroy() throws IOException { - base.closed = true; - close(); - } - - @Override - protected long seekInternal(long offset, SeekMode seekMode, SeekRWMode seekRWMode) throws IOException { - if (seekable) { - // TODO GZIP is basically seekable; however, the output stream does not allow any - // seeking - long oldPos = seekPosition; - seekPosition = offset; - return oldPos; - } - return super.seek(offset, seekMode, seekRWMode); - } - - @Override - public boolean isSeekable() { - return seekable; - } - - @Override - public ByteChannel getChannel() { - return channel; - } - - @Override - public void truncate() throws IOException { - throw RError.nyi(RError.SHOW_CALLER, "truncating compressed file not"); - } - } - private static class BZip2OutputRConnection extends CompressedOutputRConnection { private final ByteArrayOutputStream bos; private final boolean append; diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/NativeConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/NativeConnections.java index 9f12eb6e1c..a5b6aed70a 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/NativeConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/NativeConnections.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -117,7 +117,12 @@ public String getSummaryDescription() { } @Override - public String getConnectionClass() { + public ConnectionClass getConnectionClass() { + return ConnectionClass.NATIVE; + } + + @Override + public String getConnectionClassName() { return customConClass; } diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java index 9a79d72944..5cbd0c7464 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/conn/URLConnections.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,9 @@ */ package com.oracle.truffle.r.runtime.conn; +import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; +import com.oracle.truffle.r.runtime.RCompression; +import static com.oracle.truffle.r.runtime.RCompression.Type.NONE; import java.io.BufferedInputStream; import java.io.IOException; import java.net.MalformedURLException; @@ -29,17 +32,22 @@ import java.nio.channels.ByteChannel; import com.oracle.truffle.r.runtime.RError; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.AbstractOpenMode; +import static com.oracle.truffle.r.runtime.conn.ConnectionSupport.AbstractOpenMode.Lazy; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.BaseRConnection; import com.oracle.truffle.r.runtime.conn.ConnectionSupport.ConnectionClass; +import com.oracle.truffle.r.runtime.conn.ConnectionSupport.OpenMode; public class URLConnections { public static class URLRConnection extends BaseRConnection { protected final String urlString; + private RCompression.Type cType; public URLRConnection(String url, String modeString, String encoding) throws IOException { super(ConnectionClass.URL, modeString, AbstractOpenMode.Read, encoding); this.urlString = url; + this.cType = NONE; } @Override @@ -49,27 +57,55 @@ public String getSummaryDescription() { @Override protected void createDelegateConnection() throws IOException { + setDelegate(createDelegateConnectionImpl()); + } + + private DelegateRConnection createDelegateConnectionImpl() throws RError, IOException { DelegateRConnection delegate = null; - switch (getOpenMode().abstractOpenMode) { + OpenMode openMode = getOpenMode(); + AbstractOpenMode mode = openMode.abstractOpenMode; + if (mode == Lazy) { + mode = AbstractOpenMode.getOpenMode(openMode.modeString); + } + switch (mode) { case Read: case ReadBinary: - delegate = new URLReadRConnection(this); + delegate = new URLReadRConnection(this, cType); break; default: throw RError.nyi(RError.SHOW_CALLER2, "open mode: " + getOpenMode()); } - setDelegate(delegate); + return delegate; + } + + @TruffleBoundary + @Override + public void setCompressiontype(RCompression.Type cType) throws IOException { + this.cType = cType; + // changind the compression type delegate (as via the gzcon builtin) + // should not change the opened state + setDelegate(createDelegateConnectionImpl(), opened); } + } private static class URLReadRConnection extends DelegateReadRConnection { private final ByteChannel rchannel; - protected URLReadRConnection(URLRConnection base) throws MalformedURLException, IOException { + protected URLReadRConnection(URLRConnection base, RCompression.Type cType) throws MalformedURLException, IOException { super(base); URL url = new URL(base.urlString); - rchannel = ConnectionSupport.newChannel(new BufferedInputStream(url.openStream())); + switch (cType) { + case GZIP: + rchannel = createGZIPDelegateInputConnection(base, new BufferedInputStream(url.openStream())); + break; + case NONE: + rchannel = ConnectionSupport.newChannel(new BufferedInputStream(url.openStream())); + break; + default: + throw RInternalError.shouldNotReachHere("unsupported compression type. Can be GZIP or NONE"); + } } @Override diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 2a99777264..20655f741e 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -91226,6 +91226,18 @@ Traceback: 6: source("tmptest/connections/fifo_GnuR_example.R") An irrecoverable exception occurred. R is aborting now ... +##com.oracle.truffle.r.test.library.base.TestConnections.runRSourceTests# +#{ source("tmptest/connections/gzcon.R") } +[[1]] +[1] 1 + +[[2]] +[1] 2 + +[[3]] +[1] 3 + + ##com.oracle.truffle.r.test.library.base.TestConnections.runRSourceTests# #{ source("tmptest/connections/rawConnection_readBin.R") } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/connections/R/gzcon.R b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/connections/R/gzcon.R new file mode 100644 index 0000000000..bc836421a7 --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/base/connections/R/gzcon.R @@ -0,0 +1,9 @@ +gzconTestList <- list(1,2,3) +tmpf <- tempfile() +save(gzconTestList, file=tmpf) +gzconTestList <- NULL +u <- url(paste0("file:///", tmpf), open="rb") +load(u) +print(gzconTestList) +# wrong warning ctx +#u <- gzcon(u) \ No newline at end of file From b955133a1dbf37df916b779447aee62f7fb36891 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 Mar 2019 15:11:36 +0100 Subject: [PATCH 59/71] Check env.isPolyglotAccessAllowed before doing interop --- .../r/nodes/builtin/fastr/FastRInterop.java | 16 ++++++++++++++-- .../r/test/library/fastr/TestInterop.java | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index 00d1f67b9c..d525f866f8 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -118,6 +118,12 @@ public static void testingMode() { isTesting = true; } + private static void checkPolyglotAccess(Env env) { + if (!env.isPolyglotAccessAllowed()) { + throw RError.error(RError.SHOW_CALLER, RError.Message.GENERIC, "Polyglot bindings are not accessible for this language. Use --polyglot or allowPolyglotAccess when building the context."); + } + } + @RBuiltin(name = "eval.polyglot", visibility = CUSTOM, kind = PRIMITIVE, parameterNames = {"languageId", "code", "path"}, behavior = COMPLEX) public abstract static class Eval extends RBuiltinNode.Arg3 { @@ -170,6 +176,7 @@ protected Object eval(@SuppressWarnings("unused") RMissing languageId, @Suppress protected CallTarget parse(String languageId, String code) { CompilerAsserts.neverPartOfCompilation(); Env env = RContext.getInstance().getEnv(); + checkPolyglotAccess(env); LanguageInfo languageInfo = languageId != null ? env.getLanguages().get(languageId) : null; if ((languageId != null && languageInfo == null) || (languageInfo != null && languageInfo.isInternal())) { throw error(RError.Message.LANGUAGE_NOT_AVAILABLE, languageId); @@ -223,6 +230,7 @@ private Object parseFileAndCall(String path, String languageId) { protected CallTarget parseFile(String path, String languageIdArg) { CompilerAsserts.neverPartOfCompilation(); Env env = RContext.getInstance().getEnv(); + checkPolyglotAccess(env); TruffleFile tFile = env.getTruffleFile(Utils.tildeExpand(path, false)).getAbsoluteFile(); LanguageInfo languageInfo = null; try { @@ -273,7 +281,9 @@ protected Object exportSymbol(String name, TruffleObject value) { if (name == null) { throw error(RError.Message.INVALID_ARGUMENT, "name"); } - RContext.getInstance().getEnv().exportSymbol(name, value); + Env env = RContext.getInstance().getEnv(); + checkPolyglotAccess(env); + env.exportSymbol(name, value); return RNull.instance; } @@ -301,7 +311,9 @@ public abstract static class Import extends RBuiltinNode.Arg1 { @Specialization @TruffleBoundary protected Object importSymbol(String name) { - Object object = RContext.getInstance().getEnv().importSymbol(name); + Env env = RContext.getInstance().getEnv(); + checkPolyglotAccess(env); + Object object = env.importSymbol(name); if (object == null) { throw error(RError.Message.NO_IMPORT_OBJECT, name); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java index 250f6dddc9..0099eaa847 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java @@ -26,6 +26,9 @@ import java.io.IOException; import java.nio.ByteBuffer; +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.PolyglotAccess; +import org.graalvm.polyglot.PolyglotException; import org.junit.Assert; import org.junit.Test; @@ -39,6 +42,7 @@ import org.graalvm.polyglot.proxy.ProxyExecutable; import org.junit.After; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; public class TestInterop extends TestBase { @@ -85,6 +89,17 @@ public void cleanup() { } } + @Test + public void testPolyglotAccessWhenPolyglotBindingsAreDisabled() { + String message = "no PolyglotException exception occurred"; + try (org.graalvm.polyglot.Context context = FastRSession.getContextBuilder("R").allowPolyglotAccess(PolyglotAccess.NONE).build()) { + context.eval("R", "eval.polyglot('js', '1+3')"); + } catch (PolyglotException ex) { + message = ex.getMessage(); + } + assertTrue(message, message.contains("Polyglot bindings are not accessible for this language. Use --polyglot or allowPolyglotAccess when building the context.")); + } + @Test public void testInteropEval() { assertEvalFastR("eval.polyglot('R', '14 + 2')", "16"); From ee1344a9d01e842621d0fed92f9f535710727ba4 Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 Mar 2019 15:16:30 +0100 Subject: [PATCH 60/71] Re-enable "no java interop" tests --- .../r/test/library/fastr/TestJavaInterop.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index c09688547b..6646604640 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -22,6 +22,9 @@ */ package com.oracle.truffle.r.test.library.fastr; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import java.lang.reflect.Array; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -31,6 +34,8 @@ import java.util.Iterator; import java.util.List; +import org.graalvm.polyglot.Context; +import org.graalvm.polyglot.PolyglotException; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -40,6 +45,7 @@ import com.oracle.truffle.r.runtime.RRuntime; import com.oracle.truffle.r.runtime.RType; import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRSession; import com.oracle.truffle.r.test.library.fastr.TestJavaInterop.TestClass.TestPOJO; import org.graalvm.polyglot.Value; import org.graalvm.polyglot.proxy.ProxyArray; @@ -280,14 +286,18 @@ public void testNew() { } @Test - @Ignore public void testNoJavaInterop() { - // TODO: create a brand new non-shared context to test this or find out how to configure - // host access in ".fastr.context.testing.new" built-in - assertEvalFastR(Context.NoJavaInterop, "new('integer'); ", "cat('integer(0)'"); - assertEvalFastR(Context.NoJavaInterop, "new('" + Boolean.class.getName() + "');", - errorIn("getClass(Class, where = topenv(parent.frame()))", "“" + Boolean.class.getName() + "” is not a defined class")); - assertEvalFastR(Context.NoJavaInterop, "new('__bogus_class_name__');", errorIn("getClass(Class, where = topenv(parent.frame()))", "“__bogus_class_name__” is not a defined class")); + org.graalvm.polyglot.Context context = FastRSession.getContextBuilder("R").allowHostClassLookup(null).build(); + // new('integer') creates regular R object, no attempt to create a Java object + assertEquals("integer(0)", context.eval("R", "new('integer');").toString()); + // cannot create Boolean object + String message = "no PolyglotException exception occurred"; + try { + context.eval("R", "new('" + Boolean.class.getName() + "');"); + } catch (PolyglotException ex) { + message = ex.getMessage(); + } + assertTrue(message, message.contains("“" + Boolean.class.getName() + "” is not a defined class")); } @Test From 23f4fdd98c4e2f5b9516b9cd1ded26d0c415f88c Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 Mar 2019 15:17:34 +0100 Subject: [PATCH 61/71] Do not allow Java interop when --jvm was not passed to the launcher --- CHANGELOG.md | 1 + .../src/com/oracle/truffle/r/launcher/RMain.java | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3840e7b8e1..adc1886290 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Bug fixes: * `rep.int` with value argument of length 0 just returns the value argument * `tcrossprod` called from `apply` did not give correct result #60 * `Rf_lengthgets` can accept `NULL` argument +* FastR does not allow Java interop when not started with `--jvm` Added missing R builtins and C APIa diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java index 8b69b60821..8bb30bfdc9 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java @@ -36,6 +36,7 @@ import org.graalvm.options.OptionCategory; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Context.Builder; +import org.graalvm.polyglot.HostAccess; import org.graalvm.polyglot.PolyglotException; import org.graalvm.polyglot.Source; @@ -180,8 +181,8 @@ protected void launch(Builder contextBuilderIn) { } this.consoleHandler = ConsoleHandler.createConsoleHandler(options, null, inStream, outStream); Builder contextBuilder = contextBuilderIn; - if (!ignoreJvmArguments) { - contextBuilder = contextBuilder.allowHostAccess(useJVM); + if (!ignoreJvmArguments && !useJVM) { + contextBuilder.allowHostClassLookup(null); } Context context; From 5eecb0c6b673ceb4d0ba078362857247e31ba17d Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 Mar 2019 15:18:13 +0100 Subject: [PATCH 62/71] Handle primitive types in TruffleRLanguageImpl#toString --- .../r/engine/TruffleRLanguageImpl.java | 15 ++++- .../truffle/r/test/tck/JavaEmbeddingTest.java | 1 + .../r/test/tck/ToStringTesterInstrument.java | 64 +++++++++++++++++++ .../r/test/tck/TruffleRLanguageTest.java | 59 +++++++++++++++++ mx.fastr/suite.py | 3 + 5 files changed, 139 insertions(+), 3 deletions(-) create mode 100644 com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java create mode 100644 com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index 3da272f8d5..c3d0701c3d 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -47,6 +47,7 @@ import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags.FunctionBodyBlockTag; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.ExitException; +import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.context.FastROptions; import com.oracle.truffle.r.runtime.RAccuracyInfo; import com.oracle.truffle.r.runtime.RCaller; @@ -61,6 +62,7 @@ import com.oracle.truffle.r.runtime.context.RContext; import com.oracle.truffle.r.runtime.context.TruffleRLanguage; import com.oracle.truffle.r.runtime.data.RFunction; +import com.oracle.truffle.r.runtime.data.RInteropScalar.RInteropNA; import com.oracle.truffle.r.runtime.data.RPromise; import com.oracle.truffle.r.runtime.data.RTypedValue; import com.oracle.truffle.r.runtime.env.REnvironment; @@ -155,8 +157,15 @@ protected String toString(RContext context, Object value) { if (RMissingHelper.isMissing(unwrapped)) { return "missing"; } - Object asVector = RRuntime.asAbstractVector(unwrapped); - if (!(asVector instanceof TruffleObject)) { + // primitive values are never produced by FastR so we don't print them as R vectors + if (unwrapped instanceof Number || unwrapped instanceof String || unwrapped instanceof Boolean) { + return unwrapped.toString(); + } + // special class designated to exchange NA values with the outside world + if (unwrapped instanceof RInteropNA) { + unwrapped = ((RInteropNA) unwrapped).getValue(); + } + if (!(unwrapped instanceof TruffleObject)) { throw RError.error(RError.NO_CALLER, Message.GENERIC, String.format("Printing value of type '%s' is not supported by the R language.", unwrapped.getClass().getSimpleName())); } Object printObj = REnvironment.baseEnv(context).get("print"); @@ -171,7 +180,7 @@ protected String toString(RContext context, Object value) { try { StringBuilder buffer = new StringBuilder(); stateStdConnections.setBuffer(buffer); - RContext.getEngine().evalFunction((RFunction) printObj, callingFrame, RCaller.topLevel, false, ArgumentsSignature.empty(1), asVector); + RContext.getEngine().evalFunction((RFunction) printObj, callingFrame, RCaller.topLevel, false, ArgumentsSignature.empty(1), unwrapped); // remove the last "\n", which is useful for REPL, but not here if (buffer.length() > 0 && buffer.charAt(buffer.length() - 1) == '\n') { buffer.setLength(buffer.length() - 1); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java index 13014d4627..d721ac5cf9 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java @@ -59,6 +59,7 @@ public void dispose() { public void testToString() { assertEquals("[1] 1", context.eval("R", "1").toString()); assertEquals("[1] TRUE", context.eval("R", "TRUE").toString()); + assertEquals("[1] NA", context.eval("R", "NA").toString()); // @formatter:off String dataFrameExpected = " x y\n" + diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java new file mode 100644 index 0000000000..ba947cf9fe --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.test.tck; + +import com.oracle.truffle.api.frame.VirtualFrame; +import com.oracle.truffle.api.instrumentation.EventContext; +import com.oracle.truffle.api.instrumentation.ExecutionEventNode; +import com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory; +import com.oracle.truffle.api.instrumentation.SourceSectionFilter; +import com.oracle.truffle.api.instrumentation.TruffleInstrument; +import com.oracle.truffle.api.nodes.LanguageInfo; +import com.oracle.truffle.r.test.tck.ToStringTesterInstrument.Initialize; + +@TruffleInstrument.Registration(id = ToStringTesterInstrument.ID, name = ToStringTesterInstrument.ID, version = "1.0", services = Initialize.class) +public class ToStringTesterInstrument extends TruffleInstrument { + public static final String ID = "ToStringTester"; + + static String intAsString; + static String byteAsString; + static String doubleAsString; + static String stringAsString; + static String booleanAsString; + + @Override + protected void onCreate(Env env) { + env.registerService(new Initialize() { + }); + + env.getInstrumenter().attachExecutionEventFactory(SourceSectionFilter.ANY, context -> new ExecutionEventNode() { + @Override + protected void onEnter(VirtualFrame frame) { + LanguageInfo rLanguage = env.getLanguages().get("R"); + intAsString = env.toString(rLanguage, 42); + byteAsString = env.toString(rLanguage, (byte) 42); + doubleAsString = env.toString(rLanguage, 42.5); + stringAsString = env.toString(rLanguage, "Hello"); + booleanAsString = env.toString(rLanguage, true); + } + }); + } + + public interface Initialize { + } +} diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java new file mode 100644 index 0000000000..eedbe707e4 --- /dev/null +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2019, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 3 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 3 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.truffle.r.test.tck; + +import static org.junit.Assert.assertEquals; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.oracle.truffle.r.test.TestBase; +import com.oracle.truffle.r.test.generate.FastRSession; + +public class TruffleRLanguageTest extends TestBase { + + private org.graalvm.polyglot.Context context; + + @Before + public void before() { + context = FastRSession.getContextBuilder("R").build(); + } + + @After + public void dispose() { + context.close(); + } + + @Test + public void testToString() { + context.getEngine().getInstruments().get(ToStringTesterInstrument.ID).lookup(ToStringTesterInstrument.Initialize.class); + context.eval("R", "1+1"); // to trigger the instrument + assertEquals("42", ToStringTesterInstrument.intAsString); + assertEquals("42", ToStringTesterInstrument.byteAsString); + assertEquals("42.5", ToStringTesterInstrument.doubleAsString); + assertEquals("Hello", ToStringTesterInstrument.stringAsString); + assertEquals("true", ToStringTesterInstrument.booleanAsString); + } + +} diff --git a/mx.fastr/suite.py b/mx.fastr/suite.py index 9a8b84f144..a52407c49e 100644 --- a/mx.fastr/suite.py +++ b/mx.fastr/suite.py @@ -125,6 +125,9 @@ "truffle:TRUFFLE_TCK", "com.oracle.truffle.r.engine", ], + "annotationProcessors" : [ + "truffle:TRUFFLE_DSL_PROCESSOR", + ], "checkstyle" : "com.oracle.truffle.r.runtime", "javaCompliance" : "1.8", "workingSets" : "Truffle,FastR,Test", From edd867f775bed5fc5fb3c2bc38b5371f50d1c20b Mon Sep 17 00:00:00 2001 From: stepan Date: Fri, 29 Mar 2019 16:02:26 +0100 Subject: [PATCH 63/71] Handle also Character primitive in TruffleRLanguageImpl#toString --- .../src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index c3d0701c3d..0df96b9eee 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -158,7 +158,7 @@ protected String toString(RContext context, Object value) { return "missing"; } // primitive values are never produced by FastR so we don't print them as R vectors - if (unwrapped instanceof Number || unwrapped instanceof String || unwrapped instanceof Boolean) { + if (unwrapped instanceof Number || unwrapped instanceof String || unwrapped instanceof Boolean || unwrapped instanceof Character) { return unwrapped.toString(); } // special class designated to exchange NA values with the outside world From d23f69f42069d18b42a2857b5345b78a38617c1e Mon Sep 17 00:00:00 2001 From: stepan Date: Mon, 1 Apr 2019 14:42:48 +0200 Subject: [PATCH 64/71] TruffleRLanguage#toString: treat primitive values from promises as R vectors --- .../r/engine/TruffleRLanguageImpl.java | 18 +++++++--- .../com/oracle/truffle/r/launcher/RMain.java | 1 - .../truffle/r/test/tck/FastRDebugTest.java | 8 +++++ .../r/test/tck/ToStringTesterInstrument.java | 34 ++++++++----------- .../r/test/tck/TruffleRLanguageTest.java | 13 +++---- 5 files changed, 43 insertions(+), 31 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index 0df96b9eee..4cbc96fdb3 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -47,7 +47,6 @@ import com.oracle.truffle.r.nodes.instrumentation.RSyntaxTags.FunctionBodyBlockTag; import com.oracle.truffle.r.runtime.ArgumentsSignature; import com.oracle.truffle.r.runtime.ExitException; -import com.oracle.truffle.r.runtime.RInternalError; import com.oracle.truffle.r.runtime.context.FastROptions; import com.oracle.truffle.r.runtime.RAccuracyInfo; import com.oracle.truffle.r.runtime.RCaller; @@ -142,6 +141,15 @@ protected void disposeContext(RContext context) { @Override protected String toString(RContext context, Object value) { + // primitive values are never produced by FastR so we don't print them as R vectors + if (value instanceof Boolean) { + // boolean constants are capitalized like in R + return (boolean) value ? "TRUE" : "FALSE"; + } + if (value instanceof Number || value instanceof String || value instanceof Character) { + return value.toString(); + } + // the debugger also passes result of TruffleRLanguage.findMetaObject() to this method Object unwrapped = value; // print promises by other means than the "print" function to avoid evaluating them @@ -157,14 +165,14 @@ protected String toString(RContext context, Object value) { if (RMissingHelper.isMissing(unwrapped)) { return "missing"; } - // primitive values are never produced by FastR so we don't print them as R vectors - if (unwrapped instanceof Number || unwrapped instanceof String || unwrapped instanceof Boolean || unwrapped instanceof Character) { - return unwrapped.toString(); - } // special class designated to exchange NA values with the outside world if (unwrapped instanceof RInteropNA) { unwrapped = ((RInteropNA) unwrapped).getValue(); } + + // the value unwrapped from an RPromise can be primitive Java type, but now we know that we + // are dealing with primitive that is supposed to be treated as R vector + unwrapped = RRuntime.asAbstractVector(unwrapped); if (!(unwrapped instanceof TruffleObject)) { throw RError.error(RError.NO_CALLER, Message.GENERIC, String.format("Printing value of type '%s' is not supported by the R language.", unwrapped.getClass().getSimpleName())); } diff --git a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java index 8bb30bfdc9..95078027ac 100644 --- a/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java +++ b/com.oracle.truffle.r.launcher/src/com/oracle/truffle/r/launcher/RMain.java @@ -36,7 +36,6 @@ import org.graalvm.options.OptionCategory; import org.graalvm.polyglot.Context; import org.graalvm.polyglot.Context.Builder; -import org.graalvm.polyglot.HostAccess; import org.graalvm.polyglot.PolyglotException; import org.graalvm.polyglot.Source; diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java index 8d2f1abe82..be3b797893 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/FastRDebugTest.java @@ -650,6 +650,7 @@ private void assertLocation(final int line, final String code, final Object... e } private void assertLocation(final int line, final int column, final SuspendAnchor anchor, final String code, boolean includeAncestors, boolean completeMatch, final Object... expectedFrame) { + final RuntimeException trace = new RuntimeException(); run.addLast(() -> { try { assertNotNull(suspendedEvent); @@ -685,6 +686,7 @@ private void assertLocation(final int line, final int column, final SuspendAncho frame.getScope().getDeclaredValues().forEach(var -> { System.out.println(var); }); + trace.printStackTrace(); throw e; } }); @@ -702,6 +704,7 @@ private void assertLocation(final int line, final int column, final SuspendAncho * @param expectedFrame the key-value pairs (e.g. {@code "id0", 1, "id1", "strValue"}) */ private void assertScope(final int line, final String code, boolean includeAncestors, boolean completeMatch, final Object... expectedFrame) { + final RuntimeException trace = new RuntimeException(); run.addLast(() -> { try { compareScope(line, code, includeAncestors, completeMatch, expectedFrame); @@ -711,12 +714,14 @@ private void assertScope(final int line, final String code, boolean includeAnces frame.getScope().getDeclaredValues().forEach(var -> { System.out.println(var); }); + trace.printStackTrace(); throw e; } }); } private void assertArguments(final int line, final String code, final Object... expectedArgs) { + final RuntimeException trace = new RuntimeException(); run.addLast(() -> { final DebugStackFrame frame = suspendedEvent.getTopStackFrame(); DebugScope scope = frame.getScope(); @@ -746,6 +751,7 @@ private void assertArguments(final int line, final String code, final Object... scope.getDeclaredValues().forEach(var -> { System.out.println(var); }); + trace.printStackTrace(); throw e; } }); @@ -838,6 +844,7 @@ private void assertExecutedOK() throws Throwable { * @param nameAndValuePairs name followed by value (arbitrary number of times). */ private void assertMetaObjectsOrStringValues(final Source expectedSource, boolean metaObjects, final String... nameAndValuePairs) { + final RuntimeException trace = new RuntimeException(); run.addLast((Runnable) () -> { try { DebugStackFrame frame = suspendedEvent.getTopStackFrame(); @@ -877,6 +884,7 @@ private void assertMetaObjectsOrStringValues(final Source expectedSource, boolea frame.getScope().getDeclaredValues().forEach(var -> { System.out.println(var); }); + trace.printStackTrace(); throw e; } }); diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java index ba947cf9fe..46d33582d2 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java @@ -23,42 +23,38 @@ package com.oracle.truffle.r.test.tck; import com.oracle.truffle.api.frame.VirtualFrame; -import com.oracle.truffle.api.instrumentation.EventContext; import com.oracle.truffle.api.instrumentation.ExecutionEventNode; -import com.oracle.truffle.api.instrumentation.ExecutionEventNodeFactory; import com.oracle.truffle.api.instrumentation.SourceSectionFilter; import com.oracle.truffle.api.instrumentation.TruffleInstrument; import com.oracle.truffle.api.nodes.LanguageInfo; -import com.oracle.truffle.r.test.tck.ToStringTesterInstrument.Initialize; +import com.oracle.truffle.r.test.tck.ToStringTesterInstrument.TestData; -@TruffleInstrument.Registration(id = ToStringTesterInstrument.ID, name = ToStringTesterInstrument.ID, version = "1.0", services = Initialize.class) +@TruffleInstrument.Registration(id = ToStringTesterInstrument.ID, name = ToStringTesterInstrument.ID, version = "1.0", services = TestData.class) public class ToStringTesterInstrument extends TruffleInstrument { public static final String ID = "ToStringTester"; - static String intAsString; - static String byteAsString; - static String doubleAsString; - static String stringAsString; - static String booleanAsString; - @Override protected void onCreate(Env env) { - env.registerService(new Initialize() { - }); - + TestData testData = new TestData(); + env.registerService(testData); env.getInstrumenter().attachExecutionEventFactory(SourceSectionFilter.ANY, context -> new ExecutionEventNode() { @Override protected void onEnter(VirtualFrame frame) { LanguageInfo rLanguage = env.getLanguages().get("R"); - intAsString = env.toString(rLanguage, 42); - byteAsString = env.toString(rLanguage, (byte) 42); - doubleAsString = env.toString(rLanguage, 42.5); - stringAsString = env.toString(rLanguage, "Hello"); - booleanAsString = env.toString(rLanguage, true); + testData.intAsString = env.toString(rLanguage, 42); + testData.byteAsString = env.toString(rLanguage, (byte) 42); + testData.doubleAsString = env.toString(rLanguage, 42.5); + testData.stringAsString = env.toString(rLanguage, "Hello"); + testData.booleanAsString = env.toString(rLanguage, true); } }); } - public interface Initialize { + public static final class TestData { + public String intAsString; + public String byteAsString; + public String doubleAsString; + public String stringAsString; + public String booleanAsString; } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java index eedbe707e4..81bda6a508 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java @@ -30,6 +30,7 @@ import com.oracle.truffle.r.test.TestBase; import com.oracle.truffle.r.test.generate.FastRSession; +import com.oracle.truffle.r.test.tck.ToStringTesterInstrument.TestData; public class TruffleRLanguageTest extends TestBase { @@ -47,13 +48,13 @@ public void dispose() { @Test public void testToString() { - context.getEngine().getInstruments().get(ToStringTesterInstrument.ID).lookup(ToStringTesterInstrument.Initialize.class); + TestData testData = context.getEngine().getInstruments().get(ToStringTesterInstrument.ID).lookup(TestData.class); context.eval("R", "1+1"); // to trigger the instrument - assertEquals("42", ToStringTesterInstrument.intAsString); - assertEquals("42", ToStringTesterInstrument.byteAsString); - assertEquals("42.5", ToStringTesterInstrument.doubleAsString); - assertEquals("Hello", ToStringTesterInstrument.stringAsString); - assertEquals("true", ToStringTesterInstrument.booleanAsString); + assertEquals("42", testData.intAsString); + assertEquals("42", testData.byteAsString); + assertEquals("42.5", testData.doubleAsString); + assertEquals("Hello", testData.stringAsString); + assertEquals("true", testData.booleanAsString); } } From c065df1318e6576ce683be6921df0babc7f6df18 Mon Sep 17 00:00:00 2001 From: stepan Date: Mon, 1 Apr 2019 14:47:17 +0200 Subject: [PATCH 65/71] Remove polyglot access check for parsing --- .../r/nodes/builtin/fastr/FastRInterop.java | 14 ++++---- .../com/oracle/truffle/r/runtime/RError.java | 3 +- .../truffle/r/test/ExpectedTestOutput.test | 36 ++++++++++--------- .../r/test/library/fastr/TestInterop.java | 17 +++++---- .../r/test/library/fastr/TestJavaInterop.java | 1 - 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java index d525f866f8..b8543fd487 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRInterop.java @@ -118,12 +118,6 @@ public static void testingMode() { isTesting = true; } - private static void checkPolyglotAccess(Env env) { - if (!env.isPolyglotAccessAllowed()) { - throw RError.error(RError.SHOW_CALLER, RError.Message.GENERIC, "Polyglot bindings are not accessible for this language. Use --polyglot or allowPolyglotAccess when building the context."); - } - } - @RBuiltin(name = "eval.polyglot", visibility = CUSTOM, kind = PRIMITIVE, parameterNames = {"languageId", "code", "path"}, behavior = COMPLEX) public abstract static class Eval extends RBuiltinNode.Arg3 { @@ -176,7 +170,6 @@ protected Object eval(@SuppressWarnings("unused") RMissing languageId, @Suppress protected CallTarget parse(String languageId, String code) { CompilerAsserts.neverPartOfCompilation(); Env env = RContext.getInstance().getEnv(); - checkPolyglotAccess(env); LanguageInfo languageInfo = languageId != null ? env.getLanguages().get(languageId) : null; if ((languageId != null && languageInfo == null) || (languageInfo != null && languageInfo.isInternal())) { throw error(RError.Message.LANGUAGE_NOT_AVAILABLE, languageId); @@ -230,7 +223,6 @@ private Object parseFileAndCall(String path, String languageId) { protected CallTarget parseFile(String path, String languageIdArg) { CompilerAsserts.neverPartOfCompilation(); Env env = RContext.getInstance().getEnv(); - checkPolyglotAccess(env); TruffleFile tFile = env.getTruffleFile(Utils.tildeExpand(path, false)).getAbsoluteFile(); LanguageInfo languageInfo = null; try { @@ -266,6 +258,12 @@ protected Object eval(@SuppressWarnings("unused") RMissing code, @SuppressWarnin } } + private static void checkPolyglotAccess(Env env) { + if (!env.isPolyglotAccessAllowed()) { + throw RError.error(RError.SHOW_CALLER, RError.Message.POLYGLOT_BINDING_NOT_AVAILABLE); + } + } + @RBuiltin(name = "export", visibility = OFF, kind = PRIMITIVE, parameterNames = {"name", "value"}, behavior = COMPLEX) public abstract static class Export extends RBuiltinNode.Arg2 { diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java index a5a7cde7ac..32c0c1267d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RError.java @@ -1032,7 +1032,8 @@ public enum Message { "SET_ATTRIB: tag in the attributes pairlist must be a symbol. %s given. It is possible that the code intends to set the TAG after the call to SET_ATTRIB, but this is not supported in FastR."), WRONG_ARGS_COMBINATION("Wrong arguments combination, please refer to ?%s for more details."), COULD_NOT_FIND_LANGUAGE("Could not find language corresponding to extension '%s', you can specify the language id explicitly, please refer to ?%s for more details."), - LANGUAGE_NOT_AVAILABLE("Language with id '%s' is not available. Did you start R with --polyglot?"), + LANGUAGE_NOT_AVAILABLE("Language with id '%s' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?"), + POLYGLOT_BINDING_NOT_AVAILABLE("Polyglot bindings are not accessible for this language. Use --polyglot or allowPolyglotAccess when building the context."), NO_LANGUAGE_PROVIDED("No language id provided, please refer to ?%s for more details."), NO_CODE_OR_PATH_PROVIDED("No code or path provided, please refer to ?%s for more details."), LENGTH_OF_NULL_UNCHANGED("length of NULL cannot be changed"), diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 20655f741e..00d7949d56 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -29314,6 +29314,10 @@ NULL #environment(print) +##com.oracle.truffle.r.test.builtins.TestBuiltin_environment.testEnvironment# +#{ env <- list2env(list(customenvvar = 42)); fst <- function(fstvar) do.call(environment, list(), envir = env); a <- fst(0); ls(a) } +[1] "customenvvar" + ##com.oracle.truffle.r.test.builtins.TestBuiltin_environment.testEnvironment# #{ f <- y~z; class(f) <- c('myclass', class(f)); environment(f) } @@ -54093,7 +54097,7 @@ expression(for (i in 1:10) { x[i] <- i }) -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ source("test/r/simple/data/tree2/setx.r") ; x } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -54101,7 +54105,7 @@ In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file 'test/r/simple/data/tree2/setx.r': No such file or directory -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ source("test/r/simple/data/tree2/setx.r", local=TRUE) ; x } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -54109,7 +54113,7 @@ In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file 'test/r/simple/data/tree2/setx.r': No such file or directory -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ x <- 1; f <- function() { source("test/r/simple/data/tree2/incx.r", local=FALSE) ; x } ; c(f(), x) } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -54117,7 +54121,7 @@ In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file 'test/r/simple/data/tree2/incx.r': No such file or directory -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ x <- 1; f <- function() { source("test/r/simple/data/tree2/incx.r", local=TRUE) ; x } ; c(f(), x) } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -54125,7 +54129,7 @@ In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file 'test/r/simple/data/tree2/incx.r': No such file or directory -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ x <- 1; f <- function() { source("test/r/simple/data/tree2/setx.r", local=FALSE) ; x } ; c(f(), x) } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -54133,7 +54137,7 @@ In addition: Warning message: In file(filename, "r", encoding = encoding) : cannot open file 'test/r/simple/data/tree2/setx.r': No such file or directory -##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource#Output.IgnoreWarningMessage# +##com.oracle.truffle.r.test.builtins.TestBuiltin_parse.testSource# #{ x <- 1; f <- function() { source("test/r/simple/data/tree2/setx.r", local=TRUE) ; x } ; c(f(), x) } Error in file(filename, "r", encoding = encoding) : cannot open the connection @@ -150330,24 +150334,24 @@ Error: unexpected ';' in "if (!any(R.version$engine == "FastR")) { TRUE } else { [1] "123" ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEval# -#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("foo", "bar") :\n Language with id \'foo\' is not available. Did you start R with --polyglot?\n') } else { eval.polyglot('foo', 'bar') } +#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("foo", "bar") :\n Language with id \'foo\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\n') } else { eval.polyglot('foo', 'bar') } Error in eval.polyglot("foo", "bar") : - Language with id 'foo' is not available. Did you start R with --polyglot? + Language with id 'foo' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context? ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEval# -#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("foo", , "bar") :\n Language with id \'foo\' is not available. Did you start R with --polyglot?\n') } else { eval.polyglot('foo',, 'bar') } +#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("foo", , "bar") :\n Language with id \'foo\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\n') } else { eval.polyglot('foo',, 'bar') } Error in eval.polyglot("foo", , "bar") : - Language with id 'foo' is not available. Did you start R with --polyglot? + Language with id 'foo' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context? ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEval# -#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nfi", "foo.bar") :\n Language with id \'nfi\' is not available. Did you start R with --polyglot?\n') } else { eval.polyglot('nfi', 'foo.bar') } +#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nfi", "foo.bar") :\n Language with id \'nfi\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\n') } else { eval.polyglot('nfi', 'foo.bar') } Error in eval.polyglot("nfi", "foo.bar") : - Language with id 'nfi' is not available. Did you start R with --polyglot? + Language with id 'nfi' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context? ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEval# -#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nfi", , "foo.bar") :\n Language with id \'nfi\' is not available. Did you start R with --polyglot?\n') } else { eval.polyglot('nfi',,'foo.bar') } +#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nfi", , "foo.bar") :\n Language with id \'nfi\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\n') } else { eval.polyglot('nfi',,'foo.bar') } Error in eval.polyglot("nfi", , "foo.bar") : - Language with id 'nfi' is not available. Did you start R with --polyglot? + Language with id 'nfi' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context? ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEval# #if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot(, "bar") :\n No language id provided, please refer to ?eval.polyglot for more details.\n') } else { eval.polyglot(, 'bar') } @@ -150369,9 +150373,9 @@ Error in eval.polyglot("js", "console.log(42)", "file.js") : Wrong arguments combination, please refer to ?eval.polyglot for more details. ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEvalFile# -#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nonExistentLanguage", "code") :<<>> Language with id \'nonExistentLanguage\' is not available. Did you start R with --polyglot?\n') } else { eval.polyglot('nonExistentLanguage', 'code') } +#if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("nonExistentLanguage", "code") :<<>> Language with id \'nonExistentLanguage\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\n') } else { eval.polyglot('nonExistentLanguage', 'code') } Error in eval.polyglot("nonExistentLanguage", "code") : - Language with id 'nonExistentLanguage' is not available. Did you start R with --polyglot? + Language with id 'nonExistentLanguage' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context? ##com.oracle.truffle.r.test.library.fastr.TestInterop.testInteropEvalFile# #if (!any(R.version$engine == "FastR")) { cat('Error in eval.polyglot("someLanguage") :<<>> No code or path provided, please refer to ?eval.polyglot for more details.\n') } else { eval.polyglot('someLanguage') } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java index 0099eaa847..77a6a0ff7d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestInterop.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.nio.ByteBuffer; -import org.graalvm.polyglot.Context; import org.graalvm.polyglot.PolyglotAccess; import org.graalvm.polyglot.PolyglotException; import org.junit.Assert; @@ -91,13 +90,13 @@ public void cleanup() { @Test public void testPolyglotAccessWhenPolyglotBindingsAreDisabled() { - String message = "no PolyglotException exception occurred"; try (org.graalvm.polyglot.Context context = FastRSession.getContextBuilder("R").allowPolyglotAccess(PolyglotAccess.NONE).build()) { context.eval("R", "eval.polyglot('js', '1+3')"); + Assert.fail("no PolyglotException exception occurred"); } catch (PolyglotException ex) { - message = ex.getMessage(); + String message = ex.getMessage(); + assertTrue(message, message.contains("Language with id 'js' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?")); } - assertTrue(message, message.contains("Polyglot bindings are not accessible for this language. Use --polyglot or allowPolyglotAccess when building the context.")); } @Test @@ -115,14 +114,14 @@ public void testInteropEval() { "cat('Error in eval.polyglot(, , \"bar\") :\\n Could not find language corresponding to extension \\'bar\\', you can specify the language id explicitly, please refer to ?eval.polyglot for more details.\\n')"); // Checkstyle: resume assertEvalFastR("eval.polyglot('foo', 'bar')", - "cat('Error in eval.polyglot(\"foo\", \"bar\") :\\n Language with id \\'foo\\' is not available. Did you start R with --polyglot?\\n')"); + "cat('Error in eval.polyglot(\"foo\", \"bar\") :\\n Language with id \\'foo\\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\\n')"); assertEvalFastR("eval.polyglot('nfi', 'foo.bar')", - "cat('Error in eval.polyglot(\"nfi\", \"foo.bar\") :\\n Language with id \\'nfi\\' is not available. Did you start R with --polyglot?\\n')"); + "cat('Error in eval.polyglot(\"nfi\", \"foo.bar\") :\\n Language with id \\'nfi\\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\\n')"); // Checkstyle: stop assertEvalFastR("eval.polyglot('foo',, 'bar')", - "cat('Error in eval.polyglot(\"foo\", , \"bar\") :\\n Language with id \\'foo\\' is not available. Did you start R with --polyglot?\\n')"); + "cat('Error in eval.polyglot(\"foo\", , \"bar\") :\\n Language with id \\'foo\\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\\n')"); assertEvalFastR("eval.polyglot('nfi',,'foo.bar')", - "cat('Error in eval.polyglot(\"nfi\", , \"foo.bar\") :\\n Language with id \\'nfi\\' is not available. Did you start R with --polyglot?\\n')"); + "cat('Error in eval.polyglot(\"nfi\", , \"foo.bar\") :\\n Language with id \\'nfi\\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\\n')"); // Checkstyle: resume } @@ -160,7 +159,7 @@ public void testInteropEvalFile() { assertEvalFastR("f<-paste0(tempfile(),'.nonLanguageExtension'); file.create(f); tryCatch(eval.polyglot(path=f), finally=file.remove(f))", "cat('Error in eval.polyglot(path = f) :\n Could not find language corresponding to extension \\'nonLanguageExtension\\', you can specify the language id explicitly, please refer to ?eval.polyglot for more details.\\n')"); assertEvalFastR("eval.polyglot('nonExistentLanguage', 'code')", - "cat('Error in eval.polyglot(\"nonExistentLanguage\", \"code\") :\n Language with id \\'nonExistentLanguage\\' is not available. Did you start R with --polyglot?\\n')"); + "cat('Error in eval.polyglot(\"nonExistentLanguage\", \"code\") :\n Language with id \\'nonExistentLanguage\\' is not available. Did you start R with --polyglot or use allowPolyglotAccess when building the context?\\n')"); assertEvalFastR("eval.polyglot(code='')", "cat('Error in eval.polyglot(code = \"\") :\n No language id provided, please refer to ?eval.polyglot for more details.\\n')"); assertEvalFastR("eval.polyglot(languageId='js')", "cat('Error in eval.polyglot(languageId = \"js\") :\n No code or path provided, please refer to ?eval.polyglot for more details.\\n')"); } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java index 6646604640..60563cc984 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/fastr/TestJavaInterop.java @@ -34,7 +34,6 @@ import java.util.Iterator; import java.util.List; -import org.graalvm.polyglot.Context; import org.graalvm.polyglot.PolyglotException; import org.junit.Assert; import org.junit.Before; From 97c1e1cf0bd949ebdeb291bab024882562daceb7 Mon Sep 17 00:00:00 2001 From: stepan Date: Mon, 1 Apr 2019 15:02:52 +0200 Subject: [PATCH 66/71] Update CHANGELOG --- CHANGELOG.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index adc1886290..b4022d035f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ * new Truffle interop converts `double` values to `int` values if they fit in the integer range * see the changes in the [spec tests](https://github.com/oracle/fastr/commit/e08e2b19571479dddb6167d9a1d492a14cb4c7b2#diff-c842fa11097793b19bd410589c36af99) +Added missing R builtins and C APIa + +* simple support for the weak reference API functions (`R_MakeWeakRef`, `R_MakeWeakRefC`, `R_WeakRefKey`, `R_WeakRefValue`) +* `Rf_i1mach` +* `gzcon` builtin for `url` connections, e.g., `load(url('protocol://path'))` should work now +* `Sys.localeconv` supports: `decimal_point`, `thousands_sep`, `grouping`, `int_curr_symbol`, `currency_symbol`, `mon_decimal_point`, + `mon_thousands_sep`, `mon_grouping`, `int_frac_digits`, `p_cs_precedes`, other fields are fixed to some meaningful but not culture + sensitive value for given field + Bug fixes: * `rep.int` with value argument of length 0 just returns the value argument @@ -11,11 +20,6 @@ Bug fixes: * `Rf_lengthgets` can accept `NULL` argument * FastR does not allow Java interop when not started with `--jvm` -Added missing R builtins and C APIa - -* simple support for the weak reference API functions (`R_MakeWeakRef`, `R_MakeWeakRefC`, `R_WeakRefKey`, `R_WeakRefValue`) -* `Rf_i1mach` - # 1.0 RC 14 * all FastR specific options (NOT those GNU-R compatible like `--save`) are experimental except for `--R.PrintErrorStacktracesToFile`, From 348edd79296966836b6bb3da82e2c9d8fef136a1 Mon Sep 17 00:00:00 2001 From: stepan Date: Mon, 1 Apr 2019 15:34:39 +0200 Subject: [PATCH 67/71] Patch package source: remove reference to usupported R_Interactive, R_isForkedChild, Rf_KillAllDevices --- .../com/oracle/truffle/r/runtime/context/PackagePatching.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/PackagePatching.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/PackagePatching.java index ac2e48dcf1..63553b0043 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/PackagePatching.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/context/PackagePatching.java @@ -64,6 +64,10 @@ public class PackagePatching { new Patch("reinterpret_cast<.*>\\((.*)\\)->gp &= (\\w+|\\(.*\\))", "SETLEVELS($1, LEVELS($1) & ($2))"), new Patch("reinterpret_cast<.*>\\((.*)\\)->gp \\|= (\\w+|\\(.*\\))", "SETLEVELS($1, LEVELS($1) | ($2))"), new Patch("reinterpret_cast<.*>\\((.*)\\)->gp \\^= (\\w+|\\(.*\\))", "SETLEVELS($1, LEVELS($1) ^ ($2))"), + // FastR does not support these global variables: + new Patch("R_Interactive\\s*=\\s*[01]", ""), + new Patch("R_isForkedChild\\s*=\\s*[01]", ""), + new Patch("Rf_KillAllDevices\\s*\\(\\s*\\)", ""), }; @TruffleBoundary From 708dee7415e9742d5e3a610ff2b628269b04bb6c Mon Sep 17 00:00:00 2001 From: stepan Date: Mon, 1 Apr 2019 17:10:19 +0200 Subject: [PATCH 68/71] TruffleRLanguage#toString: do not print scalar NA as vector --- .../oracle/truffle/r/engine/TruffleRLanguageImpl.java | 10 ++++++---- .../oracle/truffle/r/test/tck/JavaEmbeddingTest.java | 2 ++ .../truffle/r/test/tck/ToStringTesterInstrument.java | 6 ++++-- .../truffle/r/test/tck/TruffleRLanguageTest.java | 3 ++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java index 4cbc96fdb3..e796088fed 100644 --- a/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java +++ b/com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/TruffleRLanguageImpl.java @@ -150,6 +150,12 @@ protected String toString(RContext context, Object value) { return value.toString(); } + // special class designated to exchange NA values with the outside world + // this value is a scalar, the only way to get it is via getArrayMember on an R vector + if (value instanceof RInteropNA) { + return "NA"; + } + // the debugger also passes result of TruffleRLanguage.findMetaObject() to this method Object unwrapped = value; // print promises by other means than the "print" function to avoid evaluating them @@ -165,10 +171,6 @@ protected String toString(RContext context, Object value) { if (RMissingHelper.isMissing(unwrapped)) { return "missing"; } - // special class designated to exchange NA values with the outside world - if (unwrapped instanceof RInteropNA) { - unwrapped = ((RInteropNA) unwrapped).getValue(); - } // the value unwrapped from an RPromise can be primitive Java type, but now we know that we // are dealing with primitive that is supposed to be treated as R vector diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java index d721ac5cf9..8f16a7733d 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/JavaEmbeddingTest.java @@ -60,6 +60,8 @@ public void testToString() { assertEquals("[1] 1", context.eval("R", "1").toString()); assertEquals("[1] TRUE", context.eval("R", "TRUE").toString()); assertEquals("[1] NA", context.eval("R", "NA").toString()); + // NA scalar value: + assertEquals("NA", context.eval("R", "NA").getArrayElement(0).toString()); // @formatter:off String dataFrameExpected = " x y\n" + diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java index 46d33582d2..5be4e2e84a 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/ToStringTesterInstrument.java @@ -45,7 +45,8 @@ protected void onEnter(VirtualFrame frame) { testData.byteAsString = env.toString(rLanguage, (byte) 42); testData.doubleAsString = env.toString(rLanguage, 42.5); testData.stringAsString = env.toString(rLanguage, "Hello"); - testData.booleanAsString = env.toString(rLanguage, true); + testData.trueAsString = env.toString(rLanguage, true); + testData.falseAsString = env.toString(rLanguage, false); } }); } @@ -55,6 +56,7 @@ public static final class TestData { public String byteAsString; public String doubleAsString; public String stringAsString; - public String booleanAsString; + public String trueAsString; + public String falseAsString; } } diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java index 81bda6a508..774b9aa3df 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/tck/TruffleRLanguageTest.java @@ -54,7 +54,8 @@ public void testToString() { assertEquals("42", testData.byteAsString); assertEquals("42.5", testData.doubleAsString); assertEquals("Hello", testData.stringAsString); - assertEquals("true", testData.booleanAsString); + assertEquals("TRUE", testData.trueAsString); + assertEquals("FALSE", testData.falseAsString); } } From 7a331b740ff1d823e431cd23a59ad45e4c7c3b63 Mon Sep 17 00:00:00 2001 From: Florian Angerer Date: Tue, 2 Apr 2019 21:32:02 +0200 Subject: [PATCH 69/71] Pkgtest: allow 'test.*' and 'lib.install.*' to be symbolic links. --- com.oracle.truffle.r.test.packages/pkgtest/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.test.packages/pkgtest/__init__.py b/com.oracle.truffle.r.test.packages/pkgtest/__init__.py index 85ff62f84a..5780502769 100644 --- a/com.oracle.truffle.r.test.packages/pkgtest/__init__.py +++ b/com.oracle.truffle.r.test.packages/pkgtest/__init__.py @@ -50,9 +50,11 @@ def _create_libinstall(rvm, test_installed): if not test_installed: # make sure its empty shutil.rmtree(libinstall, ignore_errors=True) - os.mkdir(libinstall) + if os.path.exists(libinstall): + logging.warning("could not clean temporary library dir %s" % libinstall) + else: + os.mkdir(libinstall) install_tmp = join(get_fastr_repo_dir(), "install.tmp." + rvm) - # install_tmp = join(_fastr_suite_dir(), "install.tmp") shutil.rmtree(install_tmp, ignore_errors=True) os.mkdir(install_tmp) _create_testdot(rvm) @@ -62,7 +64,9 @@ def _create_libinstall(rvm, test_installed): def _create_testdot(rvm): testdir = join(get_fastr_repo_dir(), "test." + rvm) shutil.rmtree(testdir, ignore_errors=True) - os.mkdir(testdir) + # Note: The existence check still makes sense because 'shutil.rmtree' won't do anything if 'testdir' is a symlink. + if not os.path.exists(testdir): + os.mkdir(testdir) return testdir From bb65b4a0f9415458dd67c8ebd56f0783b35837b4 Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 3 Apr 2019 10:13:16 +0200 Subject: [PATCH 70/71] Update the copyright years in the initial message --- .../src/com/oracle/truffle/r/runtime/RRuntime.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index 713dd328f4..4ca19fc569 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -68,9 +68,9 @@ public class RRuntime { // Parts of the welcome message originate from GNU R. public static final String WELCOME_MESSAGE = "R version " + RVersionNumber.FULL + " (FastR)\n" + - "Copyright (c) 2013-18, Oracle and/or its affiliates\n" + - "Copyright (c) 1995-2017, The R Core Team\n" + - "Copyright (c) 2017 The R Foundation for Statistical Computing\n" + + "Copyright (c) 2013-19, Oracle and/or its affiliates\n" + + "Copyright (c) 1995-2018, The R Core Team\n" + + "Copyright (c) 2018 The R Foundation for Statistical Computing\n" + "Copyright (c) 2012-4 Purdue University\n" + "Copyright (c) 1997-2002, Makoto Matsumoto and Takuji Nishimura\n" + "All rights reserved.\n" + From 5f69c4a8ae262ecd525a927926fd55f91e40c650 Mon Sep 17 00:00:00 2001 From: stepan Date: Wed, 3 Apr 2019 14:33:31 +0200 Subject: [PATCH 71/71] Upgrade PCRE to 8.42 --- ci_common/common.hocon | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci_common/common.hocon b/ci_common/common.hocon index 05cfa11986..292587afd9 100644 --- a/ci_common/common.hocon +++ b/ci_common/common.hocon @@ -61,8 +61,8 @@ logfiles : [ environmentLinux: { environment : { - PKG_INCLUDE_FLAGS_OVERRIDE : "-I/cm/shared/apps/zlib/1.2.11/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/pcre/8.38/include -I/cm/shared/apps/curl/7.50.1/include" - PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.38/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.1/lib64" + PKG_INCLUDE_FLAGS_OVERRIDE : "-I/cm/shared/apps/zlib/1.2.11/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/pcre/8.42/include -I/cm/shared/apps/curl/7.50.1/include" + PKG_LDFLAGS_OVERRIDE : "-L/cm/shared/apps/zlib/1.2.11/lib -L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L/cm/shared/apps/gcc/4.9.1/lib64" TZDIR: "/usr/share/zoneinfo" } } @@ -84,7 +84,7 @@ packagesLinux : { "pip:ninja_syntax" : "==1.7.2" make : ">=3.83" gcc-build-essentials : "==4.9.1" # TODO: upgrade to 4.9.2 - pcre : ">=8.38" + pcre : "==8.42" zlib : "==1.2.11" # these are needed to build GNU-R readline : "==6.3" @@ -96,7 +96,7 @@ packagesDarwin : { "pip:astroid" : "==1.1.0" "pip:pylint" : "==1.1.0" "pip:ninja_syntax" : "==1.7.2" - "pcre" : "==8.38" + "pcre" : "==8.42" "homebrew/gcc" : "==4.9" } @@ -141,9 +141,9 @@ gateTestLinux : ${gateTestCommon} ${commonLinux} gateTestDarwin : ${gateTestCommon} ${commonDarwin} { setup : [ - [set-export, PKG_INCLUDE_FLAGS_OVERRIDE, "-I/cm/shared/apps/pcre/8.38/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/curl/7.50.1/include"] + [set-export, PKG_INCLUDE_FLAGS_OVERRIDE, "-I/cm/shared/apps/pcre/8.42/include -I/cm/shared/apps/bzip2/1.0.6/include -I/cm/shared/apps/xz/5.2.2/include -I/cm/shared/apps/curl/7.50.1/include"] [set-export, MOD_LIB_PATH, [echo, "${LD_LIBRARY_PATH}", |, tr, "\:", "\\n", |, grep, lib/gcc, |, tail, "-1"]] - [set-export, PKG_LDFLAGS_OVERRIDE, "-L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.38/lib -L/cm/shared/apps/curl/7.50.1/lib -L${MOD_LIB_PATH} -L/usr/lib"] + [set-export, PKG_LDFLAGS_OVERRIDE, "-L/cm/shared/apps/bzip2/1.0.6/lib -L/cm/shared/apps/xz/5.2.2/lib -L/cm/shared/apps/pcre/8.42/lib -L/cm/shared/apps/curl/7.50.1/lib -L${MOD_LIB_PATH} -L/usr/lib"] ] }