src/Pure/config.ML
author wenzelm
Thu, 03 Jan 2019 14:12:44 +0100
changeset 69575 f77cc54f6d47
parent 69574 b4ea943ce0b7
child 69576 cfac69e7b962
permissions -rw-r--r--
clarified signature: more types;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/config.ML
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     3
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     4
Configuration options as values within the local context.
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     5
*)
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     6
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     7
signature CONFIG =
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
     8
sig
40291
012ed4426fda support for real valued configuration options;
wenzelm
parents: 39163
diff changeset
     9
  datatype value = Bool of bool | Int of int | Real of real | String of string
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    10
  val print_value: value -> string
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    11
  val print_type: value -> string
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    12
  type 'a T
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    13
  val name_of: 'a T -> string
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    14
  val pos_of: 'a T -> Position.T
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    15
  val get: Proof.context -> 'a T -> 'a
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    16
  val map: 'a T -> ('a -> 'a) -> Proof.context -> Proof.context
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    17
  val put: 'a T -> 'a -> Proof.context -> Proof.context
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
    18
  val restore: 'a T -> Proof.context -> Proof.context -> Proof.context
36787
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
    19
  val get_global: theory -> 'a T -> 'a
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
    20
  val map_global: 'a T -> ('a -> 'a) -> theory -> theory
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
    21
  val put_global: 'a T -> 'a -> theory -> theory
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
    22
  val restore_global: 'a T -> theory -> theory -> theory
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    23
  val get_generic: Context.generic -> 'a T -> 'a
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    24
  val map_generic: 'a T -> ('a -> 'a) -> Context.generic -> Context.generic
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    25
  val put_generic: 'a T -> 'a -> Context.generic -> Context.generic
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
    26
  val restore_generic: 'a T -> Context.generic -> Context.generic -> Context.generic
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    27
  val bool: value T -> bool T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    28
  val bool_value: bool T -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    29
  val int: value T -> int T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    30
  val int_value: int T -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    31
  val real: value T -> real T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    32
  val real_value: real T -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    33
  val string: value T -> string T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    34
  val string_value: string T -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    35
  val declare: string * Position.T -> (Context.generic -> value) -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    36
  val declare_bool: string * Position.T -> (Context.generic -> bool) -> bool T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    37
  val declare_int: string * Position.T -> (Context.generic -> int) -> int T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    38
  val declare_real: string * Position.T -> (Context.generic -> real) -> real T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    39
  val declare_string: string * Position.T -> (Context.generic -> string) -> string T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    40
  val declare_option: string * Position.T -> value T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    41
  val declare_option_bool: string * Position.T -> bool T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    42
  val declare_option_int: string * Position.T -> int T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    43
  val declare_option_real: string * Position.T -> real T
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    44
  val declare_option_string: string * Position.T -> string T
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    45
end;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    46
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    47
structure Config: CONFIG =
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    48
struct
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    49
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    50
(* simple values *)
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    51
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    52
datatype value =
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    53
  Bool of bool |
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    54
  Int of int |
40291
012ed4426fda support for real valued configuration options;
wenzelm
parents: 39163
diff changeset
    55
  Real of real |
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    56
  String of string;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    57
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    58
fun print_value (Bool true) = "true"
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    59
  | print_value (Bool false) = "false"
69574
wenzelm
parents: 68827
diff changeset
    60
  | print_value (Int i) = Value.print_int i
63806
c54a53ef1873 clarified modules;
wenzelm
parents: 58951
diff changeset
    61
  | print_value (Real x) = Value.print_real x
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    62
  | print_value (String s) = quote s;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    63
38804
99cc7e748ab4 tuned printed type names, according to ML;
wenzelm
parents: 36787
diff changeset
    64
fun print_type (Bool _) = "bool"
99cc7e748ab4 tuned printed type names, according to ML;
wenzelm
parents: 36787
diff changeset
    65
  | print_type (Int _) = "int"
40291
012ed4426fda support for real valued configuration options;
wenzelm
parents: 39163
diff changeset
    66
  | print_type (Real _) = "real"
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    67
  | print_type (String _) = "string";
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    68
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    69
fun same_type (Bool _) (Bool _) = true
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    70
  | same_type (Int _) (Int _) = true
40291
012ed4426fda support for real valued configuration options;
wenzelm
parents: 39163
diff changeset
    71
  | same_type (Real _) (Real _) = true
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    72
  | same_type (String _) (String _) = true
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    73
  | same_type _ _ = false;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    74
56438
7f6b2634d853 more source positions;
wenzelm
parents: 56294
diff changeset
    75
fun type_check (name, pos) f value =
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    76
  let
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    77
    val value' = f value;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    78
    val _ = same_type value value' orelse
