src/Pure/System/options.ML
changeset 56467 8d7d6f17c6a7
parent 56465 6ad693903e22
child 59812 675d0c692c41
equal deleted inserted replaced
56466:08982abdcdad 56467:8d7d6f17c6a7
    11   val realT: string
    11   val realT: string
    12   val stringT: string
    12   val stringT: string
    13   val unknownT: string
    13   val unknownT: string
    14   type T
    14   type T
    15   val empty: T
    15   val empty: T
    16   val position: T -> string -> Position.T
    16   val markup: T -> string * Position.T -> Markup.T
    17   val typ: T -> string -> string
    17   val typ: T -> string -> string
    18   val bool: T -> string -> bool
    18   val bool: T -> string -> bool
    19   val int: T -> string -> int
    19   val int: T -> string -> int
    20   val real: T -> string -> real
    20   val real: T -> string -> real
    21   val string: T -> string -> string
    21   val string: T -> string -> string
    25   val put_string: string -> string -> T -> T
    25   val put_string: string -> string -> T -> T
    26   val declare: {pos: Position.T, name: string, typ: string, value: string} -> T -> T
    26   val declare: {pos: Position.T, name: string, typ: string, value: string} -> T -> T
    27   val update: string -> string -> T -> T
    27   val update: string -> string -> T -> T
    28   val decode: XML.body -> T
    28   val decode: XML.body -> T
    29   val default: unit -> T
    29   val default: unit -> T
    30   val default_position: string -> Position.T
    30   val default_markup: string * Position.T -> Markup.T
    31   val default_typ: string -> string
    31   val default_typ: string -> string
    32   val default_bool: string -> bool
    32   val default_bool: string -> bool
    33   val default_int: string -> int
    33   val default_int: string -> int
    34   val default_real: string -> real
    34   val default_real: string -> real
    35   val default_string: string -> string
    35   val default_string: string -> string
    73     if #typ opt = typ then opt
    73     if #typ opt = typ then opt
    74     else error ("Ill-typed system option " ^ quote name ^ " : " ^ #typ opt ^ " vs. " ^ typ)
    74     else error ("Ill-typed system option " ^ quote name ^ " : " ^ #typ opt ^ " vs. " ^ typ)
    75   end;
    75   end;
    76 
    76 
    77 
    77 
    78 (* declaration *)
    78 (* markup *)
    79 
    79 
    80 fun position options name = #pos (check_name options name);
    80 fun markup options (name, pos) =
       
    81   let
       
    82     val opt =
       
    83       check_name options name
       
    84         handle ERROR msg => error (msg ^ Position.here pos);
       
    85     val props = Position.def_properties_of (#pos opt);
       
    86   in Markup.properties props (Markup.entity Markup.system_optionN name) end;
       
    87 
       
    88 
       
    89 (* typ *)
       
    90 
    81 fun typ options name = #typ (check_name options name);
    91 fun typ options name = #typ (check_name options name);
    82 
    92 
    83 
    93 
    84 (* basic operations *)
    94 (* basic operations *)
    85 
    95 
   171 fun default () =
   181 fun default () =
   172   (case Synchronized.value global_default of
   182   (case Synchronized.value global_default of
   173     SOME options => options
   183     SOME options => options
   174   | NONE => err_no_default ());
   184   | NONE => err_no_default ());
   175 
   185 
   176 fun default_position name = position (default ()) name;
   186 fun default_markup arg = markup (default ()) arg;
   177 fun default_typ name = typ (default ()) name;
   187 fun default_typ name = typ (default ()) name;
   178 fun default_bool name = bool (default ()) name;
   188 fun default_bool name = bool (default ()) name;
   179 fun default_int name = int (default ()) name;
   189 fun default_int name = int (default ()) name;
   180 fun default_real name = real (default ()) name;
   190 fun default_real name = real (default ()) name;
   181 fun default_string name = string (default ()) name;
   191 fun default_string name = string (default ()) name;