summaryrefslogtreecommitdiff
path: root/ghc/utils
diff options
context:
space:
mode:
authorsof <unknown>2004-09-16 22:41:33 +0000
committersof <unknown>2004-09-16 22:41:33 +0000
commit1f6224200642990516e6c8c72b819e11424a3782 (patch)
treecdce40f1c43738a12f2ef17c278896b44ba33e81 /ghc/utils
parentbb787c2954e38b3f3646ca9730eae0e404d40aea (diff)
downloadhaskell-1f6224200642990516e6c8c72b819e11424a3782.tar.gz
[project @ 2004-09-16 22:41:33 by sof]
New option, -P, turns off line pragma emission
Diffstat (limited to 'ghc/utils')
-rw-r--r--ghc/utils/unlit/unlit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ghc/utils/unlit/unlit.c b/ghc/utils/unlit/unlit.c
index 52e64156a7..769707e257 100644
--- a/ghc/utils/unlit/unlit.c
+++ b/ghc/utils/unlit/unlit.c
@@ -48,7 +48,7 @@
#define DEFNCHAR '>'
#define MISSINGBLANK "unlit: Program line next to comment"
#define EMPTYSCRIPT "unlit: No definitions in file (perhaps you forgot the '>'s?)"
-#define USAGE "usage: unlit [-q] [-n] [-c] file1 file2\n"
+#define USAGE "usage: unlit [-q] [-n] [-c] [-#] [-P] [-h label] file1 file2\n"
#define CANNOTOPEN "unlit: cannot open \"%s\"\n"
#define CANNOTWRITE "unlit: error writing \"%s\"\n"
#define CANNOTWRITESTDOUT "unlit: error writing standard output\n"
@@ -77,6 +77,7 @@ static int errors = 0; /* count the number of errors reported */
static int crunchnl = 0; /* don't print \n for removed lines */
static int leavecpp = 1; /* leave preprocessor lines */
static int ignore_shebang = 1; /* Leave out shebang (#!) lines */
+static int no_line_pragma = 0; /* Leave out initial line pragma */
static char* prefix_str = NULL; /* Prefix output with a string */
@@ -308,6 +309,7 @@ FILE *ostream; {
* -q quiet mode - do not complain about bad literate script files
* -n noisy mode - complain about bad literate script files.
* -r remove cpp droppings in output.
+ * -P don't output any CPP line pragmas.
* Expects two additional arguments, a file name for the input and a file
* name for the output file. These two names must normally be distinct.
* An exception is made for the special name "-" which can be used in either
@@ -327,6 +329,8 @@ char **argv; {
noisy = 0;
else if (strcmp(*argv,"-c")==0)
crunchnl = 1;
+ else if (strcmp(*argv,"-P")==0)
+ no_line_pragma = 1;
else if (strcmp(*argv,"-h")==0) {
if (argc > 1) {
argc--; argv++;
@@ -372,7 +376,7 @@ char **argv; {
}
/* Prefix the output with line pragmas */
- if (prefix_str) {
+ if (!no_line_pragma && prefix_str) {
/* Both GHC and CPP understand the #line pragma.
* We used to throw in both a #line and a {-# LINE #-} pragma
* here, but CPP doesn't understand {-# LINE #-} so it thought
@@ -380,7 +384,7 @@ char **argv; {
* #-} before the #line, but there's no point since GHC
* understands #line anyhow. --SDM 8/2003
*/
- fprintf(ostream, "#line 1 \"%s\"\n", prefix_str, prefix_str);
+ fprintf(ostream, "#line 1 \"%s\"\n", prefix_str);
}
unlit(file, istream, ostream);