/* called by SystemMenue / Postscript hardcopy */ LRESULT HcpyPlot( HWND hwnd) { int colorval = isblack? 0 : 1; cp_vset("hcopypscolor", CP_NUM, &colorval); com_hardcopy(NULL); return 0; }
void cp_init(void) /* called from ft_cpinit() in cpitf.c. Uses global variables: cp_chars[128] cp_maxhistlength (set to 10000 in com_history.c) cp_curin, cp_curout, cp_curerr (defined in streams.c) */ { char *s; memset(cp_chars, 0, 128); for (s = singlec; *s; s++) /* break word to right or left of characters <>;&*/ cp_chars[(int) *s] = (CPC_BRR | CPC_BRL); cp_vset("history", CP_NUM, &cp_maxhistlength); cp_curin = stdin; cp_curout = stdout; cp_curerr = stderr; /* io redirection in streams.c: cp_in set to cp_curin etc. */ cp_ioreset(); }
void cp_init() { char *s, *getenv(); bzero(cp_chars, 128); for (s = singlec; *s; s++) cp_chars[*s] = (CPC_BRR | CPC_BRL); cp_vset("history", VT_NUM, (char *) &cp_maxhistlength); cp_curin = stdin; cp_curout = stdout; cp_curerr = stderr; cp_ioreset(); return; }
/* The option command. Syntax is option [opt ...] [opt = val ...]. * Val may be a string, an int, a float, or a list of the * form (elt1 elt2 ...). */ void com_option(wordlist *wl) { struct variable *vars; CKTcircuit *circuit = NULL; if (!ft_curckt) { fprintf(cp_err, "Error: no circuit loaded\n"); return; } circuit = (ft_curckt->ci_ckt); if (wl == NULL) { printf("******************************\n"); printf("* Current simulation options *\n"); printf("******************************\n\n"); printf("Temperatures:\n"); printf("temp = %f\n", circuit->CKTtemp); printf("tnom = %f\n", circuit->CKTnomTemp); printf("\nIntegration method summary:\n"); switch (circuit->CKTintegrateMethod) { case TRAPEZOIDAL: printf("Integration Method = TRAPEZOIDAL\n"); break; case GEAR: printf("Integration Method = GEAR\n"); break; default: printf("Unknown integration method\n"); } printf("MaxOrder = %d\n", circuit->CKTmaxOrder); printf("\nTolerances (absolute):\n"); printf("abstol (current) = %g\n", circuit->CKTabstol); printf("chgtol (charge) = %g\n", circuit->CKTchgtol); printf("vntol (voltage) = %g\n", circuit->CKTvoltTol); printf("pivtol (pivot) = %g\n", circuit->CKTpivotAbsTol); printf("\nTolerances (relative):\n"); printf("reltol (current) = %g\n", circuit->CKTreltol); printf("pivrel (pivot) = %g\n", circuit->CKTpivotRelTol); printf("\nIteration limits:\n"); printf("ITL1 = %d\n", circuit->CKTdcMaxIter); printf("ITL2 = %d\n", circuit->CKTdcTrcvMaxIter); printf("ITL4 = %d\n", circuit->CKTtranMaxIter); printf("\nTruncation error correction:\n"); printf("trtol = %f\n", circuit->CKTtrtol); #ifdef NEWTRUNC printf("ltereltol = %g\n", circuit->CKTlteReltol); printf("lteabstol = %g\n", circuit->CKTlteAbstol); #endif /* NEWTRUNC */ printf("\nConductances:\n"); printf("gmin (devices) = %g\n", circuit->CKTgmin); printf("diaggmin (stepping) = %g\n", circuit->CKTdiagGmin); printf("gshunt = %g\n", circuit->CKTgshunt); printf("delmin = %g\n", circuit->CKTdelmin); printf("\nDefault parameters for MOS devices\n"); printf("Default M: %f\n", circuit->CKTdefaultMosM); printf("Default L: %f\n", circuit->CKTdefaultMosL); printf("Default W: %f\n", circuit->CKTdefaultMosW); printf("Default AD: %f\n", circuit->CKTdefaultMosAD); printf("Default AS: %f\n", circuit->CKTdefaultMosAS); return; } vars = cp_setparse(wl); /* This is sort of a hassle... */ while (vars) { void *s; switch (vars->va_type) { case CP_BOOL: s = &vars->va_bool; break; case CP_NUM: s = &vars->va_num; break; case CP_REAL: s = &vars->va_real; break; case CP_STRING: s = vars->va_string; break; case CP_LIST: s = vars->va_vlist; break; default: s = NULL; } /* qui deve settare le opzioni di simulazione */ cp_vset(vars->va_name, vars->va_type, s); vars = vars->va_next; } free_struct_variable(vars); }
void ft_cpinit(void) { bool found = FALSE, t = TRUE; char buf[BSIZE_SP], **x, *s, *r, *copys; struct comm *c; int i; FILE *fp; static char *predefs[] = { "yes", "1", "TRUE", "1", "no", "0", "FALSE", "0", "pi", "3.14159265358979323846", "e", "2.71828182845904523536", "c", "2.997925e8", "i", "0,1", "kelvin", "-273.15", "echarge", "1.60219e-19", "boltz", "1.38062e-23", "planck", "6.62620e-34" }; static char *udfs[] = { "max(x,y)", "(x gt y) * x + (x le y) * y", "min(x,y)", "(x lt y) * x + (x ge y) * y", "vdb(x)", "db(v(x))", "vdb(x,y)", "db(v(x) - v(y))", "vi(x)", "im(v(x))", "vi(x,y)", "im(v(x) - v(y))", "vm(x)", "mag(v(x))", "vm(x,y)", "mag(v(x) - v(y))", "vg(x)", "group_delay(v(x))", //A.Rroldan 10/06/05 group delay new function "gd(x)", "group_delay(v(x))", //A.Rroldan 10/06/05 group delay new function "vp(x)", "ph(v(x))", "vp(x,y)", "ph(v(x) - v(y))", "vr(x)", "re(v(x))", "vr(x,y)", "re(v(x) - v(y))" }; /* if TIOCSTI is defined (not available in MS Windows: Make escape the break character. So the user can type ahead... fcn defined in complete.c. */ cp_ccon(TRUE); /* Initialize io, cp_chars[], variable "history" in init.c. */ cp_init(); /* If command completion is available (global variable cp_nocc set in main.c by command line option -q) */ if (!cp_nocc) { /* Add commands... */ for (c = cp_coms; c->co_func; c++) { if (c->co_spiceonly && ft_nutmeg) continue; cp_addcomm(c->co_comname, c->co_cctypes[0], c->co_cctypes[1], c->co_cctypes[2], c->co_cctypes[3]); cp_addkword(CT_COMMANDS, c->co_comname); } /* And keywords... These are the ones that are constant... */ if (!ft_nutmeg) { cp_addkword(CT_LISTINGARGS, "deck"); cp_addkword(CT_LISTINGARGS, "logical"); cp_addkword(CT_LISTINGARGS, "physical"); cp_addkword(CT_LISTINGARGS, "expand"); cp_addkword(CT_STOPARGS, "when"); cp_addkword(CT_STOPARGS, "after"); } cp_addkword(CT_PLOT, "new"); cp_addkword(CT_PLOTKEYWORDS, "xlimit"); cp_addkword(CT_PLOTKEYWORDS, "ylimit"); cp_addkword(CT_PLOTKEYWORDS, "vs"); cp_addkword(CT_PLOTKEYWORDS, "xindices"); cp_addkword(CT_PLOTKEYWORDS, "xcompress"); cp_addkword(CT_PLOTKEYWORDS, "xdelta"); cp_addkword(CT_PLOTKEYWORDS, "ydelta"); cp_addkword(CT_PLOTKEYWORDS, "lingrid"); cp_addkword(CT_PLOTKEYWORDS, "loglog"); cp_addkword(CT_PLOTKEYWORDS, "linear"); cp_addkword(CT_PLOTKEYWORDS, "xlog"); cp_addkword(CT_PLOTKEYWORDS, "ylog"); cp_addkword(CT_PLOTKEYWORDS, "polar"); cp_addkword(CT_PLOTKEYWORDS, "smith"); cp_addkword(CT_PLOTKEYWORDS, "smithgrid"); cp_addkword(CT_PLOTKEYWORDS, "nointerp"); cp_addkword(CT_PLOTKEYWORDS, "title"); cp_addkword(CT_PLOTKEYWORDS, "xlabel"); cp_addkword(CT_PLOTKEYWORDS, "ylabel"); cp_addkword(CT_PLOTKEYWORDS, "linplot"); cp_addkword(CT_PLOTKEYWORDS, "combplot"); cp_addkword(CT_PLOTKEYWORDS, "pointplot"); cp_addkword(CT_RUSEARGS, "time"); cp_addkword(CT_RUSEARGS, "space"); cp_addkword(CT_RUSEARGS, "faults"); cp_addkword(CT_RUSEARGS, "elapsed"); cp_addkword(CT_RUSEARGS, "totiter"); cp_addkword(CT_RUSEARGS, "traniter"); cp_addkword(CT_RUSEARGS, "tranpoints"); cp_addkword(CT_RUSEARGS, "accept"); cp_addkword(CT_RUSEARGS, "rejected"); cp_addkword(CT_RUSEARGS, "time"); cp_addkword(CT_RUSEARGS, "trantime"); cp_addkword(CT_RUSEARGS, "lutime"); cp_addkword(CT_RUSEARGS, "solvetime"); cp_addkword(CT_RUSEARGS, "transolvetime"); cp_addkword(CT_RUSEARGS, "loadtime"); cp_addkword(CT_RUSEARGS, "all"); cp_addkword(CT_VECTOR, "all"); for (x = ft_setkwords; *x; x++) cp_addkword(CT_VARIABLES, *x); for (i = 0; ; i++) { if ((s = ft_typenames(i)) == NULL) break; cp_addkword(CT_TYPENAMES, s); } } cp_vset("program", CP_STRING, cp_program); /* Make the prompt use only the last component of the path... */ if (DIR_TERM) { for (s = cp_program; s && *s; s++) ; s--; while ((s > cp_program) && (*s != DIR_TERM)) s--; if (*s == DIR_TERM) s++; (void) strcpy(buf, s); for (s = buf; *s && (*s != '.'); s++) ; *s = '\0'; (void) strcat(buf, " ! -> "); } else { (void) sprintf(buf, "%s ! -> ", cp_program); } cp_vset("prompt", CP_STRING, buf); cp_vset("noglob", CP_BOOL, &t); cp_vset("brief", CP_BOOL, &t); /* Make vectors from values in predefs[] for the current plot. Define functions from entries in udfs[] (like user defined functions). */ { wordlist wl1, wl2, wl3; wl1.wl_next = &wl2; wl1.wl_prev = NULL; wl2.wl_next = NULL; wl2.wl_prev = &wl1; wl1.wl_word = "if"; wl2.wl_word = "1"; cp_setalias("begin", &wl1); wl1.wl_next = NULL; wl1.wl_word = "end"; cp_setalias("endif", &wl1); cp_setalias("endwhile", &wl1); cp_setalias("endforeach", &wl1); cp_setalias("endrepeat", &wl1); cp_setalias("enddowhile", &wl1); wl1.wl_word = "help"; cp_setalias("?", &wl1); wl1.wl_next = &wl2; wl2.wl_next = &wl3; wl2.wl_prev = &wl1; wl3.wl_prev = &wl2; wl3.wl_next = NULL; wl2.wl_word = "="; for (i = 0; (size_t) i < NUMELEMS(predefs); i += 2) { wl1.wl_word = predefs[i]; wl3.wl_word = predefs[i + 1]; com_let(&wl1); } wl2.wl_next = NULL; for (i = 0; (size_t) i < NUMELEMS(udfs); i += 2) { wl1.wl_word = udfs[i]; wl2.wl_word = udfs[i + 1]; com_define(&wl1); } } /* Reset this for the front end. */ cp_hash = '*'; /* NGSPICEDATADIR has been set to path "$dprefix/share/ngspice" in configure.ac, Spice_Lib_Dir has been set to NGSPICEDATADIR in conf.c, may be overridden by environmental variable SPICE_LIB_DIR in ivars(). Lib_Path has been set to Spice_Lib_Dir adding /scripts in ivars() */ if (Lib_Path && *Lib_Path) { /* set variable 'sourcepath' */ if (Inp_Path && *Inp_Path) (void) sprintf(buf, "sourcepath = ( %s %s %s )", DIR_CWD, Lib_Path, Inp_Path); else (void) sprintf(buf, "sourcepath = ( %s %s )", DIR_CWD, Lib_Path); { wordlist *wl; wl = cp_doglob(cp_lexer(buf)); cp_striplist(wl); com_set(wl); wl_free(wl); } /* Now source the standard startup file spinit or tclspinit. */ /* jump over leading spaces */ for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) { while (isspace(*s)) s++; /* copy s into buf until space is seen, r is the actual position */ for (r = buf; *s && !isspace(*s); r++, s++) *r = *s; tfree(copys); /* add a path separator to buf at actual position */ (void) strcpy(r, DIR_PATHSEP); #ifdef TCL_MODULE /* add "tclspinit" to buf after actual position */ (void) strcat(r, "tclspinit"); #else /* add "spinit" to buf after actual position */ (void) strcat(r, "spinit"); #endif if ((fp = fopen(buf, "r")) != NULL) { cp_interactive = FALSE; inp_spsource(fp, TRUE, buf, FALSE); cp_interactive = TRUE; found = TRUE; break; #if defined(HAS_WINGUI) || defined(__MINGW32__) || defined(_MSC_VER) /* search in local directory where ngspice.exe resides */ #if defined TCL_MODULE } else if ((fp = fopen("./tclspinit", "r")) != NULL) { #else } else if ((fp = fopen("./spinit", "r")) != NULL) { #endif cp_interactive = FALSE; inp_spsource(fp, TRUE, buf, FALSE); cp_interactive = TRUE; found = TRUE; break; #endif } else if (ft_controldb) { fprintf(cp_err, "Note: can't open \"%s\".\n", buf); } } if (!found) fprintf(cp_err, "Note: can't find init file.\n"); } tcap_init(); }
int ft_cktcoms(bool terse) { wordlist *coms, *command, all; char *plottype, *s; struct dvec *v; static wordlist twl = { "col", NULL, NULL }; struct plot *pl; int i, found; char numbuf[BSIZE_SP]; /* For printnum*/ all.wl_next = NULL; all.wl_word = "all"; if (!ft_curckt) return 1; plot_cur = setcplot("op"); if (!ft_curckt->ci_commands && !plot_cur) goto nocmds; coms = ft_curckt->ci_commands; cp_interactive = FALSE; /* Listing */ if (ft_listprint) { if (terse) fprintf(cp_err, ".options: no listing, rawfile was generated.\n"); else inp_list(cp_out, ft_curckt->ci_deck, ft_curckt->ci_options, LS_DECK); } /* If there was a .op line, then we have to do the .op output. */ plot_cur = setcplot("op"); if (plot_cur != NULL) { assert(plot_cur->pl_dvecs != NULL); if (plot_cur->pl_dvecs->v_realdata != NULL) { if (terse) { fprintf(cp_out, "OP information in rawfile.\n"); } else { fprintf(cp_out, "\t%-30s%15s\n", "Node", "Voltage"); fprintf(cp_out, "\t%-30s%15s\n", "----", "-------"); fprintf(cp_out, "\t----\t-------\n"); for (v = plot_cur->pl_dvecs; v; v = v->v_next) { if (!isreal(v)) { fprintf(cp_err, "Internal error: op vector %s not real\n", v->v_name); continue; } if ((v->v_type == SV_VOLTAGE) && (*(v->v_name) != '@')) { printnum(numbuf, v->v_realdata[0]); fprintf(cp_out, "\t%-30s%15s\n", v->v_name, numbuf); } } fprintf(cp_out, "\n\tSource\tCurrent\n"); fprintf(cp_out, "\t------\t-------\n\n"); for (v = plot_cur->pl_dvecs; v; v = v->v_next) if (v->v_type == SV_CURRENT) { printnum(numbuf, v->v_realdata[0]); fprintf(cp_out, "\t%-30s%15s\n", v->v_name, numbuf); } fprintf(cp_out, "\n"); if (!ft_nomod) com_showmod(&all); com_show(&all); } } } for (pl = plot_list; pl; pl = pl->pl_next) if (ciprefix("tf", pl->pl_typename)) { if (terse) { fprintf(cp_out, "TF information in rawfile.\n"); break; } plot_cur = pl; fprintf(cp_out, "Transfer function information:\n"); com_print(&all); fprintf(cp_out, "\n"); } /* Now all the '.' lines */ while (coms) { command = cp_lexer(coms->wl_word); if (!command) goto bad; if (eq(command->wl_word, ".width")) { do command = command->wl_next; while (command && !ciprefix("out", command->wl_word)); if (command) { s = strchr(command->wl_word, '='); if (!s || !s[1]) { fprintf(cp_err, "Error: bad line %s\n", coms->wl_word); coms = coms->wl_next; continue; } i = atoi(++s); cp_vset("width", CP_NUM, &i); } } else if (eq(command->wl_word, ".print")) { if (terse) { fprintf(cp_out, ".print line ignored since rawfile was produced.\n"); } else { command = command->wl_next; if (!command) { fprintf(cp_err, "Error: bad line %s\n", coms->wl_word); coms = coms->wl_next; continue; } plottype = command->wl_word; command = command->wl_next; fixdotprint(command); twl.wl_next = command; found = 0; for (pl = plot_list; pl; pl = pl->pl_next) if (ciprefix(plottype, pl->pl_typename)) { plot_cur = pl; com_print(&twl); fprintf(cp_out, "\n"); found = 1; } if (!found) fprintf(cp_err, "Error: .print: no %s analysis found.\n", plottype); } } else if (eq(command->wl_word, ".plot")) { if (terse) { fprintf(cp_out, ".plot line ignored since rawfile was produced.\n"); } else { command = command->wl_next; if (!command) { fprintf(cp_err, "Error: bad line %s\n", coms->wl_word); coms = coms->wl_next; continue; } plottype = command->wl_word; command = command->wl_next; fixdotplot(command); found = 0; for (pl = plot_list; pl; pl = pl->pl_next) if (ciprefix(plottype, pl->pl_typename)) { plot_cur = pl; com_asciiplot(command); fprintf(cp_out, "\n"); found = 1; } if (!found) fprintf(cp_err, "Error: .plot: no %s analysis found.\n", plottype); } } else if (ciprefix(".four", command->wl_word)) { if (terse) { fprintf(cp_out, ".fourier line ignored since rawfile was produced.\n"); } else { int err; plot_cur = setcplot("tran"); err = fourier(command->wl_next, plot_cur); if (!err) fprintf(cp_out, "\n\n"); else fprintf(cp_err, "No transient data available for " "fourier analysis"); } } else if (!eq(command->wl_word, ".save") && !eq(command->wl_word, ".op") && // !eq(command->wl_word, ".measure") && !ciprefix(".meas", command->wl_word) && !eq(command->wl_word, ".tf")) { goto bad; } coms = coms->wl_next; } nocmds: /* Now the node table if (ft_nodesprint) ; */ /* The options */ if (ft_optsprint) { fprintf(cp_out, "Options:\n\n"); cp_vprint(); (void) putc('\n', cp_out); } /* And finally the accounting info. */ if (ft_acctprint) { static wordlist ww = { "everything", NULL, NULL }; com_rusage(&ww); } else if ((!ft_noacctprint) && (!ft_acctprint)) { com_rusage(NULL); } /* absolutely no accounting if noacct is given */ putc('\n', cp_out); return 0; bad: fprintf(cp_err, "Internal Error: ft_cktcoms: bad commands\n"); return 1; }
/* Execute a block. There can be a number of return values from this routine. * NORMAL indicates a normal termination * BROKEN indicates a break -- if the caller is a breakable loop, * terminate it, otherwise pass the break upwards * CONTINUED indicates a continue -- if the caller is a continuable loop, * continue, else pass the continue upwards * Any other return code is considered a pointer to a string which is * a label somewhere -- if this label is present in the block, * goto it, otherwise pass it up. Note that this prevents jumping * into a loop, which is good. * * Note that here is where we expand variables, ``, and globs for * controls. * * The 'num' argument is used by break n and continue n. */ static char * doblock(struct control *bl, int *num) { struct control *ch, *cn = NULL; wordlist *wl, *wltmp; char *i, *wlword; int nn; nn = *num + 1; /*CDHW this is a guess... CDHW*/ switch (bl->co_type) { case CO_WHILE: if (!bl->co_children) { fprintf(cp_err, "Warning: Executing empty 'while' block.\n"); fprintf(cp_err, " (Use a label statement as a no-op to suppress this warning.)\n"); } while (bl->co_cond && cp_istrue(bl->co_cond)) { if (!bl->co_children) cp_periodic(); /*CDHW*/ for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); switch (*i) { case NORMAL: break; case BROKEN: /* Break. */ if (nn < 2) { return (NORMAL_STR); } else { *num = nn - 1; return (BROKEN_STR); } case CONTINUED: /* Continue. */ if (nn < 2) { cn = NULL; break; } else { *num = nn - 1; return (CONTINUED_STR); } default: cn = findlabel(i, bl->co_children); if (!cn) return (i); } } } break; case CO_DOWHILE: do { for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); switch (*i) { case NORMAL: break; case BROKEN: /* Break. */ if (nn < 2) { return (NORMAL_STR); } else { *num = nn - 1; return (BROKEN_STR); } case CONTINUED: /* Continue. */ if (nn < 2) { cn = NULL; break; } else { *num = nn - 1; return (CONTINUED_STR); } default: cn = findlabel(i, bl->co_children); if (!cn) return (i); } } } while (bl->co_cond && cp_istrue(bl->co_cond)); break; case CO_REPEAT: if (!bl->co_children) { fprintf(cp_err, "Warning: Executing empty 'repeat' block.\n"); fprintf(cp_err, " (Use a label statement as a no-op to suppress this warning.)\n"); } if (!bl->co_timestodo) bl->co_timestodo = bl->co_numtimes; /*bl->co_numtimes: total repeat count bl->co_numtimes = -1: repeat forever bl->co_timestodo: remaining repeats*/ while ((bl->co_timestodo > 0) || (bl->co_timestodo == -1)) { if (!bl->co_children) cp_periodic(); /*CDHW*/ if (bl->co_timestodo != -1) bl->co_timestodo--; /* loop through all stements inside rpeat ... end */ for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); switch (*i) { case NORMAL: break; case BROKEN: /* Break. */ /* before leaving repeat loop set remaining timestodo to 0 */ bl->co_timestodo = 0; if (nn < 2) { return (NORMAL_STR); } else { *num = nn - 1; return (BROKEN_STR); } case CONTINUED: /* Continue. */ if (nn < 2) { cn = NULL; break; } else { /* before leaving repeat loop set remaining timestodo to 0 */ bl->co_timestodo = 0; *num = nn - 1; return (CONTINUED_STR); } default: cn = findlabel(i, bl->co_children); if (!cn) { /* no label found inside repeat loop: before leaving loop set remaining timestodo to 0 */ bl->co_timestodo = 0; return (i); } } } } break; case CO_IF: if (bl->co_cond && cp_istrue(bl->co_cond)) { for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); if (*i > 2) { cn = findlabel(i, bl->co_children); if (!cn) return (i); else tfree(i); } else if (*i != NORMAL) { *num = nn; return (i); } } } else { for (ch = bl->co_elseblock; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); if (*i > 2) { cn = findlabel(i, bl->co_elseblock); if (!cn) return (i); } else if (*i != NORMAL) { *num = nn; return (i); } } } break; case CO_FOREACH: wltmp = cp_variablesubst(cp_bquote(cp_doglob(wl_copy(bl->co_text)))); for (wl = wltmp; wl; wl = wl->wl_next) { cp_vset(bl->co_foreachvar, CP_STRING, wl->wl_word); for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); switch (*i) { case NORMAL: break; case BROKEN: /* Break. */ if (nn < 2) { wl_free(wltmp); return (NORMAL_STR); } else { *num = nn - 1; wl_free(wltmp); return (BROKEN_STR); } case CONTINUED: /* Continue. */ if (nn < 2) { cn = NULL; break; } else { *num = nn - 1; wl_free(wltmp); return (CONTINUED_STR); } default: cn = findlabel(i, bl->co_children); if (!cn) { wl_free(wltmp); return (i); } } } } wl_free(wltmp); break; case CO_BREAK: if (bl->co_numtimes > 0) { *num = bl->co_numtimes; return (BROKEN_STR); } else { fprintf(cp_err, "Warning: break %d a no-op\n", bl->co_numtimes); return (NORMAL_STR); } case CO_CONTINUE: if (bl->co_numtimes > 0) { *num = bl->co_numtimes; return (CONTINUED_STR); } else { fprintf(cp_err, "Warning: continue %d a no-op\n", bl->co_numtimes); return (NORMAL_STR); } case CO_GOTO: wl = cp_variablesubst(cp_bquote(cp_doglob(wl_copy(bl->co_text)))); wlword = wl->wl_word; wl->wl_word = NULL; wl_free(wl); return (wlword); case CO_LABEL: /* Do nothing. */ cp_periodic(); /*CDHW needed to avoid lock-ups when loop contains only a label CDHW*/ break; case CO_STATEMENT: docommand(wl_copy(bl->co_text)); break; case CO_UNFILLED: /* There was probably an error here... */ fprintf(cp_err, "Warning: ignoring previous error\n"); break; default: fprintf(cp_err, "doblock: Internal Error: bad block type %d\n", bl->co_type); return (NORMAL_STR); } return (NORMAL_STR); }