Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.ruby.runtime/src/com/oracle/truffle/ruby/runtime/configuration/ConfigurationBuilder.java @ 13659:62bfc12dc9e1
Ruby: more tidy up.
author | Chris Seaton <chris.seaton@oracle.com> |
---|---|
date | Wed, 15 Jan 2014 19:54:48 +0000 |
parents | 50c11b9a7fdf |
children | 6f9ce155dcfa |
rev | line source |
---|---|
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 * The mutable counterpart to {@link Configuration}. | |
18 */ | |
19 public class ConfigurationBuilder { | |
20 | |
21 /** | |
22 * The path of the JRuby packaging of the Ruby standard library within our source tree. | |
23 */ | |
24 public static final String JRUBY_STDLIB_JAR = "lib/jruby-stdlib-1.7.4.jar"; | |
25 | |
26 private String standardLibrary = JRUBY_STDLIB_JAR; | |
27 | |
13596
dd0ba029bf34
Ruby: disabled debugging and tracing while they?re broken.
Chris Seaton <chris.seaton@oracle.com>
parents:
13514
diff
changeset
|
28 private boolean debug = false; |
13514 | 29 private boolean verbose = false; |
30 private int warningLevel = 0; | |
31 private int taintCheckLevel = 0; | |
32 | |
33 private String defaultExternalEncoding = null; | |
34 private String defaultInternalEncoding = null; | |
35 | |
13596
dd0ba029bf34
Ruby: disabled debugging and tracing while they?re broken.
Chris Seaton <chris.seaton@oracle.com>
parents:
13514
diff
changeset
|
36 private boolean trace = false; |
13514 | 37 private boolean fullObjectSpace = false; |
38 | |
39 private boolean printParseTree = false; | |
40 private boolean printUninitializedCalls = false; | |
41 private boolean printJavaExceptions = false; | |
42 | |
43 private PrintStream standardOut = System.out; | |
44 | |
45 private InputReader inputReader = new InputReader() { | |
46 | |
47 private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
48 | |
49 @Override | |
50 public String readLine(String prompt) throws IOException { | |
51 System.err.print(prompt); | |
52 return reader.readLine(); | |
53 } | |
54 | |
55 }; | |
56 | |
57 public ConfigurationBuilder() { | |
58 } | |
59 | |
60 public ConfigurationBuilder(Configuration configuration) { | |
61 assert configuration != null; | |
62 | |
63 standardLibrary = configuration.getStandardLibrary(); | |
64 | |
65 debug = configuration.getDebug(); | |
66 verbose = configuration.getVerbose(); | |
67 warningLevel = configuration.getWarningLevel(); | |
68 taintCheckLevel = configuration.getTaintCheckLevel(); | |
69 | |
70 defaultExternalEncoding = configuration.getDefaultExternalEncoding(); | |
71 defaultInternalEncoding = configuration.getDefaultInternalEncoding(); | |
72 | |
73 trace = configuration.getTrace(); | |
74 fullObjectSpace = configuration.getFullObjectSpace(); | |
75 | |
76 printParseTree = configuration.getPrintParseTree(); | |
77 printUninitializedCalls = configuration.getPrintUninitializedCalls(); | |
78 printJavaExceptions = configuration.getPrintJavaExceptions(); | |
79 | |
80 standardOut = configuration.getStandardOut(); | |
81 } | |
82 | |
83 public String getStandardLibrary() { | |
84 return standardLibrary; | |
85 } | |
86 | |
87 public void setStandardLibrary(String standardLibrary) { | |
88 assert standardLibrary != null; | |
89 this.standardLibrary = standardLibrary; | |
90 } | |
91 | |
92 public boolean getDebug() { | |
93 return debug; | |
94 } | |
95 | |
96 public void setDebug(boolean debug) { | |
97 this.debug = debug; | |
98 } | |
99 | |
100 public boolean getVerbose() { | |
101 return verbose; | |
102 } | |
103 | |
104 public void setVerbose(boolean verbose) { | |
105 this.verbose = verbose; | |
106 } | |
107 | |
108 public int getWarningLevel() { | |
109 return warningLevel; | |
110 } | |
111 | |
112 public void setWarningLevel(int warningLevel) { | |
113 this.warningLevel = warningLevel; | |
114 } | |
115 | |
116 public int getTaintCheckLevel() { | |
117 return taintCheckLevel; | |
118 } | |
119 | |
120 public void setTaintCheckLevel(int taintCheckLevel) { | |
121 this.taintCheckLevel = taintCheckLevel; | |
122 } | |
123 | |
124 public String getDefaultExternalEncoding() { | |
125 return defaultExternalEncoding; | |
126 } | |
127 | |
128 public void setDefaultExternalEncoding(String defaultExternalEncoding) { | |
129 assert defaultExternalEncoding != null; | |
130 this.defaultExternalEncoding = defaultExternalEncoding; | |
131 } | |
132 | |
133 public String getDefaultInternalEncoding() { | |
134 return defaultInternalEncoding; | |
135 } | |
136 | |
137 public void setDefaultInternalEncoding(String defaultInternalEncoding) { | |
138 assert defaultInternalEncoding != null; | |
139 this.defaultInternalEncoding = defaultInternalEncoding; | |
140 } | |
141 | |
142 public boolean getTrace() { | |
143 return trace; | |
144 } | |
145 | |
146 public void setTrace(boolean trace) { | |
147 this.trace = trace; | |
148 } | |
149 | |
150 public boolean getFullObjectSpace() { | |
151 return fullObjectSpace; | |
152 } | |
153 | |
154 public void setFullObjectSpace(boolean fullObjectSpace) { | |
155 this.fullObjectSpace = fullObjectSpace; | |
156 } | |
157 | |
158 public boolean getPrintParseTree() { | |
159 return printParseTree; | |
160 } | |
161 | |
162 public void setPrintParseTree(boolean printParseTree) { | |
163 this.printParseTree = printParseTree; | |
164 } | |
165 | |
166 public boolean getPrintUninitializedCalls() { | |
167 return printUninitializedCalls; | |
168 } | |
169 | |
170 public void setPrintUninitializedCalls(boolean printUninitializedCalls) { | |
171 this.printUninitializedCalls = printUninitializedCalls; | |
172 } | |
173 | |
174 public boolean getPrintJavaExceptions() { | |
175 return printJavaExceptions; | |
176 } | |
177 | |
178 public void setPrintJavaExceptions(boolean printJavaExceptions) { | |
179 this.printJavaExceptions = printJavaExceptions; | |
180 } | |
181 | |
182 public PrintStream getStandardOut() { | |
183 return standardOut; | |
184 } | |
185 | |
186 public void setStandardOut(PrintStream standardOut) { | |
187 assert standardOut != null; | |
188 this.standardOut = standardOut; | |
189 } | |
190 | |
191 public InputReader getInputReader() { | |
192 return inputReader; | |
193 } | |
194 | |
195 public void setInputReader(InputReader lineReader) { | |
196 assert lineReader != null; | |
197 this.inputReader = lineReader; | |
198 } | |
199 | |
200 } |