parse_tree.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 #include <string.h>
00004 #include "php_parse_tree.h"
00005 
00006 int main(int argc, char *argv[])
00007 {
00008     char filename[512] = "";
00009     extern FILE* yyin;
00010     extern char* _xml_output;
00011     extern int _error;
00012 
00013     if (argc < 2)
00014         return 0;
00015     strncpy(filename, argv[1], 512);
00016     yyin = fopen(filename, "r");
00017     if (!yyin) {
00018         return 0;
00019     }
00020     yyparse();
00021     fclose(yyin);
00022     if(_error){
00023         return 0;
00024     }
00025     char outfname[1024];
00026     if (argc == 3) {
00027         strncpy(outfname, argv[2], 1024);
00028     }
00029     else {
00030         strncpy(outfname, filename, 512);
00031         strcat(outfname, ".xml");
00032     }
00033     FILE *temp = (FILE *)NULL;
00034     if ((temp = fopen(outfname, "w")))
00035     {
00036         fprintf(temp, "%s",_xml_output);
00037     }
00038     fclose(temp);
00039     return 0;
00040 }

Generated on Wed Feb 27 20:31:05 2008 for php.ast.svn.src. by  doxygen 1.5.3