src/Pure/display.ML
changeset 4498 a088ec3e4f5e
parent 4440 9ed4098074bc
child 4782 9c0b31da51c6
equal deleted inserted replaced
4497:2ba0730672c9 4498:a088ec3e4f5e
    17   val pretty_thm	: thm -> Pretty.T
    17   val pretty_thm	: thm -> Pretty.T
    18   val print_cterm	: cterm -> unit
    18   val print_cterm	: cterm -> unit
    19   val print_ctyp	: ctyp -> unit
    19   val print_ctyp	: ctyp -> unit
    20   val show_consts	: bool ref
    20   val show_consts	: bool ref
    21   val print_goals	: int -> thm -> unit
    21   val print_goals	: int -> thm -> unit
       
    22   val pretty_name_space : string * NameSpace.T -> Pretty.T
    22   val print_syntax	: theory -> unit
    23   val print_syntax	: theory -> unit
    23   val print_theory	: theory -> unit
    24   val print_theory	: theory -> unit
    24   val print_data	: theory -> string -> unit
    25   val print_data	: theory -> string -> unit
    25   val print_thm		: thm -> unit
    26   val print_thm		: thm -> unit
    26   val prth		: thm -> thm
    27   val prth		: thm -> thm
   105 
   106 
   106 val print_syntax = Syntax.print_syntax o syn_of;
   107 val print_syntax = Syntax.print_syntax o syn_of;
   107 val print_data = Sign.print_data o sign_of;
   108 val print_data = Sign.print_data o sign_of;
   108 
   109 
   109 
   110 
       
   111 (* pretty_name_space  *)
       
   112 
       
   113 fun pretty_name_space (kind, space) =
       
   114   let
       
   115     fun prt_entry (name, accs) = Pretty.block
       
   116       (Pretty.str (quote name ^ " =") :: Pretty.brk 1 ::
       
   117         Pretty.commas (map (Pretty.str o quote) accs));
       
   118   in
       
   119     Pretty.fbreaks (Pretty.str (kind ^ ":") :: map prt_entry (NameSpace.dest space))
       
   120     |> Pretty.block
       
   121   end;
       
   122 
       
   123 
       
   124 
   110 (* print signature *)
   125 (* print signature *)
   111 
   126 
   112 fun print_sign sg =
   127 fun print_sign sg =
   113   let
   128   let
   114     fun prt_cls c = Sign.pretty_sort sg [c];
   129     fun prt_cls c = Sign.pretty_sort sg [c];
   118 
   133 
   119     val ext_class = Sign.cond_extern sg Sign.classK;
   134     val ext_class = Sign.cond_extern sg Sign.classK;
   120     val ext_tycon = Sign.cond_extern sg Sign.typeK;
   135     val ext_tycon = Sign.cond_extern sg Sign.typeK;
   121     val ext_const = Sign.cond_extern sg Sign.constK;
   136     val ext_const = Sign.cond_extern sg Sign.constK;
   122 
   137 
   123 
       
   124     fun pretty_space (kind, space) = Pretty.block (Pretty.breaks
       
   125       (map Pretty.str (kind ^ ":" :: map quote (NameSpace.dest space))));
       
   126 
   138 
   127     fun pretty_classes cs = Pretty.block
   139     fun pretty_classes cs = Pretty.block
   128       (Pretty.breaks (Pretty.str "classes:" :: map prt_cls cs));
   140       (Pretty.breaks (Pretty.str "classes:" :: map prt_cls cs));
   129 
   141 
   130     fun pretty_classrel (c, cs) = Pretty.block
   142     fun pretty_classrel (c, cs) = Pretty.block
   153     val consts = sort_wrt fst (map (apfst ext_const) (Symtab.dest const_tab));
   165     val consts = sort_wrt fst (map (apfst ext_const) (Symtab.dest const_tab));
   154   in
   166   in
   155     Pretty.writeln (Pretty.strs ("stamps:" :: Sign.stamp_names_of sg));
   167     Pretty.writeln (Pretty.strs ("stamps:" :: Sign.stamp_names_of sg));
   156     Pretty.writeln (Pretty.strs ("data:" :: Sign.data_kinds data));
   168     Pretty.writeln (Pretty.strs ("data:" :: Sign.data_kinds data));
   157     Pretty.writeln (Pretty.strs ["name entry path:", NameSpace.pack path]);
   169     Pretty.writeln (Pretty.strs ["name entry path:", NameSpace.pack path]);
   158     Pretty.writeln (Pretty.big_list "name spaces:" (map pretty_space spaces'));
   170     Pretty.writeln (Pretty.big_list "name spaces:" (map pretty_name_space spaces'));
   159     Pretty.writeln (pretty_classes classes);
   171     Pretty.writeln (pretty_classes classes);
   160     Pretty.writeln (Pretty.big_list "class relation:" (map pretty_classrel classrel));
   172     Pretty.writeln (Pretty.big_list "class relation:" (map pretty_classrel classrel));
   161     Pretty.writeln (pretty_default default);
   173     Pretty.writeln (pretty_default default);
   162     Pretty.writeln (Pretty.big_list "type constructors:" (map pretty_ty tycons));
   174     Pretty.writeln (Pretty.big_list "type constructors:" (map pretty_ty tycons));
   163     Pretty.writeln (Pretty.big_list "type abbreviations:" (map pretty_abbr abbrs));
   175     Pretty.writeln (Pretty.big_list "type abbreviations:" (map pretty_abbr abbrs));