From 7993d50d0d1dd029b34745e1ee089d9cf7c5ffbd Mon Sep 17 00:00:00 2001 From: aspiwack Date: Fri, 24 Aug 2012 17:36:36 +0000 Subject: Experimental support for a comment in the files' preamble in extraction. Scheme comments are output on a single line because Ocaml's Format module which serves as a backend to Pp has an integer, rather than a string as identation value, so we cannot make it so that each new line in the comment starts with ";; ". I've tried something with Pp.ifb but it was hackish at best and had somewhat strange results. Known bug: as Pp.std_ppcmds is non-persistent, the comment is actually printed only once per Extraction command, even if it outputs several files. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15763 85f007b7-540e-0410-9357-904b9bb8a0f7 --- plugins/extraction/table.ml | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'plugins/extraction/table.ml') diff --git a/plugins/extraction/table.ml b/plugins/extraction/table.ml index 3fb183995..1fd4840fe 100644 --- a/plugins/extraction/table.ml +++ b/plugins/extraction/table.ml @@ -547,6 +547,18 @@ let _ = declare_bool_option optwrite = (fun b -> conservative_types_ref := b) } +(* Allows to print a comment at the beginning of the output files *) +let file_comment_ref = ref "" +let file_comment () = !file_comment_ref + +let _ = declare_string_option + {optsync = true; + optdepr = false; + optname = "Extraction File Comment"; + optkey = ["Extraction"; "File"; "Comment"]; + optread = (fun () -> !file_comment_ref); + optwrite = (fun s -> file_comment_ref := s) } + (*s Extraction Lang *) type lang = Ocaml | Haskell | Scheme -- cgit v1.2.3