这篇教程C++ tempfree函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tempfree函数的典型用法代码示例。如果您正苦于以下问题:C++ tempfree函数的具体用法?C++ tempfree怎么用?C++ tempfree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tempfree函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: executeCell *cat(Node **a, int q) /* a[0] cat a[1] */{ Cell *x, *y, *z; int n1, n2; char *s; x = execute(a[0]); y = execute(a[1]); getsval(x); getsval(y); n1 = strlen(x->sval); n2 = strlen(y->sval); s = (char *) malloc(n1 + n2 + 1); if (s == NULL) ERROR "out of space concatenating %.15s... and %.15s...", x->sval, y->sval FATAL; strcpy(s, x->sval); strcpy(s+n1, y->sval); tempfree(y); z = gettemp(); z->sval = s; z->tval = STR; tempfree(x); return(z);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:25,
示例2: indexCell *intest(Node **a, int n) /* a[0] is index (list), a[1] is symtab */{ Cell *x, *ap, *k; Node *p; char buf[RECSIZE]; char *s; ap = execute(a[1]); /* array name */ if (!isarr(ap)) { dprintf( ("making %s into an array/n", ap->nval) ); if (freeable(ap)) xfree(ap->sval); ap->tval &= ~(STR|NUM|DONTFREE); ap->tval |= ARR; ap->sval = (char *) makesymtab(NSYMTAB); } buf[0] = 0; for (p = a[0]; p; p = p->nnext) { x = execute(p); /* expr */ s = getsval(x); strcat(buf, s); tempfree(x); if (p->nnext) strcat(buf, *SUBSEP); } k = lookup(buf, (Array *) ap->sval); tempfree(ap); if (k == NULL) return(false); else return(true);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:32,
示例3: forCell *instat(Node **a, int n) /* for (a[0] in a[1]) a[2] */{ Cell *x, *vp, *arrayp, *cp, *ncp; Array *tp; int i; vp = execute(a[0]); arrayp = execute(a[1]); if (!isarr(arrayp)) { return true; } tp = (Array *) arrayp->sval; tempfree(arrayp); for (i = 0; i < tp->size; i++) { /* this routine knows too much */ for (cp = tp->tab[i]; cp != NULL; cp = ncp) { setsval(vp, cp->nval); ncp = cp->cnext; x = execute(a[2]); if (isbreak(x)) { tempfree(vp); return true; } if (isnext(x) || isexit(x) || isret(x)) { tempfree(vp); return(x); } tempfree(x); } } return true;}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:31,
示例4: ifCell *ifstat(Node **a, int n) /* if (a[0]) a[1]; else a[2] */{ Cell *x; x = execute(a[0]); if (istrue(x)) { tempfree(x); x = execute(a[1]); } else if (a[2] != 0) { tempfree(x); x = execute(a[2]); } return(x);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:14,
示例5: returnCell *execute(Node *u) /* execute a node of the parse tree */{ Cell *(*proc)(Node **, int); Cell *x; Node *a; if (u == NULL) return(true); for (a = u; ; a = a->nnext) { curnode = a; if (isvalue(a)) { x = (Cell *) (a->narg[0]); if ((x->tval & FLD) && !donefld) fldbld(); else if ((x->tval & REC) && !donerec) recbld(); return(x); } if (notlegal(a->nobj)) /* probably a Cell* but too risky to print */ ERROR "illegal statement" FATAL; proc = proctab[a->nobj-FIRSTTOKEN]; x = (*proc)(a->narg, a->nobj); if ((x->tval & FLD) && !donefld) fldbld(); else if ((x->tval & REC) && !donerec) recbld(); if (isexpr(a)) return(x); if (isjump(x)) return(x); if (a->nnext == NULL) return(x); tempfree(x); }}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:35,
示例6: redirectCell *printstat(Node **a, int n) /* print a[0] */{ register Node *x; register Cell *y; FILE *fp; if (a[1] == 0) /* a[1] is redirection operator, a[2] is file */ fp = stdout; else fp = redirect((int)a[1], a[2]); for (x = a[0]; x != NULL; x = x->nnext) { y = execute(x); fputs((char *)getsval(y), fp); tempfree(y); if (x->nnext == NULL) fputs((char *)*ORS, fp); else fputs((char *)*OFS, fp); } if (a[1] != 0) fflush(fp); if (ferror(fp)) ERROR "write error on %s", filename(fp) FATAL; return(true);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:25,
示例7: whileCell *dostat(Node **a, int n) /* do a[0]; while(a[1]) */{ Cell *x; for (;;) { x = execute(a[0]); if (isbreak(x)) return true; if (isnext(x) || isnextfile(x) || isexit(x) || isret(x)) return(x); tempfree(x); x = execute(a[1]); if (!istrue(x)) return(x); tempfree(x); }}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:17,
示例8: switchCell *jump(Node **a, int n) /* break, continue, next, nextfile, return */{ Cell *y; switch (n) { case EXIT: if (a[0] != NULL) { y = execute(a[0]); errorflag = getfval(y); tempfree(y); } longjmp(env, 1); case RETURN: if (a[0] != NULL) { y = execute(a[0]); if ((y->tval & (STR|NUM)) == (STR|NUM)) { setsval(fp->retval, getsval(y)); fp->retval->fval = getfval(y); fp->retval->tval |= NUM; } else if (y->tval & STR) setsval(fp->retval, getsval(y)); else if (y->tval & NUM) setfval(fp->retval, getfval(y)); else /* can't happen */ ERROR "bad type variable %d", y->tval FATAL; tempfree(y); } return(jret); case NEXT: return(jnext); case NEXTFILE: nextfile(); return(jnextfile); case BREAK: return(jbreak); case CONTINUE: return(jcont); default: /* can't happen */ ERROR "illegal jump type %d", n FATAL; } return 0; /* not reached */}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:43,
示例9: matchCell *matchop(Node **a, int n) /* ~ and match() */{ Cell *x, *y; char *s, *t; int i; fa *pfa; int (*mf)(fa *, char *) = match, mode = 0; if (n == MATCHFCN) { mf = pmatch; mode = 1; } x = execute(a[1]); /* a[1] = target text */ s = getsval(x); if (a[0] == 0) /* a[1] == 0: already-compiled reg expr */ i = (*mf)((fa *) a[2], s); else { y = execute(a[2]); /* a[2] = regular expr */ t = getsval(y); pfa = makedfa(t, mode); i = (*mf)(pfa, s); tempfree(y); } tempfree(x); if (n == MATCHFCN) { int start = patbeg - s + 1; if (patlen < 0) start = 0; setfval(rstartloc, (Awkfloat) start); setfval(rlengthloc, (Awkfloat) patlen); x = gettemp(); x->tval = NUM; x->fval = start; return x; } else if ((n == MATCH && i == 1) || (n == NOTMATCH && i == 0)) return(true); else return(false);}
开发者ID:ajallooeian,项目名称:libawkcpp,代码行数:39,
注:本文中的tempfree函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tempnode函数代码示例 C++ temperature函数代码示例 |