From d7cb5c92ba2e97e7abef7a412b4138ffec8486ad Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 9 Feb 2025 19:54:08 +0100 Subject: [PATCH] Add a section without source info to the debug output. Truncate .model lines in this section, as .model lines with several hundred parameters may mask the relevant information. --- src/frontend/inp.c | 20 ++++++++++++++++++++ src/frontend/inpcom.c | 9 ++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 47ed8a8fe..93ddea901 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -973,6 +973,26 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) FILE *fdo = fopen("debug-out2.txt", "w"); if (fdo) { struct card *tc = NULL; + fprintf(fdo, + "\n\n**************** uncommented deck without source file info " + "**************\n\n"); + /* always print first line */ + fprintf(fdo, "%6d %s\n", deck->linenum, + deck->line); + /* here without out-commented lines */ + for (tc = deck->nextcard; tc; tc = tc->nextcard) { + if (*(tc->line) == '*') + continue; + /* Only truncated .model lines */ + if (ciprefix(".model", tc->line)) { + fprintf(fdo, "%6d %.100s ...\n", + tc->linenum, tc->line); + } + else { + fprintf(fdo, "%6d %s\n", + tc->linenum, tc->line); + } + } fprintf(fdo, "**************** uncommented deck **************\n\n"); /* always print first line */ fprintf(fdo, "%6s %6d %6d %s\n", deck->linesource, deck->linenum_orig, deck->linenum, deck->line); diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index fd076ea9f..e04b25f28 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -1231,8 +1231,15 @@ struct card *inp_readall(FILE *fp, const char *dir_name, const char* file_name, for (t = cc->nextcard; t; t = t->nextcard) { if (*(t->line) == '*') continue; - fprintf(fd, "%6d %s\n", + /* Only truncated .model lines */ + if (ciprefix(".model", t->line)) { + fprintf(fd, "%6d %.100s ...\n", t->linenum, t->line); + } + else { + fprintf(fd, "%6d %s\n", + t->linenum, t->line); + } } fprintf(fd, "\n\n**************** uncommented deck "