| author | wenzelm | 
| Tue, 10 Aug 2010 12:09:53 +0200 | |
| changeset 38258 | dd7dcb9b2637 | 
| parent 38255 | bf44a85c74cc | 
| child 38371 | 5b615a4a3a68 | 
| permissions | -rw-r--r-- | 
| 30175 | 1  | 
/* Title: Pure/System/isabelle_system.scala  | 
| 27919 | 2  | 
Author: Makarius  | 
3  | 
||
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
4  | 
Isabelle system support (settings environment etc.).  | 
| 27919 | 5  | 
*/  | 
6  | 
||
7  | 
package isabelle  | 
|
8  | 
||
| 
31520
 
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
 
wenzelm 
parents: 
31500 
diff
changeset
 | 
9  | 
import java.util.regex.Pattern  | 
| 31820 | 10  | 
import java.util.Locale  | 
| 
38253
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
11  | 
import java.io.{BufferedInputStream, FileInputStream, BufferedOutputStream, FileOutputStream,
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
12  | 
OutputStream, File, IOException}  | 
| 34024 | 13  | 
import java.awt.{GraphicsEnvironment, Font}
 | 
| 37367 | 14  | 
import java.awt.font.TextAttribute  | 
| 28063 | 15  | 
|
16  | 
import scala.io.Source  | 
|
| 
31520
 
0a99c8716312
simplified IsabelleSystem.platform_path for cygwin;
 
wenzelm 
parents: 
31500 
diff
changeset
 | 
