From 5968648f9e9db09de462dd8c3530febd66466312 Mon Sep 17 00:00:00 2001 From: Jasper Hugunin Date: Sat, 17 Feb 2018 07:35:57 -0800 Subject: Implement name mangling option --- toplevel/coqargs.ml | 8 ++++++++ toplevel/usage.ml | 1 + 2 files changed, 9 insertions(+) (limited to 'toplevel') diff --git a/toplevel/coqargs.ml b/toplevel/coqargs.ml index 5b73471c5..1fdcd2bd4 100644 --- a/toplevel/coqargs.ml +++ b/toplevel/coqargs.ml @@ -270,6 +270,11 @@ let get_cache opt = function | "force" -> Some Stm.AsyncOpts.Force | _ -> prerr_endline ("Error: force expected after "^opt); exit 1 +let get_identifier opt s = + try Names.Id.of_string s + with CErrors.UserError _ -> + prerr_endline ("Error: valid identifier expected after option "^opt); exit 1 + let is_not_dash_option = function | Some f when String.length f > 0 && f.[0] <> '-' -> true | _ -> false @@ -465,6 +470,9 @@ let parse_args arglist : coq_cmdopts * string list = |"-load-vernac-source-verbose"|"-lv" -> add_load_vernacular oval true (next ()) + |"-mangle-names" -> + Namegen.set_mangle_names_mode (get_identifier opt (next ())); oval + |"-print-mod-uid" -> let s = String.concat " " (List.map get_native_name rem) in print_endline s; exit 0 diff --git a/toplevel/usage.ml b/toplevel/usage.ml index f0215b678..e28637f2e 100644 --- a/toplevel/usage.ml +++ b/toplevel/usage.ml @@ -77,6 +77,7 @@ let print_usage_channel co command = \n -impredicative-set set sort Set impredicative\ \n -indices-matter levels of indices (and nonuniform parameters) contribute to the level of inductives\ \n -type-in-type disable universe consistency checking\ +\n -mangle-names x mangle auto-generated names using prefix x\ \n -time display the time taken by each command\ \n -profile-ltac display the time taken by each (sub)tactic\ \n -m, --memory display total heap size at program exit\ -- cgit v1.2.3