Mercurial > hg > graal-jvmci-8
view graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java @ 13563:fb846424299f
Truffle/Ruby: extend Instrumentation framework with language-agnostic interfaces for access to AST printing utilities and a Ruby implementation
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Tue, 07 Jan 2014 18:09:42 -0800 |
parents | 0fbee3eb71f0 |
children | dd0ba029bf34 |
line wrap: on
line source
/* * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This * code is released under a tri EPL/GPL/LGPL license. You can use it, * redistribute it and/or modify it under the terms of the: * * Eclipse Public License version 1.0 * GNU General Public License version 2 * GNU Lesser General Public License version 2.1 */ package com.oracle.truffle.ruby.runtime.configuration; import java.io.*; import com.oracle.truffle.ruby.runtime.*; /** * The mutable counterpart to {@link Configuration}. */ public class ConfigurationBuilder { /** * The path of the JRuby packaging of the Ruby standard library within our source tree. */ public static final String JRUBY_STDLIB_JAR = "lib/jruby-stdlib-1.7.4.jar"; private String standardLibrary = JRUBY_STDLIB_JAR; private RubyVersion rubyVersion = RubyVersion.RUBY_19; private boolean debug = true; private boolean verbose = false; private int warningLevel = 0; private int taintCheckLevel = 0; private String defaultExternalEncoding = null; private String defaultInternalEncoding = null; private boolean trace = true; private boolean fullObjectSpace = false; private boolean printParseTree = false; private boolean printExecutedFiles = false; private boolean printSpiltInstanceVariables = false; private boolean printUninitializedCalls = false; private boolean printJavaExceptions = false; private boolean printRubyExceptions = false; private PrintStream standardOut = System.out; private InputReader inputReader = new InputReader() { private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); @Override public String readLine(String prompt) throws IOException { System.err.print(prompt); return reader.readLine(); } }; public ConfigurationBuilder() { } public ConfigurationBuilder(Configuration configuration) { assert configuration != null; standardLibrary = configuration.getStandardLibrary(); rubyVersion = configuration.getRubyVersion(); debug = configuration.getDebug(); verbose = configuration.getVerbose(); warningLevel = configuration.getWarningLevel(); taintCheckLevel = configuration.getTaintCheckLevel(); defaultExternalEncoding = configuration.getDefaultExternalEncoding(); defaultInternalEncoding = configuration.getDefaultInternalEncoding(); trace = configuration.getTrace(); fullObjectSpace = configuration.getFullObjectSpace(); printParseTree = configuration.getPrintParseTree(); printExecutedFiles = configuration.getPrintExecutedFiles(); printSpiltInstanceVariables = configuration.getPrintSpiltInstanceVariables(); printUninitializedCalls = configuration.getPrintUninitializedCalls(); printJavaExceptions = configuration.getPrintJavaExceptions(); printRubyExceptions = configuration.getPrintRubyExceptions(); standardOut = configuration.getStandardOut(); } public String getStandardLibrary() { return standardLibrary; } public void setStandardLibrary(String standardLibrary) { assert standardLibrary != null; this.standardLibrary = standardLibrary; } public RubyVersion getRubyVersion() { return rubyVersion; } public void setRubyVersion(RubyVersion rubyVersion) { assert rubyVersion != null; this.rubyVersion = rubyVersion; } public boolean getDebug() { return debug; } public void setDebug(boolean debug) { this.debug = debug; } public boolean getVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public int getWarningLevel() { return warningLevel; } public void setWarningLevel(int warningLevel) { this.warningLevel = warningLevel; } public int getTaintCheckLevel() { return taintCheckLevel; } public void setTaintCheckLevel(int taintCheckLevel) { this.taintCheckLevel = taintCheckLevel; } public String getDefaultExternalEncoding() { return defaultExternalEncoding; } public void setDefaultExternalEncoding(String defaultExternalEncoding) { assert defaultExternalEncoding != null; this.defaultExternalEncoding = defaultExternalEncoding; } public String getDefaultInternalEncoding() { return defaultInternalEncoding; } public void setDefaultInternalEncoding(String defaultInternalEncoding) { assert defaultInternalEncoding != null; this.defaultInternalEncoding = defaultInternalEncoding; } public boolean getTrace() { return trace; } public void setTrace(boolean trace) { this.trace = trace; } public boolean getFullObjectSpace() { return fullObjectSpace; } public void setFullObjectSpace(boolean fullObjectSpace) { this.fullObjectSpace = fullObjectSpace; } public boolean getPrintParseTree() { return printParseTree; } public void setPrintParseTree(boolean printParseTree) { this.printParseTree = printParseTree; } public boolean getPrintExecutedFiles() { return printExecutedFiles; } public void setPrintExecutedFiles(boolean printExecutedFiles) { this.printExecutedFiles = printExecutedFiles; } public boolean getPrintSpiltInstanceVariables() { return printSpiltInstanceVariables; } public void setPrintSpiltInstanceVariables(boolean printSpiltInstanceVariables) { this.printSpiltInstanceVariables = printSpiltInstanceVariables; } public boolean getPrintUninitializedCalls() { return printUninitializedCalls; } public void setPrintUninitializedCalls(boolean printUninitializedCalls) { this.printUninitializedCalls = printUninitializedCalls; } public boolean getPrintJavaExceptions() { return printJavaExceptions; } public void setPrintJavaExceptions(boolean printJavaExceptions) { this.printJavaExceptions = printJavaExceptions; } public boolean getPrintRubyExceptions() { return printRubyExceptions; } public void setPrintRubyExceptions(boolean printRubyExceptions) { this.printRubyExceptions = printRubyExceptions; } public PrintStream getStandardOut() { return standardOut; } public void setStandardOut(PrintStream standardOut) { assert standardOut != null; this.standardOut = standardOut; } public InputReader getInputReader() { return inputReader; } public void setInputReader(InputReader lineReader) { assert lineReader != null; this.inputReader = lineReader; } }