chicken-users
[Top][All Lists]
Advanced

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

[Chicken-users] source file and line number where a macro is called?


From: Alejandro Forero Cuervo
Subject: [Chicken-users] source file and line number where a macro is called?
Date: Mon, 24 May 2010 15:18:18 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

I'm working in a logging extension.  Simplifying, I would like to be
able to write in my code an expression like:

    (logging "Starting evaluation of foo")

To cause an entry like "fooeval.scm:94: Starting evaluation of foo."
to be written to some file.  The key aspect is to be able to trace
back the location of the expression that caused an entry to be logged.

Is there a way I could make this work?  In other words, how can I make
a macro receive the filename and line number where the expression that
caused it to be called occurred?

This is trickier than it sounds, as the logging form may occur inside
the body of a macro (in which case, I suppose the ideal thing would be
to capture *a list* of file names and corresponding line numbers).  I
guess ideally some variable would expand to the "stack" of macro
calls...

Any help?  Is there any logging mechanism in Chicken that records the
position in the source code associated with the log entries?

Alejo.
http://azul.freaks-unidos.net/



reply via email to

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