From aa507185736e795197b722f742e41ab4c9ae8074 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 10 Jun 2017 17:19:20 +0200 Subject: [PATCH] device.c, #18/19, polish comments --- src/frontend/device.c | 91 ++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/src/frontend/device.c b/src/frontend/device.c index 8581fd2d8..295f95c60 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -33,12 +33,11 @@ static void if_set_binned_model(CKTcircuit *, char *, char *, struct dvec *); /* - * devhelp: lists available devices and information on parameters - * devhelp : shows all available devices - * devhelp devname : shows all parameters of that model/instance - * devhelp devname parname : shows parameter meaning - * Options: -csv (comma separated value for generating docs) - * + * devhelp: lists available devices and information on parameters + * devhelp : shows all available devices + * devhelp devname : shows all parameters of that model/instance + * devhelp devname parname : shows parameter meaning + * Options: -csv (comma separated value for generating docs) */ void com_devhelp(wordlist *wl) @@ -220,13 +219,12 @@ printdesc(IFparm p, bool csv) /* - * show: list device operating point info - * show - * show devs : params - * show devs : params ; devs : params - * show dev dev dev : param param param , dev dev : param param - * show t : param param param, t : param param - * + * show: list device operating point info + * show + * show devs : params + * show devs : params ; devs : params + * show dev dev dev : param param param , dev dev : param param + * show t : param param param, t : param param */ static int count; @@ -957,7 +955,8 @@ printvals_old(dgen *dg, IFparm *p, int i) } -/* (old "show" command) +/* + * (old "show" command) * Display various device parameters. The syntax of this command is * show devicelist : parmlist * where devicelist can be "all", the name of a device, a string like r*, @@ -1035,10 +1034,11 @@ old_show(wordlist *wl) } -/* Alter a device parameter. The new syntax here is - * alter @device[parameter] = expr - * alter device = expr - * alter device parameter = expr +/* + * Alter a device parameter. The new syntax here is + * alter @device[parameter] = expr + * alter device = expr + * alter device parameter = expr * expr must be real (complex isn't handled right now, integer is fine though, * but no strings ... for booleans, use 0/1). */ @@ -1121,7 +1121,6 @@ com_alter_common(wordlist *wl, int do_model) struct dvec *dv; struct pnode *names; - /* DIE 2009_02_06 */ int i; if (!ft_curckt) { @@ -1130,30 +1129,15 @@ com_alter_common(wordlist *wl, int do_model) } /* - wordlist 'wl' will be splitted into a wordlist wl2 with three elements, - containing - 1) '@dev[param]' string (i.e.: the substring before '=' char); - 2) '=' string; - 3) 'expression' string. - - Spaces around the '=' sign have to be removed. This is provided - by inp_remove_excess_ws(). But take care if command is entered manually! - - If the 'altermod' argument is 'altermod m1 vth0=0.7', 'm1' has to be kept as the - element in wl2 before splitting inserts the three new elements. - If 'expression' is a vector (e.g. [ 1.0 1.2 1.4 ] ), its elements - in wl2 have to follow the splitting. wl_splice() will take care of this. - */ + * when the assignment operator '=' is embedded in a wl_word + * then split the word into several words + * + * Spaces around the '=' sign have to be removed. This is provided + * by inp_remove_excess_ws(). But take care if command is entered manually! + */ for (; wl; wl = wl->wl_next) { char *argument = wl->wl_word; - /* searching for '=' ... */ char *eqptr = strchr(argument, '='); - - /* argument may be '=', then do nothing - or =token - or token= - or token1=token2 - ...and if found split argument into three chars and make a new wordlist */ if (eqptr) { if (strlen(argument) > 1) { wordlist *wn = NULL; @@ -1170,12 +1154,12 @@ com_alter_common(wordlist *wl, int do_model) if (!wl) { /* no equal sign found, probably a pre3f4 input format - 'alter device value' - 'alter device parameter value' - are supported, - 'alter device parameter value parameter value [ parameter value ]' - multiple param value pairs are not supported! - */ + * 'alter device value' + * 'alter device parameter value' + * are supported, + * 'alter device parameter value parameter value [ parameter value ]' + * with multiple param value pairs are not supported! + */ wordlist *wlin = parent->wl_next; int wlen = wl_length(wlin); int maxelem = 3; @@ -1216,10 +1200,11 @@ com_alter_common(wordlist *wl, int do_model) return; } - /* device parameter = expr - device = expr - @dev[param] = expr - */ + /* + * device parameter = expr + * device = expr + * @dev[param] = expr + */ dev = NULL; param = NULL; @@ -1261,8 +1246,8 @@ com_alter_common(wordlist *wl, int do_model) if (!names) { /* Put this to try to resolve the case of - alter @vin[pulse] = [ 0 5 10n 10n 10n 50n 100n ] - */ + * alter @vin[pulse] = [ 0 5 10n 10n 10n 50n 100n ] + */ char *xsbuf, *rem_xsbuf; double *list; @@ -1295,7 +1280,7 @@ com_alter_common(wordlist *wl, int do_model) if (!dv) return; - /* Here I was, to change the inclusion in the circuit. + /* Here I was, to change the inclusion in the circuit. * will have to revise that dv is right for its insertion. */ if_setparam(ft_curckt->ci_ckt, &dev, param, dv, do_model);