Example #1
0
int sc_recover (SCAN *scan, int stop, int beg, int end, int level)
{                               /* --- recover from an error */
  while ((scan->token != stop)     /* while at stop token */
  &&     (scan->token != T_EOF)) { /* and not at end of file */
    if       (scan->token == beg)  /* if begin level token found, */
      level++;                     /* increment level counter */
    else if ((scan->token == end)  /* if end level token found */
    &&       (--level    <= 0))    /* and on level to return to, */
      break;                       /* abort loop */
    if (sc_next(scan) < 0) return scan->token;
  }                             /* consume token */
  if (scan->token != T_EOF)     /* if not at end of file, */
    sc_next(scan);              /* consume token (stop or end) */
  return scan->token;           /* return the next token */
}  /* sc_recover() */
Example #2
0
static int
sc_schedule(sc *s, sctask *task)
{
	int rc;
	ss_mutexlock(&s->lock);
	task->db = sc_current(s);
	sc_periodic(s, task);
	rc = sc_do(s, task);
	sc_next(s);
	ss_mutexunlock(&s->lock);
	return rc;
}
Example #3
0
int sc_nexter (SCAN *scan)
{                               /* --- get next token error reporting */
  if (sc_next(scan) < 0) return sc_error(scan, scan->token);
  return scan->token;           /* get next token, report error, */
}  /* sc_nexter() */            /* and return next token */