Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
1f622420
Commit
1f622420
authored
Sep 16, 2004
by
sof
Browse files
[project @ 2004-09-16 22:41:33 by sof]
New option, -P, turns off line pragma emission
parent
bb787c29
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/utils/unlit/unlit.c
View file @
1f622420
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment