On Tue, Feb 22, 2011 at 6:07 AM, <aa...@pageofswords.net> wrote:

> Hi, I am having a lot of trouble figuring out how to prevent the debugger
> becoming active in embedded mode.
>  I have tried:
> + Calling ecl_disable_interrupts(); before cl_eval()
>

Nothing to do with that. These are Unix interrupts


> + And also this: (setf si::*interrupt-enable* nil)
>

See above.


> + Executing the following in ecl: (setf *debugger-hook* #'debug-ignore)
>

What does your *debugger-hook* function do? Just returning? This is not
going to work at all. First try doing it in Common Lisp, then port the stuff
to your program


> Mmm... I want to evaluate something like
> si_safe_eval(3,c_string_to_object("(vvvvformat t \"Hello\")"), Cnil,
> OBJNULL);
>

Problem 1: the expression you are going to evaluate is ill formed. SAFE-EVAL
can not protect you because the error happens _before_ this function is ever
invoked.

Problem 2: your debug-ignore function does not do what is expected to do.
When an error handler is invoked it should either offer an interactive
debugger or perform some transfer of control to an outer point, as in

(block nil (handler-bind ((error #'(lambda (c) (return 2)))) (cos 'a)))

I presume that debug-ignore does not do this: it simply returns and the
debugger just gets invoked again (the error has not been solved).

Alternative: if you know you are going to get ill formed expressions,
convert the READ_CL forms into a standalone function that detects and
ignores errors. Fortunately there is an undocumented function that
c_string_to_object is based on

#define ecl_read_from_cstring(s)
si_string_to_object(1,make_constant_base_string(s))
#define ecl_read_from_cstring_safe(s,v)
si_string_to_object(2,make_constant_base_string(s),(v))

The second version does it safely.

Juanjo

-- 
Instituto de FĂ­sica Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk 
Collect, index and harness all the fast moving IT data generated by your 
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights. 
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to