[CLN-list] Overriding read_number_bad_syntax and read_number_junk

Richard B. Kreckel kreckel at ginac.de
Tue Mar 15 23:55:31 CET 2005


On Tue, 15 Mar 2005, Ron Garret wrote:
> I'm using cln inside a little Lisp interpreter, which uses cln's input
> routines to parse numbers.  I'm resurrecting this project after about a
> three-year hiatus, and something that worked back then is no longer
> working.  The default behavior of cln's parser when it encounters bad
> syntax is to call read_number_bad_syntax which calls cl_abort which
> calls exit(0).  This is obviously not what I want.  Back in the day, I
> was able to override this behavior by simply defining my own version of
> read_number_bad_syntax and read_number_junk in my own code like so:
>
> namespace cln {
>    void read_number_bad_syntax(const char * string, const char *
> string_limit) {
>      throw 0;
>    }
>    void read_number_junk (const char * string_rest, const char * string,
>                           const char* string_limit) {
>      throw 0;
>    }
> }
>
> But this no longer works and I don't know why.  My guess is that it's a
> change in the C++ compiler.  Back then it was gcc-2.95 or something
> like that on Linux, and now I'm using 3.3 on OS X.
>
> Obviously I can fix this by hacking the cln source code, but I'd rather
> not do that because I don't want people to have to recompile cln (or
> keep multiple copies of cln around) to be able to use my code.  Is
> there another way for users to override the behavior of
> read_number_bad_syntax?  And does anyone know why the technique I used
> successfully before no longer works?

Could you please define what exactly "no longer works" means?  Also, it
will be helpful for people who might want to help you if you provide a
self-contained example.

  -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>





More information about the CLN-list mailing list