[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Catching errors and their line number

From: Maurizio Tomasi
Subject: Catching errors and their line number
Date: Thu, 16 Jan 2003 11:50:30 +0100

Hello to everybody.

 I am writing a thermal analysis software which uses Guile to
implement a scripting language.  Since the mean user of this program
probably has a basic understanding of the Scheme language, I use the
scm_internal_catch function to run code and catch exceptions raised by
programming errors.  I would like very much to write before any error
message the number of the line where the error is; for instance:

(+ 'a 'b)

should produce:

Error in line nn: wrong argument type in call to +

or something like.

I searched in the Guile manual and found the "(read-enable 'positions)"
instruction which tells Guile to record the line number of every Scheme
construct it reads, but I cannot figure where to pick this information when catching an exception with my own handler.

A google search was not successful. I have searched on this mailing list as well, and I found somebody asking for this very question, but I found no englightment in the answers.

I tried also to understand how the "guile" executable prints the line numbers by doing a step-by-step execution with GDB, but I got lost in the sources (I do not know very well the inner details of how Guile works). Could somebody please tell me where is the piece of code which Guile calls when printing line-numbered error messages?

Thank you very much,

MSN Extra Storage: piena libertà di esprimersi e comunicare

reply via email to

[Prev in Thread] Current Thread [Next in Thread]