You should be able to use the function yyerror to capture the debug messages. The function prototype would be like this in a re-entrant parser -
int yyerror(void *ctxt, const char *msg) { if ( 0 == yytext[0] ) return fprintf(stderr, "\n%s.", msg); else return fprintf(stderr, "\n%s at '%s'.", msg, asntext); } I believe the ctxt would not be there in a non re-entrant version (globals being used if context information is required). You can use this function to do what you want with the message. Hope this helps. Regards Ramaswamy -- "Chaos is the rule in nature, not an exception" http://ramaswamy.r.googlepages.com On 10/26/06, Bob Smith <[EMAIL PROTECTED]> wrote:
Using Bison version 2.3 (Cygwin), I have incorporated the resulting C file into a Windows app, however, I'm having trouble figuring out how to debug the parser. I've #define YYDEBUG 1, and set yydebug to 1, but the output is going to fprintf (stderr, ...) which doesn't help a Windows app. It seems that the formatting and output of the debugging information are all bound up into one #define. I want the first part, but not the second. I already have a debugging window for my app defined, so I'd like to capture the output and display it in that window (it's a Listbox). * I tried AllocConsole () hoping that the stderr output would go there, but nothing was displayed. * I tried redefining yacc.c, and then using -S myyacc.c, but it appears to rely upon an external program m4 which didn't seem to get called, so the C compiler choked on the m4 stuff. That was puzzling as I would think that it would be called for the default skeleton (yacc.c). * I tried defining YYFPRINTF but I couldn't come up with anything that worked, mostly because of the variable number of arguments. I'm sure that you clever people have solved this tricky problem before. Any help you can provide is greatly appreciated. -- _______________________________________________________________ Bob Smith - [EMAIL PROTECTED] - http://www.sudleyplace.com _______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison
_______________________________________________ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison