From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.user Subject: Re: Guile Introspection Date: Thu, 12 Jul 2007 15:09:45 +0200 Message-ID: <878x9lu5t2.fsf@ambire.localdomain> References: <266326.97925.qm@web37913.mail.mud.yahoo.com> <87y7hq2aax.fsf@chbouib.org> <1183978661.13149.5.camel@localhost.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184245842 30108 80.91.229.12 (12 Jul 2007 13:10:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 12 Jul 2007 13:10:42 +0000 (UTC) Cc: guile-user@gnu.org To: Andy Wingo Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jul 12 15:10:41 2007 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I8yRM-0000KB-DJ for guile-user@m.gmane.org; Thu, 12 Jul 2007 15:10:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8yRL-0002si-Ky for guile-user@m.gmane.org; Thu, 12 Jul 2007 09:10:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I8yRI-0002sI-8d for guile-user@gnu.org; Thu, 12 Jul 2007 09:10:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I8yRG-0002rc-NC for guile-user@gnu.org; Thu, 12 Jul 2007 09:10:35 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I8yRG-0002rZ-KO for guile-user@gnu.org; Thu, 12 Jul 2007 09:10:34 -0400 Original-Received: from smtp-out1.libero.it ([212.52.84.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I8yRG-00021U-0v for guile-user@gnu.org; Thu, 12 Jul 2007 09:10:34 -0400 Original-Received: from localhost (172.31.0.50) by smtp-out1.libero.it (7.3.120) id 4688F3170112FA30 for guile-user@gnu.org; Thu, 12 Jul 2007 15:10:04 +0200 X-Scanned: with antispam and antivirus automated system at libero.it Original-Received: from smtp-out2.libero.it ([172.31.0.38]) by localhost (asav-out9.libero.it [192.168.32.37]) (amavisd-new, port 10024) with ESMTP id GNhFFVb32-ek for ; Thu, 12 Jul 2007 15:10:04 +0200 (CEST) Original-Received: from mailrelay07.libero.it (192.168.32.94) by smtp-out2.libero.it (7.3.120) id 4611FD3807695891 for guile-user@gnu.org; Thu, 12 Jul 2007 15:10:04 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAJfElUaXFSCK/2dsb2JhbACBSw Original-Received: from ppp-138-32.21-151.libero.it (HELO ambire.localdomain) ([151.21.32.138]) by OutRelay-b07.libero.it with ESMTP; 12 Jul 2007 15:09:59 +0200 Original-Received: from ttn by ambire.localdomain with local (Exim 4.63) (envelope-from ) id 1I8yQT-0001bk-Jn; Thu, 12 Jul 2007 15:09:45 +0200 In-Reply-To: <1183978661.13149.5.camel@localhost.localdomain> (Andy Wingo's message of "Mon\, 09 Jul 2007 12\:57\:41 +0200") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) X-detected-kernel: Linux 2.4-2.6 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6047 Archived-At: () Andy Wingo () Mon, 09 Jul 2007 12:57:41 +0200 (I would really like to be able to get line numbers so that the documentation that I autogenerate based on introspection can be ordered as it appears in the source. I poked at this a couple hours and failed.) below is some code you can try. to play: save as x.scm and issue the shell command: guile -s x.scm. thi ________________________________________________________ (define (lc alist) (list (assq-ref alist 'line) (assq-ref alist 'column))) (define (posn form) (display "posn: ") (write (cond ((not (pair? form)) "not a pair") ((source-properties form) => lc) (else #f))) (newline)) (define p (open-input-file "x.scm")) (define (r) (read-enable 'positions) (let ((form (read p))) (or (eof-object? form) (begin (display "form: ") (write form) (newline) (posn form) (r))))) 42 (r) _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user