objconst_ASL(ASL *asl, int n) #endif { expr_n *e; efunc_n *opnum = f_OPNUM_ASL; static char who[] = "objconst"; if (!asl) badasl_ASL(asl,0,who); else if (asl->i.ASLtype < ASL_read_f || asl->i.ASLtype >ASL_read_pfgh) badasl_ASL(asl,ASL_read_f,who); if (n >= 0 && n < n_obj) { switch(asl->i.ASLtype) { case ASL_read_fgh: e = (expr_n*)(((ASL_fgh*)asl)->I.obj2_de_ + n)->e; break; case ASL_read_pfg: e = (expr_n*)(((ASL_pfg*)asl)->I.obj_de_ + n)->e; opnum = (efunc_n*)f_OPNUM; break; case ASL_read_pfgh: e = (expr_n*)(((ASL_pfgh*)asl)->I.obj2_de_ + n)->e; opnum = (efunc_n*)f_OPNUM; break; default: e = (expr_n*)(((ASL_fg*)asl)->I.obj_de_ + n)->e; } if (e->op == opnum) return e->v; } return 0; }
suf_declare_ASL(ASL *asl, SufDecl *sd, int n) #endif { SufDesc *d, *dnext[4]; SufDecl *sde; int i, j; if (!asl) badasl_ASL(asl, 0, "suf_declare"); asl->i.nsuffixes = 0; if (n > 0) { asl->i.nsuffixes = n; d = (SufDesc*)M1alloc(n*sizeof(SufDesc)); memset(asl->i.nsuff, 0, 4*sizeof(int)); for(i = 0; i < n; i++) asl->i.nsuff[sd[i].kind & ASL_Sufkind_mask]++; for(i = 0; i < 4; i++) if (j = asl->i.nsuff[i]) asl->i.suffixes[i] = d += j; memset(dnext, 0, 4*sizeof(SufDesc*)); for(sde = sd + n; sd < sde; sd++) { d = --asl->i.suffixes[i = sd->kind & ASL_Sufkind_mask]; d->next = dnext[i]; dnext[i] = d; d->sufname = sd->name; d->table = sd->table; d->kind = sd->kind & ~ASL_Sufkind_input; d->nextra = sd->nextra; d->u.i = 0; d->u.r = 0; } } }
wrsolw_(char *msg, fint *nmsg, real *x, real *y, fint *ws, ftnlen msg_len) #endif { char *b, *buf, *me; int i, len, nm; ASL *asl; Option_Info oi; if (!(asl = cur_ASL)) badasl_ASL(asl,0,"wrtsol"); nm = (int)*nmsg; len = nm + 1; me = msg + nm*msg_len; for(b = msg; b < me; b += msg_len) len += slen(b,msg_len); b = buf = (char *)Malloc(len); if (nm) for(;;) { if (i = slen(msg, msg_len)) { strncpy(b, msg, i); b += i; } msg += msg_len; if (msg >= me) break; *b++ = '\n'; } *b = 0; if (!(oi.wantsol = *ws & 7)) oi.wantsol = 1; write_sol_ASL(asl, buf, x, y, &oi); free(buf); }
int getopts_ASL(ASL *asl, char **argv, Option_Info *oi) { char *s; if (!Stderr) Stderr_init_ASL(); if (!(oi->asl = asl)) badasl_ASL(asl,0,"getopts"); if (!oi->option_echo) oi->option_echo = ASL_OI_echo; oi->option_echo &= ASL_OI_echo; oi->n_badopts = 0; if (oi->opname && (s = getenv(oi->opname))) while(*s) s = get_opt_ASL(oi, s); while((s = *argv++)) do s = get_opt_ASL(oi, s); while(*s); need_nl = oi->nnl; if (oi->flags & ASL_OI_show_version) show_version_ASL(oi); fflush(stdout); return oi->n_badopts; }
void hvinit_(fint *nobj, real *ow, real *y) { ASL *a; if (!(a = cur_ASL)) badasl_ASL(a,0,"hvinit"); (*a->p.Hvinit)(a, a->p.ihd_limit_, (int)*nobj, ow, y); }
xknown_(real *x) #endif { ASL *asl; if (!(asl = cur_ASL)) badasl_ASL(asl,0,"xknown"); xknowne(x, (fint*)0); }
xknowe_(real *x, fint *nerror) #endif { ASL *asl; if (!(asl = cur_ASL)) badasl_ASL(asl,0,"xknown"); xknowne(x, nerror); }
void hvcomp_(real *hv, real *p, fint *nobj, real *ow, real *y) { ASL *a; if (!(a = cur_ASL)) badasl_ASL(a,0,"objval"); (*a->p.Hvcomp)(a, hv, p, (int)*nobj, ow, y); }
void xunkno_(VOID) { ASL *asl; if (!(asl = cur_ASL)) badasl_ASL(asl,0,"xunkno"); asl->i.x_known = 0; }
static void ASL_check1(ASL *asl, const char *who) { if (!asl || asl->i.ASLtype < ASL_read_fg || asl->i.ASLtype > ASL_read_pfgh) badasl_ASL(asl, ASL_read_fg, who); }
void objgrd_(fint *N, real *X, fint *NOBJ, real *G, fint *nerror) { ASL *a; static char who[] = "objgrd_"; if (!(a = cur_ASL)) badasl_ASL(a, 0, who); if (a->i.n_var_ != *N) bad_N(a, N, who); (*a->p.Objgrd)(a, (int)*NOBJ, X, G, nerror); }
real objval_(fint *N, real *X, fint *NOBJ, fint *nerror) { ASL *a; static char who[] = "objval_"; if (!(a = cur_ASL)) badasl_ASL(a,0,who); if (a->i.n_var_ != *N) bad_N(a, N, who); return (*a->p.Objval)(a, (int)*NOBJ, X, nerror); }
void conval_(fint *M, fint *N, real *X, real *F, fint *nerror) { ASL *a; static char who[] = "conval_"; if (!(a = cur_ASL)) badasl_ASL(a, 0, who); if (*M != a->i.n_con_ || *N != a->i.n_var_) { what_prog(); fprintf(Stderr, "%s: got M = %ld, N = %ld; expected %d, %d\n", who, *M, *N, a->i.n_con_, a->i.n_var_); exit(1); } (*a->p.Conval)(a, X, F, nerror); }
mnnzchk_ASL(ASL *asl, fint *M, fint *N, fint *NZ, char *who1) #endif { int n; if (!asl || (n = asl->i.ASLtype) < ASL_read_fg || n > ASL_read_pfgh) badasl_ASL(asl, ASL_read_fg, who1); ASL_CHECK(asl, n, who1); if (*M != n_con || *N != c_vars || *NZ != nzjac) { what_prog(); fprintf(Stderr, "%s: got M = %ld, N = %ld, NZ = %ld\nexpected M = %d, N = %d, NZ = %d\n", who1, (long)*M, (long)*N, *NZ, n_con, c_vars, nzjac); exit(1); } }
void varscale_ASL(ASL *asl, int i, real s, fint *ierror) { static char who[] = "varscale"; if (!asl || asl->i.ASLtype < ASL_read_fg || asl->i.ASLtype > ASL_read_pfgh) badasl_ASL(asl, ASL_read_fg, who); if (zcheck(asl, i, s, n_var, ierror, who)) return; if (!asl->i.vscale) asl->i.vscale = ones(asl, n_var); scaleadj(s, i, 0, asl->i.vscale, LUv, Uvx, X0); }
char * getstops_ASL(ASL *asl, char **argv, Option_Info *oi) { char *s; if (!asl) badasl_ASL(asl,0,"getstops"); if (!(s = getstub_ASL(asl, &argv, oi))) { fprintf(Stderr, "No stub!\n"); usage_ASL(oi,1); } if (getopts_ASL(asl,argv,oi)) exit(1); return s; }
static ASL * NI_check(fint *I, fint *N, const char *who) { ASL *asl; fint i, m; if (!(asl = cur_ASL)) badasl_ASL(asl,0,who); if (*N != n_var) bad_N(asl, N, who); i = *I; m = n_con; if (i < 1 || i > m) { what_prog(); fprintf(Stderr, "%s: got I = %ld; expected 1 <= I <= %ld\n", who, (long)i, (long)m); exit(1); } return asl; }
void mnnzchk_ASL(ASL *asl, fint *M, fint *N, size_t NZ, const char *who1) { int n; if (!asl) goto bad; n = asl->i.ASLtype; if (n < ASL_read_fg || n > ASL_read_pfgh) goto bad; ASL_CHECK(asl, n, who1); if (*M == n_con && *N == c_vars && NZ == nzjac) return; what_prog(); fprintf(Stderr, "%s: got M = %ld, N = %ld, NZ = %ld\nexpected M = %d, N = %d, NZ = %d\n", who1, (long)*M, (long)*N, NZ, n_con, c_vars, nzjac); exit(1); bad: badasl_ASL(asl, ASL_read_fg, who1); }
void conscale_ASL(ASL *asl, int i, real s, fint *ierror) { static char who[] = "conscale"; if (!asl || asl->i.ASLtype < ASL_read_fg || asl->i.ASLtype > ASL_read_pfgh) badasl_ASL(asl, ASL_read_fg, who); if (zcheck(asl, i, s, n_con, ierror, who)) return; if (s == 1.) return; if (!asl->i.cscale) asl->i.cscale = ones(asl, n_con); if (!asl->i.lscale) asl->i.lscale = asl->i.cscale; scaleadj(s, i, 1, asl->i.cscale, LUrhs, Urhsx, pi0); if (asl->i.lscale != asl->i.cscale) asl->i.lscale[i] *= s; }
suf_get_ASL(ASL *asl, const char *name, int kind) #endif { SufDesc *d, *de; int ifread; if (!asl) badasl_ASL(asl, 0, "suf_get"); ifread = kind & ASL_Sufkind_input; d = asl->i.suffixes[kind &= ASL_Sufkind_mask]; de = d + asl->i.nsuff[kind]; for(;; d++) { if (d >= de) { fprintf(Stderr, "suf_get(\"%s\") fails!\n", name); exit(1); } if (!strcmp(name, d->sufname)) break; } if (ifread && !(d->kind & ASL_Sufkind_input)) d = 0; return d; }
void lagscale_ASL(ASL *asl, real s, fint *ierror) { static char who[] = "lagscale"; real *c, *l, *le; size_t L; if (!asl || (asl->i.ASLtype != ASL_read_pfgh && asl->i.ASLtype != ASL_read_fgh)) badasl_ASL(asl, ASL_read_pfgh, who); if (zcheck(asl, 0, s, -1, ierror, who)) return; if (s == 1.) return; if (!asl->i.lscale) asl->i.lscale = ones(asl, n_con); else if (asl->i.lscale == asl->i.cscale) { L = n_con*sizeof(real); memcpy(asl->i.lscale = (real*)mem_ASL(asl,L), asl->i.cscale, L); } l = asl->i.lscale; le = l + n_con; if ((c = asl->i.cscale)) { while(l < le) *l++ = s * *c++; } else while(l < le) *l++ *= s; if ((c = pi0)) { le = c + n_con; s = 1. / s; while(c < le) *c++ *= s; } }
char * read_sol_ASL(ASL *asl, real **xp, real **yp) { int binary, flag1, i, j, je, n, need_vbtol; FILE *f; char buf[512], *s, *se; real vbtol, *y; ftnlen L, L1, L2; fint Objno[2], Options[14], nOpts, *z; msginfo mi; if (!asl || asl->i.ASLtype < 1 || asl->i.ASLtype > 5) badasl_ASL(asl,0,"read_soln"); strcpy(stub_end, ".sol"); f = fopen(filename, "rb"); if (!f) { fprintf(Stderr, "Can't open %s\n", filename); fflush(Stderr); return 0; } if (fread(&L, sizeof(ftnlen), 1, f) && L == 6) { /* binary files may be written by Fortran unformatted writes */ binary = 1; if (!fread(buf, 6, 1, f) || strncmp(buf,"binary",6) || !fread(&L, sizeof(ftnlen), 1, f) || L != 6) { badbinary: fprintf(Stderr, "bad binary file %s\n", filename); fflush(Stderr); goto done; } } else { binary = 0; rewind(f); } L1 = 0; z = 0; /* Read termination msg */ nOpts = i = need_vbtol = 0; mi.msg = mi.msg0 = (char *)Malloc(mi.msglen = MSGGULP); mi.msgend = mi.msg0 + MSGGULP; if (binary) { for(;; i++) { if (!fread(&L,sizeof(ftnlen),1,f)) goto early_eof; if ((L1 = L)) { do { n = L < sizeof(buf) ? (int)L : (int)sizeof(buf); L -= n; if (!fread(buf, n, 1, f)) goto early_eof; if (!L) { while(--n >= 0 && buf[n] == ' '); n++; } msgput(&mi, buf, n); } while(L); msgput(&mi, "\n", 1); } if (!fread(&L, sizeof(ftnlen), 1, f)) goto early_eof; if (L != L1) goto badbinary; if (!L) break; } L1 = n_con * sizeof(real); if (!fread(&L, sizeof(ftnlen), 1, f)) goto badbinary; if (L >= 3*sizeof(fint) + 7) { /* check for Options */ if (!fread(buf, 7, 1, f)) goto badbinary; if (strncmp(buf, "Options", 7)) goto badbinary; if (!fread(&Options, sizeof(fint), 3, f)) goto badbinary; nOpts = Options[0]; if (nOpts < 3 || nOpts > 9) { bad_nOpts: fprintf(Stderr, "expected nOpts between 3 and 9; got %ld: ", (long)nOpts); goto badbinary; } if (Options[2] == 3) { nOpts -= 2; need_vbtol = 1; } L2 = (nOpts + 5)*sizeof(fint) + 7; if (need_vbtol) L2 += sizeof(real); if (L != L2) goto badbinary; if (!fread(Options+3, sizeof(fint), nOpts + 2, f)) goto badbinary; if (need_vbtol && !fread(&vbtol, sizeof(real), 1, f)) goto badbinary; if (!fread(&L2, sizeof(ftnlen), 1, f) || L != L2) goto badbinary; } else if (L != L1) goto badbinary; } else { for(;; i++) { if (!fgets(buf, sizeof(buf), f)) { early_eof: fprintf(Stderr, "early end of file reading %s\n", filename); fflush(Stderr); done: fclose(f); return 0; } if (*buf == '\n' || (*buf == '\r' && buf[1] == '\n')) break; msgput(&mi, buf, strlen(buf)); } while((j = getc(f)) == '\n'); if (j != 'O') ungetc(j,f); else { if (!fgets(buf, sizeof(buf), f)) goto early_eof; if (!strncmp(buf, "ptions", 6)) { for(j = 0; j <3; j++) { if (!fgets(buf, sizeof(buf), f)) goto early_eof; Options[j] = strtol(buf,&se,10); if (se == buf) goto badline; } nOpts = Options[0]; if (nOpts < 3 || nOpts > 9) goto bad_nOpts; if (Options[2] == 3) { nOpts -= 2; need_vbtol = 1; } je = (int)nOpts + 4; for(j = 3; j <= je; j++) { if (!fgets(buf, sizeof(buf), f)) goto early_eof; Options[j] = strtol(buf,&se,10); if (se == buf) goto badline; } if (need_vbtol && !fgets(buf, sizeof(buf), f)) goto early_eof; /* We don't do anything here with vbtol, */ /* so we don't bother converting it. */ } } } memcpy(ampl_options, Options, (nOpts+1)*sizeof(fint)); msgput(&mi, "", 1); /* add null to end */ if (i) fflush(stdout); if (nOpts) { z = Options + nOpts + 1; j = (int)z[3]; if (j > n_var || j < 0) { badnumber(asl, j, n_var, "variables"); goto done; } j = (int)z[1]; if (j > n_con || j < 0) { badnumber(asl, j, n_con, "constraints"); goto done; } if (binary) { L1 = j * sizeof(real); if (!fread(&L, sizeof(ftnlen), 1, f)) goto badbinary; if (L != L1) goto badbinary; } } else j = n_con; if (!j) { *yp = 0; goto get_x; } y = *yp = (real *)Malloc(n_con * sizeof(real)); if (binary) { if (fread(y, sizeof(real), j, f) != j) goto early_eof; if (!fread(&L, sizeof(ftnlen), 1, f) || L != L1) goto badbinary; y += j; } else for(i = 0; i < j; i++) { if (!fgets(buf, sizeof(buf), f)) goto early_eof; if (!decstring(buf, y++)) continue; badline: fprintf(Stderr, "bad line in %s: %s", filename, buf); fflush(Stderr); goto done; } y = *yp; while(j < n_con) y[j++] = 0; get_x: Objno[0] = 0; Objno[1] = -1; flag1 = asl->i.flags & ~1;; if (!(j = nOpts ? (int)z[3] : n_var)) { *xp = 0; goto ret; } y = *xp = (real *)Malloc(n_var*sizeof(real)); if (binary) { L1 = j * sizeof(real); if (!fread(&L, sizeof(ftnlen), 1, f) || L != L1) goto badbinary; if (fread(y, sizeof(real), j, f) != j) goto early_eof; y += j; /* do we have an obj_no ? */ if (!fread(&L, sizeof(ftnlen), 1, f) || L != L1) goto badbinary; if (fread(&L, sizeof(ftnlen), 1, f)) { i = 1; if (L == 2*sizeof(fint)) { i = 2; flag1 |= 1; } else if (L != sizeof(fint)) goto badbinary; if (!fread(Objno, i*sizeof(fint), 1, f)) goto badbinary; } } else { for(i = j; i > 0; i--) { if (!fgets(buf, sizeof(buf), f)) goto early_eof; if (decstring(buf, y++)) goto badline; } if (fgets(buf,sizeof(buf), f)) { if (strncmp(buf,"objno ",6)) { extra_line: fprintf(Stderr, "Bug: extra line in %s:\n%s", filename, buf); fflush(Stderr); } else { Objno[0] = strtol(buf+6, &se, 10); if (se == buf+6 || *se > ' ') goto extra_line; if (*se == ' ') { Objno[1] = strtol(se,&s,10); if (s == se || *s > ' ') goto extra_line; flag1 |= 1; } } } } asl->i.flags = flag1; obj_no = (int)Objno[0]; solve_result_num = (int)Objno[1]; y = *xp; while(j < n_var) y[j++] = 0; ret: fclose(f); return (char*)Realloc(mi.msg0, mi.msglen); }
jac0dim_ASL(ASL *asl, char *stub, ftnlen stub_len) #endif { FILE *nl; int i, k, nlv; char *s, *se; const char *opfmt; EdRead ER, *R; if (!asl) badasl_ASL(asl,0,"jac0dim"); fpinit_ASL(); /* get IEEE arithmetic, if possible */ if (stub_len <= 0) for(i = 0; stub[i]; i++); else for(i = stub_len; stub[i-1] == ' ' && i > 0; --i); filename = (char *)M1alloc(i + 5); s = stub_end = filename + i; strncpy(filename, stub, i); strcpy(s, ".nl"); nl = fopen(filename, "rb"); if (!nl && i > 3 && !strncmp(s-3, ".nl", 3)) { *s = 0; stub_end = s - 3; nl = fopen(filename, "rb"); } if (!nl) { if (return_nofile) return 0; fflush(stdout); what_prog(); fprintf(Stderr, "can't open %s\n", filename); exit(1); } R = EdReadInit_ASL(&ER, asl, nl, 0); R->Line = 0; s = read_line(R); binary_nl = 0; opfmt = "%d"; switch(*s) { #ifdef DEPRECATED case 'E': /* deprecated "-oe" format */ {int ncsi = 0; k = Sscanf(s, "E%d %d %d %d %d %d", &n_var, &n_con, &n_obj, &maxrownamelen, &maxcolnamelen, &ncsi); if (k < 5) badints(R, k, 5); if (ncsi) { if (ncsi != 6) { badread(R); fprintf(Stderr, "expected 6th integer to be 0 or 6, not %d\n", ncsi); exit(1); } s = read_line(R); k = Sscanf(s, " %d %d %d %d %d %d", &comb, &comc, &como, &comc1, &como1, &nfunc); if (k != 6) badints(R, k, 6); } } break; #endif case 'z': case 'Z': opfmt = "%hd"; case 'B': case 'b': binary_nl = 1; xscanf = bscanf; goto have_xscanf; case 'h': case 'H': opfmt = "%hd"; binary_nl = 1; xscanf = hscanf; goto have_xscanf; case 'G': case 'g': xscanf = ascanf; have_xscanf: if ((k = ampl_options[0] = strtol(++s, &se, 10))) { if (k > 9) { fprintf(Stderr, "ampl_options = %d is too large\n", k); exit(1); } for(i = 1; i <= k && se > s; i++) ampl_options[i] = strtol(s = se,&se,10); if (ampl_options[2] == 3) ampl_vbtol = strtod(s = se, &se); } s = read_line(R); n_eqn = -1; k = Sscanf(s, " %d %d %d %d %d %d", &n_var, &n_con, &n_obj, &nranges, &n_eqn, &n_lcon); if (k < 3) badints(R,k,3); nclcon = n_con + n_lcon; /* formerly read2(R, &nlc, &nlo); */ s = read_line(R); n_cc = nlcc = ndcc = nzlb = 0; k = Sscanf(s, " %d %d %d %d %d %d", &nlc, &nlo, &n_cc, &nlcc, &ndcc, &nzlb); if (k < 2) badints(R,k,2); if ((n_cc += nlcc) > 0 && k < 6) ndcc = -1; /* indicate unknown */ read2(R, &nlnc, &lnc); nlvb = -1; s = read_line(R); k = Sscanf(s, " %d %d %d", &nlvc, &nlvo, &nlvb); if (k < 2) badints(R,k,2); /* read2(R, &nwv, &nfunc); */ s = read_line(R); asl->i.flags = 0; k = Sscanf(s, " %d %d %d %d", &nwv, &nfunc, &i, &asl->i.flags); if (k < 2) badints(R,k,2); else if (k >= 3 && i != Arith_Kind_ASL && i) { #ifdef Want_bswap if (i > 0 && i + Arith_Kind_ASL == 3) { asl->i.iadjfcn = asl->i.dadjfcn = bswap_ASL; binary_nl = i << 1; } else #endif badfmt(R); } if (nlvb < 0) /* ampl versions < 19930630 */ read2(R, &nbv, &niv); else { s = read_line(R); k = Sscanf(s, " %d %d %d %d %d", &nbv, &niv, &nlvbi, &nlvci, &nlvoi); if (k != 5) badints(R,k,5); } /* formerly read2(R, &nzc, &nzo); */ s = read_line(R); k = Sscanf(s, " %D %D", &nZc, &nZo); if (k != 2) badints(R, k, 2); nzc = nZc; nzo = nZo; read2(R, &maxrownamelen, &maxcolnamelen); s = read_line(R); k = Sscanf(s, " %d %d %d %d %d", &comb, &comc, &como, &comc1, &como1); if (k != 5) badints(R,k,5); } student_check_ASL(asl); if (n_con < 0 || n_var <= 0 || n_obj < 0) { what_prog(); fprintf(Stderr, "jacdim: got M = %d, N = %d, NO = %d\n", n_con, n_var, n_obj); exit(1); } asl->i.opfmt = opfmt; asl->i.n_var0 = asl->i.n_var1 = n_var; asl->i.n_con0 = asl->i.n_con1 = n_con; if ((nlv = nlvc) < nlvo) nlv = nlvo; if (nlv <= 0) nlv = 1; x0len = nlv * sizeof(real); x0kind = ASL_first_x; n_conjac[0] = 0; n_conjac[1] = n_con; c_vars = o_vars = n_var; /* confusion arises otherwise */ return nl; }
char * getstub_ASL(ASL *asl, char ***pargv, Option_Info *oi) { char *s, *s1; keyword *kw, *okw; int i, options; char **argv = *pargv; progname = *argv; if (!Stderr) Stderr_init_ASL(); /* set Stderr if necessary */ if (!asl) badasl_ASL(asl,0,"getstub"); amplflag = 0; options = 1; okw = 0; if (oi) { oi->nnl = 0; oi->asl = asl; okw = oi->options; if ((s = getenv("solver_msg"))) { i = (int)strtol(s, &s1, 10); if (s1 > s && !*s1 && i >= 0 && !(i & 1)) oi->option_echo = ASL_OI_never_echo; } oi->option_echo = (oi->option_echo & ASL_OI_never_echo) ? ASL_OI_never_echo : ASL_OI_clopt | ASL_OI_echo; oi->n_badopts = 0; } while((s = *++argv)) { if (*s == '-' && options) { s1 = s + 1; if (okw && (kw = (keyword*)b_search_ASL(okw, (int)sizeof(keyword), oi->n_options, &s1, &oi->eqsign))) { if (!*s1 && argv[1]) { s = (*kw->kf)(oi, kw, argv[1]); if (s != argv[1]) argv++; continue; } (*kw->kf)(oi, kw, s1); continue; } if (!s1[1]) switch(*s1) { case '=': shownames(oi); case '?': usage_ASL(oi,0); case '-': options = 0; continue; #ifdef SYMANTEC case 'E': _8087 = 0; continue; #endif case 'e': if (oi) oi->option_echo &= ~ASL_OI_echo; continue; case 's': if (oi) oi->wantsol = 1; continue; case 'u': if (!oi || !(oi->flags && ASL_OI_want_funcadd)) break; func_add(asl); show_funcs(); exit(0); case 'v': if (oi) Ver_val_ASL(oi,0,0); continue; case 'i': if (ix_details_ASL[0]) { if ((s = argv[1])) { argv++; if (*s == '?' && !s[1]) ix_usage(); i_option_ASL = s; } continue; } } if (*s1 == 'i' && ix_details_ASL[0]) { if (s1[1] == '?' && !s1[2]) ix_usage(); i_option_ASL = s1 + 1; continue; } if (*s1 == '-') { if (!strcmp(++s1, "help")) { if (oi) usage_ASL(oi,0); } else if (!strcmp(s1, "version")) { if (oi) { Ver_val_ASL(oi,0,0); continue; } } } fprintf(Stderr, "%s: bad option %s\n", progname, s); usage_ASL(oi,1); } if (strchr(s,'=')) break; if ((s1 = *++argv) && !strncmp(s1,"-AMPL",5)) { amplflag = 1; argv++; if (oi && oi->bsname && !(oi->option_echo & ASL_OI_never_echo)) need_nl = oi->nnl = printf("%s: ", oi->bsname); } i = strlen(s) - 3; if (i > 0 && !strcmp(s+i,".nl")) s[i] = 0; break; } if (oi && oi->n_badopts) /* possiby set by kw->kf */ exit(1); *pargv = argv; return s; }