[CLN-list] Overriding read_number_bad_syntax and read_number_junk
Ron Garret
ron at flownet.com
Tue Mar 15 20:37:49 CET 2005
Now that I've finally gotten cln compiled (again) I've encountered
another problem.
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?
Thanks,
rg
More information about the CLN-list
mailing list