(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * Copyright INRIA, CNRS and contributors *) (* Format.fprintf fmt " %s,@." name ) opcodes; Format.fprintf fmt "};@." let pp_coq_jumptbl_h fmt = pp_header false fmt; Array.iter (fun (name, _) -> Format.fprintf fmt " &&coq_lbl_%s,@." name ) opcodes let pp_coq_arity_h fmt = pp_header false fmt; Format.fprintf fmt "static signed char arity2[] = {@."; Array.iter (fun (_, arity) -> Format.fprintf fmt " %d,@." arity ) opcodes; Format.fprintf fmt "};@." let pp_vmopcodes_ml fmt = pp_header true fmt; Array.iteri (fun n s -> Format.fprintf fmt "let op%s = %d@.@." s n ) (Array.map fst opcodes) let usage () = Format.eprintf "usage: %s [enum|jump|arity|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 | "arity" -> pp_coq_arity_h Format.std_formatter | "copml" -> pp_vmopcodes_ml Format.std_formatter | _ -> usage () | exception Invalid_argument _ -> usage () let () = main ()