Create files with default suffix when $dumpfile doesn't include a suffix.
This commit is contained in:
parent
d718e7b468
commit
eeeb9ff099
|
|
@ -435,7 +435,7 @@ static PLI_INT32 sys_dumpfile_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
path = get_filename(callh, name, vpi_scan(argv));
|
||||
path = get_filename_with_suffix(callh, name, vpi_scan(argv), "fst");
|
||||
vpi_free_object(argv);
|
||||
if (! path) return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ static PLI_INT32 sys_dumpfile_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
path = get_filename(callh, name, vpi_scan(argv));
|
||||
path = get_filename_with_suffix(callh, name, vpi_scan(argv), "lxt");
|
||||
vpi_free_object(argv);
|
||||
if (! path) return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -543,7 +543,7 @@ static PLI_INT32 sys_dumpfile_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
path = get_filename(callh, name, vpi_scan(argv));
|
||||
path = get_filename_with_suffix(callh, name, vpi_scan(argv), "lx2");
|
||||
vpi_free_object(argv);
|
||||
if (! path) return 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -103,6 +103,26 @@ char *get_filename(vpiHandle callh, const char *name, vpiHandle file)
|
|||
return strdup(val.value.str);
|
||||
}
|
||||
|
||||
char* get_filename_with_suffix(vpiHandle callh, const char *name, vpiHandle file, const char*suff)
|
||||
{
|
||||
char*path = get_filename(callh, name, file);
|
||||
if (path == 0) return 0;
|
||||
|
||||
/* If the name already has a suffix, then don't replace it or
|
||||
add another suffix. Just return this path. */
|
||||
char*tailp = strrchr(path, '.');
|
||||
if (tailp != 0) return path;
|
||||
|
||||
/* The name doesn't have a suffix, so append the passed in
|
||||
suffix to the file name. */
|
||||
char*new_path = malloc(strlen(path) + strlen(suff) + 2);
|
||||
strcpy(new_path, path);
|
||||
strcat(new_path, ".");
|
||||
strcat(new_path, suff);
|
||||
free(path);
|
||||
return new_path;
|
||||
}
|
||||
|
||||
void check_for_extra_args(vpiHandle argv, vpiHandle callh, const char *name,
|
||||
const char *arg_str, unsigned opt)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ extern PLI_UINT64 timerec_to_time64(const struct t_vpi_time*timerec);
|
|||
|
||||
extern char *as_escaped(char *arg);
|
||||
extern char *get_filename(vpiHandle callh, const char *name, vpiHandle file);
|
||||
extern char *get_filename_with_suffix(vpiHandle callh, const char*name,
|
||||
vpiHandle file, const char*suff);
|
||||
|
||||
extern void check_for_extra_args(vpiHandle argv, vpiHandle callh, const char *name,
|
||||
const char *arg_str, unsigned opt);
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@ static PLI_INT32 sys_dumpfile_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
path = get_filename(callh, name, vpi_scan(argv));
|
||||
path = get_filename_with_suffix(callh, name, vpi_scan(argv), "vcd");
|
||||
vpi_free_object(argv);
|
||||
if (! path) return 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue