fix regression (no check for null raw->sim_type), allow quoted table titles in table_read()

This commit is contained in:
stefan schippers 2025-11-01 22:43:48 +01:00
parent ba020c243e
commit eae8c2772a
2 changed files with 13 additions and 9 deletions

View File

@ -2759,7 +2759,7 @@ int graph_fullyzoom(xRect *r, Graph_ctx *gr, int graph_dataset)
if(gr->logx) xx = mylog10(gv[p]);
else xx = gv[p];
if(p == ofs) xx0 = gv0[p];
wrap = !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
wrap = xctx->raw->sim_type && !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
if(wrap) {
sweepvar_wrap++;
cnt = 0;
@ -3788,7 +3788,7 @@ int calc_custom_data_yrange(int sweep_idx, const char *express, Graph_ctx *gr)
xx = gv[p];
if(p == ofs) xx0 = gv0[p];
wrap = !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
wrap = xctx->raw->sim_type && !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
if(first != -1) { /* there is something to plot ... */
if(xx > end || xx < start || /* ... and we ran out of graph area ... */
wrap) { /* ... or sweep variable changed direction */
@ -3933,7 +3933,7 @@ int find_closest_wave(int i, Graph_ctx *gr)
if(gr->logy) yy = mylog10(gvy[p]);
else yy = gvy[p];
if(p == ofs) xx0 = gv0[p];
wrap = !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
wrap = xctx->raw->sim_type && !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
if(first != -1) {
if(xx > end || xx < start || wrap) {
dbg(1, "find_closest_wave(): last=%d\n", last);
@ -4256,7 +4256,7 @@ void draw_graph(int i, int flags, Graph_ctx *gr, void *ct)
* are simulated and thos no equality test can be done, and any "approx equal" test si going
* to do unexpected things (liek in simulations with very dense steps) */
if(p == ofs) xx0 = gv0[p]; /* gv[p];*/
wrap = !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
wrap = xctx->raw->sim_type && !strcmp(xctx->raw->sim_type, "dc") && cnt > 1 && gv0[p] == xx0;
#if 1 /* plot one point before start and one point after end so
* waves will extend to whole graph area even if there are few points
* but NOT if we are about to wrap (missing 1st/last point in 2-var dc sweeps) */

View File

@ -1548,11 +1548,15 @@ int table_read(const char *f)
prev_prev_empty = prev_empty = 0;
line_ptr = line;
field = 0;
#ifdef __unix__
while( (line_tok = strtok_r(line_ptr, ", \t\n", &line_save)) ) {
#else
while( (line_tok = my_strtok_r(line_ptr, ", \t\n", "", 0, &line_save)) ) {
#endif
/*
* #ifdef __unix__
* while( (line_tok = strtok_r(line_ptr, ", \t\n", &line_save)) ) {
* #else
*/
while( (line_tok = my_strtok_r(line_ptr, ", \t\n", "\"", 0, &line_save)) ) {
/*
* #endif
*/
line_ptr = NULL;
/* dbg(1,"%s ", line_tok); */
if(nline == 0) { /* header line */