56438
7f6b2634d853 more source positions;
wenzelm
parents: 56294
diff changeset
    79
      error ("Ill-typed configuration option " ^ quote name ^ Position.here pos ^ ": " ^
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    80
        print_type value ^ " expected,\nbut " ^ print_type value' ^ " was found");
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    81
  in value' end;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    82
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    83
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    84
(* abstract configuration options *)
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    85
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    86
datatype 'a T = Config of
24125
454a0c895735 added name_of;
wenzelm
parents: 24114
diff changeset
    87
 {name: string,
56438
7f6b2634d853 more source positions;
wenzelm
parents: 56294
diff changeset
    88
  pos: Position.T,
24125
454a0c895735 added name_of;
wenzelm
parents: 24114
diff changeset
    89
  get_value: Context.generic -> 'a,
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    90
  map_value: ('a -> 'a) -> Context.generic -> Context.generic};
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    91
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    92
fun name_of (Config {name, ...}) = name;
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
    93
fun pos_of (Config {pos, ...}) = pos;
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    94
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    95
fun get_generic context (Config {get_value, ...}) = get_value context;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    96
fun map_generic (Config {map_value, ...}) f context = map_value f context;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    97
fun put_generic config value = map_generic config (K value);
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
    98
fun restore_generic config context = put_generic config (get_generic context config);
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
    99
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   100
fun get_ctxt ctxt = get_generic (Context.Proof ctxt);
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   101
fun map_ctxt config f = Context.proof_map (map_generic config f);
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   102
fun put_ctxt config value = map_ctxt config (K value);
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
   103
fun restore_ctxt config ctxt = put_ctxt config (get_ctxt ctxt config);
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   104
36787
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
   105
fun get_global thy = get_generic (Context.Theory thy);
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
   106
fun map_global config f = Context.theory_map (map_generic config f);
f60e4dd6d76f renamed Config.get_thy to Config.get_global etc. to indicate that this is not the real thing;
wenzelm
parents: 36002
diff changeset
   107
fun put_global config value = map_global config (K value);
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
   108
fun restore_global config thy = put_global config (get_global thy config);
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   109
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   110
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   111
(* coerce type *)
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   112
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   113
fun coerce make dest (Config {name, pos, get_value, map_value}) = Config
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   114
 {name = name,
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   115
  pos = pos,
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   116
  get_value = dest o get_value,
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   117
  map_value = fn f => map_value (make o f o dest)};
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   118
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   119
fun coerce_pair make dest = (coerce make dest, coerce dest make);
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   120
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   121
val (bool, bool_value) = coerce_pair Bool (fn Bool b => b);
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   122
val (int, int_value) = coerce_pair Int (fn Int i => i);
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   123
val (real, real_value) = coerce_pair Real (fn Real x => x);
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   124
val (string, string_value) = coerce_pair String (fn String s => s);
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   125
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   126
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   127
(* context data *)
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   128
63806
c54a53ef1873 clarified modules;
wenzelm
parents: 58951
diff changeset
   129
structure Data = Generic_Data
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   130
(
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   131
  type T = value Inttab.table;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   132
  val empty = Inttab.empty;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   133
  val extend = I;
33519
e31a85f92ce9 adapted Generic_Data, Proof_Data;
wenzelm
parents: 29606
diff changeset
   134
  fun merge data = Inttab.merge (K true) data;
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   135
);
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   136
58951
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   137
fun declare (name, pos) default =
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   138
  let
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   139
    val id = serial ();
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   140
36000
5560b2437789 configuration options admit dynamic default values;
wenzelm
parents: 33519
diff changeset
   141
    fun get_value context =
63806
c54a53ef1873 clarified modules;
wenzelm
parents: 58951
diff changeset
   142
      (case Inttab.lookup (Data.get context) id of
36000
5560b2437789 configuration options admit dynamic default values;
wenzelm
parents: 33519
diff changeset
   143
        SOME value => value
36002
f4f343500249 pass raw Context.generic, to avoid wasteful Context.proof_of -- Config.get_thy is often used in performance critical spots like unify.ML;
wenzelm
parents: 36000
diff changeset
   144
      | NONE => default context);
36000
5560b2437789 configuration options admit dynamic default values;
wenzelm
parents: 33519
diff changeset
   145
58951
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   146
    fun map_value f context =
63806
c54a53ef1873 clarified modules;
wenzelm
parents: 58951
diff changeset
   147
      Data.map (Inttab.update (id, type_check (name, pos) f (get_value context))) context;
58951
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   148
  in
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   149
    Config {name = name, pos = pos, get_value = get_value, map_value = map_value}
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   150
  end;
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   151
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   152
fun declare_bool name default = bool (declare name (Bool o default));
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   153
fun declare_int name default = int (declare name (Int o default));
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   154
fun declare_real name default = real (declare name (Real o default));
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   155
fun declare_string name default = string (declare name (String o default));
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   156
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   157
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   158
(* system options *)
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   159
58951
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   160
fun declare_option (name, pos) =
51947
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   161
  let
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   162
    val typ = Options.default_typ name;
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   163
    val default =
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   164
      if typ = Options.boolT then fn _ => Bool (Options.default_bool name)
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   165
      else if typ = Options.intT then fn _ => Int (Options.default_int name)
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   166
      else if typ = Options.realT then fn _ => Real (Options.default_real name)
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   167
      else if typ = Options.stringT then fn _ => String (Options.default_string name)
56438
7f6b2634d853 more source positions;
wenzelm
parents: 56294
diff changeset
   168
      else error ("Unknown type for option " ^ quote name ^ Position.here pos ^ " : " ^ quote typ);
58951
8b7caf447357 removed obsolete global-only options, which did not work out anyway (due to complexity of local_theory sandwich);
wenzelm
parents: 57858
diff changeset
   169
  in declare (name, pos) default end;
51947
3301612c4893 support for system options as context-sensitive config options;
wenzelm
parents: 47814
diff changeset
   170
69575
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   171
val declare_option_bool = bool o declare_option;
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   172
val declare_option_int = int o declare_option;
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   173
val declare_option_real = real o declare_option;
f77cc54f6d47 clarified signature: more types;
wenzelm
parents: 69574
diff changeset
   174
val declare_option_string = string o declare_option;
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   175
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   176
(*final declarations of this structure!*)
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   177
val get = get_ctxt;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   178
val map = map_ctxt;
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   179
val put = put_ctxt;
68827
1286ca9dfd26 tuned signature;
wenzelm
parents: 63806
diff changeset
   180
val restore = restore_ctxt;
24114
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   181
1b0bc10019a5 renamed config_option.ML to config.ML;
wenzelm
parents:
diff changeset
   182
end;