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 printUninitializedCalls;
|
|
36 private final boolean printJavaExceptions;
|
|
37
|
|
38 private final PrintStream standardOut;
|
|
39 private final InputReader inputReader;
|
|
40
|
|
41 public Configuration(ConfigurationBuilder builder) {
|
|
42 assert builder != null;
|
|
43
|
|
44 standardLibrary = builder.getStandardLibrary();
|
|
45
|
|
46 verbose = builder.getVerbose();
|
|
47 warningLevel = builder.getWarningLevel();
|
|
48 taintCheckLevel = builder.getTaintCheckLevel();
|
|
49
|
|
50 defaultExternalEncoding = builder.getDefaultExternalEncoding();
|
|
51 defaultInternalEncoding = builder.getDefaultInternalEncoding();
|
|
52
|
|
53 debug = builder.getDebug();
|
|
54 trace = builder.getTrace();
|
|
55 fullObjectSpace = builder.getFullObjectSpace();
|
|
56
|
|
57 printParseTree = builder.getPrintParseTree();
|
|
58 printUninitializedCalls = builder.getPrintUninitializedCalls();
|
|
59 printJavaExceptions = builder.getPrintJavaExceptions();
|
|
60
|
|
61 standardOut = builder.getStandardOut();
|
|
62 inputReader = builder.getInputReader();
|
|
63 }
|
|
64
|
|
65 public String getStandardLibrary() {
|
|
66 return standardLibrary;
|
|
67 }
|
|
68
|
|
69 public boolean getDebug() {
|
|
70 return debug;
|
|
71 }
|
|
72
|
|
73 public boolean getVerbose() {
|
|
74 return verbose;
|
|
75 }
|
|
76
|
|
77 public int getWarningLevel() {
|
|
78 return warningLevel;
|
|
79 }
|
|
80
|
|
81 public int getTaintCheckLevel() {
|
|
82 return taintCheckLevel;
|
|
83 }
|
|
84
|
|
85 public String getDefaultExternalEncoding() {
|
|
86 return defaultExternalEncoding;
|
|
87 }
|
|
88
|
|
89 public String getDefaultInternalEncoding() {
|
|
90 return defaultInternalEncoding;
|
|
91 }
|
|
92
|
|
93 public boolean getTrace() {
|
|
94 return trace;
|
|
95 }
|
|
96
|
|
97 public boolean getFullObjectSpace() {
|
|
98 return fullObjectSpace;
|
|
99 }
|
|
100
|
|
101 public boolean getPrintParseTree() {
|
|
102 return printParseTree;
|
|
103 }
|
|
104
|
|
105 public boolean getPrintUninitializedCalls() {
|
|
106 return printUninitializedCalls;
|
|
107 }
|
|
108
|
|
109 public boolean getPrintJavaExceptions() {
|
|
110 return printJavaExceptions;
|
|
111 }
|
|
112
|
|
113 public PrintStream getStandardOut() {
|
|
114 return standardOut;
|
|
115 }
|
|
116
|
|
117 public InputReader getInputReader() {
|
|
118 return inputReader;
|
|
119 }
|
|
120
|
|
121 }
|