src/Pure/ML/ml_print_depth.ML
author wenzelm
Mon, 20 Mar 2023 10:59:27 +0100
changeset 77692 3e746e684f4b
parent 69575 f77cc54f6d47
permissions -rw-r--r--
clarified operations for ML object sizes;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62978
c04eead96cca tuned headers;
wenzelm
parents: 62900
diff changeset
     1
(*  Title:      Pure/ML/ml_print_depth.ML
62878
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     3
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     4
Print depth for ML toplevel pp: context option with global default.
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     5
*)
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     6
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     7
signature ML_PRINT_DEPTH =
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     8
sig
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
     9
  val set_print_depth: int -> unit
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    10
  val print_depth: int Config.T
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    11
  val get_print_depth: unit -> int
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    12
end;
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    13
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    14
structure ML_Print_Depth: ML_PRINT_DEPTH =
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    15
struct
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    16
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    17
val set_print_depth = ML_Print_Depth.set_print_depth;
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    18
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 64556
diff changeset
    19
val print_depth =
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 64556
diff changeset
    20
  Config.declare_int ("ML_print_depth", \<^here>) (fn _ => ML_Print_Depth.get_print_depth ());
62878
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    21
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    22
fun get_print_depth () =
62889
99c7f31615c2 clarified modules;
wenzelm
parents: 62878
diff changeset
    23
  (case Context.get_generic_context () of
62878
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    24
    NONE => ML_Print_Depth.get_print_depth ()
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    25
  | SOME context => Config.get_generic context print_depth);
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    26
1cec457e0a03 clarified modules -- simplified bootstrap;
wenzelm
parents:
diff changeset
    27
end;