equal
deleted
inserted
replaced
42 String of string; |
42 String of string; |
43 |
43 |
44 fun print_value (Bool true) = "true" |
44 fun print_value (Bool true) = "true" |
45 | print_value (Bool false) = "false" |
45 | print_value (Bool false) = "false" |
46 | print_value (Int i) = signed_string_of_int i |
46 | print_value (Int i) = signed_string_of_int i |
47 | print_value (Real x) = Markup.print_real x |
47 | print_value (Real x) = Value.print_real x |
48 | print_value (String s) = quote s; |
48 | print_value (String s) = quote s; |
49 |
49 |
50 fun print_type (Bool _) = "bool" |
50 fun print_type (Bool _) = "bool" |
51 | print_type (Int _) = "int" |
51 | print_type (Int _) = "int" |
52 | print_type (Real _) = "real" |
52 | print_type (Real _) = "real" |
101 fun put_global config value = map_global config (K value); |
101 fun put_global config value = map_global config (K value); |
102 |
102 |
103 |
103 |
104 (* context information *) |
104 (* context information *) |
105 |
105 |
106 structure Value = Generic_Data |
106 structure Data = Generic_Data |
107 ( |
107 ( |
108 type T = value Inttab.table; |
108 type T = value Inttab.table; |
109 val empty = Inttab.empty; |
109 val empty = Inttab.empty; |
110 val extend = I; |
110 val extend = I; |
111 fun merge data = Inttab.merge (K true) data; |
111 fun merge data = Inttab.merge (K true) data; |
114 fun declare (name, pos) default = |
114 fun declare (name, pos) default = |
115 let |
115 let |
116 val id = serial (); |
116 val id = serial (); |
117 |
117 |
118 fun get_value context = |
118 fun get_value context = |
119 (case Inttab.lookup (Value.get context) id of |
119 (case Inttab.lookup (Data.get context) id of |
120 SOME value => value |
120 SOME value => value |
121 | NONE => default context); |
121 | NONE => default context); |
122 |
122 |
123 fun map_value f context = |
123 fun map_value f context = |
124 Value.map (Inttab.update (id, type_check (name, pos) f (get_value context))) context; |
124 Data.map (Inttab.update (id, type_check (name, pos) f (get_value context))) context; |
125 in |
125 in |
126 Config {name = name, pos = pos, get_value = get_value, map_value = map_value} |
126 Config {name = name, pos = pos, get_value = get_value, map_value = map_value} |
127 end; |
127 end; |
128 |
128 |
129 fun declare_option (name, pos) = |
129 fun declare_option (name, pos) = |