src/Pure/Tools/proof_general.ML
changeset 52016 4b77f444afbb
parent 52015 d021c180e7df
child 52017 bc0238c1f73a
equal deleted inserted replaced
52015:d021c180e7df 52016:4b77f444afbb
    16   type pgiptype = string
    16   type pgiptype = string
    17   val pgipbool: pgiptype
    17   val pgipbool: pgiptype
    18   val pgipint: pgiptype
    18   val pgipint: pgiptype
    19   val pgipfloat: pgiptype
    19   val pgipfloat: pgiptype
    20   val pgipstring: pgiptype
    20   val pgipstring: pgiptype
    21   val preference_raw: category ->
    21   val preference: category -> (unit -> string) -> (string -> unit) ->
    22     (unit -> string) -> (string -> unit) -> string -> string -> string -> unit
    22     string -> string -> string -> unit
    23   val preference_bool: category -> bool Unsynchronized.ref -> string -> string -> unit
    23   val preference_bool: category -> bool Unsynchronized.ref -> string -> string -> unit
    24   val preference_int: category -> int Unsynchronized.ref -> string -> string -> unit
    24   val preference_int: category -> int Unsynchronized.ref -> string -> string -> unit
    25   val preference_real: category -> real Unsynchronized.ref -> string -> string -> unit
    25   val preference_real: category -> real Unsynchronized.ref -> string -> string -> unit
    26   val preference_string: category -> string Unsynchronized.ref -> string -> string -> unit
    26   val preference_string: category -> string Unsynchronized.ref -> string -> string -> unit
    27   val preference_option: category -> string -> string -> string -> unit
    27   val preference_option: category -> string -> string -> string -> unit
    87 
    87 
    88 
    88 
    89 
    89 
    90 (* raw preferences *)
    90 (* raw preferences *)
    91 
    91 
    92 fun preference_raw category raw_get raw_set typ name descr =
    92 fun preference category get set typ name descr =
    93   let
    93   add_preference name
    94     fun get () = CRITICAL raw_get;
    94     {category = category, descr = descr, pgiptype = typ, get = get, set = set, default = get ()};
    95     fun set x = CRITICAL (fn () => raw_set x);
       
    96   in
       
    97     add_preference name
       
    98       {category = category, descr = descr, pgiptype = typ, get = get, set = set, default = get ()}
       
    99   end;
       
   100 
    95 
   101 fun preference_ref category read write typ r =
    96 fun preference_ref category read write typ r =
   102   preference_raw category (fn () => read (! r)) (fn x => r := write x) typ;
    97   preference category (fn () => read (! r)) (fn x => r := write x) typ;
   103 
    98 
   104 fun preference_bool category = preference_ref category Markup.print_bool Markup.parse_bool pgipbool;
    99 fun preference_bool category = preference_ref category Markup.print_bool Markup.parse_bool pgipbool;
   105 fun preference_int category = preference_ref category Markup.print_int Markup.parse_int pgipint;
   100 fun preference_int category = preference_ref category Markup.print_int Markup.parse_int pgipint;
   106 fun preference_real category = preference_ref category Markup.print_real Markup.parse_real pgipfloat;
   101 fun preference_real category = preference_ref category Markup.print_real Markup.parse_real pgipfloat;
   107 fun preference_string category = preference_ref category I I pgipstring;
   102 fun preference_string category = preference_ref category I I pgipstring;