Example #1
0
int Parser::oint(bool neg, bool eat_follow) {
  errno = 0;
  if (!neg) {
    char c = ogetc();
    neg = (c == '-');
    if (!neg)
      ogetc_push(c);
  }
  char buf[1024];
  int i = 0;
  char c;
  while (isdigit(c = ogetc()) && i < 1024)
    buf[i++] = c;
  buf[i] = 0;
  int t = atoi(buf);
  if (!eat_follow)
    ogetc_push(c);
  if (errno)
    error("Overflow or underflow occurred reading an integer.");
  return neg ? -t : t;
}
Example #2
0
static void next_ch(prolog_obj_t *o) { o->ch = ogetc(o); }
Example #3
0
void Parser::eatws() {
  char c;
  while (isspace(c = ogetc()));
  ogetc_push(c);
}
Example #4
0
static int comment(prolog_obj_t *o)
{       int c; 
        while(((c = ogetc(o)) > 0) && (c != '\n'));
        return c;
} /*process a comment line from input*/