src/Pure/Tools/main.scala
author wenzelm
Wed, 04 Sep 2013 15:27:24 +0200
changeset 53403 c09f4005d6bd
parent 52675 f3a6b1d0915e
child 53419 1c87e79bb838
permissions -rw-r--r--
some explicit indication of Proof General legacy;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50687
a8db4bf70e90 moved files;
wenzelm
parents: 48275
diff changeset
     1
/*  Title:      Pure/Tools/main.scala
47663
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     3
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     4
Default Isabelle application wrapper.
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     5
*/
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     6
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     7
package isabelle
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     8
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
     9
import scala.swing.TextArea
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    10
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    11
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    12
object Main
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    13
{
48275
31daac3a85ea more standard main method;
wenzelm
parents: 48192
diff changeset
    14
  def main(args: Array[String])
47663
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    15
  {
52675
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    16
    args.toList match {
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    17
      case "-i" :: rest =>
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    18
        if (Platform.is_windows) Cygwin_Init.main(rest.toArray)
47663
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    19
52675
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    20
      case _ =>
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    21
        val (out, rc) =
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    22
          try {
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    23
            GUI.init_laf()
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    24
            Isabelle_System.init()
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    25
            Isabelle_System.isabelle_tool("jedit", ("-s" :: "--" :: args.toList): _*)
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    26
          }
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    27
          catch { case exn: Throwable => (Exn.message(exn), 2) }
47663
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    28
52675
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    29
        if (rc != 0)
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    30
          GUI.dialog(null, "Isabelle", "Isabelle output",
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    31
            GUI.scrollable_text(out + "\nReturn code: " + rc))
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    32
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    33
        sys.exit(rc)
f3a6b1d0915e more self-contained application, with side-entry for init;
wenzelm
parents: 51617
diff changeset
    34
    }
47663
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    35
  }
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    36
}
20e0865ae9e7 default Isabelle application wrapper -- JVM entry point for Isabelle.exe;
wenzelm
parents:
diff changeset
    37