(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* (if isOcaml then pp_ocaml_comment else pp_c_comment) fmt Format.pp_print_string) "DO NOT EDIT: automatically generated by kernel/genOpcodeFiles.ml" let pp_with_commas fmt k = Array.iteri (fun n s -> Format.fprintf fmt " %a%s@." k s (if n + 1 < Array.length opcodes then "," else "") ) opcodes let pp_coq_instruct_h fmt = let line = Format.fprintf fmt "%s@." in pp_header false fmt; line "#pragma once"; line "enum instructions {"; pp_with_commas fmt Format.pp_print_string; line "};" let pp_coq_jumptbl_h fmt = pp_with_commas fmt (fun fmt -> Format.fprintf fmt "&&coq_lbl_%s") let pp_vmopcodes_ml fmt = pp_header true fmt; Array.iteri (fun n s -> Format.fprintf fmt "let op%s = %d@.@." s n ) opcodes let usage () = Format.eprintf "usage: %s [enum|jump|copml]@." Sys.argv.(0); exit 1 let main () = match Sys.argv.(1) with | "enum" -> pp_coq_instruct_h Format.std_formatter | "jump" -> pp_coq_jumptbl_h Format.std_formatter | "copml" -> pp_vmopcodes_ml Format.std_formatter | _ -> usage () | exception Invalid_argument _ -> usage () let () = main ()