beautify code: indentations etc.
This commit is contained in:
parent
43b14e4d35
commit
9dbb7654eb
|
|
@ -1,3 +1,6 @@
|
||||||
|
2011-11-13 Holger Vogt
|
||||||
|
* inp.c: code beautify, indentations etc.
|
||||||
|
|
||||||
2011-11-04 Holger Vogt
|
2011-11-04 Holger Vogt
|
||||||
* INSTALL: give more precise instructions
|
* INSTALL: give more precise instructions
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,7 @@ com_listing(wordlist *wl)
|
||||||
s = wl->wl_word;
|
s = wl->wl_word;
|
||||||
if ( strcmp( s, "param" ) == 0 ) {
|
if ( strcmp( s, "param" ) == 0 ) {
|
||||||
do_param_listing = TRUE;
|
do_param_listing = TRUE;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
switch (*s) {
|
switch (*s) {
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
case 'L':
|
||||||
|
|
@ -95,8 +94,7 @@ com_listing(wordlist *wl)
|
||||||
}
|
}
|
||||||
if ( do_param_listing ) {
|
if ( do_param_listing ) {
|
||||||
nupa_list_params(cp_out);
|
nupa_list_params(cp_out);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (type != LS_DECK)
|
if (type != LS_DECK)
|
||||||
fprintf(cp_out, "\t%s\n\n", ft_curckt->ci_name);
|
fprintf(cp_out, "\t%s\n\n", ft_curckt->ci_name);
|
||||||
inp_list(cp_out, expand ? ft_curckt->ci_deck :
|
inp_list(cp_out, expand ? ft_curckt->ci_deck :
|
||||||
|
|
@ -136,13 +134,13 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
|
||||||
bool renumber;
|
bool renumber;
|
||||||
bool useout = (file == cp_out);
|
bool useout = (file == cp_out);
|
||||||
int i = 1;
|
int i = 1;
|
||||||
/* gtri - wbk - 03/07/91 - Don't use 'more' type output if ipc enabled */
|
/* gtri - wbk - 03/07/91 - Don't use 'more' type output if ipc enabled */
|
||||||
#ifdef XSPICE
|
#ifdef XSPICE
|
||||||
if(g_ipc.enabled) {
|
if(g_ipc.enabled) {
|
||||||
useout = FALSE;
|
useout = FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* gtri - end - 03/07/91 */
|
/* gtri - end - 03/07/91 */
|
||||||
|
|
||||||
if (useout)
|
if (useout)
|
||||||
out_init();
|
out_init();
|
||||||
|
|
@ -289,7 +287,8 @@ top2:
|
||||||
* SJB - 22nd May 2001
|
* SJB - 22nd May 2001
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
line_free_x(struct line * deck, bool recurse) {
|
line_free_x(struct line * deck, bool recurse)
|
||||||
|
{
|
||||||
if(!deck)
|
if(!deck)
|
||||||
return;
|
return;
|
||||||
tfree(deck->li_line);
|
tfree(deck->li_line);
|
||||||
|
|
@ -308,7 +307,7 @@ line_free_x(struct line * deck, bool recurse) {
|
||||||
* Then, we run dodeck, which parses up the deck. */
|
* Then, we run dodeck, which parses up the deck. */
|
||||||
void
|
void
|
||||||
inp_spsource(FILE *fp, bool comfile, char *filename)
|
inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
/* arguments:
|
/* arguments:
|
||||||
* *fp = pointer to the input file
|
* *fp = pointer to the input file
|
||||||
* comfile = whether it is a command file. Values are TRUE/FALSE
|
* comfile = whether it is a command file. Values are TRUE/FALSE
|
||||||
* *filename = name of input file
|
* *filename = name of input file
|
||||||
|
|
@ -382,17 +381,15 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
if (dd->li_line[0] == '*')
|
if (dd->li_line[0] == '*')
|
||||||
cp_evloop(dd->li_line + 2);
|
cp_evloop(dd->li_line + 2);
|
||||||
/* option line stored but not processed */
|
/* option line stored but not processed */
|
||||||
else if (ciprefix("option", dd->li_line))
|
else if (ciprefix("option", dd->li_line)) {
|
||||||
{
|
|
||||||
com_options = inp_getoptsc(dd->li_line, com_options);
|
com_options = inp_getoptsc(dd->li_line, com_options);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
cp_evloop(dd->li_line);
|
cp_evloop(dd->li_line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* free the control deck */
|
/* free the control deck */
|
||||||
line_free(deck,TRUE);
|
line_free(deck,TRUE);
|
||||||
/* printf("Command deck freed\n"); */
|
/* printf("Command deck freed\n"); */
|
||||||
} /* end if(comfile) */
|
} /* end if(comfile) */
|
||||||
|
|
||||||
else { /* must be regular deck . . . . */
|
else { /* must be regular deck . . . . */
|
||||||
|
|
@ -495,8 +492,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
|| eq(s, ".save")
|
|| eq(s, ".save")
|
||||||
|| eq(s, ".op")
|
|| eq(s, ".op")
|
||||||
|| ciprefix(".meas", s)
|
|| ciprefix(".meas", s)
|
||||||
|| eq(s, ".tf"))
|
|| eq(s, ".tf")) {
|
||||||
{
|
|
||||||
if (end) {
|
if (end) {
|
||||||
end->wl_next = alloc(struct wordlist);
|
end->wl_next = alloc(struct wordlist);
|
||||||
end->wl_next->wl_prev = end;
|
end->wl_next->wl_prev = end;
|
||||||
|
|
@ -534,7 +530,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
#endif
|
#endif
|
||||||
/* Now expand subcircuit macros and substitute numparams.*/
|
/* Now expand subcircuit macros and substitute numparams.*/
|
||||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL))
|
if (!cp_getvar("nosubckt", CP_BOOL, NULL))
|
||||||
if( (deck->li_next = inp_subcktexpand(deck->li_next)) == NULL ){
|
if( (deck->li_next = inp_subcktexpand(deck->li_next)) == NULL ) {
|
||||||
line_free(realdeck,TRUE);
|
line_free(realdeck,TRUE);
|
||||||
line_free(deck->li_actual, TRUE);
|
line_free(deck->li_actual, TRUE);
|
||||||
return;
|
return;
|
||||||
|
|
@ -626,8 +622,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
|
|
||||||
if ( curr_meas == NULL ) {
|
if ( curr_meas == NULL ) {
|
||||||
curr_meas = ft_curckt->ci_meas = dd;
|
curr_meas = ft_curckt->ci_meas = dd;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
curr_meas->li_next = dd;
|
curr_meas->li_next = dd;
|
||||||
curr_meas = dd;
|
curr_meas = dd;
|
||||||
}
|
}
|
||||||
|
|
@ -709,10 +704,12 @@ inp_dodeck(
|
||||||
FALSE if called from inp_spsource() */
|
FALSE if called from inp_spsource() */
|
||||||
struct line *options, /*in: all .option lines from deck */
|
struct line *options, /*in: all .option lines from deck */
|
||||||
char *filename /*in: input file of deck */
|
char *filename /*in: input file of deck */
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
struct circ *ct;
|
struct circ *ct;
|
||||||
struct line *dd;
|
struct line *dd;
|
||||||
CKTcircuit *ckt; char *s;
|
CKTcircuit *ckt;
|
||||||
|
char *s;
|
||||||
INPtables *tab = NULL;
|
INPtables *tab = NULL;
|
||||||
struct variable *eev = NULL;
|
struct variable *eev = NULL;
|
||||||
wordlist *wl;
|
wordlist *wl;
|
||||||
|
|
@ -746,7 +743,7 @@ inp_dodeck(
|
||||||
noparse = cp_getvar("noparse", CP_BOOL, NULL);
|
noparse = cp_getvar("noparse", CP_BOOL, NULL);
|
||||||
|
|
||||||
|
|
||||||
/* We check preliminary for the scale option. This special processing
|
/* We check preliminary for the scale option. This special processing
|
||||||
is needed because we need the scale info BEFORE building the circuit
|
is needed because we need the scale info BEFORE building the circuit
|
||||||
and seems there is no other way to do this. */
|
and seems there is no other way to do this. */
|
||||||
if (!noparse) {
|
if (!noparse) {
|
||||||
|
|
@ -776,15 +773,14 @@ inp_dodeck(
|
||||||
case CP_NUM:
|
case CP_NUM:
|
||||||
break;
|
break;
|
||||||
case CP_REAL:
|
case CP_REAL:
|
||||||
if ( strcmp("scale",eev->va_name)==0 ){
|
if ( strcmp("scale",eev->va_name)==0 ) {
|
||||||
cp_vset("scale", CP_REAL, &eev->va_real );
|
cp_vset("scale", CP_REAL, &eev->va_real );
|
||||||
printf("Scale set\n");
|
printf("Scale set\n");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CP_STRING:
|
case CP_STRING:
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
|
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
|
||||||
controlled_exit(EXIT_FAILURE);
|
controlled_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
@ -898,7 +894,7 @@ inp_dodeck(
|
||||||
ct->ci_filename = NULL;
|
ct->ci_filename = NULL;
|
||||||
|
|
||||||
if (!noparse) {
|
if (!noparse) {
|
||||||
/* for (; options; options = options->li_next) {
|
/* for (; options; options = options->li_next) {
|
||||||
for (s = options->li_line; *s && !isspace(*s); s++)
|
for (s = options->li_line; *s && !isspace(*s); s++)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -915,7 +911,7 @@ inp_dodeck(
|
||||||
while (eev->va_next)
|
while (eev->va_next)
|
||||||
eev = eev->va_next;
|
eev = eev->va_next;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
for (eev = ct->ci_vars; eev; eev = eev->va_next) {
|
for (eev = ct->ci_vars; eev; eev = eev->va_next) {
|
||||||
bool one = TRUE; /* FIXME, actually eev->va_bool should be TRUE anyway */
|
bool one = TRUE; /* FIXME, actually eev->va_bool should be TRUE anyway */
|
||||||
switch (eev->va_type) {
|
switch (eev->va_type) {
|
||||||
|
|
@ -935,8 +931,7 @@ inp_dodeck(
|
||||||
if_option(ct->ci_ckt, eev->va_name,
|
if_option(ct->ci_ckt, eev->va_name,
|
||||||
eev->va_type, eev->va_string);
|
eev->va_type, eev->va_string);
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
{
|
|
||||||
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
|
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
|
||||||
controlled_exit(EXIT_FAILURE);
|
controlled_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
@ -1103,8 +1098,7 @@ com_source(wordlist *wl)
|
||||||
/* Don't print the title if this is a spice initialisation file. */
|
/* Don't print the title if this is a spice initialisation file. */
|
||||||
if (ft_nutmeg || substring(INITSTR, owl->wl_word) || substring(ALT_INITSTR, owl->wl_word)) {
|
if (ft_nutmeg || substring(INITSTR, owl->wl_word) || substring(ALT_INITSTR, owl->wl_word)) {
|
||||||
inp_spsource(fp, TRUE, tempfile ? NULL : wl->wl_word);
|
inp_spsource(fp, TRUE, tempfile ? NULL : wl->wl_word);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
inp_spsource(fp, FALSE, tempfile ? NULL : wl->wl_word);
|
inp_spsource(fp, FALSE, tempfile ? NULL : wl->wl_word);
|
||||||
}
|
}
|
||||||
cp_interactive = inter;
|
cp_interactive = inter;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue