src/Pure/context.ML
changeset 61878 fa4dbb82732f
parent 61877 276ad4354069
child 62663 bea354f6ff21
equal deleted inserted replaced
61877:276ad4354069 61878:fa4dbb82732f
    35   val ancestors_of: theory -> theory list
    35   val ancestors_of: theory -> theory list
    36   val theory_id_name: theory_id -> string
    36   val theory_id_name: theory_id -> string
    37   val theory_name: theory -> string
    37   val theory_name: theory -> string
    38   val PureN: string
    38   val PureN: string
    39   val pretty_thy: theory -> Pretty.T
    39   val pretty_thy: theory -> Pretty.T
    40   val string_of_thy: theory -> string
       
    41   val pretty_abbrev_thy: theory -> Pretty.T
    40   val pretty_abbrev_thy: theory -> Pretty.T
    42   val str_of_thy: theory -> string
       
    43   val get_theory: theory -> string -> theory
    41   val get_theory: theory -> string -> theory
    44   val this_theory: theory -> string -> theory
    42   val this_theory: theory -> string -> theory
    45   val eq_thy_id: theory_id * theory_id -> bool
    43   val eq_thy_id: theory_id * theory_id -> bool
    46   val eq_thy: theory * theory -> bool
    44   val eq_thy: theory * theory -> bool
    47   val proper_subthy_id: theory_id * theory_id -> bool
    45   val proper_subthy_id: theory_id * theory_id -> bool
   168     val name = display_name (theory_id thy);
   166     val name = display_name (theory_id thy);
   169     val ancestor_names = map theory_name (ancestors_of thy);
   167     val ancestor_names = map theory_name (ancestors_of thy);
   170   in rev (name :: ancestor_names) end;
   168   in rev (name :: ancestor_names) end;
   171 
   169 
   172 val pretty_thy = Pretty.str_list "{" "}" o display_names;
   170 val pretty_thy = Pretty.str_list "{" "}" o display_names;
   173 val string_of_thy = Pretty.string_of o pretty_thy;
       
   174 
   171 
   175 fun pretty_abbrev_thy thy =
   172 fun pretty_abbrev_thy thy =
   176   let
   173   let
   177     val names = display_names thy;
   174     val names = display_names thy;
   178     val n = length names;
   175     val n = length names;
   179     val abbrev = if n > 5 then "..." :: List.drop (names, n - 5) else names;
   176     val abbrev = if n > 5 then "..." :: List.drop (names, n - 5) else names;
   180   in Pretty.str_list "{" "}" abbrev end;
   177   in Pretty.str_list "{" "}" abbrev end;
   181 
       
   182 val str_of_thy = Pretty.unformatted_string_of o pretty_abbrev_thy;
       
   183 
   178 
   184 fun get_theory thy name =
   179 fun get_theory thy name =
   185   if theory_name thy <> name then
   180   if theory_name thy <> name then
   186     (case find_first (fn thy' => theory_name thy' = name) (ancestors_of thy) of
   181     (case find_first (fn thy' => theory_name thy' = name) (ancestors_of thy) of
   187       SOME thy' => thy'
   182       SOME thy' => thy'