equal
deleted
inserted
replaced
1 /* |
|
2 * $Id$ |
|
3 * |
|
4 * Simple demo for IsabelleProcess wrapper. |
|
5 * |
|
6 * Example session with Beanshell: |
|
7 * |
|
8 * $ cd [ISABELLE_HOME]/lib/classes |
|
9 * $ javac isabelle/*.java |
|
10 * |
|
11 * $ bsh |
|
12 * or |
|
13 * $ java -Disabelle.home=[ISABELLE_HOME] -jar bsh.jar |
|
14 * % addClassPath("."); |
|
15 * |
|
16 * % import isabelle.*; |
|
17 * % isabelle = new IsabelleDemo("HOL"); |
|
18 * % isabelle.command("theory Test imports Main begin"); |
|
19 * % isabelle.command("lemma \"A --> A\""); |
|
20 * % isabelle.command(".."); |
|
21 * % isabelle.command("end"); |
|
22 * % isabelle.close(); |
|
23 * |
|
24 */ |
|
25 |
|
26 package isabelle; |
|
27 |
|
28 public class IsabelleDemo extends IsabelleProcess { |
|
29 public IsabelleDemo(String logic) throws IsabelleProcessException |
|
30 { |
|
31 super(logic); |
|
32 new Thread (new Runnable () { |
|
33 public void run() |
|
34 { |
|
35 IsabelleProcess.Result result = null; |
|
36 do { |
|
37 try { |
|
38 result = results.take(); |
|
39 } catch (NullPointerException ex) { |
|
40 result = null; |
|
41 } catch (InterruptedException ex) { |
|
42 result = null; |
|
43 } |
|
44 if (result != null) |
|
45 System.err.println(result.toString()); |
|
46 if (result.kind == IsabelleProcess.Result.Kind.EXIT) { |
|
47 result = null; |
|
48 } |
|
49 } while (result != null); |
|
50 System.err.println("Console thread terminated"); |
|
51 } |
|
52 }).start(); |
|
53 } |
|
54 |
|
55 public IsabelleDemo() throws IsabelleProcessException { |
|
56 this(null); |
|
57 } |
|
58 } |
|