/[lispfaq]/lispfaq/__FILE__.xml
ViewVC logotype

Contents of /lispfaq/__FILE__.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Mon Mar 22 20:07:41 2004 UTC (10 years, 1 month ago) by emarsden
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +16 -15 lines
File MIME type: text/xml
  - minor formatting changes
1 <qandaentry>
2 <question>
3 <para>
4 What is the Lisp equivalent of the <symbol>__FILE__</symbol> and
5 <symbol>__LINE__</symbol> <acronym>ANSI</acronym> C preprocessor
6 macros? How do I find out where an error occurred?
7 </para>
8 </question>
9 <answer>
10 <para>
11 There is no direct equivalent of <symbol>__FILE__</symbol> and
12 <symbol>__LINE__</symbol> in ANSI Common Lisp; this is perhaps
13 most simply explained by the fact that CL is not particularly a
14 file-oriented and definitely not a line-oriented language. That
15 said, your particular implementation may carry around some
16 information about where functions were compiled, and
17 <code>COMPILE-FILE</code> binds the special variables
18 <code>*COMPILE-FILE-TRUENAME*</code> and
19 <code>*COMPILE-FILE-PATHNAME*</code>.
20 </para>
21 </answer>
22 <answer>
23 <programlisting>
24 (defun foo () (break "Stopped inside ~S" (the-function-i-am-in)))
25
26 (setf (symbol-function 'bar) (symbol-function 'foo))
27
28 (bar)
29 </programlisting>
30 <para>
31 Are you in a breakpoint in FOO or in BAR?
32 </para>
33 </answer>
34 </qandaentry>
35

  ViewVC Help
Powered by ViewVC 1.1.5