main.c

Go to the documentation of this file.
00001 
00004 #include <stdio.h>
00005 #include <stdlib.h>             /* EXIT_SUCCESS, etc. */
00006 #include <errno.h>
00007 #include <string.h>
00008 #include "out.h"
00009 #include "in.h"
00010 #include "lexer.h"
00011 #include "parser.h"
00012 #include "main.h"
00013 
00017 #define EVAL(expr, err) if (expr) { errno = err; perror(pcerr); iret = EXIT_FAILURE; goto cleanup; }
00018 
00021 int main() {
00022   int iret = EXIT_SUCCESS;
00023   const char *pcerr = "main.c main()";
00024   char *pc;
00025 
00026   /* Unsuccessful read. */
00027   EVAL(in(stdin, &pc) == EXIT_FAILURE, EIO);
00028   /* Else, perform tokenization and thence parse. */
00029   EVAL(parse(pc) != EXIT_SUCCESS, EINVAL);
00030 
00031  cleanup:
00032   free(pc);
00033   return iret;
00034 }

Generated on Tue Dec 7 06:38:25 2004 for CSCI101:ProjectLatex by  doxygen 1.3.9.1