From e42775ea7fe55bce9e387031d78a56ed562838ce Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 8 Dec 2001 04:13:07 +0000 Subject: [PATCH] support toupper and tolower of file names. --- driver/cflexor.lex | 4 ++-- driver/cfparse.y | 44 +++++++++++++++++++++++++++++++++++++++----- driver/iverilog.man | 13 ++++++++++++- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/driver/cflexor.lex b/driver/cflexor.lex index eaedba9d0..b2d88103b 100644 --- a/driver/cflexor.lex +++ b/driver/cflexor.lex @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: cflexor.lex,v 1.4 2001/11/16 05:07:19 steve Exp $" +#ident "$Id: cflexor.lex,v 1.5 2001/12/08 04:13:07 steve Exp $" #endif # include "cfparse.h" @@ -61,7 +61,7 @@ static int comment_enter; ^"#".* { ; } /* Skip white space. */ -[ \t\f] { ; } +[ \t\f\r] { ; } /* Skip line ends, but also count the line. */ \n { yylloc.first_line += 1; } diff --git a/driver/cfparse.y b/driver/cfparse.y index b27df5974..0ee5fbce7 100644 --- a/driver/cfparse.y +++ b/driver/cfparse.y @@ -18,11 +18,37 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: cfparse.y,v 1.4 2001/11/16 05:07:19 steve Exp $" +#ident "$Id: cfparse.y,v 1.5 2001/12/08 04:13:07 steve Exp $" #endif # include "globals.h" +# include + +/* + * This flag is set to 0, 1 or 2 if file names are to be translated to + * uppercase(1) or lowercase(2). + */ +static int setcase_filename_flag = 0; +static void translate_file_name(char*text) +{ + switch (setcase_filename_flag) { + case 0: + break; + case 1: + while (*text) { + *text = toupper(*text); + text += 1; + } + break; + case 2: + while (*text) { + *text = tolower(*text); + text += 1; + } + break; + } +} %} @@ -51,7 +77,8 @@ item of a source file. Add the file to the file list. */ : TOK_STRING - { process_file_name($1); + { translate_file_name($1); + process_file_name($1); free($1); } @@ -63,7 +90,8 @@ item as an ordinary source file. */ | TOK_Dv TOK_STRING - { process_file_name($2); + { translate_file_name($2); + process_file_name($2); fprintf(stderr, "%s:%u: Ignoring -v in front of %s\n", @1.text, @1.first_line, $2); free($2); @@ -103,8 +131,14 @@ item free($1); } | TOK_PLUSWORD - { fprintf(stderr, "%s:%u: Ignoring %s\n", - @1.text, @1.first_line, $1); + { if (strcmp($1, "+toupper-filenames") == 0) { + setcase_filename_flag = 1; + } else if (strcmp($1, "+tolower-filenames") == 0) { + setcase_filename_flag = 2; + } else { + fprintf(stderr, "%s:%u: Ignoring %s\n", + @1.text, @1.first_line, $1); + } free($1); } ; diff --git a/driver/iverilog.man b/driver/iverilog.man index c70a6e9e3..4bb3d3b91 100644 --- a/driver/iverilog.man +++ b/driver/iverilog.man @@ -1,4 +1,4 @@ -.TH iverilog 1 "$Date: 2001/11/17 17:45:37 $" Version "$Date: 2001/11/17 17:45:37 $" +.TH iverilog 1 "$Date: 2001/12/08 04:13:07 $" Version "$Date: 2001/12/08 04:13:07 $" .SH NAME iverilog - Icarus Verilog compiler @@ -222,6 +222,17 @@ on to the next library directory. The \fB+define+\fP token is the same as the \fB-D\fP option on the command line. The value part of the token is optional. +.TP 8 +.B +toupper-filename\fP +This token causes file names after this in the command file to be +translated to uppercase. This helps with situations where a directory +has passed through a DOS machine, and in the process the file names +become munged. + +.TP 8 +.B +tolower-filename\fP +This is similar to the \fB+toupper-filename\fP hack described above. + .SH EXAMPLES These examples assume that you have a Verilog source file called hello.v in the current directory