src/Pure/Thy/thy_read.ML
changeset 3039 bbf4e3738ef0
parent 2406 7becd4dd5ca7
child 3527 b894f4c13df5
equal deleted inserted replaced
3038:bb2ded320911 3039:bbf4e3738ef0
    42                  Warning: If these functions access reference variables inside
    42                  Warning: If these functions access reference variables inside
    43                           READTHY, they have to be redefined each time
    43                           READTHY, they have to be redefined each time
    44                           init_thy_reader is invoked
    44                           init_thy_reader is invoked
    45         data: user defined data; exn is used to allow arbitrary types;
    45         data: user defined data; exn is used to allow arbitrary types;
    46               first element of pairs contains result that get returned after
    46               first element of pairs contains result that get returned after
    47               thy file was read, second element after ML file was read
    47               thy file was read, second element after ML file was read;
       
    48               if ML files has not been read, second element is identical to
       
    49               first one because get_thydata, which is meant to return the
       
    50               latest data, always accesses the 2nd element
    48        *)
    51        *)
    49 
    52 
    50 signature READTHY =
    53 signature READTHY =
    51 sig
    54 sig
    52   datatype basetype = Thy  of string
    55   datatype basetype = Thy  of string
   659             | get_data ((id, ThyMethods {get, ...}) :: ms) data =
   662             | get_data ((id, ThyMethods {get, ...}) :: ms) data =
   660                 get_data ms (Symtab.update ((id, get ()), data));
   663                 get_data ms (Symtab.update ((id, get ()), data));
   661 
   664 
   662           val new_data = get_data (Symtab.dest methods) Symtab.null;
   665           val new_data = get_data (Symtab.dest methods) Symtab.null;
   663 
   666 
   664           val data' = if thy_only then (new_data, snd data)
   667           val data' = (if thy_only then new_data else fst data, new_data)
   665                       else (fst data, new_data);
   668                       (* 2nd component must be up to date *)
   666       in loaded_thys := Symtab.update
   669       in loaded_thys := Symtab.update
   667            ((tname, ThyInfo {path = path,
   670            ((tname, ThyInfo {path = path,
   668                              children = children, parents = parents,
   671                              children = children, parents = parents,
   669                              thy_time = thy_time, ml_time = ml_time,
   672                              thy_time = thy_time, ml_time = ml_time,
   670                              theory = theory, thms = thms,
   673                              theory = theory, thms = thms,