From 663991ce70f5949a0ef2c121dc9d3fdbc9cfdd61 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 14 Oct 2023 23:09:40 +0200 Subject: [PATCH] add "filename" member in Raw (raw file) struct --- src/save.c | 3 +++ src/xschem.h | 1 + 2 files changed, 4 insertions(+) diff --git a/src/save.c b/src/save.c index 846e7b20..a2311929 100644 --- a/src/save.c +++ b/src/save.c @@ -685,6 +685,7 @@ void free_rawfile(Raw **rawptr, int dr) } if(raw->npoints) my_free(_ALLOC_ID_, &raw->npoints); if(raw->schname) my_free(_ALLOC_ID_, &raw->schname); + my_strncpy(raw->filename, "", S(raw->filename)); if(raw->table.table) int_hash_free(&raw->table); my_free(_ALLOC_ID_, rawptr); if(deleted && dr) draw(); @@ -780,6 +781,7 @@ int raw_read(const char *f, Raw **rawptr, const char *type) if(fd) { if((res = read_dataset(fd, rawptr, type)) == 1) { int i; + my_strncpy(raw->filename, f, S(raw->filename)); my_strdup2(_ALLOC_ID_, &raw->schname, xctx->sch[xctx->currsch]); raw->level = xctx->currsch; raw->allpoints = 0; @@ -922,6 +924,7 @@ int table_read(const char *f) if(res == 1) { int i; my_strdup2(_ALLOC_ID_, &xctx->raw->schname, xctx->sch[xctx->currsch]); + my_strncpy(xctx->raw->filename, f, S(xctx->raw->filename)); xctx->raw->level = xctx->currsch; xctx->raw->allpoints = 0; for(i = 0; i < xctx->raw->datasets; ++i) { diff --git a/src/xschem.h b/src/xschem.h index 6043d0e3..d9672429 100644 --- a/src/xschem.h +++ b/src/xschem.h @@ -766,6 +766,7 @@ struct hilight_hashentry typedef struct { /* spice raw file specific data */ char **names; + char filename[PATH_MAX]; SPICE_DATA **values; int nvars; int *npoints;