Add support for ${var} substitutions in the command file.
We still support $(var).
This commit is contained in:
parent
9dc4c8cbe1
commit
4cb39f584d
|
|
@ -1,4 +1,4 @@
|
||||||
.TH iverilog 1 "May 28th, 2009" "" "Version 0.10.devel"
|
.TH iverilog 1 "October 28th, 2009" "" "Version 0.10.devel"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
iverilog - Icarus Verilog compiler
|
iverilog - Icarus Verilog compiler
|
||||||
|
|
||||||
|
|
@ -436,7 +436,8 @@ integer value.
|
||||||
.SH "VARIABLES IN COMMAND FILES"
|
.SH "VARIABLES IN COMMAND FILES"
|
||||||
|
|
||||||
In certain cases, iverilog supports variables in command files. These
|
In certain cases, iverilog supports variables in command files. These
|
||||||
are strings of the form "$(\fIvarname\fP)", where \fIvarname\fP is the
|
are strings of the form "$(\fIvarname\fP)" or "${\fIvarname\fP}", where
|
||||||
|
\fIvarname\fP is the
|
||||||
name of the environment variable to read. The entire string is
|
name of the environment variable to read. The entire string is
|
||||||
replaced with the contents of that variable. Variables are only
|
replaced with the contents of that variable. Variables are only
|
||||||
substituted in contexts that explicitly support them, including file
|
substituted in contexts that explicitly support them, including file
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2002-2009 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -16,9 +16,6 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CVS_IDENT
|
|
||||||
#ident "$Id: substit.c,v 1.5 2003/12/19 01:27:10 steve Exp $"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
@ -35,13 +32,13 @@ char* substitutions(const char*str)
|
||||||
|
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
|
||||||
if ((str[0] == '$') && (str[1] == '(')) {
|
if ((str[0] == '$') && ((str[1] == '(') || str[1] == '{')) {
|
||||||
/* If I find a $(x) string in the source, replace
|
/* If I find a $(x) or ${x} string in the source, replace
|
||||||
it in the destination with the contents of the
|
it in the destination with the contents of the
|
||||||
environment variable x. */
|
environment variable x. */
|
||||||
char*name;
|
char*name;
|
||||||
char*value;
|
char*value;
|
||||||
const char*ep = strchr(str, ')');
|
const char*ep = strchr(str, (str[1]=='(') ? ')' : '}');
|
||||||
str += 2;
|
str += 2;
|
||||||
|
|
||||||
name = malloc(ep-str+1);
|
name = malloc(ep-str+1);
|
||||||
|
|
@ -92,24 +89,3 @@ char* substitutions(const char*str)
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log: substit.c,v $
|
|
||||||
* Revision 1.5 2003/12/19 01:27:10 steve
|
|
||||||
* Fix various unsigned compare warnings.
|
|
||||||
*
|
|
||||||
* Revision 1.4 2002/08/12 01:35:01 steve
|
|
||||||
* conditional ident string using autoconfig.
|
|
||||||
*
|
|
||||||
* Revision 1.3 2002/08/11 23:47:04 steve
|
|
||||||
* Add missing Log and Ident strings.
|
|
||||||
*
|
|
||||||
* Revision 1.2 2002/06/25 01:33:01 steve
|
|
||||||
* include malloc.h only when available.
|
|
||||||
*
|
|
||||||
* Revision 1.1 2002/06/23 20:10:51 steve
|
|
||||||
* Variable substitution in command files.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue