src/Pure/Isar/session.ML
changeset 9414 1463576f3968
parent 8807 0046be1769f9
child 10571 fdde440a9033
equal deleted inserted replaced
9413:ba209591a8d4 9414:1463576f3968
    22 val pure = "Pure";
    22 val pure = "Pure";
    23 
    23 
    24 val session = ref ([pure]: string list);
    24 val session = ref ([pure]: string list);
    25 val session_path = ref ([]: string list);
    25 val session_path = ref ([]: string list);
    26 val session_finished = ref false;
    26 val session_finished = ref false;
    27 val rpath = ref (None : Url.T option);
    27 val rpath = ref (None: Url.T option);
       
    28 
       
    29 
       
    30 (* access path *)
    28 
    31 
    29 fun path () = ! session_path;
    32 fun path () = ! session_path;
    30 
       
    31 fun add_path reset s =
       
    32   (session := ! session @ [s]; session_path := ((if reset then [] else ! session_path) @ [s]));
       
    33 
       
    34 
       
    35 (* diagnostics *)
       
    36 
    33 
    37 fun str_of [] = "Pure"
    34 fun str_of [] = "Pure"
    38   | str_of elems = space_implode "/" elems;
    35   | str_of elems = space_implode "/" elems;
    39 
    36 
    40 fun welcome () = "Welcome to Isabelle/" ^ str_of (path ()) ^ " (" ^ version ^ ")";
    37 fun welcome () = "Welcome to Isabelle/" ^ str_of (path ()) ^ " (" ^ version ^ ")";
       
    38 
       
    39 
       
    40 (* add_path *)
       
    41 
       
    42 fun add_path reset s =
       
    43   let val sess = ! session @ [s] in
       
    44     (case Library.duplicates sess of
       
    45       [] => (session := sess; session_path := ((if reset then [] else ! session_path) @ [s]))
       
    46     | dups => error ("Duplicate session identifiers " ^ commas_quote dups ^ " in " ^ str_of sess))
       
    47   end;
    41 
    48 
    42 
    49 
    43 (* init *)
    50 (* init *)
    44 
    51 
    45 fun init reset parent name =
    52 fun init reset parent name =