[PPL-devel] Problem with ciao_raise_exception()

Roberto Bagnara bagnara at cs.unipr.it
Mon Oct 20 12:13:07 CEST 2008


Hi there,

according to the documentation (emphasis mine):

@subsection{Raising Exceptions}

The following functions offers a way of throwing @concept{exceptions}
from C that can be caught in Prolog with @tt{catch/3}.  THE TERM THAT
REACHES PROLOG IS EXACTLY THE SAME WHICH WAS THROWN BY C.  The
execution flow is broken at the point where
@tt{ciao_raise_exception()} is executed, and it returns to Prolog.

However, it seems that ciao_raise_exception() throws a different
term.  We obtain:

?- catch(ppl_Polyhedron_add_constraints(p, []),
            Exception, true).

Exception = error(system_error,'ppl_ciao:ppl_Polyhedron_add_constraints'/2-1) ?

yes
?-

whereas we should obtain:

?- catch(ppl_Polyhedron_add_constraints(p, []),
            Exception, true).
Exception = ppl_invalid_argument(found(p), expected(handle), where('ppl_Polyhedron_add_constraints/2')).

?-

We are sure that the C code throws the term

   ppl_invalid_argument(found(p), expected(handle), where('ppl_Polyhedron_add_constraints/2'))

moreover the string "system_error" never occurs in the PPL sources.
 From this we conclude that the

   error(system_error,'ppl_ciao:ppl_Polyhedron_add_constraints'/2-1)

term is synthesized by Ciao itself, and this is causing problems.
Are we missing something?
Thanks,

    Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list