Logo Search packages:      
Sourcecode: lbt version File versions  Download package

static int parseGate ( void   )  [static]

Copy a gate condition from standard input to standard output

Returns:
zero if everything is ok; nonzero on error

Definition at line 32 of file lbt2dot.c.

Referenced by main().

{
  int ch;
 loop:
  while (isspace (ch = fgetc (stdin)));
  fputc (ch, stdout);
  switch (ch) {
  case 't':
  case 'f':
    return 0;
  case '|':
  case '&':
  case 'i':
  case 'e':
    if (parseGate ())
      return 1;
  case '!':
    goto loop;
  case 'p':
    if (1 != fscanf (stdin, "%d", &ch)) {
      fputs ("error in proposition number\n", stderr);
      return 1;
    }
    fprintf (stdout, "%d", ch);
    return 0;
  case EOF:
    fputs ("unexpected end of file while parsing formula\n", stderr);
    return 2;
  default:
    fprintf (stderr, "unknown character 0x%02x", ch);
    return 2;
  }
}


Generated by  Doxygen 1.6.0   Back to index