src/Pure/ML/ml_process.scala
changeset 71598 269dc4bf1f40
parent 71594 8a298184f3f9
child 71639 ec84f542e411
equal deleted inserted replaced
71597:d025735a4090 71598:269dc4bf1f40
    12 
    12 
    13 object ML_Process
    13 object ML_Process
    14 {
    14 {
    15   def apply(options: Options,
    15   def apply(options: Options,
    16     sessions_structure: Sessions.Structure,
    16     sessions_structure: Sessions.Structure,
       
    17     store: Sessions.Store,
    17     logic: String = "",
    18     logic: String = "",
    18     args: List[String] = Nil,
    19     args: List[String] = Nil,
    19     modes: List[String] = Nil,
    20     modes: List[String] = Nil,
    20     raw_ml_system: Boolean = false,
    21     raw_ml_system: Boolean = false,
    21     cwd: JFile = null,
    22     cwd: JFile = null,
    22     env: Map[String, String] = Isabelle_System.settings(),
    23     env: Map[String, String] = Isabelle_System.settings(),
    23     redirect: Boolean = false,
    24     redirect: Boolean = false,
    24     cleanup: () => Unit = () => (),
    25     cleanup: () => Unit = () => (),
    25     session_base: Option[Sessions.Base] = None,
    26     session_base: Option[Sessions.Base] = None): Bash.Process =
    26     store: Option[Sessions.Store] = None): Bash.Process =
       
    27   {
    27   {
    28     val logic_name = Isabelle_System.default_logic(logic)
    28     val logic_name = Isabelle_System.default_logic(logic)
    29     val _store = store.getOrElse(Sessions.store(options))
       
    30 
    29 
    31     val heaps: List[String] =
    30     val heaps: List[String] =
    32       if (raw_ml_system) Nil
    31       if (raw_ml_system) Nil
    33       else {
    32       else {
    34         sessions_structure.selection(Sessions.Selection.session(logic_name)).
    33         sessions_structure.selection(Sessions.Selection.session(logic_name)).
    35           build_requirements(List(logic_name)).
    34           build_requirements(List(logic_name)).
    36           map(a => File.platform_path(_store.the_heap(a)))
    35           map(a => File.platform_path(store.the_heap(a)))
    37       }
    36       }
    38 
    37 
    39     val eval_init =
    38     val eval_init =
    40       if (heaps.isEmpty) {
    39       if (heaps.isEmpty) {
    41         List(
    40         List(
   177 
   176 
   178     val more_args = getopts(args)
   177     val more_args = getopts(args)
   179     if (args.isEmpty || more_args.nonEmpty) getopts.usage()
   178     if (args.isEmpty || more_args.nonEmpty) getopts.usage()
   180 
   179 
   181     val sessions_structure = Sessions.load_structure(options, dirs = dirs)
   180     val sessions_structure = Sessions.load_structure(options, dirs = dirs)
       
   181     val store = Sessions.store(options)
   182 
   182 
   183     val rc =
   183     val rc =
   184       ML_Process(options, sessions_structure, logic = logic, args = eval_args, modes = modes)
   184       ML_Process(options, sessions_structure, store, logic = logic, args = eval_args, modes = modes)
   185         .result().print_stdout.rc
   185         .result().print_stdout.rc
   186     sys.exit(rc)
   186     sys.exit(rc)
   187   })
   187   })
   188 }
   188 }