13514
|
1 /*
|
|
2 * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. This
|
|
3 * code is released under a tri EPL/GPL/LGPL license. You can use it,
|
|
4 * redistribute it and/or modify it under the terms of the:
|
|
5 *
|
|
6 * Eclipse Public License version 1.0
|
|
7 * GNU General Public License version 2
|
|
8 * GNU Lesser General Public License version 2.1
|
|
9 */
|
|
10 package com.oracle.truffle.ruby.runtime.configuration;
|
|
11
|
|
12 import java.io.*;
|
|
13
|
|
14 import com.oracle.truffle.ruby.runtime.*;
|
|
15
|
|
16 /**
|
|
17 * Configurable, immutable global parameters for Ruby.
|
|
18 */
|
|
19 public class Configuration {
|
|
20
|
|
21 private final String standardLibrary;
|
|
22
|
|
23 private final boolean verbose;
|
|
24 private final int warningLevel;
|
|
25 private final int taintCheckLevel;
|
|
26
|
|
27 private final String defaultExternalEncoding;
|
|
28 private final String defaultInternalEncoding;
|
|
29
|
|
30 private final boolean debug;
|
|
31 private final boolean trace;
|
|
32 private final boolean fullObjectSpace;
|
|
33
|
|
34 private final boolean printParseTree;
|
|
35 private final boolean printExecutedFiles;
|
|
36 private final boolean printSpiltInstanceVariables;
|
|
37 private final boolean printUninitializedCalls;
|
|
38 private final boolean printJavaExceptions;
|
|
39 private final boolean printRubyExceptions;
|
|
40
|
|
41 private final PrintStream standardOut;
|
|
42 private final InputReader inputReader;
|
|
43
|
|
44 public Configuration(ConfigurationBuilder builder) {
|
|
45 assert builder != null;
|
|
46
|
|
47 standardLibrary = builder.getStandardLibrary();
|
|
48
|
|
49 verbose = builder.getVerbose();
|
|
50 warningLevel = builder.getWarningLevel();
|
|
51 taintCheckLevel = builder.getTaintCheckLevel();
|
|
52
|
|
53 defaultExternalEncoding = builder.getDefaultExternalEncoding();
|
|
54 defaultInternalEncoding = builder.getDefaultInternalEncoding();
|
|
55
|
|
56 debug = builder.getDebug();
|
|
57 trace = builder.getTrace();
|
|
58 fullObjectSpace = builder.getFullObjectSpace();
|
|
59
|
|
60 printParseTree = builder.getPrintParseTree();
|
|
61 printExecutedFiles = builder.getPrintExecutedFiles();
|
|
62 printSpiltInstanceVariables = builder.getPrintSpiltInstanceVariables();
|
|
63 printUninitializedCalls = builder.getPrintUninitializedCalls();
|
|
64 printJavaExceptions = builder.getPrintJavaExceptions();
|
|
65 printRubyExceptions = builder.getPrintRubyExceptions();
|
|
66
|
|
67 standardOut = builder.getStandardOut();
|
|
68 inputReader = builder.getInputReader();
|
|
69 }
|
|
70
|
|
71 public String getStandardLibrary() {
|
|
72 return standardLibrary;
|
|
73 }
|
|
74
|
|
75 public boolean getDebug() {
|
|
76 return debug;
|
|
77 }
|
|
78
|
|
79 public boolean getVerbose() {
|
|
80 return verbose;
|
|
81 }
|
|
82
|
|
83 public int getWarningLevel() {
|
|
84 return warningLevel;
|
|
85 }
|
|
86
|
|
87 public int getTaintCheckLevel() {
|
|
88 return taintCheckLevel;
|
|
89 }
|
|
90
|
|
91 public String getDefaultExternalEncoding() {
|
|
92 return defaultExternalEncoding;
|
|
93 }
|
|
94
|
|
95 public String getDefaultInternalEncoding() {
|
|
96 return defaultInternalEncoding;
|
|
97 }
|
|
98
|
|
99 public boolean getTrace() {
|
|
100 return trace;
|
|
101 }
|
|
102
|
|
103 public boolean getFullObjectSpace() {
|
|
104 return fullObjectSpace;
|
|
105 }
|
|
106
|
|
107 public boolean getPrintParseTree() {
|
|
108 return printParseTree;
|
|
109 }
|
|
110
|
|
111 public boolean getPrintExecutedFiles() {
|
|
112 return printExecutedFiles;
|
|
113 }
|
|
114
|
|
115 public boolean getPrintSpiltInstanceVariables() {
|
|
116 return printSpiltInstanceVariables;
|
|
117 }
|
|
118
|
|
119 public boolean getPrintUninitializedCalls() {
|
|
120 return printUninitializedCalls;
|
|
121 }
|
|
122
|
|
123 public boolean getPrintJavaExceptions() {
|
|
124 return printJavaExceptions;
|
|
125 }
|
|
126
|
|
127 public boolean getPrintRubyExceptions() {
|
|
128 return printRubyExceptions;
|
|
129 }
|
|
130
|
|
131 public PrintStream getStandardOut() {
|
|
132 return standardOut;
|
|
133 }
|
|
134
|
|
135 public InputReader getInputReader() {
|
|
136 return inputReader;
|
|
137 }
|
|
138
|
|
139 }
|