summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJessica Clarke2020-09-27 16:53:48 +0100
committerJessica Clarke2020-09-27 16:53:48 +0100
commit57fd06728f923d039c3f60d116f646c136528b77 (patch)
tree5785eae9917e860ab8f5168bcee4f4c872c81256
parent36159bc54164916c555716123c1c63a466952db0 (diff)
latex: Prefix label names with the specified -latex_prefix
This ensures names shared between multiple projects don't collide if included in a common LaTeX document; cheri-architecture using both sail-cheri-mips and sail-cheri-riscv runs into this. Closes: #88
-rw-r--r--src/latex.ml3
-rw-r--r--src/sail.ml2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/latex.ml b/src/latex.ml
index 4abd7c6b..c59d8367 100644
--- a/src/latex.ml
+++ b/src/latex.ml
@@ -208,7 +208,8 @@ let rec app_code (E_aux (exp, _)) =
| _ -> ""
let refcode_cat_string cat str =
- category_name_val cat ^ Str.global_replace (Str.regexp "_") "zy" (Util.zencode_string str)
+ let refcode_str = Str.global_replace (Str.regexp "_") "zy" (Util.zencode_string str) in
+ !opt_prefix ^ category_name_val cat ^ refcode_str
let refcode_cat_id prefix id = refcode_cat_string prefix (string_of_id id)
diff --git a/src/sail.ml b/src/sail.ml
index d07ea216..53a5cc5d 100644
--- a/src/sail.ml
+++ b/src/sail.ml
@@ -162,7 +162,7 @@ let options = Arg.align ([
" pretty print the input to LaTeX");
( "-latex_prefix",
Arg.String (fun prefix -> Latex.opt_prefix := prefix),
- "<prefix> set a custom prefix for generated LaTeX macro command (default sail)");
+ "<prefix> set a custom prefix for generated LaTeX labels and macro commands (default sail)");
( "-latex_full_valspecs",
Arg.Clear Latex.opt_simple_val,
" print full valspecs in LaTeX output");