src/Tools/code/code_target.ML
changeset 31013 69a476d6fea6
parent 30963 f44736b9d804
child 31036 64ff53fc0c0c
equal deleted inserted replaced
31012:751f5aa3e315 31013:69a476d6fea6
   321   in map_includes target (add args) thy end;
   321   in map_includes target (add args) thy end;
   322 
   322 
   323 val add_include = gen_add_include Code_Unit.check_const;
   323 val add_include = gen_add_include Code_Unit.check_const;
   324 val add_include_cmd = gen_add_include Code_Unit.read_const;
   324 val add_include_cmd = gen_add_include Code_Unit.read_const;
   325 
   325 
   326 fun add_module_alias target =
   326 fun add_module_alias target (thyname, modlname) =
   327   map_module_alias target o Symtab.update o apsnd Code_Name.check_modulename;
   327   let
       
   328     val xs = Long_Name.explode modlname;
       
   329     val xs' = map (Code_Name.purify_name true) xs;
       
   330   in if xs' = xs
       
   331     then map_module_alias target (Symtab.update (thyname, modlname))
       
   332     else error ("Invalid module name: " ^ quote modlname ^ "\n"
       
   333       ^ "perhaps try " ^ quote (Long_Name.implode xs'))
       
   334   end;
   328 
   335 
   329 fun gen_allow_abort prep_const raw_c thy =
   336 fun gen_allow_abort prep_const raw_c thy =
   330   let
   337   let
   331     val c = prep_const thy raw_c;
   338     val c = prep_const thy raw_c;
   332   in thy |> (CodeTargetData.map o apsnd) (insert (op =) c) end;
   339   in thy |> (CodeTargetData.map o apsnd) (insert (op =) c) end;