382 val thy = Proof_Context.theory_of ctxt; |
382 val thy = Proof_Context.theory_of ctxt; |
383 val (modify, (target, data)) = join_ancestry thy target_name; |
383 val (modify, (target, data)) = join_ancestry thy target_name; |
384 val serializer = (#serializer o #language) target; |
384 val serializer = (#serializer o #language) target; |
385 in { serializer = serializer, data = data, modify = modify } end; |
385 in { serializer = serializer, data = data, modify = modify } end; |
386 |
386 |
387 fun project_program_for_syms ctxt syms_hidden syms1 program1 = |
387 fun report_unimplemented ctxt program requested unimplemented = |
388 let |
388 let |
389 val syms2 = subtract (op =) syms_hidden syms1; |
389 val deps = flat (map_product (fn req => fn unimpl => |
|
390 Code_Symbol.Graph.irreducible_paths program (req, Constant unimpl)) requested unimplemented) |
|
391 val pretty_dep = space_implode " -> " o map (Code_Symbol.quote ctxt) |
|
392 in |
|
393 error ("No code equations for " |
|
394 ^ commas (map (Proof_Context.markup_const ctxt) unimplemented) |
|
395 ^ ",\nrequested by dependencies\n" |
|
396 ^ space_implode "\n" (map pretty_dep deps)) |
|
397 end; |
|
398 |
|
399 fun project_program_for_syms ctxt syms_hidden requested1 program1 = |
|
400 let |
|
401 val requested2 = subtract (op =) syms_hidden requested1; |
390 val program2 = Code_Symbol.Graph.restrict (not o member (op =) syms_hidden) program1; |
402 val program2 = Code_Symbol.Graph.restrict (not o member (op =) syms_hidden) program1; |
391 val unimplemented = Code_Thingol.unimplemented program2; |
403 val unimplemented = Code_Thingol.unimplemented program2; |
392 val _ = |
404 val _ = |
393 if null unimplemented then () |
405 if null unimplemented then () |
394 else error ("No code equations for " ^ |
406 else report_unimplemented ctxt program2 requested2 unimplemented; |
395 commas (map (Proof_Context.markup_const ctxt) unimplemented)); |
407 val syms3 = Code_Symbol.Graph.all_succs program2 requested2; |
396 val syms3 = Code_Symbol.Graph.all_succs program2 syms2; |
|
397 val program3 = Code_Symbol.Graph.restrict (member (op =) syms3) program2; |
408 val program3 = Code_Symbol.Graph.restrict (member (op =) syms3) program2; |
398 in program3 end; |
409 in program3 end; |
399 |
410 |
400 fun project_includes_for_syms syms includes = |
411 fun project_includes_for_syms syms includes = |
401 let |
412 let |