bool redis_string::setex(const char* key, const char* value, int timeout) { return setex(key, strlen(key), value, strlen(value), timeout); }
command() { double tval; int i,echeck; int pmin,pmax,pstep; while (echeck = getstring(": ")) { if (echeck == EOF) { fileinput(EOF); } else if (in[0] == '\0') { errprint(""); } else if (startsame(in,"cycle")) { cycle(); } else if (startsame(in,"clear")) { clear(); } else if (startsame(in,"coarticulation")) { getint(&coartflag); } else if (startsame(in,"rc")) { zarrays(); cycle(); } else if (startsame(in,"wordacts")) { scr_words(printmin,printmax,3,0,"MAX"); } else if (startsame(in,"wtacts")) { scr_words(printmin,printmax,3,0,"ALL"); } else if (startsame(in,"owtacts")) { getstring("word: "); scr_words(printmin,printmax,3,0,in); } else if (startsame(in,"phonacts")) { scr_phonemes(printmin,printmax,3,0); } else if (startsame(in,"featacts")) { scr_features(); } else if (startsame(in,"sfeatacts")) { getstring("fname: "); sfeatacts(in); } else if (startsame(in,"memo")) { getstring("string: "); strcpy(memo,in); } else if (startsame(in,"expr")) { setex(); } else if (startsame(in,"fcopt")) { getint(&fcflag); } else if (startsame(in,"fpcyc")) { getint(&fpcyc); } else if (startsame(in,"finput")) { fileinput(NONSTD); } else if (startsame(in,"inoise")) { getval(&inoise); } else if (startsame(in,"inspecs")) { getstring("File name (- = stdin): "); inspecs(in); } else if (startsame(in,"infeatures")) { getstring("File name: "); infeats(in); } /* NOT PRESENTLY OPERATIVE -- JLM 10-5-82 else if (startsame(in,"wsubset")) { wordsubset(); } */ else if (startsame(in,"test")) { getstring("test string: "); strcpy(memo,in); test(in); } else if (startsame(in,"topdown")) { topdown(); } else if (startsame(in,"output")) { setout(); } else if (startsame(in,"ofile")) { getstring("give filename (or - for none): "); setoutfile(in); } else if (in[0] == '?') { help(); } else if (startsame(in,"help")) { help(); } else if (startsame(in,"lexicon")) { getlex(); } else if (startsame(in,"params")) { getpars(); } else if (startsame(in,"quit")) { quit(); } else if (startsame(in,"decay")) { getdouble(decay,NLEVS,levlabs); } else if (startsame(in,"alpha")) { getdouble(alpha,NPARAMS,conlabs); } else if (startsame(in,"gamma")) { getdouble(ga,NLEVS,levlabs); } else if (startsame(in,"grace")) { getint(&grace); } else if (startsame(in,"rest")) { tval = rest[W]; getdouble(rest,NLEVS,levlabs); if (tval != rest[W]) { initialize(); } } else if (startsame(in,"fweight")) { getdouble(fweight,NCONTINS,contname); } else if (startsame(in,"pthresh")) { getdouble(pthresh,NLEVS,levlabs); } else if (startsame(in,"ngraph")) { newgraph(pmin,ng_max,pstep); } else if (startsame(in,"ngmax")) { getint(&ng_max); } else if (startsame(in,"ngwscale")) { getval(&ng_wscale); } else if (startsame(in,"ngsscale")) { getval(&ng_sscale); } else if (startsame(in,"ngpscale")) { getval(&ng_pscale); } else if (startsame(in,"nreps")) { getint(&nreps); } else if (startsame(in,"pfreq")) { getint(&printfreq); } else if (startsame(in,"rarate")) { getval(&rarate); } else if (startsame(in,"sumpr")) { scr_sum(pmin,pmax,pstep); } else if (startsame(in,"sinspec")) { sinspec(); } else if (startsame(in,"sfeatures")) { getstring("Filename: "); sfeatures(in); } else if (startsame(in,"dinspec")) { dinspec(); } else if (startsame(in,"sumopt")) { getint(&sumflag); } else if (startsame(in,"pmin")) { getint(&pmin); } else if (startsame(in,"pmax")) { getint(&pmax); } else if (startsame(in,"pstep")) { getint(&pstep); } else if (startsame(in,"min")) { getval(&min); } else if (startsame(in,"max")) { getval(&max); } else if (startsame(in,"windowcent")) { getval(&windowcent); } else if (startsame(in,"wbase")) { getval(&wbase); } else if (startsame(in,"wgraph")) { wgraph(pmin,ng_max,pstep); } else if (startsame(in,"wchange")) { getval(&wchange); } else if (startsame(in,"wgain")) { getval(&wgain); } else if (startsame(in,"wramp")) { getval(&wramp); } else if (startsame(in,"imax")) { getval(&imax); } else if (startsame(in,"sscale")) { getval(&sscale); } else if (startsame(in,"nsscale")) { getval(&nsscale); } else if (startsame(in,"freqscale")) { tval = fscale; getval(&fscale); if (tval != fscale) { initialize(); } } else if (startsame(in,"abort")) { abort(); /* to get a core dump for sdb */ } else { errprint("Unrecognized request: For help type ?."); if (infp != stdin) fileinput(STD); } wait(0); } }
command() { float tval; int i,echeck; int pmin,pmax,pstep; char tbuf[20]; while (echeck = getstring(": ")) { if (echeck == EOF) { fileinput(STD); } else if (startsame(in,"cycle")) { cycle(); } else if (startsame(in,"coarticulation")) { ttyprint("coarticulation %s: change? ",(coartflag ? "ON":"OFF")); fscanf(infp,"%s",in); if(in[0] == 'n') continue; coartflag = 1 - coartflag; } else if (startsame(in,"rc")) { printf("reset and cycle\n"); zarrays(); cycle(); } else if (startsame(in,"wordacts")) { printwords(printmin,printmax,3,stdout); if (outfile) printwords(printmin,printmax,3,outfile); } else if (startsame(in,"wtacts")) { printwt(printmin,printmax,3,stdout); if (outfile) printwt(printmin,printmax,3,outfile); } else if (startsame(in,"owtacts")) { getstring("word: "); strcpy(tbuf,in); printonewt(tbuf,printmin,printmax,3,stdout); if (outfile) printonewt(tbuf,printmin,printmax,3,outfile); } else if (startsame(in,"phonacts")) { printphonemes(printmin,printmax,3,stdout); if (outfile) printphonemes(printmin,printmax,3,outfile); } else if (startsame(in,"featacts")) { printf("feature activations - give min,max,step: "); scanf("%d %d %d",&pmin,&pmax,&pstep); printfeatures(pmin,pmax,pstep,stdout); if (outfile) printfeatures(pmin,pmax,pstep,outfile); } else if (startsame(in,"expression")) { setex(); } else if (startsame(in,"fileinput")) { fileinput(NONSTD); } else if (startsame(in,"inspecs")) { ttyprint("File name (- = stdin): "); fscanf(infp,"%s",in); inspecs(in); } else if (startsame(in,"infeatures")) { ttyprint("File name: "); fscanf(infp,"%s",in); infeats(in); } /* NOT PRESENTLY OPERATIVE -- JLM 10-5-82 else if (startsame(in,"wsubset")) { wordsubset(); } */ else if (startsame(in,"test")) { getstring("test string: "); test(in); } else if (startsame(in,"topdown")) { topdown(); } else if (startsame(in,"output")) { setout(); } else if (startsame(in,"ofile")) { getstring("give filename (or - for none): "); setoutfile(in); } else if (in[0] == '!') { system(&in[1]); } else if (in[0] == '?') { help(); } else if (startsame(in,"help")) { help(); } else if (startsame(in,"lexicon")) { getlex(); } else if (startsame(in,"parameters")) { getpars(); } else if (startsame(in,"quit")) { quit(); } else if (startsame(in,"decay")) { ttyprint ("decay values:\n"); getfloat(decay,NLEVS,"F","P","W"); } else if (startsame(in,"alpha")) { ttyprint ("alpha values:\n"); getfloat(alpha,NPARAMS, "IF","FF","FP","PP","PW","WW","WP","PF","PFC"); } else if (startsame(in,"gamma")) { ttyprint ("gamma values:\n"); getfloat(ga,NLEVS,"F","P","W"); } else if (startsame(in,"grace")) { ttyprint ("grace %s: change? ",(grace ? "ON" : "OFF")); fscanf(infp,"%s",in); if (in[0] == 'n') continue; grace = 1 - grace; } else if (startsame(in,"rest")) { tval = rest[W]; ttyprint ("rest values:\n"); getfloat(rest,NLEVS,"F","P","W"); if (tval != rest[W]) { initialize(); } } else if (startsame(in,"fweight")) { ttyprint ("fweight values:\n"); getfloat(fweight,NCONTINS, "POW","PIT","VOI","ABT","DIF","ACU","CON","LWS", "MDS", "HIS","FT1","FT2","FT3","FT4","FT5","FT6"); } else if (startsame(in,"pthresh")) { ttyprint ("pthresh values:\n"); getfloat(pthresh,NLEVS,"F","P","W"); } else if (startsame(in,"nreps")) { ttyprint ("%d nreps: change? ",nreps); fscanf(infp,"%s",in); if (in[0] == 'n') continue; sscanf(in,"%d",&nreps); } else if (startsame(in,"pfreq")) { ttyprint ("%d pfreq: change? ",printfreq); fscanf(infp,"%s",in); if (in[0] == 'n') continue; sscanf(in,"%d",&printfreq); } else if (startsame(in,"summarypr")) { ttyprint("give min, max, and step: "); fscanf(infp,"%d %d %d",&pmin,&pmax,&pstep); summarypr(pmin,pmax,pstep,stdout); if (outfile) summarypr(pmin,pmax,pstep,outfile); } else if (startsame(in,"spointers")) { qsort(wordptr,nwptrs,sizeof(struct word *),ecomp); } else if (startsame(in,"sinspec")) { sinspec(); } else if (startsame(in,"sfeatures")) { ttyprint("file name: "); fscanf(infp,"%s",in); sfeatures(in); } else if (startsame(in,"dinspec")) { dinspec(); } else if (startsame(in,"acoustinput")) { ttyprint("give min, max, and step: "); fscanf(infp,"%d %d %d",&pmin,&pmax,&pstep); acoustinput(pmin,pmax,pstep,stdout); if (outfile) acoustinput(pmin,pmax,pstep,outfile); } else if (startsame(in,"sumopt")) { ttyprint ("summaryprint %s: change? ",(sumflag ? "ON" : "OFF")); fscanf(infp,"%s",in); if (in[0] == 'n') continue; sumflag = 1 - sumflag; } else if (startsame(in,"echooutput")) { ttyprint ("echooutput %s: change? ",(echoflag ? "ON" : "OFF")); fscanf(infp,"%s",in); if (in[0] == 'n') continue; echoflag = 1 - echoflag; } else if (startsame(in,"min")) { ttyprint ("min = "); getval(&min); } else if (startsame(in,"max")) { ttyprint ("max = "); getval(&max); } else if (startsame(in,"windowcent")) { ttyprint ("windowcent = "); getval(&windowcent); } else if (startsame(in,"wbase")) { ttyprint ("wbase = "); getval(&wbase); } else if (startsame(in,"wchange")) { ttyprint ("wchange = "); getval(&wchange); } else if (startsame(in,"wgain")) { ttyprint ("wgain = "); getval(&wgain); } else if (startsame(in,"wramp")) { ttyprint ("wramp = "); getval(&wramp); } else if (startsame(in,"imax")) { ttyprint ("imax = "); getval(&imax); } else if (startsame(in,"freqscale")) { ttyprint ("freqscale = "); tval = fscale; getval(&fscale); if (tval != fscale) { initialize(); } } else if (startsame(in,"abort")) { abort(); /* to get a core dump for sdb */ } else { printf("Unrecognized request: For help type ?.\n"); if (infp != stdin) fileinput(STD); } wait(0); } }