[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] gtp command `loadsgf' exits on parse error
From: |
Gunnar Farnebäck |
Subject: |
Re: [gnugo-devel] gtp command `loadsgf' exits on parse error |
Date: |
Sun, 14 Nov 2004 21:08:04 +0100 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI) |
Thi wrote:
> static void
> parse_error(const char *msg, int arg)
> {
> fprintf(stderr, msg, arg);
> fprintf(stderr, "\n");
> exit(EXIT_FAILURE);
> }
>
> that seems a bit harsh, and violates the gtp error-reporting
> convention of displaying "?" and continuing. is someone looking
> into this?
Yes, this is bad. I took a look at it and it seems to be a fairly
serious design problem which will take some significant changes to
fix. I don't think we should try to do that before GNU Go 3.6 but it
certainly needs to be done. The patch below adds it as a TODO item.
/Gunnar
Index: TODO
===================================================================
RCS file: /cvsroot/gnugo/gnugo/TODO,v
retrieving revision 1.17
diff -u -r1.17 TODO
--- TODO 8 Sep 2004 17:03:41 -0000 1.17
+++ TODO 14 Nov 2004 20:10:13 -0000
@@ -46,6 +46,12 @@
engine internals. The issues are presented here in an approximate
order of perceived difficulty.
+ * The function readsgffile() in sgf/sgfnode.c is responsible for
+ reading sgf files. Unfortunately it calls exit(EXIT_FAILURE), via
+ parse_error(), if the sgf file is misformed. This is inappropriate
+ in many cases and the code should be changed to return an exit code
+ instead of calling exit().
+
* Add more checks in patterns/mkpat.c testing whether the main diagram and
the constraint diagram are consistent.