Let's see how much of this I can understand.<br><br>1) FILE & LINE are macros.<br>2) in (lambda (src <-- this variable here<br>    the src is linked to the reader/parser object, which is why we can query it for the current line / file number?<br>
3) Why the ##'s<br><br>Thanks!<br><br><div class="gmail_quote">On Sat, May 2, 2009 at 8:23 PM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca">feeley@iro.umontreal.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
On 1-May-09, at 5:38 PM, lowly coder wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
For C macros, I tend to use __FILE__ and __LINE__ alot. Does gambit have an equiv for this?<br>
</blockquote>
<br>
<br></div>
There's a builtin macro to get the current source file, which is called "this-source-file".  Nothing is builtin to get the line, but you can get that in the following way:<br>
<br>
(##define-syntax FILE<br>
  (lambda (src)<br>
    (if (not (##source? src))<br>
        (error "expected a source object")<br>
        (let ((locat (##source-locat src)))<br>
          (if (not locat)<br>
              (error "location unknown")<br>
              (let ((container (##locat-container locat))<br>
                    (position (##locat-position locat)))<br>
                (let ((path (##container->path container)))<br>
                  path)))))))<br>
<br>
(##define-syntax LINE<br>
  (lambda (src)<br>
    (if (not (##source? src))<br>
        (error "expected a source object")<br>
        (let ((locat (##source-locat src)))<br>
          (if (not locat)<br>
              (error "location unknown")<br>
              (let ((position (##locat-position locat)))<br>
                (let ((filepos (##position->filepos position)))<br>
                  (let ((line (##fixnum.+ (##filepos-line filepos) 1)))<br>
                    line))))))))<br>
<br>
(pp (list (FILE) (LINE)))<br>
(pp (list (this-source-file) (LINE)))<br>
<br>
;; prints:<br>
;;<br>
;; ("/u/feeley/test.scm" 25)<br>
;; ("/u/feeley/test.scm" 26)<br><font color="#888888">
<br>
Marc<br>
<br>
</font></blockquote></div><br>