Add +vhdl-work+ control to the config file.
Presumably, the user will want the ability to explicitly set the working library location, so create a +vhdl-work+ plusarg setting for exactly that purpose.
This commit is contained in:
parent
19099c944f
commit
521005caf6
|
|
@ -88,6 +88,8 @@ int cmdfile_stack_ptr = 0;
|
|||
|
||||
"+timescale+" { BEGIN(PLUS_ARGS); return TOK_TIMESCALE; }
|
||||
|
||||
"+vhdl-work+" { BEGIN(PLUS_ARGS); return TOK_VHDL_WORK; }
|
||||
|
||||
/* If it is not any known plus-flag, return the generic form. */
|
||||
"+"[^\n \t\b\f\r+]* {
|
||||
cflval.text = strdup(yytext);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ static void translate_file_name(char*text)
|
|||
|
||||
%token TOK_Da TOK_Dc TOK_Dv TOK_Dy
|
||||
%token TOK_DEFINE TOK_INCDIR TOK_INTEGER_WIDTH TOK_LIBDIR TOK_LIBDIR_NOCASE
|
||||
%token TOK_LIBEXT TOK_PARAMETER TOK_TIMESCALE
|
||||
%token TOK_LIBEXT TOK_PARAMETER TOK_TIMESCALE TOK_VHDL_WORK
|
||||
%token <text> TOK_PLUSARG TOK_PLUSWORD TOK_STRING
|
||||
|
||||
%%
|
||||
|
|
@ -157,6 +157,12 @@ item
|
|||
free($2);
|
||||
}
|
||||
|
||||
| TOK_VHDL_WORK TOK_PLUSARG
|
||||
{ char*tmp = substitutions($2);
|
||||
vhdlpp_work = tmp;
|
||||
free($2);
|
||||
}
|
||||
|
||||
/* The +incdir token introduces a list of +<path> arguments that are
|
||||
the include directories to search. */
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
/* This is the integer-width argument that will be passed to ivl. */
|
||||
extern unsigned integer_width;
|
||||
|
||||
extern const char*vhdlpp_work;
|
||||
|
||||
/* Perform variable substitutions on the string. */
|
||||
extern char* substitutions(const char*str);
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ extern void cfreset(FILE*fd, const char*path);
|
|||
const char*base = 0;
|
||||
const char*ivlpp_dir = 0;
|
||||
const char*vhdlpp_dir= 0;
|
||||
const char*vhdlpp_work = 0;
|
||||
const char*mtm = 0;
|
||||
const char*opath = "a.out";
|
||||
const char*npath = 0;
|
||||
|
|
@ -1026,8 +1027,6 @@ int main(int argc, char **argv)
|
|||
snprintf(iconfig_common_path, sizeof iconfig_common_path, "%s%c%s%s.conf",
|
||||
base, sep, targ, synth_flag? "-s" : "");
|
||||
|
||||
fprintf(defines_file, "vhdlpp:%s%cvhdlpp\n", vhdlpp_dir, sep);
|
||||
|
||||
/* Write values to the iconfig file. */
|
||||
fprintf(iconfig_file, "basedir:%s\n", base);
|
||||
|
||||
|
|
@ -1102,6 +1101,11 @@ int main(int argc, char **argv)
|
|||
fprintf(defines_file, "M%c:%s\n", depmode, depfile);
|
||||
}
|
||||
|
||||
if (vhdlpp_work == 0)
|
||||
vhdlpp_work = "ivl_vhdl_work";
|
||||
fprintf(defines_file, "vhdlpp:%s%cvhdlpp\n", vhdlpp_dir, sep);
|
||||
fprintf(defines_file, "vhdlpp-work:%s\n", vhdlpp_work);
|
||||
|
||||
/* Process parameter definition from command line. The last
|
||||
defined would override previous ones. */
|
||||
int pitr;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ extern char**include_dir;
|
|||
extern unsigned include_cnt;
|
||||
/* Program to use for VHDL processing. */
|
||||
extern char*vhdlpp_path;
|
||||
/* vhdlpp work directory */
|
||||
extern char*vhdlpp_work;
|
||||
|
||||
extern int relative_include;
|
||||
|
||||
|
|
|
|||
|
|
@ -1790,7 +1790,7 @@ static void open_input_file(struct include_stack_t*isp)
|
|||
cmdlen += 32;
|
||||
|
||||
char*cmd = malloc(cmdlen);
|
||||
snprintf(cmd, cmdlen, "%s %s", vhdlpp_path, isp->path);
|
||||
snprintf(cmd, cmdlen, "%s -w'%s' %s", vhdlpp_path, vhdlpp_work, isp->path);
|
||||
|
||||
isp->file = popen(cmd, "r");
|
||||
isp->file_close = pclose;
|
||||
|
|
|
|||
13
ivlpp/main.c
13
ivlpp/main.c
|
|
@ -59,6 +59,8 @@ char *dep_path = NULL;
|
|||
char dep_mode = 'a';
|
||||
/* Path to vhdlpp */
|
||||
char *vhdlpp_path = 0;
|
||||
/* vhdlpp work directory */
|
||||
char *vhdlpp_work = 0;
|
||||
|
||||
/*
|
||||
* Keep in source_list an array of pointers to file names. The array
|
||||
|
|
@ -174,6 +176,13 @@ static int flist_read_flags(const char*path)
|
|||
vhdlpp_path = strdup(arg);
|
||||
}
|
||||
|
||||
} else if (strcmp(cp,"vhdlpp-work") == 0) {
|
||||
if (vhdlpp_work) {
|
||||
fprintf(stderr, "Ignore duplicate vhdlpp-work flags\n");
|
||||
} else {
|
||||
vhdlpp_work = strdup(arg);
|
||||
}
|
||||
|
||||
} else {
|
||||
fprintf(stderr, "%s: Invalid keyword %s\n", path, cp);
|
||||
}
|
||||
|
|
@ -403,6 +412,10 @@ int main(int argc, char*argv[])
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (vhdlpp_work == 0) {
|
||||
vhdlpp_work = strdup("ivl_vhdl_work");
|
||||
}
|
||||
|
||||
/* Pass to the lexical analyzer the list of input file, and
|
||||
start scanning. */
|
||||
reset_lexor(out, source_list);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
const char COPYRIGHT[] =
|
||||
"Copyright (c) 2011 Stephen Williams (steve@icarus.com)";
|
||||
|
||||
/*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -22,6 +21,38 @@ const char COPYRIGHT[] =
|
|||
# include "version_base.h"
|
||||
# include "version_tag.h"
|
||||
|
||||
/*
|
||||
* Usage: vhdlpp [flags] sourcefile...
|
||||
* Flags:
|
||||
*
|
||||
** -D <token>
|
||||
* This activates various sorts of debugging aids. The <token>
|
||||
* specifies which debugging aid to activate. Valid tokens are:
|
||||
*
|
||||
* yydebug | no-yydebug
|
||||
* Enable (disable) debug prints from the bison parser
|
||||
*
|
||||
* libraries=<path>
|
||||
* Enable debugging of library support by dumping library
|
||||
* information to the file named <path>.
|
||||
*
|
||||
* entities=<path>
|
||||
* Enable debugging of elaborated entities by writing the
|
||||
* elaboration results to the file named <path>.
|
||||
*
|
||||
** -v
|
||||
* Verbose operation. Display verbose non-debug information.
|
||||
*
|
||||
** -V
|
||||
* Version. Print the version of this binary.
|
||||
*
|
||||
** -w <path>
|
||||
* Work path. This sets the path to the working library
|
||||
* directory. I write into that directory files for packages that
|
||||
* I declare, and I read from that directory packages that are
|
||||
* already declared. The default path is "ivl_vhdl_work".
|
||||
*/
|
||||
|
||||
const char NOTICE[] =
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms of the GNU General Public License as published by\n"
|
||||
|
|
|
|||
Loading…
Reference in New Issue