17  | 
import scala.util.matching.Regex  | 
| 34163 | 18  | 
import scala.collection.mutable  | 
| 27936 | 19  | 
|
| 27919 | 20  | 
|
| 
37013
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
21  | 
class Isabelle_System(this_isabelle_home: String) extends Standard_System  | 
| 31498 | 22  | 
{
 | 
| 
37013
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
23  | 
def this() = this(null)  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
24  | 
|
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
25  | 
|
| 31796 | 26  | 
/** Isabelle environment **/  | 
27  | 
||
| 
37013
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
28  | 
/*  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
29  | 
isabelle_home precedence:  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
30  | 
(1) this_isabelle_home as explicit argument  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
31  | 
(2) ISABELLE_HOME process environment variable (e.g. inherited from running isabelle tool)  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
32  | 
(3) isabelle.home system property (e.g. via JVM application boot process)  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
33  | 
*/  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
34  | 
|
| 31498 | 35  | 
private val environment: Map[String, String] =  | 
36  | 
  {
 | 
|
| 
36011
 
3ff725ac13a4
adapted to Scala 2.8.0 Beta1 -- with notable changes to scala.collection;
 
wenzelm 
parents: 
35023 
diff
changeset
 | 
37  | 
import scala.collection.JavaConversions._  | 
| 31498 | 38  | 
|
| 
36193
 
067a01827fca
improved ISABELLE_JAVA, based on THIS_JAVA of the actually running JVM;
 
wenzelm 
parents: 
36136 
diff
changeset
 | 
39  | 
val env0 = Map(java.lang.System.getenv.toList: _*) +  | 
| 
 
067a01827fca
improved ISABELLE_JAVA, based on THIS_JAVA of the actually running JVM;
 
wenzelm 
parents: 
36136 
diff
changeset
 | 
40  | 
      ("THIS_JAVA" -> this_java())
 | 
| 27919 | 41  | 
|
| 
31927
 
9a0f28bcc81d
init isabelle home from existing setting or hint via system property;
 
wenzelm 
parents: 
31829 
diff
changeset
 | 
42  | 
val isabelle_home =  | 
| 
37013
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
43  | 
if (this_isabelle_home != null) this_isabelle_home  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
44  | 
else  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
45  | 
        env0.get("ISABELLE_HOME") match {
 | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
46  | 
          case None | Some("") =>
 | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
47  | 
            val path = java.lang.System.getProperty("isabelle.home")
 | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
48  | 
            if (path == null || path == "") error("Unknown Isabelle home directory")
 | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
49  | 
else path  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
50  | 
case Some(path) => path  | 
| 
 
641923374eba
Isabelle_System: allow explicit isabelle_home argument;
 
wenzelm 
parents: 
36991 
diff
changeset
 | 
51  | 
}  | 
| 29177 | 52  | 
|
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
53  | 
    Standard_System.with_tmp_file("settings") { dump =>
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
54  | 
val shell_prefix =  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
55  | 
if (Platform.is_windows) List(platform_root + "\\bin\\bash", "-l") else Nil  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
56  | 
val cmdline =  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
57  | 
shell_prefix ::: List(isabelle_home + "/bin/isabelle", "getenv", "-d", dump.toString)  | 
| 34258 | 58  | 
val (output, rc) = Standard_System.raw_exec(null, env0, true, cmdline: _*)  | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
59  | 
if (rc != 0) error(output)  | 
| 31498 | 60  | 
|
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
61  | 
val entries =  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
62  | 
          for (entry <- Source.fromFile(dump).mkString split "\0" if entry != "") yield {
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
63  | 
            val i = entry.indexOf('=')
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
64  | 
if (i <= 0) (entry -> "")  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
65  | 
else (entry.substring(0, i) -> entry.substring(i + 1))  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
66  | 
}  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
67  | 
Map(entries: _*) +  | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
68  | 
          ("HOME" -> java.lang.System.getenv("HOME")) +
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
69  | 
          ("PATH" -> java.lang.System.getenv("PATH"))
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
70  | 
}  | 
| 27953 | 71  | 
}  | 
| 27919 | 72  | 
|
| 31796 | 73  | 
|
| 34204 | 74  | 
/* external processes */  | 
75  | 
||
76  | 
def execute(redirect: Boolean, args: String*): Process =  | 
|
77  | 
  {
 | 
|
78  | 
val cmdline =  | 
|
79  | 
if (Platform.is_windows) List(platform_root + "\\bin\\env.exe") ++ args  | 
|
80  | 
else args  | 
|
| 34219 | 81  | 
Standard_System.raw_execute(null, environment, redirect, cmdline: _*)  | 
| 34204 | 82  | 
}  | 
83  | 
||
84  | 
||
| 31796 | 85  | 
/* getenv */  | 
86  | 
||
| 31498 | 87  | 
def getenv(name: String): String =  | 
88  | 
environment.getOrElse(if (name == "HOME") "HOME_JVM" else name, "")  | 
|
89  | 
||
90  | 
def getenv_strict(name: String): String =  | 
|
91  | 
  {
 | 
|
| 
31234
 
6ce6801129de
getenv_strict needs to be based on getenv (accidentally broken in 0e88d33e8d19);
 
wenzelm 
parents: 
30175 
diff
changeset
 | 
92  | 
val value = getenv(name)  | 
| 
27993
 
6dd90ef9f927
simplified exceptions: use plain error function / RuntimeException;
 
wenzelm 
parents: 
27974 
diff
changeset
 | 
93  | 
    if (value != "") value else error("Undefined environment variable: " + name)
 | 
| 27919 | 94  | 
}  | 
95  | 
||
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
96  | 
  override def toString = getenv_strict("ISABELLE_HOME")
 | 
| 31703 | 97  | 
|
| 27936 | 98  | 
|
| 31796 | 99  | 
|
100  | 
/** file path specifications **/  | 
|
101  | 
||
| 31820 | 102  | 
/* expand_path */  | 
| 31796 | 103  | 
|
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
104  | 
  private val Root = new Regex("(//+[^/]*|/)(.*)")
 | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
105  | 
  private val Only_Root = new Regex("//+[^/]*|/")
 | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
106  | 
|
| 31820 | 107  | 
def expand_path(isabelle_path: String): String =  | 
| 31796 | 108  | 
  {
 | 
109  | 
val result_path = new StringBuilder  | 
|
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
110  | 
def init(path: String): String =  | 
| 31796 | 111  | 
    {
 | 
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
112  | 
      path match {
 | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
113  | 
case Root(root, rest) =>  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
114  | 
result_path.clear  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
115  | 
result_path ++= root  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
116  | 
rest  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
117  | 
case _ => path  | 
| 31796 | 118  | 
}  | 
119  | 
}  | 
|
120  | 
def append(path: String)  | 
|
121  | 
    {
 | 
|
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
122  | 
val rest = init(path)  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
123  | 
      for (p <- rest.split("/") if p != "" && p != ".") {
 | 
| 31803 | 124  | 
        if (p == "..") {
 | 
125  | 
val result = result_path.toString  | 
|
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
126  | 
          if (!Only_Root.pattern.matcher(result).matches) {
 | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
127  | 
            val i = result.lastIndexOf("/")
 | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
128  | 
if (result == "")  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
129  | 
result_path ++= ".."  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
130  | 
else if (result.substring(i + 1) == "..")  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
131  | 
result_path ++= "/.."  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
132  | 
else if (i < 0)  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
133  | 
result_path.length = 0  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
134  | 
else  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
135  | 
result_path.length = i  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
136  | 
}  | 
| 31803 | 137  | 
}  | 
138  | 
        else {
 | 
|
139  | 
val len = result_path.length  | 
|
140  | 
if (len > 0 && result_path(len - 1) != '/')  | 
|
141  | 
result_path += '/'  | 
|
142  | 
result_path ++= p  | 
|
143  | 
}  | 
|
| 31796 | 144  | 
}  | 
145  | 
}  | 
|
| 
36136
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
146  | 
val rest = init(isabelle_path)  | 
| 
 
89b1a136edef
more precise treatment of UNC server prefix, e.g. //foo;
 
wenzelm 
parents: 
36012 
diff
changeset
 | 
147  | 
    for (p <- rest.split("/")) {
 | 
| 31796 | 148  | 
      if (p.startsWith("$")) append(getenv_strict(p.substring(1)))
 | 
149  | 
      else if (p == "~") append(getenv_strict("HOME"))
 | 
|
150  | 
      else if (p == "~~") append(getenv_strict("ISABELLE_HOME"))
 | 
|
151  | 
else append(p)  | 
|
152  | 
}  | 
|
153  | 
result_path.toString  | 
|
154  | 
}  | 
|
155  | 
||
156  | 
||
| 31820 | 157  | 
/* platform_path */  | 
| 27936 | 158  | 
|
| 31820 | 159  | 
def platform_path(isabelle_path: String): String =  | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
160  | 
jvm_path(expand_path(isabelle_path))  | 
| 27953 | 161  | 
|
| 31498 | 162  | 
def platform_file(path: String) = new File(platform_path(path))  | 
| 29152 | 163  | 
|
| 27953 | 164  | 
|
| 36991 | 165  | 
/* try_read */  | 
166  | 
||
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
167  | 
def try_read(paths: Seq[String]): String =  | 
| 36991 | 168  | 
  {
 | 
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
169  | 
val buf = new StringBuilder  | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
170  | 
    for {
 | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
171  | 
path <- paths  | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
172  | 
file = platform_file(path) if file.isFile  | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
173  | 
      c <- (Source.fromFile(file) ++ Iterator.single('\n'))
 | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
174  | 
} buf.append(c)  | 
| 
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
175  | 
buf.toString  | 
| 36991 | 176  | 
}  | 
177  | 
||
178  | 
||
| 31436 | 179  | 
/* source files */  | 
180  | 
||
181  | 
private def try_file(file: File) = if (file.isFile) Some(file) else None  | 
|
182  | 
||
| 31498 | 183  | 
def source_file(path: String): Option[File] =  | 
184  | 
  {
 | 
|
185  | 
    if (path.startsWith("/") || path == "")
 | 
|
| 31436 | 186  | 
try_file(platform_file(path))  | 
187  | 
    else {
 | 
|
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
188  | 
      val pure_file = platform_file("$ISABELLE_HOME/src/Pure/" + path)
 | 
| 31436 | 189  | 
if (pure_file.isFile) Some(pure_file)  | 
190  | 
      else if (getenv("ML_SOURCES") != "")
 | 
|
191  | 
        try_file(platform_file("$ML_SOURCES/" + path))
 | 
|
192  | 
else None  | 
|
193  | 
}  | 
|
194  | 
}  | 
|
195  | 
||
196  | 
||
| 32450 | 197  | 
|
| 31796 | 198  | 
/** system tools **/  | 
199  | 
||
| 
35010
 
d6e492cea6e4
renamed system/system_out to bash/bash_output -- to emphasized that this is really GNU bash, not some undefined POSIX sh;
 
wenzelm 
parents: 
35006 
diff
changeset
 | 
200  | 
def bash_output(script: String): (String, Int) =  | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
201  | 
  {
 | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
202  | 
    Standard_System.with_tmp_file("isabelle_script") { script_file =>
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
203  | 
      Standard_System.with_tmp_file("isabelle_pid") { pid_file =>
 | 
| 
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
204  | 
        Standard_System.with_tmp_file("isabelle_output") { output_file =>
 | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
205  | 
|
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
206  | 
Standard_System.write_file(script_file, script)  | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
207  | 
|
| 
35023
 
16f9877abf0b
modernized perl scripts: prefer standalone executables;
 
wenzelm 
parents: 
35010 
diff
changeset
 | 
208  | 
          val proc = execute(true, expand_path("$ISABELLE_HOME/lib/scripts/bash"), "group",
 | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
209  | 
script_file.getPath, pid_file.getPath, output_file.getPath)  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
210  | 
|
| 34199 | 211  | 
def kill(strict: Boolean) =  | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
212  | 
          {
 | 
| 34199 | 213  | 
val pid =  | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
214  | 
              try { Some(Standard_System.read_file(pid_file)) }
 | 
| 34199 | 215  | 
              catch { case _: IOException => None }
 | 
216  | 
            if (pid.isDefined) {
 | 
|
217  | 
var running = true  | 
|
| 37132 | 218  | 
var count = 10 // FIXME property!?  | 
| 34199 | 219  | 
              while (running && count > 0) {
 | 
220  | 
if (execute(true, "kill", "-INT", "-" + pid.get).waitFor != 0)  | 
|
221  | 
running = false  | 
|
222  | 
                else {
 | 
|
| 37132 | 223  | 
Thread.sleep(100) // FIXME property!?  | 
| 34199 | 224  | 
if (!strict) count -= 1  | 
225  | 
}  | 
|
226  | 
}  | 
|
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
227  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
228  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
229  | 
|
| 34199 | 230  | 
          val shutdown_hook = new Thread { override def run = kill(true) }
 | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
231  | 
Runtime.getRuntime.addShutdownHook(shutdown_hook) // FIXME tmp files during shutdown?!?  | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
232  | 
|
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
233  | 
def cleanup() =  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
234  | 
            try { Runtime.getRuntime.removeShutdownHook(shutdown_hook) }
 | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
235  | 
            catch { case _: IllegalStateException => }
 | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
236  | 
|
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
237  | 
val rc =  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
238  | 
            try {
 | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
239  | 
              try { proc.waitFor }  // FIXME read stderr (!??)
 | 
| 34199 | 240  | 
              catch { case e: InterruptedException => Thread.interrupted; kill(false); throw e }
 | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
241  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
242  | 
            finally {
 | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
243  | 
proc.getOutputStream.close  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
244  | 
proc.getInputStream.close  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
245  | 
proc.getErrorStream.close  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
246  | 
proc.destroy  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
247  | 
cleanup()  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
248  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
249  | 
|
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
250  | 
val output =  | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
251  | 
            try { Standard_System.read_file(output_file) }
 | 
| 
34198
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
252  | 
            catch { case _: IOException => "" }
 | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
253  | 
|
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
254  | 
(output, rc)  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
255  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
256  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
257  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
258  | 
}  | 
| 
 
ff5486262cd6
moved Library.decode_permissive_utf8 to Isabelle_System;
 
wenzelm 
parents: 
34196 
diff
changeset
 | 
259  | 
|
| 
31818
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
260  | 
def isabelle_tool(name: String, args: String*): (String, Int) =  | 
| 31498 | 261  | 
  {
 | 
| 34200 | 262  | 
    getenv_strict("ISABELLE_TOOLS").split(":").find { dir =>
 | 
| 
31818
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
263  | 
val file = platform_file(dir + "/" + name)  | 
| 34025 | 264  | 
      try { file.isFile && file.canRead && file.canExecute }
 | 
| 
31818
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
265  | 
      catch { case _: SecurityException => false }
 | 
| 34200 | 266  | 
    } match {
 | 
| 
31818
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
267  | 
case Some(dir) =>  | 
| 
34201
 
c95dcd12f48a
separate Standard_System (Cygwin/Posix compatibility) vs. Isabelle_System (settings environment etc.);
 
wenzelm 
parents: 
34200 
diff
changeset
 | 
268  | 
Standard_System.process_output(  | 
| 34195 | 269  | 
execute(true, (List(expand_path(dir + "/" + name)) ++ args): _*))  | 
| 
31818
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
270  | 
      case None => ("Unknown Isabelle tool: " + name, 2)
 | 
| 
 
f698f76a3713
builtin isabelle_tool for ML and Scala -- avoids excessive shell script (especially important for Cygwin);
 
wenzelm 
parents: 
31803 
diff
changeset
 | 
271  | 
}  | 
| 28063 | 272  | 
}  | 
273  | 
||
274  | 
||
275  | 
/* named pipes */  | 
|
276  | 
||
| 31498 | 277  | 
def mk_fifo(): String =  | 
278  | 
  {
 | 
|
| 
28496
 
4cff10648928
renamed isatool to isabelle_tool in programming interfaces;
 
wenzelm 
parents: 
28063 
diff
changeset
 | 
279  | 
    val (result, rc) = isabelle_tool("mkfifo")
 | 
| 28063 | 280  | 
if (rc == 0) result.trim  | 
281  | 
else error(result)  | 
|
282  | 
}  | 
|
283  | 
||
| 31498 | 284  | 
def rm_fifo(fifo: String)  | 
285  | 
  {
 | 
|
| 
28496
 
4cff10648928
renamed isatool to isabelle_tool in programming interfaces;
 
wenzelm 
parents: 
28063 
diff
changeset
 | 
286  | 
    val (result, rc) = isabelle_tool("rmfifo", fifo)
 | 
| 28063 | 287  | 
if (rc != 0) error(result)  | 
288  | 
}  | 
|
289  | 
||
| 
38253
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
290  | 
def fifo_input_stream(fifo: String): BufferedInputStream =  | 
| 31498 | 291  | 
  {
 | 
| 
38253
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
292  | 
// block until peer is ready  | 
| 29177 | 293  | 
val stream =  | 
| 
38255
 
bf44a85c74cc
uniform raw_dump for input/output fifos on Cygwin;
 
wenzelm 
parents: 
38253 
diff
changeset
 | 
294  | 
      if (Platform.is_windows) { // Cygwin fifo as Windows/Java input stream
 | 
| 
 
bf44a85c74cc
uniform raw_dump for input/output fifos on Cygwin;
 
wenzelm 
parents: 
38253 
diff
changeset
 | 
295  | 
        val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), fifo, "-")
 | 
| 
34194
 
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
 
wenzelm 
parents: 
34186 
diff
changeset
 | 
296  | 
proc.getOutputStream.close  | 
| 
 
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
 
wenzelm 
parents: 
34186 
diff
changeset
 | 
297  | 
proc.getErrorStream.close  | 
| 
 
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
 
wenzelm 
parents: 
34186 
diff
changeset
 | 
298  | 
proc.getInputStream  | 
| 
 
001321ca185c
slightly more paranoid cleanup of process (cf. http://kylecartmell.com/?p=9 "Five Common java.lang.Process Pitfalls");
 
wenzelm 
parents: 
34186 
diff
changeset
 | 
299  | 
}  | 
| 29177 | 300  | 
else new FileInputStream(fifo)  | 
| 34100 | 301  | 
new BufferedInputStream(stream)  | 
| 29177 | 302  | 
}  | 
| 28063 | 303  | 
|
| 
38253
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
304  | 
def fifo_output_stream(fifo: String): BufferedOutputStream =  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
305  | 
  {
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
306  | 
// block until peer is ready  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
307  | 
val stream =  | 
| 
38255
 
bf44a85c74cc
uniform raw_dump for input/output fifos on Cygwin;
 
wenzelm 
parents: 
38253 
diff
changeset
 | 
308  | 
      if (Platform.is_windows) { // Cygwin fifo as Windows/Java output stream
 | 
| 
 
bf44a85c74cc
uniform raw_dump for input/output fifos on Cygwin;
 
wenzelm 
parents: 
38253 
diff
changeset
 | 
309  | 
        val proc = execute(false, expand_path("$ISABELLE_HOME/lib/scripts/raw_dump"), "-", fifo)
 | 
| 
38253
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
310  | 
proc.getInputStream.close  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
311  | 
proc.getErrorStream.close  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
312  | 
val out = proc.getOutputStream  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
313  | 
        new OutputStream {
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
314  | 
          override def close() { out.close(); proc.waitFor() }
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
315  | 
          override def flush() { out.flush() }
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
316  | 
          override def write(b: Array[Byte]) { out.write(b) }
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
317  | 
          override def write(b: Array[Byte], off: Int, len: Int) { out.write(b, off, len) }
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
318  | 
          override def write(b: Int) { out.write(b) }
 | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
319  | 
}  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
320  | 
}  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
321  | 
else new FileOutputStream(fifo)  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
322  | 
new BufferedOutputStream(stream)  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
323  | 
}  | 
| 
 
3d4e521014f7
Isabelle_Process: separate input fifo for commands (still using the old tty protocol);
 
wenzelm 
parents: 
37367 
diff
changeset
 | 
324  | 
|
| 29152 | 325  | 
|
| 32450 | 326  | 
|
| 31796 | 327  | 
/** Isabelle resources **/  | 
328  | 
||
| 32328 | 329  | 
/* components */  | 
330  | 
||
331  | 
def components(): List[String] =  | 
|
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
332  | 
    getenv_strict("ISABELLE_COMPONENTS").split(":").toList
 | 
| 32328 | 333  | 
|
334  | 
||
| 29152 | 335  | 
/* find logics */  | 
336  | 
||
| 31498 | 337  | 
def find_logics(): List[String] =  | 
338  | 
  {
 | 
|
| 29152 | 339  | 
    val ml_ident = getenv_strict("ML_IDENTIFIER")
 | 
| 34163 | 340  | 
val logics = new mutable.ListBuffer[String]  | 
| 29152 | 341  | 
    for (dir <- getenv_strict("ISABELLE_PATH").split(":")) {
 | 
342  | 
val files = platform_file(dir + "/" + ml_ident).listFiles()  | 
|
343  | 
      if (files != null) {
 | 
|
344  | 
for (file <- files if file.isFile) logics += file.getName  | 
|
345  | 
}  | 
|
346  | 
}  | 
|
| 36012 | 347  | 
logics.toList.sortWith(_ < _)  | 
| 29152 | 348  | 
}  | 
| 29570 | 349  | 
|
350  | 
||
351  | 
/* symbols */  | 
|
352  | 
||
353  | 
val symbols = new Symbol.Interpretation(  | 
|
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
354  | 
    try_read(getenv_strict("ISABELLE_SYMBOLS").split(":").toList).split("\n").toList)
 | 
| 34024 | 355  | 
|
356  | 
||
357  | 
/* fonts */  | 
|
358  | 
||
| 
37058
 
c47653f3ec14
rendering information and style sheets via settings;
 
wenzelm 
parents: 
37013 
diff
changeset
 | 
359  | 
  val font_family = getenv_strict("ISABELLE_FONT_FAMILY")
 | 
| 37367 | 360  | 
val font_family_default = "IsabelleText"  | 
| 34024 | 361  | 
|
| 36788 | 362  | 
def get_font(size: Int = 1, bold: Boolean = false): Font =  | 
| 36785 | 363  | 
new Font(font_family, if (bold) Font.BOLD else Font.PLAIN, size)  | 
| 34024 | 364  | 
|
| 37367 | 365  | 
def create_default_font(bold: Boolean = false): Font =  | 
366  | 
if (bold)  | 
|
367  | 
Font.createFont(Font.TRUETYPE_FONT,  | 
|
368  | 
        platform_file("$ISABELLE_HOME/lib/fonts/IsabelleTextBold.ttf"))
 | 
|
369  | 
else  | 
|
370  | 
Font.createFont(Font.TRUETYPE_FONT,  | 
|
371  | 
        platform_file("$ISABELLE_HOME/lib/fonts/IsabelleText.ttf"))
 | 
|
372  | 
||
| 
34044
 
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
 
wenzelm 
parents: 
34027 
diff
changeset
 | 
373  | 
def install_fonts()  | 
| 
 
09afb1d49fe7
slightly more robust and less ambitious version of install_fonts;
 
wenzelm 
parents: 
34027 
diff
changeset
 | 
374  | 
  {
 | 
| 37367 | 375  | 
val ge = GraphicsEnvironment.getLocalGraphicsEnvironment()  | 
376  | 
ge.registerFont(create_default_font(bold = false))  | 
|
377  | 
ge.registerFont(create_default_font(bold = true))  | 
|
| 34024 | 378  | 
}  | 
| 27919 | 379  | 
}  |