From: Martin Q. <mqu...@us...> - 2005-02-10 10:47:50
|
Update of /cvsroot/flexml/flexml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22851 Modified Files: flexml.pl skel Log Message: Add a -q flag to keep the parser quiet (not writting on stderr) ; Add some function prototypes so that generated parsers compile with -Wmissing-prototypes Index: skel =================================================================== RCS file: /cvsroot/flexml/flexml/skel,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** skel 24 Jan 2005 20:44:03 -0000 1.20 --- skel 10 Feb 2005 10:47:25 -0000 1.21 *************** *** 60,63 **** --- 60,64 ---- #define FAIL return fail static int fail(const char*, ...); + const char * parse_err_msg(void); /* Text buffer stack handling. */ *************** *** 334,339 **** chars_left = flexml_max_err_msg_size - used - 1; vsnprintf(flexml_err_msg + used, chars_left, fmt, ap); - va_end(ap); return 1; } --- 335,346 ---- chars_left = flexml_max_err_msg_size - used - 1; vsnprintf(flexml_err_msg + used, chars_left, fmt, ap); va_end(ap); + + #ifndef FLEXML_quiet_parser + /* print directly to sdterr */ + fprintf(stderr, "%s", flexml_err_msg); + flexml_err_msg[0] = '\0'; + #endif + return 1; } Index: flexml.pl =================================================================== RCS file: /cvsroot/flexml/flexml/flexml.pl,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** flexml.pl 24 Jan 2005 21:47:29 -0000 1.36 --- flexml.pl 10 Feb 2005 10:47:25 -0000 1.37 *************** *** 51,54 **** --- 51,55 ---- my $lineno; # -L option flag my $nofail; # -X option flag + my $quiet_parser; # -q option flag my $uri; # -u option uri my $pubid; # -p option string *************** *** 459,463 **** # Parse options. ! $Use = "Usage: flexml [-ASHDvdnLXV] [-s skel] [-p pubid] [-u uri]\n" . " [-r roottags] [-a actions] name[.dtd]"; --- 460,464 ---- # Parse options. ! $Use = "Usage: flexml [-ASHDvdqnLXV] [-s skel] [-p pubid] [-u uri]\n" . " [-r roottags] [-a actions] name[.dtd]"; *************** *** 475,478 **** --- 476,482 ---- $lineno = $opt{L}; + # Quiet parser? + $quiet_parser = $opt{q}; + # Exit without fail message? $nofail = $opt{X}; *************** *** 1043,1046 **** --- 1047,1054 ---- print "extern int yylex(void);\n"; print "\n"; + + print "/* Flexml error handling function (useful only when -q flag passed to flexml) */\n"; + print "const char * parse_err_msg(void);\n"; + print "#endif\n"; *************** *** 1094,1097 **** --- 1102,1106 ---- print "#define FLEXML_yylineno\n" if $lineno; print "#define FLEXML_NOFAIL\n" if $nofail; + print "#define FLEXML_quiet_parser\n" if $quiet_parser; print "#define FLEXML_HasMixed\n" if %inmixed; print "#define FLEXML_BUFFERSTACKSIZE 100000\n"; *************** *** 1674,1677 **** --- 1683,1693 ---- overhead is significant.) + =item B<-q> + + Prevents the XML processor (as produced by I<flex>(1)) from reporting + the error it runs into on stderr. Instead, users will have to pool for + error messages with the parse_err_msg() function. + By default, error messages are written on stderr. + =item B<-n> |