From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: unknown location: definition in expression context in subform optname-from of "_^" Date: Sat, 28 Jan 2012 14:47:17 -0500 Message-ID: <87d3a3lid6.fsf@netris.org> References: <4F20CEE7.4000403@gmail.com> <1327551746.85660.YahooMailNeo@web37907.mail.mud.yahoo.com> <4F21BFFC.8040300@gmail.com> <87d3a6ovhs.fsf@netris.org> <4F21F635.4020404@gmail.com> <8762fxq3rr.fsf@netris.org> <4F220F84.5090601@gmail.com> <4F221BD3.8090105@gmail.com> <87r4ykl36k.fsf@netris.org> <87obtnzm2p.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1327780121 12278 80.91.229.3 (28 Jan 2012 19:48:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 Jan 2012 19:48:41 +0000 (UTC) Cc: Bruce Korb , guile-devel@gnu.org To: Andy Wingo Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sat Jan 28 20:48:41 2012 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RrEGN-0006Qe-EW for guile-devel@m.gmane.org; Sat, 28 Jan 2012 20:48:39 +0100 Original-Received: from localhost ([::1]:57236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrEGM-0005pH-VG for guile-devel@m.gmane.org; Sat, 28 Jan 2012 14:48:38 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrEGJ-0005p1-R7 for guile-devel@gnu.org; Sat, 28 Jan 2012 14:48:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RrEGI-0008OD-Gs for guile-devel@gnu.org; Sat, 28 Jan 2012 14:48:35 -0500 Original-Received: from world.peace.net ([96.39.62.75]:36350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RrEGI-0008NY-CL for guile-devel@gnu.org; Sat, 28 Jan 2012 14:48:34 -0500 Original-Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1RrEG2-0002lj-EE; Sat, 28 Jan 2012 14:48:18 -0500 In-Reply-To: <87obtnzm2p.fsf@pobox.com> (Andy Wingo's message of "Sat, 28 Jan 2012 20:03:26 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 96.39.62.75 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:13723 Archived-At: Andy Wingo writes: > On Sat 28 Jan 2012 17:58, Bruce Korb writes: > >>> Bruce Korb writes: >>> > I need to be able to locate a guile scheme expression in my ASCII >>> > text input and hand it off to Guile, telling it the file name and >>> > line number and column number of where I found the string. >>> >>> I agree that we should add a function or two to handle this more >>> conveniently. Let's talk about it after 2.0.4 has been released, and >>> hopefully we can get it into 2.0.5. >> >> Maybe less cumbersome than scm_c_eval_string_from_file_line ;) > > Didn't we settle on eval-string, with the #:file and #:line kwargs? See > eval-string in the manual. I guess the code to use that from C would look something like this: SCM scm_c_eval_string_from_file (const char *string, const char *file_name, long line, long column) { static SCM eval_string_var, file_keyword, line_keyword, column_keyword; static int initialized = 0; SCM args[7]; if (!initialized) { eval_string_var = scm_c_public_variable ("ice-9 eval-string", "eval-string"); file_keyword = scm_from_latin1_keyword ("file"); line_keyword = scm_from_latin1_keyword ("line"); column_keyword = scm_from_latin1_keyword ("column"); initialized = 1; } args[0] = scm_from_locale_string (string); args[1] = file_keyword; args[2] = scm_from_locale_string (file_name); args[3] = line_keyword; args[4] = scm_from_long (line); args[5] = column_keyword; args[6] = scm_from_long (column); return scm_call_n (SCM_VARIABLE_REF (eval_string_var), args, 7); } This seems very awkward. Is there an easier way? Mark