本文整理汇总了C++中popstackmark函数的典型用法代码示例。如果您正苦于以下问题:C++ popstackmark函数的具体用法?C++ popstackmark怎么用?C++ popstackmark使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了popstackmark函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evalstring
void
evalstring(char *s, int flags)
{
union node *n;
struct stackmark smark;
int flags_exit;
int any;
flags_exit = flags & EV_EXIT;
flags &= ~EV_EXIT;
any = 0;
setstackmark(&smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
if (n != NULL && !nflag) {
if (flags_exit && preadateof())
evaltree(n, flags | EV_EXIT);
else
evaltree(n, flags);
any = 1;
}
popstackmark(&smark);
setstackmark(&smark);
}
popfile();
popstackmark(&smark);
if (!any)
exitstatus = 0;
if (flags_exit)
exraise(EXEXIT);
}
示例2: evalcase
static union node *
evalcase(union node *n)
{
union node *cp;
union node *patp;
struct arglist arglist;
struct stackmark smark;
setstackmark(&smark);
arglist.lastp = &arglist.list;
oexitstatus = exitstatus;
expandarg(n->ncase.expr, &arglist, EXP_TILDE);
for (cp = n->ncase.cases ; cp ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
if (casematch(patp, arglist.list->text)) {
popstackmark(&smark);
while (cp->nclist.next &&
cp->type == NCLISTFALLTHRU &&
cp->nclist.body == NULL)
cp = cp->nclist.next;
if (cp->nclist.next &&
cp->type == NCLISTFALLTHRU)
return (cp);
if (cp->nclist.body == NULL)
exitstatus = 0;
return (cp->nclist.body);
}
}
}
popstackmark(&smark);
exitstatus = 0;
return (NULL);
}
示例3: evalstring
void
evalstring(char *s, int flags)
{
union node *n;
struct stackmark smark;
int flags_exit;
flags_exit = flags & EV_EXIT;
flags &= ~EV_EXIT;
setstackmark(&smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
if (n != NULL) {
if (flags_exit && preadateof())
evaltree(n, flags | EV_EXIT);
else
evaltree(n, flags);
}
popstackmark(&smark);
}
popfile();
popstackmark(&smark);
if (flags_exit)
exitshell(exitstatus);
}
示例4: cmdloop
void
cmdloop(int top)
{
union node *n;
struct stackmark smark;
int inter;
int numeof = 0;
enum skipstate skip;
TRACE(("cmdloop(%d) called\n", top));
setstackmark(&smark);
for (;;) {
if (pendingsigs)
dotrap();
inter = 0;
if (iflag == 1 && top) {
inter = 1;
showjobs(out2, SHOW_CHANGED);
chkmail(0);
flushout(&errout);
nflag = 0;
}
n = parsecmd(inter);
TRACE(("cmdloop: "); showtree(n));
/* showtree(n); DEBUG */
if (n == NEOF) {
if (!top || numeof >= 50)
break;
if (nflag)
break;
if (!stoppedjobs()) {
if (!iflag || !Iflag)
break;
out2str("\nUse \"exit\" to leave shell.\n");
}
numeof++;
} else if (n != NULL && nflag == 0) {
job_warning = (job_warning == 2) ? 1 : 0;
numeof = 0;
evaltree(n, EV_MORE);
}
popstackmark(&smark);
setstackmark(&smark);
/*
* Any SKIP* can occur here! SKIP(FUNC|BREAK|CONT) occur when
* a dotcmd is in a loop or a function body and appropriate
* built-ins occurs in file scope in the sourced file. Values
* other than SKIPFILE are reset by the appropriate eval*()
* that contained the dotcmd() call.
*/
skip = current_skipstate();
if (skip != SKIPNONE) {
if (skip == SKIPFILE)
stop_skipping();
break;
}
}
popstackmark(&smark);
}
示例5: evalstring
void
evalstring(char *s)
{
union node *n;
struct stackmark smark;
setstackmark(&smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
evaltree(n, 0);
popstackmark(&smark);
}
popfile();
popstackmark(&smark);
}
示例6: cmdloop
static void
cmdloop(int top)
{
union node *n;
struct stackmark smark;
int inter;
int numeof = 0;
TRACE(("cmdloop(%d) called\n", top));
setstackmark(&smark);
for (;;) {
if (pendingsig)
dotrap();
inter = 0;
if (iflag && top) {
inter++;
showjobs(1, SHOWJOBS_DEFAULT);
#ifndef CBSD
chkmail(0);
#endif
flushout(&output);
}
n = parsecmd(inter);
/* showtree(n); DEBUG */
if (n == NEOF) {
if (!top || numeof >= 50)
break;
if (!stoppedjobs()) {
if (!Iflag)
break;
out2fmt_flush("\nUse \"exit\" to leave shell.\n");
}
numeof++;
} else if (n != NULL && nflag == 0) {
job_warning = (job_warning == 2) ? 1 : 0;
numeof = 0;
evaltree(n, 0);
}
popstackmark(&smark);
setstackmark(&smark);
if (evalskip != 0) {
if (evalskip == SKIPRETURN)
evalskip = 0;
break;
}
}
popstackmark(&smark);
}
示例7: dotcmd
int
dotcmd(int argc, char **argv)
{
exitstatus = 0;
if (argc >= 2) { /* That's what SVR2 does */
char *fullname;
/*
* dot_funcnest needs to be 0 when not in a dotcmd, so it
* cannot be restored with (funcnest + 1).
*/
int dot_funcnest_old;
struct stackmark smark;
setstackmark(&smark);
fullname = find_dot_file(argv[1]);
setinputfile(fullname, 1);
commandname = fullname;
dot_funcnest_old = dot_funcnest;
dot_funcnest = funcnest + 1;
cmdloop(0);
dot_funcnest = dot_funcnest_old;
popfile();
popstackmark(&smark);
}
return exitstatus;
}
示例8: evalcase
static void
evalcase(union node *n, int flags)
{
union node *cp;
union node *patp;
struct arglist arglist;
struct stackmark smark;
setstackmark(&smark);
arglist.lastp = &arglist.list;
oexitstatus = exitstatus;
exitstatus = 0;
expandarg(n->ncase.expr, &arglist, EXP_TILDE);
for (cp = n->ncase.cases ; cp && evalskip == 0 ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
if (casematch(patp, arglist.list->text)) {
if (evalskip == 0) {
evaltree(cp->nclist.body, flags);
}
goto out;
}
}
}
out:
popstackmark(&smark);
}
示例9: evalcase
STATIC void
evalcase(shinstance *psh, union node *n, int flags)
{
union node *cp;
union node *patp;
struct arglist arglist;
struct stackmark smark;
int status = 0;
setstackmark(psh, &smark);
arglist.lastp = &arglist.list;
expandarg(psh, n->ncase.expr, &arglist, EXP_TILDE);
for (cp = n->ncase.cases ; cp && psh->evalskip == 0 ; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern ; patp ; patp = patp->narg.next) {
if (casematch(psh, patp, arglist.list->text)) {
if (psh->evalskip == 0) {
evaltree(psh, cp->nclist.body, flags);
status = psh->exitstatus;
}
goto out;
}
}
}
out:
psh->exitstatus = status;
popstackmark(psh, &smark);
}
示例10: evalstring
void
evalstring(shinstance *psh, char *s, int flag)
{
union node *n;
struct stackmark smark;
setstackmark(psh, &smark);
setinputstring(psh, s, 1);
while ((n = parsecmd(psh, 0)) != NEOF) {
evaltree(psh, n, flag);
popstackmark(psh, &smark);
}
popfile(psh);
popstackmark(psh, &smark);
}
示例11: evalfor
static void
evalfor(union node *n, int flags)
{
struct arglist arglist;
union node *argp;
struct strlist *sp;
struct stackmark smark;
setstackmark(&smark);
arglist.lastp = &arglist.list;
for (argp = n->nfor.args ; argp ; argp = argp->narg.next) {
oexitstatus = exitstatus;
expandarg(argp, &arglist, EXP_FULL | EXP_TILDE);
}
*arglist.lastp = NULL;
exitstatus = 0;
loopnest++;
for (sp = arglist.list ; sp ; sp = sp->next) {
setvar(n->nfor.var, sp->text, 0);
evaltree(n->nfor.body, flags);
if (evalskip) {
if (evalskip == SKIPCONT && --skipcount <= 0) {
evalskip = 0;
continue;
}
if (evalskip == SKIPBREAK && --skipcount <= 0)
evalskip = 0;
break;
}
}
loopnest--;
popstackmark(&smark);
}
示例12: cmdloop
void
cmdloop(struct shinstance *psh, int top)
{
union node *n;
struct stackmark smark;
int inter;
int numeof = 0;
TRACE((psh, "cmdloop(%d) called\n", top));
setstackmark(psh, &smark);
for (;;) {
if (psh->pendingsigs)
dotrap(psh);
inter = 0;
if (iflag(psh) && top) {
inter = 1;
showjobs(psh, psh->out2, SHOW_CHANGED);
chkmail(psh, 0);
flushout(&psh->errout);
}
n = parsecmd(psh, inter);
/* showtree(n); DEBUG */
if (n == NEOF) {
if (!top || numeof >= 50)
break;
if (!stoppedjobs(psh)) {
if (!Iflag(psh))
break;
out2str(psh, "\nUse \"exit\" to leave shell.\n");
}
numeof++;
} else if (n != NULL && nflag(psh) == 0) {
psh->job_warning = (psh->job_warning == 2) ? 1 : 0;
numeof = 0;
evaltree(psh, n, 0);
}
popstackmark(psh, &smark);
setstackmark(psh, &smark);
if (psh->evalskip == SKIPFILE) {
psh->evalskip = 0;
break;
}
}
popstackmark(psh, &smark);
}
示例13: cmdloop
void
cmdloop(int top)
{
union node *n;
struct stackmark smark;
int inter;
int numeof = 0;
TRACE(("cmdloop(%d) called\n", top));
setstackmark(&smark);
for (;;) {
if (pendingsigs)
dotrap();
inter = 0;
if (iflag && top) {
inter = 1;
showjobs(out2, SHOW_CHANGED);
chkmail(0);
flushout(&errout);
}
n = parsecmd(inter);
/* showtree(n); DEBUG */
if (n == NEOF) {
if (!top || numeof >= 50)
break;
if (!stoppedjobs()) {
if (!Iflag)
break;
out2str("\nUse \"exit\" to leave shell.\n");
}
numeof++;
} else if (n != NULL && nflag == 0) {
job_warning = (job_warning == 2) ? 1 : 0;
numeof = 0;
evaltree(n, 0);
}
popstackmark(&smark);
setstackmark(&smark);
if (evalskip == SKIPFILE) {
evalskip = 0;
break;
}
}
popstackmark(&smark);
}
示例14: evalstring
void
evalstring(char *s, int flag)
{
union node *n;
struct stackmark smark;
setstackmark(&smark);
setinputstring(s, 1);
while ((n = parsecmd(0)) != NEOF) {
TRACE(("evalstring: "); showtree(n));
if (nflag == 0)
evaltree(n, flag);
popstackmark(&smark);
}
popfile();
popstackmark(&smark);
}
示例15: evalbackcmd
void
evalbackcmd(union node *n, struct backcmd *result)
{
int pip[2];
struct job *jp;
struct stackmark smark; /* unnecessary */
setstackmark(&smark);
result->fd = -1;
result->buf = NULL;
result->nleft = 0;
result->jp = NULL;
if (nflag || n == NULL) {
goto out;
}
#ifdef notyet
/*
* For now we disable executing builtins in the same
* context as the shell, because we are not keeping
* enough state to recover from changes that are
* supposed only to affect subshells. eg. echo "`cd /`"
*/
if (n->type == NCMD) {
exitstatus = oexitstatus;
evalcommand(n, EV_BACKCMD, result);
} else
#endif
{
INTOFF;
if (sh_pipe(pip) < 0)
error("Pipe call failed");
jp = makejob(n, 1);
if (forkshell(jp, n, FORK_NOJOB) == 0) {
FORCEINTON;
close(pip[0]);
if (pip[1] != 1) {
close(1);
copyfd(pip[1], 1, 1, 0);
close(pip[1]);
}
eflag = 0;
evaltree(n, EV_EXIT);
/* NOTREACHED */
}
close(pip[1]);
result->fd = pip[0];
result->jp = jp;
INTON;
}
out:
popstackmark(&smark);
TRACE(("evalbackcmd done: fd=%d buf=0x%x nleft=%d jp=0x%x\n",
result->fd, result->buf, result->nleft, result->jp));
}