From 68b06c7a736d66b0a2f3460743059e228cc7c0f4 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sat, 19 Dec 2009 16:04:22 +0000 Subject: [PATCH] comments --- ChangeLog | 5 ++++- src/frontend/breakp2.c | 15 +++++++++------ src/frontend/dotcards.c | 6 ++++++ src/frontend/inp.c | 4 +++- src/frontend/measure.c | 10 ++++++---- src/include/fteext.h | 36 +----------------------------------- src/main.c | 21 +++++++++++++-------- 7 files changed, 42 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ec7f3cfb..25241cedc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2009-12-19 Holger Vogt * main.c, inpcom.c: source file path added as additional search path for opening .include files (MS Windows only). + measure.c: .meas only when -b and -r are not set + fteext.h: cleanup of unused entries + breakp2.c, dotcards.c, inp.c, main.c: comments added 2009-12-17 Dietmar Warning * devices/bsim3/b3set.c: add the ngspice specific copyNodesets approach and remove @@ -12,7 +15,7 @@ * tests/transmission/ibm2.cir: wrong cpl model instantiation 2009-12-12 Holger Vogt - * runcoms: evalusate measure commands only when avaialble + * runcoms: evaluate measure commands only when avaialble * /examples/transimpedanceamp/output.net: correct .plot statement * string.c: '^' added to is_arith_char(), to allow parsing of '^' in .func function definitions diff --git a/src/frontend/breakp2.c b/src/frontend/breakp2.c index 105d3e581..228b82dd0 100644 --- a/src/frontend/breakp2.c +++ b/src/frontend/breakp2.c @@ -16,14 +16,14 @@ $Id$ #include "quote.h" #include "breakp2.h" +/* global linked list to store .save data and breakpoint data */ struct dbcomm *dbs = NULL; /* export for iplot */ + +/* used in breakp.c and breakp2.c */ int debugnumber = 1; -/* Set a breakpoint. Possible commands are: - * stop after n - * stop when var cond val - * - * If more than one is given on a command line, then this is a conjunction. +/* Analyse the data given by the .save card or 'save' command. + Store the data in the global dbs struct. */ /* Save a vector. */ @@ -35,6 +35,7 @@ com_save(wordlist *wl) return; } +/* Save a vector with the analysis type given (name). */ void com_save2(wordlist *wl, char *name) { @@ -95,8 +96,10 @@ settrace(wordlist *wl, int what, char *name) return; } +/* retrieve the save nodes from dbs into an array */ int ft_getSaves(struct save_info **savesp) +/* global variable: dbs */ { struct dbcomm *d; int count = 0, i = 0; @@ -105,7 +108,7 @@ ft_getSaves(struct save_info **savesp) for (d = dbs; d; d = d->db_next) if (d->db_type == DB_SAVE) count++; - + if (!count) return (0); diff --git a/src/frontend/dotcards.c b/src/frontend/dotcards.c index d9e7e10b2..2b0307c3d 100644 --- a/src/frontend/dotcards.c +++ b/src/frontend/dotcards.c @@ -47,6 +47,12 @@ setcplot(char *name) +/* All lines with .width, .plot, .print, .save, .op, .meas, .tf + have been assembled into a wordlist (wl_first) in inp.c:inp_spsource(), + and then stored to ci_commands in inp.c:inp_dodeck(). + The .save lines are selected, com_save will put the commands into dbs. +*/ + void ft_dotsaves(void) { diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 680f043a4..673c29002 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -314,7 +314,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename) /* arguments: * *fp = pointer to the input file * comfile = whether it is a command file. Values are TRUE/FALSE - * *filename = + * *filename = name of input file */ { struct line *deck, *dd, *ld, *prev_param = NULL, *prev_card = NULL; @@ -615,6 +615,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename) } } + /* linked list dbs is used to store the "save" or .save data (defined in breakp2.c), + breakpoint and iplot data, will be renewed in ft_dotsaves(). */ if(dbs) tfree(dbs); /*saj, to process save commands always, not just in batch mode diff --git a/src/frontend/measure.c b/src/frontend/measure.c index cf42e6148..5129bc40e 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -31,6 +31,7 @@ static bool just_chk_meas; /* TRUE: only check if measurement can be done succ static bool measures_passed; /* TRUE: stop simulation (if option autostop is set)*/ extern bool ft_batchmode; +extern bool rflag; static bool chkAnalysisType( char *an_type ) { @@ -115,10 +116,11 @@ do_measure( strtolower( an_name ); measure_word_list = NULL ; - /* don't allow .meas if batchmode is set by -b */ - if (ft_batchmode) { - fprintf(cp_err, "\nNo .measure possible in batch mode (-b)!\n"); - fprintf(cp_err, "Select interactive mode (optionally with .control section) instead.\n\n"); + /* don't allow .meas if batchmode is set by -b and -r rawfile given */ + if (ft_batchmode && rflag) { + fprintf(cp_err, "\nNo .measure possible in batch mode (-b) with -r rawfile set!\n"); + fprintf(cp_err, "Remove rawfile and use .print or .plot or\n"); + fprintf(cp_err, "select interactive mode (optionally with .control section) instead.\n\n"); return; } diff --git a/src/include/fteext.h b/src/include/fteext.h index 5f10cf4a8..b8bba82da 100644 --- a/src/include/fteext.h +++ b/src/include/fteext.h @@ -510,43 +510,9 @@ extern char *vec_basename(); extern bool plot_prefix(); extern void vec_transpose(); -/* writedata.c */ - +/* main.c */ extern bool ft_intrpt; extern bool ft_setflag; -extern int wrd_close(); -extern int wrd_command(); -extern int wrd_cptime; -extern int wrd_end(); -extern int wrd_init(); -extern int wrd_limpts; -extern int wrd_open(); -extern int wrd_output(); -extern int wrd_point(); -extern int wrd_pt2(); -extern int wrd_run(); -extern int wrd_stopnow(); -extern void wrd_chtrace(); -extern void wrd_error(); -extern void wrd_version(); -extern wordlist *wrd_saves; - -/* xinterface.c */ - -extern void xi_arc(); -extern bool xi_init(); -extern bool xi_dump(); -extern void xi_clearscreen(); -extern void xi_close(); -extern void xi_drawline(); -extern void xi_resetcolor(); -extern void xi_setcolor(); -extern void xi_setlinestyle(); -extern void xi_text(); -extern void xi_update(); -extern void xi_zoomdata(); -extern struct screen *screens; -extern void com_clearplot(); /* newcoms.c */ extern void com_reshape(); diff --git a/src/main.c b/src/main.c index 314376710..8c48d12c4 100644 --- a/src/main.c +++ b/src/main.c @@ -79,6 +79,7 @@ static char *application_name; /* Main options */ static bool ft_servermode = FALSE; bool ft_batchmode = FALSE; +bool rflag = FALSE; /* has rawfile */ /* Frontend options */ bool ft_intrpt = FALSE; /* Set by the (void) signal handlers. TRUE = we've been interrupted. */ @@ -704,7 +705,7 @@ main(int argc, char **argv) bool istty = TRUE; bool iflag = FALSE; bool qflag = FALSE; - bool rflag = FALSE; + FILE *fp; FILE *circuit_file; bool orflag = FALSE; @@ -1120,12 +1121,12 @@ bot: evl: if (ft_batchmode) { - /* If we get back here in batch mode then something is wrong, - * so exit. */ + bool st = FALSE; (void) SETJMP(jbuf, 1); - + /* If we get back here in batch mode then something is wrong, + * so exit. */ if (st == TRUE) { sp_shutdown(EXIT_BAD); @@ -1141,17 +1142,21 @@ evl: sp_shutdown(EXIT_NORMAL); } - /* If -r is specified, then we don't bother with the dot - * cards. Otherwise, we use wrd_run, but we are careful not to - * save too much. */ + cp_interactive = FALSE; if (rflag) { - /* saj done already in inp_spsource ft_dotsaves();*/ + /* If -r is specified, then dot cards (.width, .plot, .print, .op, .meas, .tf) + are ignored, except .save, which has been handled by ft_dotsaves() + from within inp_spsource (), data are put into linked list dbs. + */ error2 = ft_dorun(ft_rawfile); + /* Execute the .whatever lines found in the deck, after we are done running. */ if (ft_cktcoms(TRUE) || error2) sp_shutdown(EXIT_BAD); } else if (ft_savedotargs()) { + /* all dot card data to be put into dbs */ error2 = ft_dorun(NULL); + /* Execute the .whatever lines found in the deck, after we are done running. */ if (ft_cktcoms(FALSE) || error2) sp_shutdown(EXIT_BAD); } else {