rem
stringlengths 0
83.5k
| add
stringlengths 0
223k
| context
stringlengths 10
471k
| meta
stringlengths 120
236
|
---|---|---|---|
if (!pt->size) return 0; | if (!pt->size) return 0; | alreadyMapped(Triv121PgTbl pt, long vsid, unsigned long pi){int i;unsigned long hash,api;PTE pte; if (!pt->size) return 0; if (vsid<0) { vsid=VSID121(pi); pi=PI121(pi); } hash = PTE_HASH1(vsid,pi); api=API(pi); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 0==pte->h) return pte; /* try the secondary hash table */ hash = PTE_HASH2(hash); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 1==pte->h) return pte; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c |
if (vsid<0) { vsid=VSID121(pi); pi=PI121(pi); } | if (TRIV121_121_VSID == vsid) { vsid = VSID121 (pi); pi = PI121 (pi); } else if (TRIV121_SEG_VSID == vsid) { vsid = seg2vsid (pi); pi = PI121 (pi); } | alreadyMapped(Triv121PgTbl pt, long vsid, unsigned long pi){int i;unsigned long hash,api;PTE pte; if (!pt->size) return 0; if (vsid<0) { vsid=VSID121(pi); pi=PI121(pi); } hash = PTE_HASH1(vsid,pi); api=API(pi); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 0==pte->h) return pte; /* try the secondary hash table */ hash = PTE_HASH2(hash); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 1==pte->h) return pte; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c |
hash = PTE_HASH1(vsid,pi); api=API(pi); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 0==pte->h) return pte; /* try the secondary hash table */ hash = PTE_HASH2(hash); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 1==pte->h) return pte; return 0; | hash = PTE_HASH1 (vsid, pi); api = API (pi); for (i = 0, pte = ptegOf (pt, hash); i < PTE_PER_PTEG; i++, pte++) if (pte->v && pte->vsid == vsid && pte->api == api && 0 == pte->h) return pte; /* try the secondary hash table */ hash = PTE_HASH2 (hash); for (i = 0, pte = ptegOf (pt, hash); i < PTE_PER_PTEG; i++, pte++) if (pte->v && pte->vsid == vsid && pte->api == api && 1 == pte->h) return pte; return 0; | alreadyMapped(Triv121PgTbl pt, long vsid, unsigned long pi){int i;unsigned long hash,api;PTE pte; if (!pt->size) return 0; if (vsid<0) { vsid=VSID121(pi); pi=PI121(pi); } hash = PTE_HASH1(vsid,pi); api=API(pi); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 0==pte->h) return pte; /* try the secondary hash table */ hash = PTE_HASH2(hash); for (i=0, pte=ptegOf(pt,hash); i<PTE_PER_PTEG; i++,pte++) if (pte->v && pte->vsid==vsid && pte->api==api && 1==pte->h) return pte; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c |
if (!m) err(bugparier, "precision too low in random_rel"); | if (!m) err(bugparier, "random_rel (precision too low)"); | random_rel(long phase, RELCACHE_t *cache, FB_t *F, long MAXRELSUP, GEN nf, GEN vecG, GEN L_jideal){ static long jideal, jdir; long i, cptlist, cptzer, nbG, lgsub, jlist = 1; pari_sp av, av1; GEN ideal, IDEAL, m, P, ex; if (phase != 1) { jideal=jdir=1; if (phase < 0) return 0; } if (!F->pow) powFBgen(F, nf, CBUCHG+1); nbG = lg(vecG)-1; lgsub = lg(F->subFB); ex = cgetg(lgsub, t_VECSMALL); cptzer = cptlist = 0; if (DEBUGLEVEL && L_jideal) fprintferr("looking hard for %Z\n",L_jideal); P = NULL; /* gcc -Wall */ for (av = avma;;) { REL_t *rel = cache->last; if (L_jideal && jlist < lg(L_jideal)) { if (++cptlist > 3) { jideal = L_jideal[jlist++]; cptlist = 0; } } else { if (jideal == F->KC) jideal=1; else jideal++; } avma = av; P = prime_to_ideal(nf, (GEN)F->LP[jideal]); ideal = P; do { for (i=1; i<lgsub; i++) { /* reduce mod apparent order */ ex[i] = random_bits(RANDOM_BITS) % F->pow->ord[i]; if (ex[i]) ideal = idealmulh(nf,ideal, gmael(F->pow->id2,i,ex[i])); } } while (ideal == P); /* If ex = 0, try another */ ideal = remove_content(ideal); IDEAL = lllint_ip(ideal, 4); if (phase != 1) jdir = 1; else phase = 2; for (av1 = avma; jdir <= nbG; jdir++, avma = av1) { /* reduce along various directions */ if (DEBUGLEVEL>2) fprintferr("jideal=%ld,jdir=%ld,rand=%ld\n", jideal,jdir,getrand()); m = pseudomin(IDEAL, (GEN)vecG[jdir]); if (!m) err(bugparier, "precision too low in random_rel"); if (!factorgen(F,nf,ideal,m)) { if (DEBUGLEVEL>1) { fprintferr("."); flusherr(); } continue; } /* can factor ideal, record relation */ set_fact(++rel, F); rel->R[jideal]--; for (i=1; i<lgsub; i++) rel->R[ F->subFB[i] ] -= ex[i]; if (already_known(cache, rel)) { /* forget it */ if (DEBUGLEVEL>1) dbg_cancelrel(jideal,jdir,rel->R); free((void*)rel->R); rel--; if (++cptzer > MAXRELSUP) { if (L_jideal) { cptzer -= 10; break; } return 0; } continue; } rel->m = gclone(m); rel->ex = gclone(ex); rel->pow = F->pow; cache->last = rel; if (DEBUGLEVEL) dbg_newrel(cache, jideal, jdir); /* Need more, try next P */ if (rel < cache->end) { cptzer = 0; break; } /* We have found enough. Return */ if (phase) { jdir = 1; if (jideal == F->KC) jideal=1; else jideal++; } if (DEBUGLEVEL>2) { fprintferr("Upon exit: jideal=%ld,jdir=%ld\n",jideal,jdir); if (DEBUGLEVEL > 3 && phase == 0) dbg_outrel(cache); } avma = av; return 1; } }} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/02c8bbfb23bb5ffabad34406c7b0e17ff7b08096/buch2.c/buggy/src/basemath/buch2.c |
suppressed(ANYARG) {err(talker,"this function has been suppressed");} | suppressed(void) {err(talker,"this function has been suppressed");} | suppressed(ANYARG) {err(talker,"this function has been suppressed");} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/6f0450eaf26bb1653fbb257487c2cbc116d69406/compat.c/buggy/src/language/compat.c |
GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; | GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms; | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
dummy = cgetg(1,t_STR); | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
|
if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } | if (stockmax) S = clonefill(S, s, stockmax); | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); | av1 = avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); | borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
{ pari_sp av2 = avma; GEN per; | { /* overflow */ GEN per, Sold = S; pari_sp av2; | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
if (j || check(data,(GEN)S[k])) | if (j || check(data,(GEN)Sold[k])) | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; | if (!j) borne1 = mpadd(norme1,eps); S[++j] = Sold[k]; | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
s = j; if (!j) avma = av2; else | s = j; avma = av2; if (s) | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); | if (isclone(Sold)) { S = clonefill(S, s, stockmax); gunclone(Sold); } norme1 = (GEN)norms[ per[i-1] ]; norms = cgetg(stockmax+1, t_VEC); | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); | borne1 = mpadd(norme1, eps); borne2 = mpmul(borne1, alpha); checkcnt = 0; | smallvectors(GEN q, GEN BORNE, long stockmax, FP_chk_fun *CHECK){ long N, n, i, j, k, s, epsbit, prec, checkcnt = 1; pari_sp av, av1, lim; GEN u,S,x,y,z,v,norme1,normax1,borne1,borne2,eps,p1,alpha,norms,dummy; GEN (*check)(void *,GEN) = CHECK? CHECK->f: NULL; void *data = CHECK? CHECK->data: NULL; int skipfirst = CHECK? CHECK->skipfirst: 0; if (DEBUGLEVEL) fprintferr("smallvectors looking for norm <= %Z\n",gprec_w(BORNE,3)); prec = gprecision(q); epsbit = bit_accuracy(prec) >> 1; eps = real2n(-epsbit, 3); alpha = dbltor(0.95); normax1 = gzero; borne1= gadd(BORNE,eps); borne2 = mpmul(borne1,alpha); N = lg(q); n = N-1; v = cgetg(N,t_VEC); dummy = cgetg(1,t_STR); av = avma; lim = stack_lim(av,2); if (check) norms = cgetg(stockmax+1,t_VEC); S = cgetg(stockmax+1,t_VEC); x = cgetg(N,t_COL); y = cgetg(N,t_COL); z = cgetg(N,t_COL); for (i=1; i<N; i++) { v[i] = coeff(q,i,i); x[i]=y[i]=z[i] = zero; } x[n] = lmpent(mpsqrt(gdiv(borne1,(GEN)v[n]))); if (DEBUGLEVEL>3) { fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } s = 0; k = n; for(;; x[k] = laddis((GEN)x[k],-1)) /* main */ { do { int fl = 0; if (k > 1) { av1=avma; k--; p1 = mpmul(gcoeff(q,k,k+1),(GEN)x[k+1]); for (j=k+2; j<N; j++) p1 = mpadd(p1, mpmul(gcoeff(q,k,j),(GEN)x[j])); z[k] = (long)gerepileuptoleaf(av1,p1); av1=avma; p1 = gsqr(mpadd((GEN)x[k+1],(GEN)z[k+1])); p1 = mpadd((GEN)y[k+1], mpmul(p1,(GEN)v[k+1])); y[k] = (long)gerepileuptoleaf(av1, p1); /* reject the [x_1,...,x_skipfirst,0,...,0] */ if (k <= skipfirst && !signe(y[skipfirst])) goto END; av1=avma; p1 = mpsub(borne1, (GEN)y[k]); if (signe(p1) < 0) { avma=av1; fl = 1; } else { p1 = mpadd(eps,mpsub(mpsqrt(gdiv(p1,(GEN)v[k])), (GEN)z[k])); x[k] = (long)gerepileuptoleaf(av1,mpent(p1)); } } for(;; x[k] = laddis((GEN)x[k],-1)) { if (!fl) { av1 = avma; /* p1 >= 0 */ p1 = mpmul((GEN)v[k], gsqr(mpadd((GEN)x[k],(GEN)z[k]))); i = mpcmp(mpsub(mpadd(p1,(GEN)y[k]), borne1), gmul2n(p1,-epsbit)); avma = av1; if (i <= 0) break; } k++; fl=0; } if (low_stack(lim, stack_lim(av,2))) { int cnt = 4; if(DEBUGMEM>1) err(warnmem,"smallvectors"); if (stockmax) { /* initialize to dummy values */ GEN T = S; for (i=s+1; i<=stockmax; i++) S[i]=(long)dummy; S = gclone(S); if (isclone(T)) gunclone(T); } if (check) { cnt += 3; for (i=s+1; i<=stockmax; i++) norms[i]=(long)dummy; } gerepileall(av,cnt,&x,&y,&z,&normax1,&borne1,&borne2,&norms); } if (DEBUGLEVEL>3) { if (DEBUGLEVEL>5) fprintferr("%ld ",k); if (k==n) fprintferr("\nx[%ld] = %Z\n",n,x[n]); flusherr(); } } while (k > 1); /* x = 0: we're done */ if (!signe(x[1]) && !signe(y[1])) goto END; av1=avma; p1 = gsqr(mpadd((GEN)x[1],(GEN)z[1])); norme1 = mpadd((GEN)y[1], mpmul(p1, (GEN)v[1])); if (mpcmp(norme1,borne1) > 0) { avma=av1; continue; /* main */ } norme1 = gerepileupto(av1,norme1); if (check) { if (checkcnt < 5 && mpcmp(norme1, borne2) < 0) { if (!check(data,x)) { checkcnt++ ; continue; /* main */} borne1 = mpadd(norme1,eps); borne2 = mpmul(borne1,alpha); s = 0; checkcnt = 0; } } else if (mpcmp(norme1,normax1) > 0) normax1 = norme1; if (++s <= stockmax) { if (check) norms[s] = (long)norme1; S[s] = (long)dummycopy(x); if (s == stockmax) { pari_sp av2 = avma; GEN per; if (!check) goto END; per = sindexsort(norms); if (DEBUGLEVEL) fprintferr("sorting...\n"); for (j=0,i=1; i<=s; i++) { /* let N be the minimal norm so far for x satisfying 'check'. Keep * all elements of norm N */ long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if (j || check(data,(GEN)S[k])) { if (!j) borne1 = gclone( mpadd(norme1,eps) ); S[++j] = S[k]; } } s = j; if (!j) avma = av2; else { GEN t = borne1; checkcnt = 0; norme1 = mpsub(borne1,eps); for (i=1; i<=s; i++) norms[i] = (long)norme1; borne1 = gcopy(borne1); gunclone(t); borne2 = mpmul(borne1,alpha); } } } }END: if (s < stockmax) stockmax = s; if (check) { GEN per, alph, pols, p; if (DEBUGLEVEL) fprintferr("final sort & check...\n"); s = stockmax; setlg(norms,s+1); per = sindexsort(norms); alph = cgetg(s+1,t_VEC); pols = cgetg(s+1,t_VEC); for (j=0,i=1; i<=s; i++) { long k = per[i]; norme1 = (GEN)norms[k]; if (j && mpcmp(norme1, borne1) > 0) break; if ((p = check(data,(GEN)S[k]))) { if (!j) borne1 = gadd(norme1,eps); j++; pols[j]=(long)p; alph[j]=S[k]; } } u = cgetg(3,t_VEC); setlg(pols,j+1); u[1] = (long)pols; setlg(alph,j+1); u[2] = (long)alph; if (isclone(S)) { u[2] = (long)forcecopy(alph); gunclone(S); } return u; } u = cgetg(4,t_VEC); u[1] = lstoi(s<<1); u[2] = (long)normax1; if (stockmax) { setlg(S,stockmax+1); settyp(S,t_MAT); if (isclone(S)) { p1 = S; S = forcecopy(S); gunclone(p1); } } else S = cgetg(1,t_MAT); u[3] = (long)S; return u;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/654d6ffc42aad5ced22b253c18125504f657adbc/bibli1.c/buggy/src/basemath/bibli1.c |
m360.brgc1 = smc1BRGC (9600); | m360.brgc1 = smc1BRGC (console_baud_rate); | smc1Initialize (int major, int minor, void *arg){ /* * Allocate buffer descriptors */ smcRxBd = M360AllocateBufferDescriptors (1); smcTxBd = M360AllocateBufferDescriptors (1); /* * Configure port B pins to enable SMTXD1 and SMRXD1 pins */ m360.pbpar |= 0xC0; m360.pbdir &= ~0xC0; m360.pbodr &= ~0xC0; /* * Set up BRG1 (9,600 baud) */ m360.brgc1 = M360_BRG_RST; m360.brgc1 = smc1BRGC (9600); /* * Put SMC1 in NMSI mode, connect SMC1 to BRG1 */ m360.simode |= M360_SI_SMC1_BRG1; /* * Set up SMC1 parameter RAM common to all protocols */ m360.smc1p.rbase = (char *)smcRxBd - (char *)&m360; m360.smc1p.tbase = (char *)smcTxBd - (char *)&m360; m360.smc1p.rfcr = M360_RFCR_MOT | M360_RFCR_DMA_SPACE; m360.smc1p.tfcr = M360_TFCR_MOT | M360_TFCR_DMA_SPACE; if (m360_smc1_interrupt) m360.smc1p.mrblr = RXBUFSIZE; else m360.smc1p.mrblr = 1; /* * Set up SMC1 parameter RAM UART-specific parameters */ m360.smc1p.un.uart.max_idl = 10; m360.smc1p.un.uart.brklen = 0; m360.smc1p.un.uart.brkec = 0; m360.smc1p.un.uart.brkcr = 0; /* * Set up the Receive Buffer Descriptor */ smcRxBd->status = M360_BD_EMPTY | M360_BD_WRAP | M360_BD_INTERRUPT; smcRxBd->length = 0; smcRxBd->buffer = rxBuf; /* * Setup the Transmit Buffer Descriptor */ smcTxBd->status = M360_BD_WRAP; /* * Set up SMC1 general and protocol-specific mode registers */ m360.smc1.smce = ~0; /* Clear any pending events */ m360.smc1.smcm = 0; /* Mask all interrupt/event sources */ m360.smc1.smcmr = M360_SMCMR_CLEN(9) | M360_SMCMR_SM_UART; /* * Send "Init parameters" command */ M360ExecuteRISC (M360_CR_OP_INIT_RX_TX | M360_CR_CHAN_SMC1); /* * Enable receiver and transmitter */ m360.smc1.smcmr |= M360_SMCMR_TEN | M360_SMCMR_REN; if (m360_smc1_interrupt) { rtems_isr_entry old_handler; rtems_status_code sc; sc = rtems_interrupt_catch (smc1InterruptHandler, (m360.cicr & 0xE0) | 0x04, &old_handler); m360.smc1.smcm = 3; /* Enable SMC1 TX and RX interrupts */ m360.cimr |= 1UL << 4; /* Enable SMC1 interrupts */ } return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/6940545972884c45628be6bb15d0e8a3252c5166/console.c/clean/c/src/lib/libbsp/m68k/gen68360/console/console.c |
if (!ret_basis) return gerepile(av,tetpil,gcopy(disc)); | nfbasis00(GEN x0, long flag, GEN p, long ret_basis, GEN *y){ GEN x, disc, basis, lead; GEN *gptr[2]; long k, tetpil, av = avma, l = lgef(x0), smll; if (typ(x0)!=t_POL) err(typeer,"nfbasis00"); if (l<=3) err(zeropoler,"nfbasis00"); for (k=2; k<l; k++) if (typ(x0[k])!=t_INT) err(talker,"polynomial not in Z[X] in nfbasis"); x = pol_to_monic(x0,&lead); if (!p || gcmp0(p)) smll = (flag & 1); /* small basis */ else { if (lead) p = update_fact(x,p); smll = (long) p; /* factored basis */ } if (flag & 2) basis = allbase(x,smll,&disc); /* round 2 */ else basis = allbase4(x,smll,&disc,NULL); /* round 4 */ tetpil=avma; if (!ret_basis) return gerepile(av,tetpil,gcopy(disc)); if (!lead) basis = gcopy(basis); else { long v = varn(x); GEN pol = gmul(polx[v],lead); tetpil = avma; basis = gsubst(basis,v,pol); } if (!y) return gerepile(av,tetpil,basis); *y = gcopy(disc); gptr[0]=&basis; gptr[1]=y; gerepilemanysp(av,tetpil,gptr,2); return basis;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base2.c/clean/src/basemath/base2.c |
|
return centermod(idealapprfact_i(nf,fact,1), gcoeff(x,1,1)); | return idealapprfact_i(nf,fact,1); | mat_ideal_two_elt2(GEN nf, GEN x, GEN a){ GEN L, e, fact = idealfactor(nf,a); long i, r; L = gel(fact,1); e = gel(fact,2); r = lg(e); for (i=1; i<r; i++) gel(e,i) = stoi( idealval(nf,x,gel(L,i)) ); return centermod(idealapprfact_i(nf,fact,1), gcoeff(x,1,1));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/88a5ea098bd3f806f055886045cbd51a60cc0863/base4.c/clean/src/basemath/base4.c |
if (valp(x) > 0) return gzero; | if (divise(lift(x), p)) return gzero; | phi_ms(GEN vz, GEN p, long m, GEN s, GEN x){ GEN p1, p2; if (valp(x) > 0) return gzero; p1 = powgi(quickteich(vz, p, x), addis(s, m)); p2 = powgi(x, negi(s)); return gmul(p1, p2);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/81282841645f6a41162c6b7c228e3e863d4a6c31/trans3.c/buggy/src/basemath/trans3.c |
return gmul(p1, p2); | return lift(gmul(p1, p2)); | phi_ms(GEN vz, GEN p, long m, GEN s, GEN x){ GEN p1, p2; if (valp(x) > 0) return gzero; p1 = powgi(quickteich(vz, p, x), addis(s, m)); p2 = powgi(x, negi(s)); return gmul(p1, p2);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/81282841645f6a41162c6b7c228e3e863d4a6c31/trans3.c/buggy/src/basemath/trans3.c |
T.fact = gerepilecopy(av2, sort_vecpol(rep)); | T.fact = gerepilecopy(av2, sort_vecpol(rep, &cmp_pol)); | nfsqff(GEN nf, GEN pol, long fl){ long i, n, nbf, ct, maxf, dpol = degpol(pol); ulong pp; pari_sp av = avma; GEN pr, C0, dk, bad, polbase, init_fa = NULL; GEN N2, rep, polmod, polred, lt, nfpol; byteptr pt = diffptr; nfcmbf_t T; nflift_t L; pari_timer ti, ti_tot; if (DEBUGLEVEL>2) { TIMERstart(&ti); TIMERstart(&ti_tot); } nfpol = (GEN)nf[1]; n = degpol(nfpol); polbase = unifpol(nf, pol, t_COL); if (typ(polbase) != t_POL) err(typeer, "nfsqff"); polmod = unifpol(nf, pol, t_POLMOD); /* heuristic */ if (dpol*3 < n) { GEN z, t; if (DEBUGLEVEL>2) fprintferr("Using Trager's method\n"); z = (GEN)polfnf(polmod, nfpol)[1]; if (fl) { long l = lg(z); for (i = 1; i < l; i++) { t = (GEN)z[i]; if (degpol(t) > 1) break; z[i] = lneg(gdiv((GEN)t[3], (GEN)t[2])); } setlg(z, i); } return gerepilecopy(av, z); } pol = simplify_i(lift(polmod)); lt = leading_term(polbase); /* t_INT */ if (gcmp1(lt)) lt = NULL; dk = absi((GEN)nf[3]); bad = mulii(dk,(GEN)nf[4]); if (lt) bad = mulii(bad, lt); polred = pr = NULL; /* gcc -Wall */ nbf = 0; pp = 0; L.Tp = NULL; /* FIXME: slow factorization of large polynomials over large Fq */ maxf = 1; if (dpol > 100) /* tough */ { if (n >= 20) maxf = 4; } else { if (n >= 15) maxf = 4; } for (ct = 5;;) { GEN aT, apr, ap, modpr, red; long anbf; pari_timer ti_pr; GEN list, r = NULL, fa = NULL; pari_sp av2 = avma; if (DEBUGLEVEL>3) TIMERstart(&ti_pr); for (;;) { NEXT_PRIME_VIADIFF_CHECK(pp, pt); if (! umodiu(bad,pp)) continue; ap = utoi(pp); list = (GEN)factmod0(nfpol, ap)[1]; if (maxf == 1) { /* deg.1 factors are best */ r = (GEN)list[1]; if (degpol(r) == 1) break; } else { /* otherwise, pick factor of largish degree */ long i, dr; for (i = lg(list)-1; i > 0; i--) { r = (GEN)list[i]; dr = degpol(r); if (dr <= maxf) break; } if (i > 0) break; } avma = av2; } apr = apply_kummer(nf,r,gun,ap); modpr = zk_to_ff_init(nf,&apr,&aT,&ap); red = modprX(polbase, nf, modpr); if (!aT) { /* degree 1 */ red = u_Fp_FpX(red, pp); if (!u_FpX_is_squarefree(red, pp)) { avma = av2; continue; } anbf = fl? u_FpX_nbroots(red, pp): u_FpX_nbfact(red, pp); } else { GEN q; if (!FqX_is_squarefree(red,aT,ap)) { avma = av2; continue; } q = gpowgs(ap, degpol(aT)); anbf = fl? FqX_split_deg1(&fa, red, q, aT, ap) : FqX_split_by_degree(&fa, red, q, aT, ap); } if (fl == 2 && anbf < dpol) return cgetg(1,t_VEC); if (anbf <= 1) { if (!fl) /* irreducible */ return gerepilecopy(av, _vec(QXQ_normalize(polmod, nfpol))); if (!anbf) return cgetg(1,t_VEC); /* no root */ } if (!nbf || anbf < nbf || (anbf == nbf && cmpii((GEN)apr[4], (GEN)pr[4]) > 0)) { nbf = anbf; pr = apr; L.Tp = aT; init_fa = fa; } else avma = av2; if (DEBUGLEVEL>3) fprintferr("%3ld %s at prime\n %Z\nTime: %ld\n", anbf, fl?"roots": "factors", apr, TIMER(&ti_pr)); if (--ct <= 0) break; } if (DEBUGLEVEL>2) { msgTIMER(&ti, "choice of a prime ideal"); fprintferr("Prime ideal chosen: %Z\n", pr); } L.tozk = (GEN)nf[8]; L.topow= Q_remove_denom((GEN)nf[7], &L.topowden); T.ZC = L2_bound(nf, L.tozk, &(T.dn)); T.Br = nf_root_bounds(pol, nf); if (lt) T.Br = gmul(T.Br, lt); if (fl) C0 = normlp(T.Br, 2, n); else C0 = nf_factor_bound(nf, polbase); /* bound for T_2(Q_i), Q | P */ T.bound = mulrr(T.ZC, C0); /* bound for |Q_i|^2 in Z^n on chosen Z-basis */ N2 = mulsr(dpol*dpol, normlp(T.Br, 4, n)); /* bound for T_2(lt * S_2) */ T.BS_2 = mulrr(T.ZC, N2); /* bound for |S_2|^2 on chosen Z-basis */ if (DEBUGLEVEL>2) { msgTIMER(&ti, "bound computation"); fprintferr(" 1) T_2 bound for %s: %Z\n", fl?"root":"factor", C0); fprintferr(" 2) Conversion from T_2 --> | |^2 bound : %Z\n", T.ZC); fprintferr(" 3) Final bound: %Z\n", T.bound); } L.p = (GEN)pr[1]; if (L.Tp && degpol(L.Tp) == 1) L.Tp = NULL; bestlift_init(0, nf, pr, T.bound, &L); if (DEBUGLEVEL>2) TIMERstart(&ti); polred = ZqX_normalize(polbase, lt, &L); /* monic */ if (fl) return gerepilecopy(av, nf_DDF_roots(pol, polred, nfpol, lt, init_fa, nbf, fl, &L)); { pari_sp av2 = avma; if (L.Tp) rep = FqX_split_all(init_fa, L.Tp, L.p); else { long d; rep = cgetg(dpol + 1, t_VEC); rep[1] = (long)polred; d = FpX_split_berlekamp((GEN*)(rep + 1), L.p); setlg(rep, d + 1); } T.fact = gerepilecopy(av2, sort_vecpol(rep)); } if (DEBUGLEVEL>2) msgTIMER(&ti, "splitting mod %Z", pr); T.pr = pr; T.L = &L; T.polbase = polbase; T.pol = pol; T.nf = nf; T.hint = 1; /* useless */ rep = nf_combine_factors(&T, polred, L.p, L.k, dpol-1); if (DEBUGLEVEL>2) fprintferr("Total Time: %ld\n===========\n", TIMER(&ti_tot)); return gerepileupto(av, rep);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/fe5f36d4c0b1af99f25ebb784480a929ad51a590/nffactor.c/buggy/src/modules/nffactor.c |
modulereltoabs(GEN nf, GEN rnfeq, GEN x) | modulereltoabs(GEN rnf, GEN x) | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; | GEN oms = (GEN)x[1], ids = (GEN)x[2], nf = (GEN)rnf[10], rnfeq = (GEN)rnf[11]; GEN M, basnf, cobasnf, T = (GEN)nf[1]; long i, j, k, n = lg(oms)-1, m = degpol(T); | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
M = cgetg(degabs+1,t_MAT); | M = cgetg(n*m+1, t_VEC); | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) | basnf = Q_primitive_part(basnf, &cobasnf); for (k=i=1; i<=n; i++) | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
om = primitive_part(eltreltoabs(rnfeq, om), &c0); | om = Q_primitive_part(eltreltoabs(rnfeq, om), &c0); | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); | GEN z = Q_primitive_part(gmul(basnf,(GEN)id[j]), &c1); z = lift_intern(gmul(om, z)); c = mul_content(c1, c0); if (c) z = gmul(c, z); M[k++] = (long)z; | modulereltoabs(GEN nf, GEN rnfeq, GEN x){ GEN oms = (GEN)x[1], ids = (GEN)x[2], T = (GEN)nf[1]; GEN p1, M, basnf, cobasnf; long i,j, n = lg(oms)-1, m = degpol(T), degabs = n*m; M = cgetg(degabs+1,t_MAT); basnf = gsubst((GEN)nf[7], varn(T), (GEN)rnfeq[2]); /* removing denominators speeds up multiplication */ basnf = primitive_part(basnf, &cobasnf); for (i=1; i<=n; i++) { GEN c,c0,c1, om = (GEN)oms[i], id = (GEN)ids[i]; om = primitive_part(eltreltoabs(rnfeq, om), &c0); c0 = mul_content(c0, cobasnf); for (j=1; j<=m; j++) { p1 = primitive_part(gmul(basnf,(GEN)id[j]), &c1); p1 = lift_intern(gmul(om,p1)); c = mul_content(c1, c0); if (c) p1 = gmul(c,p1); M[(i-1)*m+j] = (long)pol_to_vec(p1, degabs); } } return M;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/59f511650949bd335c0ea3ba14f6dd6ce94d3308/base5.c/clean/src/basemath/base5.c |
rtems_unsigned32 n = rtems_get_index(*next_id); | uint32_t n = rtems_get_index(*next_id); | rtems_monitor_driver_next( void *object_info, rtems_monitor_driver_t *canonical_driver, rtems_id *next_id){ rtems_configuration_table *c = _Configuration_Table; rtems_unsigned32 n = rtems_get_index(*next_id); if (n >= c->number_of_device_drivers) goto failed; _Thread_Disable_dispatch(); /* * dummy up a fake id and name for this item */ canonical_driver->id = n; canonical_driver->name = rtems_build_name('-', '-', '-', '-'); *next_id += 1; return (void *) (c->Device_driver_table + n);failed: *next_id = RTEMS_OBJECT_ID_FINAL; return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3e08d4ee6242f1a0ea4afe9dc0a20800632184fe/mon-driver.c/clean/cpukit/libmisc/monitor/mon-driver.c |
isascii(*cp) && !isspace(*cp)) | isascii((int)*cp) && !isspace((int)*cp)) | res_init(){ register FILE *fp; register char *cp, **pp; register int n; char buf[MAXDNAME]; int nserv = 0; /* number of nameserver records read from file */ int haveenv = 0; int havesearch = 0;#ifdef RESOLVSORT int nsort = 0; char *net;#endif#ifndef RFC1535 int dots;#endif /* * These three fields used to be statically initialized. This made * it hard to use this code in a shared library. It is necessary, * now that we're doing dynamic initialization here, that we preserve * the old semantics: if an application modifies one of these three * fields of _res before res_init() is called, res_init() will not * alter them. Of course, if an application is setting them to * _zero_ before calling res_init(), hoping to override what used * to be the static default, we can't detect it and unexpected results * will follow. Zero for any of these fields would make no sense, * so one can safely assume that the applications were already getting * unexpected results. * * _res.options is tricky since some apps were known to diddle the bits * before res_init() was first called. We can't replicate that semantic * with dynamic initialization (they may have turned bits off that are * set in RES_DEFAULT). Our solution is to declare such applications * "broken". They could fool us by setting RES_INIT but none do (yet). */ if (!_res.retrans) _res.retrans = RES_TIMEOUT; if (!_res.retry) _res.retry = 4; if (!(_res.options & RES_INIT)) _res.options = RES_DEFAULT; /* * This one used to initialize implicitly to zero, so unless the app * has set it to something in particular, we can randomize it now. */ if (!_res.id) _res.id = res_randomid();#ifdef USELOOPBACK _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);#else _res.nsaddr.sin_addr.s_addr = INADDR_ANY;#endif _res.nsaddr.sin_family = AF_INET; _res.nsaddr.sin_port = htons(NAMESERVER_PORT); _res.nscount = 1; _res.ndots = 1; _res.pfcode = 0; /* * RTEMS -- Set up name servers */ {#include <rtems/rtems_bsdnet_internal.h> int n = 0; while ((n < rtems_bsdnet_nameserver_count) && (nserv < MAXNS)) { _res.nsaddr_list[nserv].sin_addr = rtems_bsdnet_nameserver[n]; _res.nsaddr_list[nserv].sin_family = AF_INET; _res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT); nserv++; n++; } if (rtems_bsdnet_domain_name) (void)strncpy(_res.defdname, rtems_bsdnet_domain_name, sizeof(_res.defdname) - 1); } /* Allow user to override the local domain definition */ if ((cp = getenv("LOCALDOMAIN")) != NULL) { (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); haveenv++; /* * Set search list to be blank-separated strings * from rest of env value. Permits users of LOCALDOMAIN * to still have a search list, and anyone to set the * one that they want to use as an individual (even more * important now that the rfc1535 stuff restricts searches) */ cp = _res.defdname; pp = _res.dnsrch; *pp++ = cp; for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) { if (*cp == '\n') /* silly backwards compat */ break; else if (*cp == ' ' || *cp == '\t') { *cp = 0; n = 1; } else if (n) { *pp++ = cp; n = 0; havesearch = 1; } } /* null terminate last domain if there are excess */ while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n') cp++; *cp = '\0'; *pp++ = 0; }#define MATCH(line, name) \ (!strncmp(line, name, sizeof(name) - 1) && \ (line[sizeof(name) - 1] == ' ' || \ line[sizeof(name) - 1] == '\t')) if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) { /* read the config file */ while (fgets(buf, sizeof(buf), fp) != NULL) { /* skip comments */ if (*buf == ';' || *buf == '#') continue; /* read default domain name */ if (MATCH(buf, "domain")) { if (haveenv) /* skip if have from environ */ continue; cp = buf + sizeof("domain") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) *cp = '\0'; havesearch = 0; continue; } /* set search list */ if (MATCH(buf, "search")) { if (haveenv) /* skip if have from environ */ continue; cp = buf + sizeof("search") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); if ((cp = strchr(_res.defdname, '\n')) != NULL) *cp = '\0'; /* * Set search list to be blank-separated strings * on rest of line. */ cp = _res.defdname; pp = _res.dnsrch; *pp++ = cp; for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) { if (*cp == ' ' || *cp == '\t') { *cp = 0; n = 1; } else if (n) { *pp++ = cp; n = 0; } } /* null terminate last domain if there are excess */ while (*cp != '\0' && *cp != ' ' && *cp != '\t') cp++; *cp = '\0'; *pp++ = 0; havesearch = 1; continue; } /* read nameservers to query */ if (MATCH(buf, "nameserver") && nserv < MAXNS) { struct in_addr a; cp = buf + sizeof("nameserver") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp != '\0') && (*cp != '\n') && inet_aton(cp, &a)) { _res.nsaddr_list[nserv].sin_addr = a; _res.nsaddr_list[nserv].sin_family = AF_INET; _res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT); nserv++; } continue; }#ifdef RESOLVSORT if (MATCH(buf, "sortlist")) { struct in_addr a; cp = buf + sizeof("sortlist") - 1; while (nsort < MAXRESOLVSORT) { while (*cp == ' ' || *cp == '\t') cp++; if (*cp == '\0' || *cp == '\n' || *cp == ';') break; net = cp; while (*cp && !ISSORTMASK(*cp) && *cp != ';' && isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; if (inet_aton(net, &a)) { _res.sort_list[nsort].addr = a; if (ISSORTMASK(n)) { *cp++ = n; net = cp; while (*cp && *cp != ';' && isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; if (inet_aton(net, &a)) { _res.sort_list[nsort].mask = a.s_addr; } else { _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } } else { _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } nsort++; } *cp = n; } continue; }#endif if (MATCH(buf, "options")) { res_setoptions(buf + sizeof("options") - 1, "conf"); continue; } } if (nserv > 1) _res.nscount = nserv;#ifdef RESOLVSORT _res.nsort = nsort;#endif (void) fclose(fp); } if (_res.defdname[0] == 0 && gethostname(buf, sizeof(_res.defdname) - 1) == 0 && (cp = strchr(buf, '.')) != NULL) strcpy(_res.defdname, cp + 1); /* find components of local domain that might be searched */ if (havesearch == 0) { pp = _res.dnsrch; *pp++ = _res.defdname; *pp = NULL;#ifndef RFC1535 dots = 0; for (cp = _res.defdname; *cp; cp++) dots += (*cp == '.'); cp = _res.defdname; while (pp < _res.dnsrch + MAXDFLSRCH) { if (dots < LOCALDOMAINPARTS) break; cp = strchr(cp, '.') + 1; /* we know there is one */ *pp++ = cp; dots--; } *pp = NULL;#ifdef DEBUG if (_res.options & RES_DEBUG) { printf(";; res_init()... default dnsrch list:\n"); for (pp = _res.dnsrch; *pp; pp++) printf(";;\t%s\n", *pp); printf(";;\t..END..\n"); }#endif#endif /* !RFC1535 */ } if ((cp = getenv("RES_OPTIONS")) != NULL) res_setoptions(cp, "env"); _res.options |= RES_INIT; return (0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_init.c/clean/cpukit/libnetworking/libc/res_init.c |
isascii(*cp) && !isspace(*cp)) | isascii((int)*cp) && !isspace((int)*cp)) | res_init(){ register FILE *fp; register char *cp, **pp; register int n; char buf[MAXDNAME]; int nserv = 0; /* number of nameserver records read from file */ int haveenv = 0; int havesearch = 0;#ifdef RESOLVSORT int nsort = 0; char *net;#endif#ifndef RFC1535 int dots;#endif /* * These three fields used to be statically initialized. This made * it hard to use this code in a shared library. It is necessary, * now that we're doing dynamic initialization here, that we preserve * the old semantics: if an application modifies one of these three * fields of _res before res_init() is called, res_init() will not * alter them. Of course, if an application is setting them to * _zero_ before calling res_init(), hoping to override what used * to be the static default, we can't detect it and unexpected results * will follow. Zero for any of these fields would make no sense, * so one can safely assume that the applications were already getting * unexpected results. * * _res.options is tricky since some apps were known to diddle the bits * before res_init() was first called. We can't replicate that semantic * with dynamic initialization (they may have turned bits off that are * set in RES_DEFAULT). Our solution is to declare such applications * "broken". They could fool us by setting RES_INIT but none do (yet). */ if (!_res.retrans) _res.retrans = RES_TIMEOUT; if (!_res.retry) _res.retry = 4; if (!(_res.options & RES_INIT)) _res.options = RES_DEFAULT; /* * This one used to initialize implicitly to zero, so unless the app * has set it to something in particular, we can randomize it now. */ if (!_res.id) _res.id = res_randomid();#ifdef USELOOPBACK _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);#else _res.nsaddr.sin_addr.s_addr = INADDR_ANY;#endif _res.nsaddr.sin_family = AF_INET; _res.nsaddr.sin_port = htons(NAMESERVER_PORT); _res.nscount = 1; _res.ndots = 1; _res.pfcode = 0; /* * RTEMS -- Set up name servers */ {#include <rtems/rtems_bsdnet_internal.h> int n = 0; while ((n < rtems_bsdnet_nameserver_count) && (nserv < MAXNS)) { _res.nsaddr_list[nserv].sin_addr = rtems_bsdnet_nameserver[n]; _res.nsaddr_list[nserv].sin_family = AF_INET; _res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT); nserv++; n++; } if (rtems_bsdnet_domain_name) (void)strncpy(_res.defdname, rtems_bsdnet_domain_name, sizeof(_res.defdname) - 1); } /* Allow user to override the local domain definition */ if ((cp = getenv("LOCALDOMAIN")) != NULL) { (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); haveenv++; /* * Set search list to be blank-separated strings * from rest of env value. Permits users of LOCALDOMAIN * to still have a search list, and anyone to set the * one that they want to use as an individual (even more * important now that the rfc1535 stuff restricts searches) */ cp = _res.defdname; pp = _res.dnsrch; *pp++ = cp; for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) { if (*cp == '\n') /* silly backwards compat */ break; else if (*cp == ' ' || *cp == '\t') { *cp = 0; n = 1; } else if (n) { *pp++ = cp; n = 0; havesearch = 1; } } /* null terminate last domain if there are excess */ while (*cp != '\0' && *cp != ' ' && *cp != '\t' && *cp != '\n') cp++; *cp = '\0'; *pp++ = 0; }#define MATCH(line, name) \ (!strncmp(line, name, sizeof(name) - 1) && \ (line[sizeof(name) - 1] == ' ' || \ line[sizeof(name) - 1] == '\t')) if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) { /* read the config file */ while (fgets(buf, sizeof(buf), fp) != NULL) { /* skip comments */ if (*buf == ';' || *buf == '#') continue; /* read default domain name */ if (MATCH(buf, "domain")) { if (haveenv) /* skip if have from environ */ continue; cp = buf + sizeof("domain") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL) *cp = '\0'; havesearch = 0; continue; } /* set search list */ if (MATCH(buf, "search")) { if (haveenv) /* skip if have from environ */ continue; cp = buf + sizeof("search") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp == '\0') || (*cp == '\n')) continue; strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1); if ((cp = strchr(_res.defdname, '\n')) != NULL) *cp = '\0'; /* * Set search list to be blank-separated strings * on rest of line. */ cp = _res.defdname; pp = _res.dnsrch; *pp++ = cp; for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) { if (*cp == ' ' || *cp == '\t') { *cp = 0; n = 1; } else if (n) { *pp++ = cp; n = 0; } } /* null terminate last domain if there are excess */ while (*cp != '\0' && *cp != ' ' && *cp != '\t') cp++; *cp = '\0'; *pp++ = 0; havesearch = 1; continue; } /* read nameservers to query */ if (MATCH(buf, "nameserver") && nserv < MAXNS) { struct in_addr a; cp = buf + sizeof("nameserver") - 1; while (*cp == ' ' || *cp == '\t') cp++; if ((*cp != '\0') && (*cp != '\n') && inet_aton(cp, &a)) { _res.nsaddr_list[nserv].sin_addr = a; _res.nsaddr_list[nserv].sin_family = AF_INET; _res.nsaddr_list[nserv].sin_port = htons(NAMESERVER_PORT); nserv++; } continue; }#ifdef RESOLVSORT if (MATCH(buf, "sortlist")) { struct in_addr a; cp = buf + sizeof("sortlist") - 1; while (nsort < MAXRESOLVSORT) { while (*cp == ' ' || *cp == '\t') cp++; if (*cp == '\0' || *cp == '\n' || *cp == ';') break; net = cp; while (*cp && !ISSORTMASK(*cp) && *cp != ';' && isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; if (inet_aton(net, &a)) { _res.sort_list[nsort].addr = a; if (ISSORTMASK(n)) { *cp++ = n; net = cp; while (*cp && *cp != ';' && isascii(*cp) && !isspace(*cp)) cp++; n = *cp; *cp = 0; if (inet_aton(net, &a)) { _res.sort_list[nsort].mask = a.s_addr; } else { _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } } else { _res.sort_list[nsort].mask = net_mask(_res.sort_list[nsort].addr); } nsort++; } *cp = n; } continue; }#endif if (MATCH(buf, "options")) { res_setoptions(buf + sizeof("options") - 1, "conf"); continue; } } if (nserv > 1) _res.nscount = nserv;#ifdef RESOLVSORT _res.nsort = nsort;#endif (void) fclose(fp); } if (_res.defdname[0] == 0 && gethostname(buf, sizeof(_res.defdname) - 1) == 0 && (cp = strchr(buf, '.')) != NULL) strcpy(_res.defdname, cp + 1); /* find components of local domain that might be searched */ if (havesearch == 0) { pp = _res.dnsrch; *pp++ = _res.defdname; *pp = NULL;#ifndef RFC1535 dots = 0; for (cp = _res.defdname; *cp; cp++) dots += (*cp == '.'); cp = _res.defdname; while (pp < _res.dnsrch + MAXDFLSRCH) { if (dots < LOCALDOMAINPARTS) break; cp = strchr(cp, '.') + 1; /* we know there is one */ *pp++ = cp; dots--; } *pp = NULL;#ifdef DEBUG if (_res.options & RES_DEBUG) { printf(";; res_init()... default dnsrch list:\n"); for (pp = _res.dnsrch; *pp; pp++) printf(";;\t%s\n", *pp); printf(";;\t..END..\n"); }#endif#endif /* !RFC1535 */ } if ((cp = getenv("RES_OPTIONS")) != NULL) res_setoptions(cp, "env"); _res.options |= RES_INIT; return (0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_init.c/clean/cpukit/libnetworking/libc/res_init.c |
} else { *len = requested; | static apr_status_t serf_mmap_read(serf_bucket_t *bucket, apr_size_t requested, const char **data, apr_size_t *len){ mmap_context_t *ctx = bucket->data; if (requested == SERF_READ_ALL_AVAIL || requested > ctx->remaining) { *len = ctx->remaining; } /* ### Would it be faster to call this once and do the offset ourselves? */ apr_mmap_offset((void**)data, ctx->mmap, ctx->offset); /* For the next read... */ ctx->offset += *len; ctx->remaining -= *len; if (ctx->remaining == 0) { return APR_EOF; } return APR_SUCCESS;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/7bfce8b3df95f417d1aad928252b6db36e85c219/mmap_buckets.c/buggy/buckets/mmap_buckets.c |
|
} else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) | } else if ((rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh))) | route_output(m, so) register struct mbuf *m; struct socket *so;{ register struct rt_msghdr *rtm = 0; register struct rtentry *rt = 0; struct rtentry *saved_nrt = 0; struct radix_node_head *rnh; struct rt_addrinfo info; int len, error = 0; struct ifnet *ifp = 0; struct ifaddr *ifa = 0;#define senderr(e) { error = e; goto flush;} if (m == 0 || ((m->m_len < sizeof(long)) && (m = m_pullup(m, sizeof(long))) == 0)) return (ENOBUFS); if ((m->m_flags & M_PKTHDR) == 0) panic("route_output"); len = m->m_pkthdr.len; if (len < sizeof(*rtm) || len != mtod(m, struct rt_msghdr *)->rtm_msglen) { dst = 0; senderr(EINVAL); } R_Malloc(rtm, struct rt_msghdr *, len); if (rtm == 0) { dst = 0; senderr(ENOBUFS); } m_copydata(m, 0, len, (caddr_t)rtm); if (rtm->rtm_version != RTM_VERSION) { dst = 0; senderr(EPROTONOSUPPORT); } info.rti_addrs = rtm->rtm_addrs; if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { dst = 0; senderr(EINVAL); } if (dst == 0 || (dst->sa_family >= AF_MAX) || (gate != 0 && (gate->sa_family >= AF_MAX))) senderr(EINVAL); if (genmask) { struct radix_node *t; t = rn_addmask((caddr_t)genmask, 0, 1); if (t && Bcmp(genmask, t->rn_key, *(u_char *)genmask) == 0) genmask = (struct sockaddr *)(t->rn_key); else senderr(ENOBUFS); } switch (rtm->rtm_type) { case RTM_ADD: if (gate == 0) senderr(EINVAL); error = rtrequest(RTM_ADD, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0 && saved_nrt) { rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &saved_nrt->rt_rmx); saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); saved_nrt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); saved_nrt->rt_refcnt--; saved_nrt->rt_genmask = genmask; } break; case RTM_DELETE: error = rtrequest(RTM_DELETE, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0) { if ((rt = saved_nrt)) rt->rt_refcnt++; goto report; } break; case RTM_GET: case RTM_CHANGE: case RTM_LOCK: if ((rnh = rt_tables[dst->sa_family]) == 0) { senderr(EAFNOSUPPORT); } else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) rt->rt_refcnt++; else senderr(ESRCH); switch(rtm->rtm_type) { case RTM_GET: report: dst = rt_key(rt); gate = rt->rt_gateway; netmask = rt_mask(rt); genmask = rt->rt_genmask; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { ifpaddr = ifp->if_addrlist->ifa_addr; ifaaddr = rt->rt_ifa->ifa_addr; rtm->rtm_index = ifp->if_index; } else { ifpaddr = 0; ifaaddr = 0; } } len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, (struct walkarg *)0); if (len > rtm->rtm_msglen) { struct rt_msghdr *new_rtm; R_Malloc(new_rtm, struct rt_msghdr *, len); if (new_rtm == 0) senderr(ENOBUFS); Bcopy(rtm, new_rtm, rtm->rtm_msglen); Free(rtm); rtm = new_rtm; } (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, (struct walkarg *)0); rtm->rtm_flags = rt->rt_flags; rtm->rtm_rmx = rt->rt_rmx; rtm->rtm_addrs = info.rti_addrs; break; case RTM_CHANGE: if (gate && (error = rt_setgate(rt, rt_key(rt), gate))) senderr(error); /* * If they tried to change things but didn't specify * the required gateway, then just use the old one. * This can happen if the user tries to change the * flags on the default route without changing the * default gateway. Changing flags still doesn't work. */ if ((rt->rt_flags & RTF_GATEWAY) && !gate) gate = rt->rt_gateway; /* new gateway could require new ifaddr, ifp; flags may also be different; ifp may be specified by ll sockaddr when protocol address is ambiguous */ if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && (ifp = ifa->ifa_ifp) && (ifaaddr || gate)) ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, ifp); else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || (gate && (ifa = ifa_ifwithroute(rt->rt_flags, rt_key(rt), gate)))) ifp = ifa->ifa_ifp; if (ifa) { register struct ifaddr *oifa = rt->rt_ifa; if (oifa != ifa) { if (oifa && oifa->ifa_rtrequest) oifa->ifa_rtrequest(RTM_DELETE, rt, gate); IFAFREE(rt->rt_ifa); rt->rt_ifa = ifa; ifa->ifa_refcnt++; rt->rt_ifp = ifp; } } rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &rt->rt_rmx); if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); if (genmask) rt->rt_genmask = genmask; /* * Fall into */ case RTM_LOCK: rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); rt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); break; } break; default: senderr(EOPNOTSUPP); }flush: if (rtm) { if (error) rtm->rtm_errno = error; else rtm->rtm_flags |= RTF_DONE; } if (rt) rtfree(rt); { register struct rawcb *rp = 0; /* * Check to see if we don't want our own messages. */ if ((so->so_options & SO_USELOOPBACK) == 0) { if (route_cb.any_count <= 1) { if (rtm) Free(rtm); m_freem(m); return (error); } /* There is another listener, so construct message */ rp = sotorawcb(so); } if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); Free(rtm); } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (dst) route_proto.sp_protocol = dst->sa_family; raw_input(m, &route_proto, &route_src, &route_dst); if (rp) rp->rcb_proto.sp_family = PF_ROUTE; } return (error);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/rtsock.c/clean/cpukit/libnetworking/net/rtsock.c |
} else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) | } else if ((rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh))) | rt_msg1 __P((int, struct rt_addrinfo *));static int rt_msg2 __P((int, struct rt_addrinfo *, caddr_t, struct walkarg *));static int rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *));static int sysctl_dumpentry __P((struct radix_node *rn, void *vw));static int sysctl_iflist __P((int af, struct walkarg *w));static int route_output __P((struct mbuf *, struct socket *));static int route_usrreq __P((struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *));static void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *));/* Sleazy use of local variables throughout file, warning!!!! */#define dst info.rti_info[RTAX_DST]#define gate info.rti_info[RTAX_GATEWAY]#define netmask info.rti_info[RTAX_NETMASK]#define genmask info.rti_info[RTAX_GENMASK]#define ifpaddr info.rti_info[RTAX_IFP]#define ifaaddr info.rti_info[RTAX_IFA]#define brdaddr info.rti_info[RTAX_BRD]/*ARGSUSED*/static introute_usrreq(so, req, m, nam, control) register struct socket *so; int req; struct mbuf *m, *nam, *control;{ register int error = 0; register struct rawcb *rp = sotorawcb(so); int s; if (req == PRU_ATTACH) { MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK); so->so_pcb = (caddr_t)rp; if (so->so_pcb) bzero(so->so_pcb, sizeof(*rp)); } if (req == PRU_DETACH && rp) { int af = rp->rcb_proto.sp_protocol; if (af == AF_INET) route_cb.ip_count--; else if (af == AF_IPX) route_cb.ipx_count--; else if (af == AF_NS) route_cb.ns_count--; else if (af == AF_ISO) route_cb.iso_count--; route_cb.any_count--; } s = splnet(); error = raw_usrreq(so, req, m, nam, control); rp = sotorawcb(so); if (req == PRU_ATTACH && rp) { int af = rp->rcb_proto.sp_protocol; if (error) { free((caddr_t)rp, M_PCB); splx(s); return (error); } if (af == AF_INET) route_cb.ip_count++; else if (af == AF_IPX) route_cb.ipx_count++; else if (af == AF_NS) route_cb.ns_count++; else if (af == AF_ISO) route_cb.iso_count++; rp->rcb_faddr = &route_src; route_cb.any_count++; soisconnected(so); so->so_options |= SO_USELOOPBACK; } splx(s); return (error);}/*ARGSUSED*/static introute_output(m, so) register struct mbuf *m; struct socket *so;{ register struct rt_msghdr *rtm = 0; register struct rtentry *rt = 0; struct rtentry *saved_nrt = 0; struct radix_node_head *rnh; struct rt_addrinfo info; int len, error = 0; struct ifnet *ifp = 0; struct ifaddr *ifa = 0;#define senderr(e) { error = e; goto flush;} if (m == 0 || ((m->m_len < sizeof(long)) && (m = m_pullup(m, sizeof(long))) == 0)) return (ENOBUFS); if ((m->m_flags & M_PKTHDR) == 0) panic("route_output"); len = m->m_pkthdr.len; if (len < sizeof(*rtm) || len != mtod(m, struct rt_msghdr *)->rtm_msglen) { dst = 0; senderr(EINVAL); } R_Malloc(rtm, struct rt_msghdr *, len); if (rtm == 0) { dst = 0; senderr(ENOBUFS); } m_copydata(m, 0, len, (caddr_t)rtm); if (rtm->rtm_version != RTM_VERSION) { dst = 0; senderr(EPROTONOSUPPORT); } info.rti_addrs = rtm->rtm_addrs; if (rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info)) { dst = 0; senderr(EINVAL); } if (dst == 0 || (dst->sa_family >= AF_MAX) || (gate != 0 && (gate->sa_family >= AF_MAX))) senderr(EINVAL); if (genmask) { struct radix_node *t; t = rn_addmask((caddr_t)genmask, 0, 1); if (t && Bcmp(genmask, t->rn_key, *(u_char *)genmask) == 0) genmask = (struct sockaddr *)(t->rn_key); else senderr(ENOBUFS); } switch (rtm->rtm_type) { case RTM_ADD: if (gate == 0) senderr(EINVAL); error = rtrequest(RTM_ADD, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0 && saved_nrt) { rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &saved_nrt->rt_rmx); saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); saved_nrt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); saved_nrt->rt_refcnt--; saved_nrt->rt_genmask = genmask; } break; case RTM_DELETE: error = rtrequest(RTM_DELETE, dst, gate, netmask, rtm->rtm_flags, &saved_nrt); if (error == 0) { if ((rt = saved_nrt)) rt->rt_refcnt++; goto report; } break; case RTM_GET: case RTM_CHANGE: case RTM_LOCK: if ((rnh = rt_tables[dst->sa_family]) == 0) { senderr(EAFNOSUPPORT); } else if (rt = (struct rtentry *) rnh->rnh_lookup(dst, netmask, rnh)) rt->rt_refcnt++; else senderr(ESRCH); switch(rtm->rtm_type) { case RTM_GET: report: dst = rt_key(rt); gate = rt->rt_gateway; netmask = rt_mask(rt); genmask = rt->rt_genmask; if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { ifp = rt->rt_ifp; if (ifp) { ifpaddr = ifp->if_addrlist->ifa_addr; ifaaddr = rt->rt_ifa->ifa_addr; rtm->rtm_index = ifp->if_index; } else { ifpaddr = 0; ifaaddr = 0; } } len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, (struct walkarg *)0); if (len > rtm->rtm_msglen) { struct rt_msghdr *new_rtm; R_Malloc(new_rtm, struct rt_msghdr *, len); if (new_rtm == 0) senderr(ENOBUFS); Bcopy(rtm, new_rtm, rtm->rtm_msglen); Free(rtm); rtm = new_rtm; } (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, (struct walkarg *)0); rtm->rtm_flags = rt->rt_flags; rtm->rtm_rmx = rt->rt_rmx; rtm->rtm_addrs = info.rti_addrs; break; case RTM_CHANGE: if (gate && (error = rt_setgate(rt, rt_key(rt), gate))) senderr(error); /* * If they tried to change things but didn't specify * the required gateway, then just use the old one. * This can happen if the user tries to change the * flags on the default route without changing the * default gateway. Changing flags still doesn't work. */ if ((rt->rt_flags & RTF_GATEWAY) && !gate) gate = rt->rt_gateway; /* new gateway could require new ifaddr, ifp; flags may also be different; ifp may be specified by ll sockaddr when protocol address is ambiguous */ if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && (ifp = ifa->ifa_ifp) && (ifaaddr || gate)) ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, ifp); else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || (gate && (ifa = ifa_ifwithroute(rt->rt_flags, rt_key(rt), gate)))) ifp = ifa->ifa_ifp; if (ifa) { register struct ifaddr *oifa = rt->rt_ifa; if (oifa != ifa) { if (oifa && oifa->ifa_rtrequest) oifa->ifa_rtrequest(RTM_DELETE, rt, gate); IFAFREE(rt->rt_ifa); rt->rt_ifa = ifa; ifa->ifa_refcnt++; rt->rt_ifp = ifp; } } rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &rt->rt_rmx); if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); if (genmask) rt->rt_genmask = genmask; /* * Fall into */ case RTM_LOCK: rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); rt->rt_rmx.rmx_locks |= (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); break; } break; default: senderr(EOPNOTSUPP); }flush: if (rtm) { if (error) rtm->rtm_errno = error; else rtm->rtm_flags |= RTF_DONE; } if (rt) rtfree(rt); { register struct rawcb *rp = 0; /* * Check to see if we don't want our own messages. */ if ((so->so_options & SO_USELOOPBACK) == 0) { if (route_cb.any_count <= 1) { if (rtm) Free(rtm); m_freem(m); return (error); } /* There is another listener, so construct message */ rp = sotorawcb(so); } if (rtm) { m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); Free(rtm); } if (rp) rp->rcb_proto.sp_family = 0; /* Avoid us */ if (dst) route_proto.sp_protocol = dst->sa_family; raw_input(m, &route_proto, &route_src, &route_dst); if (rp) rp->rcb_proto.sp_family = PF_ROUTE; } return (error);}static voidrt_setmetrics(which, in, out) u_long which; register struct rt_metrics *in, *out;{#define metric(f, e) if (which & (f)) out->e = in->e; metric(RTV_RPIPE, rmx_recvpipe); metric(RTV_SPIPE, rmx_sendpipe); metric(RTV_SSTHRESH, rmx_ssthresh); metric(RTV_RTT, rmx_rtt); metric(RTV_RTTVAR, rmx_rttvar); metric(RTV_HOPCOUNT, rmx_hopcount); metric(RTV_MTU, rmx_mtu); metric(RTV_EXPIRE, rmx_expire);#undef metric}#define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))/* * Extract the addresses of the passed sockaddrs. * Do a little sanity checking so as to avoid bad memory references. * This data is derived straight from userland. */static intrt_xaddrs(cp, cplim, rtinfo) register caddr_t cp, cplim; register struct rt_addrinfo *rtinfo;{ register struct sockaddr *sa; register int i; bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info)); for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { if ((rtinfo->rti_addrs & (1 << i)) == 0) continue; sa = (struct sockaddr *)cp; /* * It won't fit. */ if ( (cp + sa->sa_len) > cplim ) { return (EINVAL); } /* * there are no more.. quit now * If there are more bits, they are in error. * I've seen this. route(1) can evidently generate these. * This causes kernel to core dump. * for compatibility, If we see this, point to a safe address. */ if (sa->sa_len == 0) { rtinfo->rti_info[i] = &sa_zero; return (0); /* should be EINVAL but for compat */ } /* accept it */ rtinfo->rti_info[i] = sa; ADVANCE(cp, sa); } return (0);}static struct mbuf *rt_msg1(type, rtinfo) int type; register struct rt_addrinfo *rtinfo;{ register struct rt_msghdr *rtm; register struct mbuf *m; register int i; register struct sockaddr *sa; int len, dlen; m = m_gethdr(M_DONTWAIT, MT_DATA); if (m == 0) return (m); switch (type) { case RTM_DELADDR: case RTM_NEWADDR: len = sizeof(struct ifa_msghdr); break; case RTM_IFINFO: len = sizeof(struct if_msghdr); break; default: len = sizeof(struct rt_msghdr); } if (len > MHLEN) panic("rt_msg1"); m->m_pkthdr.len = m->m_len = len; m->m_pkthdr.rcvif = 0; rtm = mtod(m, struct rt_msghdr *); bzero((caddr_t)rtm, len); for (i = 0; i < RTAX_MAX; i++) { if ((sa = rtinfo->rti_info[i]) == NULL) continue; rtinfo->rti_addrs |= (1 << i); dlen = ROUNDUP(sa->sa_len); m_copyback(m, len, dlen, (caddr_t)sa); len += dlen; } if (m->m_pkthdr.len != len) { m_freem(m); return (NULL); } rtm->rtm_msglen = len; rtm->rtm_version = RTM_VERSION; rtm->rtm_type = type; return (m);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/rtsock.c/clean/cpukit/libnetworking/net/rtsock.c |
long i,l,ec,av,tetpil; | ulong av = avma; long i,l,ec; | laplace(GEN x){ long i,l,ec,av,tetpil; GEN y,p1; if (typ(x)!=t_SER) err(talker,"not a series in laplace"); if (gcmp0(x)) return gcopy(x); av=avma; ec=valp(x); if (ec<0) err(talker,"negative valuation in laplace"); l=lg(x); y=cgetg(l,t_SER); p1=mpfact(ec); y[1]=x[1]; for (i=2; i<l; i++) { y[i]=lmul(p1,(GEN)x[i]); ec++; p1=mulsi(ec,p1); } tetpil=avma; return gerepile(av,tetpil,gcopy(y));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/bibli2.c/buggy/src/basemath/bibli2.c |
av=avma; ec=valp(x); | ec = valp(x); | laplace(GEN x){ long i,l,ec,av,tetpil; GEN y,p1; if (typ(x)!=t_SER) err(talker,"not a series in laplace"); if (gcmp0(x)) return gcopy(x); av=avma; ec=valp(x); if (ec<0) err(talker,"negative valuation in laplace"); l=lg(x); y=cgetg(l,t_SER); p1=mpfact(ec); y[1]=x[1]; for (i=2; i<l; i++) { y[i]=lmul(p1,(GEN)x[i]); ec++; p1=mulsi(ec,p1); } tetpil=avma; return gerepile(av,tetpil,gcopy(y));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/bibli2.c/buggy/src/basemath/bibli2.c |
tetpil=avma; return gerepile(av,tetpil,gcopy(y)); | return gerepilecopy(av,y); | laplace(GEN x){ long i,l,ec,av,tetpil; GEN y,p1; if (typ(x)!=t_SER) err(talker,"not a series in laplace"); if (gcmp0(x)) return gcopy(x); av=avma; ec=valp(x); if (ec<0) err(talker,"negative valuation in laplace"); l=lg(x); y=cgetg(l,t_SER); p1=mpfact(ec); y[1]=x[1]; for (i=2; i<l; i++) { y[i]=lmul(p1,(GEN)x[i]); ec++; p1=mulsi(ec,p1); } tetpil=avma; return gerepile(av,tetpil,gcopy(y));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/bibli2.c/buggy/src/basemath/bibli2.c |
if (gcmp0(x)) return zeroser(vx,e-1); | if (gcmp0(x)) return zeroser(vx,e? e-1: 0); | derivser(GEN x){ long i,j,vx = varn(x), e = valp(x), lx = lg(x); GEN y; if (gcmp0(x)) return zeroser(vx,e-1); if (e) { y=cgetg(lx,t_SER); y[1] = evalsigne(1) | evalvalp(e-1) | evalvarn(vx); for (i=2; i<lx; i++) y[i]=lmulsg(i+e-2,(GEN)x[i]); return y; } i=3; while (i<lx && gcmp0((GEN)x[i])) i++; if (i==lx) return zeroser(vx,lx-3); lx--; if (lx<3) lx=3; lx = lx-i+3; y=cgetg(lx,t_SER); y[1]=evalsigne(1) | evalvalp(i-3) | evalvarn(vx); for (j=2; j<lx; j++) y[j]=lmulsg(j+i-4,(GEN)x[i+j-2]); return y;} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/aa9c2ed60e5aa6a606da65d80fb019a9bcc7c2a9/gen3.c/clean/src/basemath/gen3.c |
long i, j, lgsub, ino, lv = KC+1; | long i, j, lgsub, ino, minSFB, lv = KC+1; | subFBquad(GEN D, double PROD, long KC){ long i, j, lgsub, ino, lv = KC+1; double prod = 1.; pari_sp av; GEN no; vperm = cgetg(lv, t_VECSMALL); av = avma; no = cgetg(lv, t_VECSMALL); ino = 1; for (i=j=1; j < lv; j++) { long p = FB[j]; if (smodis(D, p) == 0) no[ino++] = j; /* ramified */ else { vperm[i] = j; i++; prod *= p; if (i > 2 && prod > PROD) break; } } if (j == lv) return NULL; lgsub = i; for (j = 1; j <ino; i++,j++) vperm[i] = no[j]; for ( ; i < lv; i++) vperm[i] = i; avma = av; if (DEBUGLEVEL) msgtimer("subFBquad (%ld elt.)", lgsub-1); return vecextract_i(vperm, 1, lgsub-1);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/715305d902d7f2ad671dc1e7c723528ccf2d3a61/buch1.c/buggy/src/basemath/buch1.c |
if (i > 2 && prod > PROD) break; | if (i > minSFB && prod > PROD) break; | subFBquad(GEN D, double PROD, long KC){ long i, j, lgsub, ino, lv = KC+1; double prod = 1.; pari_sp av; GEN no; vperm = cgetg(lv, t_VECSMALL); av = avma; no = cgetg(lv, t_VECSMALL); ino = 1; for (i=j=1; j < lv; j++) { long p = FB[j]; if (smodis(D, p) == 0) no[ino++] = j; /* ramified */ else { vperm[i] = j; i++; prod *= p; if (i > 2 && prod > PROD) break; } } if (j == lv) return NULL; lgsub = i; for (j = 1; j <ino; i++,j++) vperm[i] = no[j]; for ( ; i < lv; i++) vperm[i] = i; avma = av; if (DEBUGLEVEL) msgtimer("subFBquad (%ld elt.)", lgsub-1); return vecextract_i(vperm, 1, lgsub-1);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/715305d902d7f2ad671dc1e7c723528ccf2d3a61/buch1.c/buggy/src/basemath/buch1.c |
char new_name[ NAME_MAX + 1 ]; | char new_name[ IMFS_NAME_MAX + 1 ]; | int IMFS_symlink( rtems_filesystem_location_info_t *parent_loc, const char *link_name, const char *node_name){ IMFS_types_union info; IMFS_jnode_t *new_node; char new_name[ NAME_MAX + 1 ]; int i; /* * Remove any separators at the end of the string. */ IMFS_get_token( node_name, new_name, &i ); info.sym_link.name = link_name; /* * Create a new link node. */ new_node = IMFS_create_node( parent_loc, IMFS_SYM_LINK, new_name, ( S_IFLNK | ( S_IRWXU | S_IRWXG | S_IRWXO )), &info ); if ( !new_node ) set_errno_and_return_minus_one( ENOMEM ); return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/3cf8394af5f646642df593c8de833441e186af64/imfs_symlink.c/clean/cpukit/libfs/src/imfs/imfs_symlink.c |
/* | static void serf_limit_destroy(serf_bucket_t *bucket){ limit_context_t *ctx = bucket->data; /* serf_bucket_destroy(ctx->stream); */ serf_default_destroy_and_data(bucket);} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c161a2e07956023692bfee04809ffa7069c8def2/limit_buckets.c/buggy/buckets/limit_buckets.c |
|
*/ | static void serf_limit_destroy(serf_bucket_t *bucket){ limit_context_t *ctx = bucket->data; /* serf_bucket_destroy(ctx->stream); */ serf_default_destroy_and_data(bucket);} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/c161a2e07956023692bfee04809ffa7069c8def2/limit_buckets.c/buggy/buckets/limit_buckets.c |
|
if (ctx->state == READ_DONE) { *len = 0; return APR_EOF; } | static apr_status_t serf_headers_readline(serf_bucket_t *bucket, int acceptable, int *found, const char **data, apr_size_t *len){ headers_context_t *ctx = bucket->data; apr_status_t status; /* ### what behavior should we use here? abort() isn't very friendly */ if ((acceptable & SERF_NEWLINE_CRLF) == 0) abort(); if (ctx->state == READ_DONE) { *len = 0; return APR_EOF; } /* get whatever is in this chunk */ select_value(ctx, data, len); /* we consumed this chunk. advance the state. */ status = consume_chunk(ctx); /* the type of newline found is easy... */ *found = ctx->state == READ_CRLF ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; return status;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/b5b74a30055b33cbaf6ee787b0b1c5974a22f822/headers_buckets.c/clean/buckets/headers_buckets.c |
|
*found = ctx->state == READ_CRLF ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; | *found = (ctx->state == READ_CRLF || ctx->state == READ_TERM) ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; | static apr_status_t serf_headers_readline(serf_bucket_t *bucket, int acceptable, int *found, const char **data, apr_size_t *len){ headers_context_t *ctx = bucket->data; apr_status_t status; /* ### what behavior should we use here? abort() isn't very friendly */ if ((acceptable & SERF_NEWLINE_CRLF) == 0) abort(); if (ctx->state == READ_DONE) { *len = 0; return APR_EOF; } /* get whatever is in this chunk */ select_value(ctx, data, len); /* we consumed this chunk. advance the state. */ status = consume_chunk(ctx); /* the type of newline found is easy... */ *found = ctx->state == READ_CRLF ? SERF_NEWLINE_CRLF : SERF_NEWLINE_NONE; return status;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/b5b74a30055b33cbaf6ee787b0b1c5974a22f822/headers_buckets.c/clean/buckets/headers_buckets.c |
(*pos)->Imports(list); | int main( int argc, char ** argv ){ try { CommandOptionParse * args = makeCommandOptionParse( argc, argv, "\n" "Usage: nmdepend [option(s)] [file(s)]\n" "The options are:" ); if ( option_version.numSet ) { cerr << "nmdepend version 0.1.0 (" __DATE__ ")" << endl; ::exit(0); } if ( helparg.numSet ) { cerr << args->printUsage(); ::exit(0); } args->performTask(); filelist_t list; // print all the other options. for ( int i = 0; i < restoargs.numValue; i ++ ) { fs::path root(restoargs.values[i]); find_file(root, list);//creates list of *.o files } Symbol::SymbolIndex_t symbolIndex; //why use vectors of pointers and not vectors of objects? //this uses two indirections instead of one; //todo change to object container instead of pointer to object container typedef std::vector<ObjectFile*> ObjectList_t; typedef std::vector<Package*> PackageList_t; ObjectList_t objectList; PackageList_t packageList; Package::PackageRegistry_t packages; for(filelist_t::iterator pos = list.begin(); pos != list.end(); ++pos) { //todo define packages as collection of object files //using config setting fs::path::iterator p = pos->end(); --p; //file std::string name = *p; --p; //directory containing file -> Release or Debug using msvc --p; // 1 level higher for visual studio std::string packagename = *p; ObjectFile* o = new ObjectFile(name,symbolIndex); //memory leak Package* pack = packages[packagename]; if (pack == 0) { //std::cout << "Adding package " << packagename << std::endl; pack = new Package(packagename); //memory leak packages[packagename] = pack; } o->Read(*pos); o->SetParent(*pack); objectList.push_back(o); } for (ObjectList_t::iterator pos = objectList.begin(); pos != objectList.end(); ++pos) { (*pos)->Link(); } std::ofstream dotfile; dotfile.open("object.dot"); dotfile << "digraph G {" << std::endl; dotfile << "node [shape=box];" << std::endl; for (ObjectList_t::iterator pos = objectList.begin(); pos != objectList.end(); ++pos) { Package::SubPackageList_t list; // (*pos)->Imports(list); for (Package::SubPackageList_t::iterator package = list.begin(); package != list.end(); ++package) { dotfile << (*pos)->Name2() << " -> " << (*package)->Name2() << ";" << std::endl; } } dotfile << "}" << std::endl; dotfile.close(); dotfile.open("package.dot"); dotfile << "digraph G {" << std::endl; dotfile << "node [shape=box];" << std::endl; for (Package::PackageRegistry_t::iterator pos = packages.begin(); pos != packages.end(); ++pos) { Package::SubPackageList_t list; //pos->second->Imports(list); for (Package::SubPackageList_t::iterator package = list.begin(); package != list.end(); ++package) { dotfile << pos->first << " -> " << (*package)->Name2() << ";" << std::endl; //std::cout << "Super " << pos->first << " -> " // << (*package)->Name2() << ";" << std::endl; //(*package)->Imports(); } } dotfile << "}" << std::endl; dotfile.close(); delete args; return 0; } catch(const std::exception& e) { std::clog << "exception: " << e.what() << std::endl; } catch(...) { std::clog << "caught unknown exception, exiting" << std::endl; } return 1;} | 7945 /local/tlutelli/issta_data/temp/c/2005_temp/2005/7945/9cbf8e4bd2b59a2e1e5642e031f69f9bc3d3d692/Nmdepend.cpp/buggy/src/Nmdepend.cpp |
|
pos->second->Imports(list); | int main( int argc, char ** argv ){ try { CommandOptionParse * args = makeCommandOptionParse( argc, argv, "\n" "Usage: nmdepend [option(s)] [file(s)]\n" "The options are:" ); if ( option_version.numSet ) { cerr << "nmdepend version 0.1.0 (" __DATE__ ")" << endl; ::exit(0); } if ( helparg.numSet ) { cerr << args->printUsage(); ::exit(0); } args->performTask(); filelist_t list; // print all the other options. for ( int i = 0; i < restoargs.numValue; i ++ ) { fs::path root(restoargs.values[i]); find_file(root, list);//creates list of *.o files } Symbol::SymbolIndex_t symbolIndex; //why use vectors of pointers and not vectors of objects? //this uses two indirections instead of one; //todo change to object container instead of pointer to object container typedef std::vector<ObjectFile*> ObjectList_t; typedef std::vector<Package*> PackageList_t; ObjectList_t objectList; PackageList_t packageList; Package::PackageRegistry_t packages; for(filelist_t::iterator pos = list.begin(); pos != list.end(); ++pos) { //todo define packages as collection of object files //using config setting fs::path::iterator p = pos->end(); --p; //file std::string name = *p; --p; //directory containing file -> Release or Debug using msvc --p; // 1 level higher for visual studio std::string packagename = *p; ObjectFile* o = new ObjectFile(name,symbolIndex); //memory leak Package* pack = packages[packagename]; if (pack == 0) { //std::cout << "Adding package " << packagename << std::endl; pack = new Package(packagename); //memory leak packages[packagename] = pack; } o->Read(*pos); o->SetParent(*pack); objectList.push_back(o); } for (ObjectList_t::iterator pos = objectList.begin(); pos != objectList.end(); ++pos) { (*pos)->Link(); } std::ofstream dotfile; dotfile.open("object.dot"); dotfile << "digraph G {" << std::endl; dotfile << "node [shape=box];" << std::endl; for (ObjectList_t::iterator pos = objectList.begin(); pos != objectList.end(); ++pos) { Package::SubPackageList_t list; // (*pos)->Imports(list); for (Package::SubPackageList_t::iterator package = list.begin(); package != list.end(); ++package) { dotfile << (*pos)->Name2() << " -> " << (*package)->Name2() << ";" << std::endl; } } dotfile << "}" << std::endl; dotfile.close(); dotfile.open("package.dot"); dotfile << "digraph G {" << std::endl; dotfile << "node [shape=box];" << std::endl; for (Package::PackageRegistry_t::iterator pos = packages.begin(); pos != packages.end(); ++pos) { Package::SubPackageList_t list; //pos->second->Imports(list); for (Package::SubPackageList_t::iterator package = list.begin(); package != list.end(); ++package) { dotfile << pos->first << " -> " << (*package)->Name2() << ";" << std::endl; //std::cout << "Super " << pos->first << " -> " // << (*package)->Name2() << ";" << std::endl; //(*package)->Imports(); } } dotfile << "}" << std::endl; dotfile.close(); delete args; return 0; } catch(const std::exception& e) { std::clog << "exception: " << e.what() << std::endl; } catch(...) { std::clog << "caught unknown exception, exiting" << std::endl; } return 1;} | 7945 /local/tlutelli/issta_data/temp/c/2005_temp/2005/7945/9cbf8e4bd2b59a2e1e5642e031f69f9bc3d3d692/Nmdepend.cpp/buggy/src/Nmdepend.cpp |
|
printf("0%o\n",msk); | printf("0%o\n", (unsigned int) msk); | int main_umask(int argc,char *argv[]) { mode_t msk=umask(0); if (argc == 2) msk=str2int(argv[1]); umask(msk); msk=umask(0); printf("0%o\n",msk); umask(msk); return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/b2b143f402b30c7bbe4ee98c58221b0cc78a1e9e/cmds.c/clean/cpukit/libmisc/shell/cmds.c |
void __gnat_signals_Abormal_termination_handler( int signo ) | __gnat_signals_Abormal_termination_handler (int signo) | void __gnat_signals_Abormal_termination_handler( int signo ){ switch ( signo ) { case SIGFPE: DEBUG_puts("\nConstraint_Error\n"); break; case SIGSEGV: DEBUG_puts("\nStorage_Error\n"); break; default: DEBUG_puts("\nProgram_Error\n"); break; } exit( 1 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f42fb02e1d0c406291cd6e78b8484d5a66b2e963/gnatsupp.c/buggy/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c |
switch ( signo ) { case SIGFPE: DEBUG_puts("\nConstraint_Error\n"); break; case SIGSEGV: DEBUG_puts("\nStorage_Error\n"); break; default: DEBUG_puts("\nProgram_Error\n"); break; } exit( 1 ); | switch (signo) { case SIGFPE: DEBUG_puts ("\nConstraint_Error\n"); break; case SIGSEGV: DEBUG_puts ("\nStorage_Error\n"); break; default: DEBUG_puts ("\nProgram_Error\n"); break; } exit (1); | void __gnat_signals_Abormal_termination_handler( int signo ){ switch ( signo ) { case SIGFPE: DEBUG_puts("\nConstraint_Error\n"); break; case SIGSEGV: DEBUG_puts("\nStorage_Error\n"); break; default: DEBUG_puts("\nProgram_Error\n"); break; } exit( 1 );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/f42fb02e1d0c406291cd6e78b8484d5a66b2e963/gnatsupp.c/buggy/c/src/lib/libbsp/sparc/erc32/gnatsupp/gnatsupp.c |
int rtems_gxx_once(__gthread_once_t *once, void (*func) ()) | int rtems_gxx_once(__gthread_once_t *once, void (*func) (void)) | int rtems_gxx_once(__gthread_once_t *once, void (*func) ()){#ifdef DEBUG_GXX_WRAPPERS printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );#endif if( *(volatile __gthread_once_t *)once == 0 ) { rtems_mode saveMode; rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode); if( *(volatile __gthread_once_t *)once == 0 ) { *(volatile __gthread_once_t *)once = 1; (*func)(); } rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode); } return 0;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/616b9f56cab411e76bed5fe759aa762f770bd595/gxx_wrappers.c/clean/c/src/lib/libc/gxx_wrappers.c |
while (isdigit(*cp)) | while (isdigit((int)*cp)) | precsize_aton(strptr) char **strptr;{ unsigned int mval = 0, cmval = 0; u_int8_t retval = 0; char *cp; int exponent; int mantissa; cp = *strptr; while (isdigit(*cp)) mval = mval * 10 + (*cp++ - '0'); if (*cp == '.') { /* centimeters */ cp++; if (isdigit(*cp)) { cmval = (*cp++ - '0') * 10; if (isdigit(*cp)) { cmval += (*cp++ - '0'); } } } cmval = (mval * 100) + cmval; for (exponent = 0; exponent < 9; exponent++) if (cmval < poweroften[exponent+1]) break; mantissa = cmval / poweroften[exponent]; if (mantissa > 9) mantissa = 9; retval = (mantissa << 4) | exponent; *strptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/exec/libnetworking/libc/res_debug.c |
if (isdigit(*cp)) { | if (isdigit((int)*cp)) { | precsize_aton(strptr) char **strptr;{ unsigned int mval = 0, cmval = 0; u_int8_t retval = 0; char *cp; int exponent; int mantissa; cp = *strptr; while (isdigit(*cp)) mval = mval * 10 + (*cp++ - '0'); if (*cp == '.') { /* centimeters */ cp++; if (isdigit(*cp)) { cmval = (*cp++ - '0') * 10; if (isdigit(*cp)) { cmval += (*cp++ - '0'); } } } cmval = (mval * 100) + cmval; for (exponent = 0; exponent < 9; exponent++) if (cmval < poweroften[exponent+1]) break; mantissa = cmval / poweroften[exponent]; if (mantissa > 9) mantissa = 9; retval = (mantissa << 4) | exponent; *strptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/exec/libnetworking/libc/res_debug.c |
if (isdigit(*cp)) { | if (isdigit((int)*cp)) { | precsize_aton(strptr) char **strptr;{ unsigned int mval = 0, cmval = 0; u_int8_t retval = 0; char *cp; int exponent; int mantissa; cp = *strptr; while (isdigit(*cp)) mval = mval * 10 + (*cp++ - '0'); if (*cp == '.') { /* centimeters */ cp++; if (isdigit(*cp)) { cmval = (*cp++ - '0') * 10; if (isdigit(*cp)) { cmval += (*cp++ - '0'); } } } cmval = (mval * 100) + cmval; for (exponent = 0; exponent < 9; exponent++) if (cmval < poweroften[exponent+1]) break; mantissa = cmval / poweroften[exponent]; if (mantissa > 9) mantissa = 9; retval = (mantissa << 4) | exponent; *strptr = cp; return (retval);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/ff0f694d466fb114c185bf464811658f97d012f1/res_debug.c/clean/c/src/exec/libnetworking/libc/res_debug.c |
so_ioctl (struct socket *so, unsigned32 command, void *buffer) | so_ioctl (rtems_libio_t *iop, struct socket *so, unsigned32 command, void *buffer) | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/exec/libnetworking/rtems/rtems_syscall.c |
if (*(int *)buffer) | if (*(int *)buffer) { iop->flags |= O_NONBLOCK; | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/exec/libnetworking/rtems/rtems_syscall.c |
else | } else { iop->flags &= ~O_NONBLOCK; | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/exec/libnetworking/rtems/rtems_syscall.c |
} | so_ioctl (struct socket *so, unsigned32 command, void *buffer){ switch (command) { case FIONBIO: if (*(int *)buffer) so->so_state |= SS_NBIO; else so->so_state &= ~SS_NBIO; return 0; case FIONREAD: *(int *)buffer = so->so_rcv.sb_cc; return 0; } if (IOCGROUP(command) == 'i') return ifioctl (so, command, buffer, NULL); if (IOCGROUP(command) == 'r') return rtioctl (command, buffer, NULL); return (*so->so_proto->pr_usrreqs->pru_control)(so, command, buffer, 0);} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/af0200363e8d0a69648bd78fd5ee2d0ee5f40624/rtems_syscall.c/clean/c/src/exec/libnetworking/rtems/rtems_syscall.c |
|
m_reclaim() | m_reclaim(void) | m_reclaim(){ register struct domain *dp; register struct protosw *pr; int s = splimp(); for (dp = domains; dp; dp = dp->dom_next) for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) if (pr->pr_drain) (*pr->pr_drain)(); splx(s); mbstat.m_drain++;} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/11cdbebd585380dfd5b030612158b083cee50ad4/uipc_mbuf.c/buggy/c/src/exec/libnetworking/kern/uipc_mbuf.c |
Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; | char Buffer[ BUFFER_SIZE ]; Line_Control *line; Line_Control *next_node; Line_Control *up_node; Line_Control *new_line; Line_Control *menu_insert_point; Line_Control *node_line; int next_found; int menu_items; Keyword_indices_t index; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; /* * Set Initial Previous Node Name */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
!_Chain_Is_last( &line->Node ) ; | !_Chain_Is_last( &line->Node ) ; | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
) { | ) { | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
menu_insert_point = (Line_Control *) line->Node.next; | if ( line->level == -1 ) continue; | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: | LineCopyFromRight( line, NodeName ); if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { strcpy( ChapterName, NodeName ); } /* * Set Default Next Node Name */ next_found = FALSE; strcpy( NextNodeName, DocsNextNode ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; menu_insert_point = next_node; menu_items = 0; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
|
if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); | if ( next_node->level == -1 ) goto continue_menu_loop; | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
/* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ | LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; if (NodeNameIncludesChapter) sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); else sprintf( NextNodeName, "%s", Buffer ); } if ( next_node->level <= line->level ) break; if ( next_node->level != (line->level + 1) ) goto continue_menu_loop; if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); | strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); | menu_items++; | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); | new_line = AllocateLine(); if (NodeNameIncludesChapter) sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); else sprintf( new_line->Contents, "* %s::", Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } | continue_menu_loop: next_node = (Line_Control *) next_node->Node.next; } | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); | /* * If menu items were generated, then insert the end of menu stuff. */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } | if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
menu_items++; | new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ | /* * Find the UpNodeName */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); | /* DumpList( &Lines ); */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } | if ( line->level == 0 ) { strcpy( UpNodeName, DocsUpNode ); } else { for ( up_node = line; up_node && !_Chain_Is_first((Chain_Node *)up_node) ; up_node = (Line_Control *) up_node->Node.previous ) { | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
menu_items++; | if ( (up_node->level == -1) ) continue; if ( up_node->level == (line->level - 1) ) { LineCopySectionName( up_node, Buffer ); if (NodeNameIncludesChapter) sprintf( UpNodeName, "%s %s", ChapterName, Buffer ); else sprintf( UpNodeName, "%s", Buffer ); break; } } } | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } #if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); #endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; } | /* * Update the node information */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); | fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
|
new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); | /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
strcpy( PreviousNodeName, NodeName ); break; } | strcpy( PreviousNodeName, NodeName ); /* PrintLine( line ); */ | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
bottom: | void BuildTexinfoNodes( void ) { Line_Control *line; Line_Control *new_line; Line_Control *next_node; char Buffer[ BUFFER_SIZE ]; char ChapterName[ BUFFER_SIZE ]; char NodeName[ BUFFER_SIZE ]; char NextNode[ BUFFER_SIZE ]; char NextNodeName[ BUFFER_SIZE ]; char PreviousNodeName[ BUFFER_SIZE ]; char UpNodeName[ BUFFER_SIZE ]; char SectionName[ BUFFER_SIZE ]; char MenuBuffer[ BUFFER_SIZE ]; Line_Control *node_insert_point; Line_Control *menu_insert_point; Line_Control *node_line; boolean next_found; int menu_items; strcpy( PreviousNodeName, DocsPreviousNode ); for ( line = (Line_Control *) Lines.first ; !_Chain_Is_last( &line->Node ) ; line = (Line_Control *) line->Node.next ) { menu_insert_point = (Line_Control *) line->Node.next; switch ( Keywords[ line->keyword ].level ) { case TEXT: case HEADING: break; case SECTION: if ( line->keyword == KEYWORD_END ) goto bottom; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { LineCopyFromRight( line, ChapterName ); strcpy( UpNodeName, DocsUpNode ); strcpy( NodeName, ChapterName ); } else { LineCopySectionName( line, Buffer ); sprintf( NodeName, "%s %s", ChapterName, Buffer ); strcpy( UpNodeName, ChapterName ); } strcpy( SectionName, NodeName ); /* * Go ahead and put it on the chain in the right order (ahead of * the menu) and we can fill it in later (after the menu is built). */ new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); node_line = AllocateLine(); _Chain_Insert( line->Node.previous, &node_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); menu_items = 0; if ( line->keyword == KEYWORD_CHAPTER || line->keyword == KEYWORD_CHAPHEADING ) { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( next_node->keyword == KEYWORD_END ) break; if ( Keywords[ next_node->keyword ].level == SECTION ) { LineCopySectionName( next_node, Buffer ); if ( !next_found ) { next_found = TRUE; sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s %s::", ChapterName, Buffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } next_node = (Line_Control *) next_node->Node.next; } } else { next_node = (Line_Control *) line->Node.next; next_found = FALSE; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( !next_found ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } next_found = TRUE; } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopySectionName( next_node, MenuBuffer ); /* has next node */ if ( menu_items == 0 ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); } menu_items++; new_line = AllocateLine(); sprintf( new_line->Contents, "* %s::", MenuBuffer ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); if ( !next_found ) { next_found = TRUE; strcpy( NextNodeName, MenuBuffer ); } } next_node = (Line_Control *) next_node->Node.next; } } if ( menu_items ) { new_line = AllocateLine(); strcpy( new_line->Contents, "@end menu" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( menu_insert_point->Node.previous, &new_line->Node ); }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif /* node_line was previously inserted */ sprintf( node_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); strcpy( PreviousNodeName, NodeName ); break; case SUBSECTION: strcpy( UpNodeName, SectionName ); LineCopyFromRight( line, NodeName ); new_line = AllocateLine(); strcpy( new_line->Contents, "@ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); next_node = (Line_Control *) line->Node.next; for ( ; ; ) { if ( Keywords[ next_node->keyword ].level == SECTION ) { if ( next_node->keyword == KEYWORD_END ) { strcpy( NextNodeName, DocsNextNode ); } else { LineCopySectionName( next_node, Buffer ); sprintf( NextNodeName, "%s %s", ChapterName, Buffer ); } break; } else if ( Keywords[ next_node->keyword ].level == SUBSECTION ) { LineCopyFromRight( next_node, NextNodeName ); break; } next_node = (Line_Control *) next_node->Node.next; }#if 0 fprintf( stderr, "@node %s, %s, %s, %s\n", NodeName, NextNodeName, PreviousNodeName, UpNodeName );#endif new_line = AllocateLine(); sprintf( new_line->Contents, "@node %s, %s, %s, %s", NodeName, NextNodeName, PreviousNodeName, UpNodeName ); _Chain_Insert( line->Node.previous, &new_line->Node ); new_line = AllocateLine(); strcpy( new_line->Contents, "@end ifinfo" ); _Chain_Insert( line->Node.previous, &new_line->Node ); strcpy( PreviousNodeName, NodeName ); break; } }bottom:} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/2744eec4952b3280f323d85459e5c90648e7c45d/main.c/clean/doc/tools/bmenu/main.c |
|
return u_FpX_rem(z,pol,p, 0); | return u_FpX_rem(z,pol,p); | u_FpXQ_mul(GEN y,GEN x,GEN pol,ulong p){ GEN z = u_FpX_mul(y,x,p); return u_FpX_rem(z,pol,p, 0);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/8fb106e433493a99b7b083a32bc824515ed57d1c/polarit3.c/buggy/src/basemath/polarit3.c |
idmul(GEN x, GEN y) { return idealmul(static_OBJ, x, y); } | idmul(void *nf, GEN x, GEN y) { return idealmul((GEN) nf, x, y); } | idmul(GEN x, GEN y) { return idealmul(static_OBJ, x, y); } | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d5847452a0a61f4b94c584ee5aed865e7709a077/polarit2.c/clean/src/basemath/polarit2.c |
idpow(GEN x, GEN n) { return idealpow(static_OBJ, x, n); } | idpow(void *nf, GEN x, GEN n) { return idealpow((GEN) nf, x, n); } | idpow(GEN x, GEN n) { return idealpow(static_OBJ, x, n); } | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d5847452a0a61f4b94c584ee5aed865e7709a077/polarit2.c/clean/src/basemath/polarit2.c |
idmulred(GEN x, GEN y) { return idealmulred(static_OBJ, x, y, 0); } | idmulred(void *nf, GEN x, GEN y) { return idealmulred((GEN) nf, x, y, 0); } | idmulred(GEN x, GEN y) { return idealmulred(static_OBJ, x, y, 0); } | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d5847452a0a61f4b94c584ee5aed865e7709a077/polarit2.c/clean/src/basemath/polarit2.c |
if (!OBJ) return _factorback(fa, e, &gmul, &powgi); | if (!OBJ) return _factorback(fa, e, &_agmul, &_apowgi, NULL); | factorback_i(GEN fa, GEN e, GEN OBJ, int red){ if (!OBJ) { if (e) { OBJ = _checknf(e); if (OBJ) e = NULL; } if (!OBJ) return _factorback(fa, e, &gmul, &powgi); } static_OBJ = OBJ; if (red) return _factorback(fa, e, &idmulred, &idpowred); else return _factorback(fa, e, &idmul, &idpow);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d5847452a0a61f4b94c584ee5aed865e7709a077/polarit2.c/clean/src/basemath/polarit2.c |
static_OBJ = OBJ; if (red) return _factorback(fa, e, &idmulred, &idpowred); else return _factorback(fa, e, &idmul, &idpow); | if (red) return _factorback(fa, e, &idmulred, &idpowred, OBJ); else return _factorback(fa, e, &idmul, &idpow, OBJ); | factorback_i(GEN fa, GEN e, GEN OBJ, int red){ if (!OBJ) { if (e) { OBJ = _checknf(e); if (OBJ) e = NULL; } if (!OBJ) return _factorback(fa, e, &gmul, &powgi); } static_OBJ = OBJ; if (red) return _factorback(fa, e, &idmulred, &idpowred); else return _factorback(fa, e, &idmul, &idpow);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/d5847452a0a61f4b94c584ee5aed865e7709a077/polarit2.c/clean/src/basemath/polarit2.c |
triv121PgTblSDR1(Triv121PgTbl pt) | triv121PgTblSDR1 (Triv121PgTbl pt) | triv121PgTblSDR1(Triv121PgTbl pt){ return (((unsigned long)pt->base) & ~(LD_MIN_PT_SIZE-1)) | ( ((pt->size-1) >> LD_MIN_PT_SIZE) & ((1<<(LD_HASH_SIZE-(LD_MIN_PT_SIZE-LD_PTEG_SIZE)))-1) );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c |
return (((unsigned long)pt->base) & ~(LD_MIN_PT_SIZE-1)) | ( ((pt->size-1) >> LD_MIN_PT_SIZE) & ((1<<(LD_HASH_SIZE-(LD_MIN_PT_SIZE-LD_PTEG_SIZE)))-1) ); | return (((unsigned long) pt->base) & ~((1 << LD_MIN_PT_SIZE) - 1)) | (((pt->size - 1) >> LD_MIN_PT_SIZE) & ((1 << (LD_HASH_SIZE - (LD_MIN_PT_SIZE - LD_PTEG_SIZE))) - 1) ); | triv121PgTblSDR1(Triv121PgTbl pt){ return (((unsigned long)pt->base) & ~(LD_MIN_PT_SIZE-1)) | ( ((pt->size-1) >> LD_MIN_PT_SIZE) & ((1<<(LD_HASH_SIZE-(LD_MIN_PT_SIZE-LD_PTEG_SIZE)))-1) );} | 10355 /local/tlutelli/issta_data/temp/c/2005_temp/2005/10355/1b1b43ccc1a6d654199ddb6329366d2e44bdaea3/pte121.c/clean/c/src/lib/libcpu/powerpc/mpc6xx/mmu/pte121.c |
if (ctx->state == READ_DONE) { | if (ctx->state == READ_TERM) { | static apr_status_t consume_chunk(headers_context_t *ctx){ /* move to the next state, resetting the amount read. */ ++ctx->state; ctx->amt_read = 0; /* end of this header. move to the next one. */ if (ctx->state == READ_DONE) { ctx->cur_read = ctx->cur_read->next; if (ctx->cur_read == NULL) { /* there is no more data. leave us at READ_DONE and signal completion to the caller. */ return APR_EOF; } /* there _is_ another header, so reset the read state */ ctx->state = READ_HEADER; } /* there is more data which can be read immediately. */ return APR_SUCCESS;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/b5b74a30055b33cbaf6ee787b0b1c5974a22f822/headers_buckets.c/clean/buckets/headers_buckets.c |
if (ctx->cur_read == NULL) { /* there is no more data. leave us at READ_DONE and signal completion to the caller. */ return APR_EOF; | if (ctx->cur_read != NULL) { /* We've got another head to send. Reset the read state. */ ctx->state = READ_HEADER; | static apr_status_t consume_chunk(headers_context_t *ctx){ /* move to the next state, resetting the amount read. */ ++ctx->state; ctx->amt_read = 0; /* end of this header. move to the next one. */ if (ctx->state == READ_DONE) { ctx->cur_read = ctx->cur_read->next; if (ctx->cur_read == NULL) { /* there is no more data. leave us at READ_DONE and signal completion to the caller. */ return APR_EOF; } /* there _is_ another header, so reset the read state */ ctx->state = READ_HEADER; } /* there is more data which can be read immediately. */ return APR_SUCCESS;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/b5b74a30055b33cbaf6ee787b0b1c5974a22f822/headers_buckets.c/clean/buckets/headers_buckets.c |
/* there _is_ another header, so reset the read state */ ctx->state = READ_HEADER; | /* else leave in READ_TERM */ | static apr_status_t consume_chunk(headers_context_t *ctx){ /* move to the next state, resetting the amount read. */ ++ctx->state; ctx->amt_read = 0; /* end of this header. move to the next one. */ if (ctx->state == READ_DONE) { ctx->cur_read = ctx->cur_read->next; if (ctx->cur_read == NULL) { /* there is no more data. leave us at READ_DONE and signal completion to the caller. */ return APR_EOF; } /* there _is_ another header, so reset the read state */ ctx->state = READ_HEADER; } /* there is more data which can be read immediately. */ return APR_SUCCESS;} | 1874 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1874/b5b74a30055b33cbaf6ee787b0b1c5974a22f822/headers_buckets.c/clean/buckets/headers_buckets.c |
reducebetanaive(GEN bnfz, GEN be, GEN b, long ell) | reducebetanaive(GEN bnfz, GEN be, GEN b, GEN ell) | reducebetanaive(GEN bnfz, GEN be, GEN b, long ell){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) { if (typ(be) != t_COL) be = algtobasis(nf, be); b = gmul(gmael(nf,5,1), be); } n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c); return fix_be(bnfz,be,c);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c |
n = max((ell>>1), 3); | n = max((itos(ell)>>1), 3); | reducebetanaive(GEN bnfz, GEN be, GEN b, long ell){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) { if (typ(be) != t_COL) be = algtobasis(nf, be); b = gmul(gmael(nf,5,1), be); } n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c); return fix_be(bnfz,be,c);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c |
c = gmulgs(greal((GEN)bnfz[3]), ell); | c = gmul(greal((GEN)bnfz[3]), ell); | reducebetanaive(GEN bnfz, GEN be, GEN b, long ell){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) { if (typ(be) != t_COL) be = algtobasis(nf, be); b = gmul(gmael(nf,5,1), be); } n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c); return fix_be(bnfz,be,c);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c |
return fix_be(bnfz,be,c); | return fix_be(bnfz, be, gmul(ell,c)); | reducebetanaive(GEN bnfz, GEN be, GEN b, long ell){ long i,k,n,ru,r1, prec = nfgetprec(bnfz); GEN z,p1,p2,nmax,c, nf = checknf(bnfz); if (DEBUGLEVEL) fprintferr("reduce modulo (Z_K^*)^l\n"); r1 = nf_get_r1(nf); if (!b) { if (typ(be) != t_COL) be = algtobasis(nf, be); b = gmul(gmael(nf,5,1), be); } n = max((ell>>1), 3); z = cgetg(n+1, t_VEC); c = gmulgs(greal((GEN)bnfz[3]), ell); c = logarch2arch(c, r1, prec); /* = embeddings of fu^ell */ c = gprec_w(gnorm(c), DEFAULTPREC); b = gprec_w(gnorm(b), DEFAULTPREC); /* need little precision */ z[1] = (long)concatsp(c, vecinv(c)); for (k=2; k<=n; k++) z[k] = (long) vecmul((GEN)z[1], (GEN)z[k-1]); nmax = T2_from_embed_norm(b, r1); ru = lg(c)-1; c = zerovec(ru); for(;;) { GEN B = NULL; long besti = 0, bestk = 0; for (k=1; k<=n; k++) for (i=1; i<=ru; i++) { p1 = vecmul(b, gmael(z,k,i)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk = k; continue; } p1 = vecmul(b, gmael(z,k,i+ru)); p2 = T2_from_embed_norm(p1,r1); if (gcmp(p2,nmax) < 0) { B=p1; nmax=p2; besti=i; bestk =-k; } } if (!B) break; b = B; c[besti] = laddis((GEN)c[besti], bestk); } if (DEBUGLEVEL) fprintferr("unit exponents = %Z\n",c); return fix_be(bnfz,be,c);} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/73929b165be3dc8f342788321bf5a06394a0cf3d/kummer.c/clean/src/modules/kummer.c |
c = gerepileupto(av2, gcopy(c)); | c = gerepilecopy(av2, c); | newtoncharpoly(GEN a, GEN chi, GEN pp, GEN ns){ GEN v, c, s, t; long n = degpol(chi), j, k, vn = varn(chi), av = avma, av2, lim; v = newtonsums(a, chi, pp, ns); av2 = avma; lim = stack_lim(av2, 1); c = cgetg(n + 2, t_VEC); c[1] = un; if (n%2) c[1] = lneg((GEN)c[1]); for (k = 2; k <= n+1; k++) c[k] = zero; for (k = 2; k <= n+1; k++) { s = gzero; for (j = 1; j < k; j++) { t = gmul((GEN)v[j], (GEN)c[k-j]); if (!(j%2)) t = gneg(t); s = gadd(s, t); } c[k] = ldiv(s, stoi(k - 1)); if (low_stack(lim, stack_lim(av2, 1))) { if(DEBUGMEM>1) err(warnmem, "newtoncharpoly"); c = gerepileupto(av2, gcopy(c)); } } k = (n%2)? 1: 2; for ( ; k <= n+1; k += 2) c[k] = lneg((GEN)c[k]); return gerepileupto(av, gtopoly(c, vn));} | 2195 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2195/7168973a923818508c45aa17d871c53e9225fad1/base2.c/clean/src/basemath/base2.c |