From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludovic.courtes@laas.fr (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: I don't want to maintain this Date: Wed, 30 Nov 2005 09:39:29 +0100 Organization: LAAS-CNRS Message-ID: <87mzjmfs1q.fsf@laas.fr> References: <200511272025.32395.bruce.korb@gmail.com> <8764qbuawp.fsf@laas.fr> <200511291214.37104.bruce.korb@gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1133360358 22543 80.91.229.2 (30 Nov 2005 14:19:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2005 14:19:18 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Wed Nov 30 15:19:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EhPtm-0001zo-8n for guile-devel@m.gmane.org; Wed, 30 Nov 2005 12:13:21 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhPkv-0005s7-KQ for guile-devel@m.gmane.org; Wed, 30 Nov 2005 06:04:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EhNVR-0006Rg-I2 for guile-devel@gnu.org; Wed, 30 Nov 2005 03:40:02 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EhNVN-0006R6-HC for guile-devel@gnu.org; Wed, 30 Nov 2005 03:40:00 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EhNVL-0006Qm-V9 for guile-devel@gnu.org; Wed, 30 Nov 2005 03:39:57 -0500 Original-Received: from [140.93.0.15] (helo=laas.laas.fr) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1EhNVL-0007jD-Jt for guile-devel@gnu.org; Wed, 30 Nov 2005 03:39:56 -0500 Original-Received: by laas.laas.fr (8.13.1/8.13.4) with SMTP id jAU8dmiU004623; Wed, 30 Nov 2005 09:39:50 +0100 (CET) Original-To: Bruce Korb X-URL: http://www.laas.fr/~lcourtes/ X-Revolutionary-Date: 10 Frimaire an 214 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEB1F5364 X-PGP-Key: http://www.laas.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 821D 815D 902A 7EAB 5CEE D120 7FBA 3D4F EB1F 5364 X-OS: powerpc-unknown-linux-gnu Mail-Followup-To: Bruce Korb , guile-devel@gnu.org In-Reply-To: <200511291214.37104.bruce.korb@gmail.com> (Bruce Korb's message of "Tue, 29 Nov 2005 12:14:36 -0800") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) X-Spam-Score: 0 () X-Scanned-By: MIMEDefang at CNRS-LAAS X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5427 Archived-At: Hi Bruce, Bruce Korb writes: > *I* certainly cannot. Do you mean that you don't *want* to, or that this is not possible? The point is that writing Scheme code will always be easier than writing C code, and maintaining it will be even more easier. > And I do not understand the usage of the "file" > argument. What I am doing is extracting Scheme code from an encompassing > template and handing it off for evaluation. My program is reading the > file, not Guile. When I hand off the the string for evaluation, I hand > it to that ugly thing that I do not want to maintain. I do this in > exactly the same way as one would with scm_c_eval_string, except I have > the additional parameters file name and line number. Perhaps I could > wrap my strings in something like this: > > char* fmt = > "(read-enable 'positions) > (format #t \"evaluating `~a' from ~a:~a:~a~%%\" > sexp (port-filename (current-input-port)) > (source-property sexp \"%s\") > (source-property sexp %d)) > (begin > %s > )"; > > and use it thus: > > sprintf( buf, fmt, filename, linenum, script ); > result = scm_c_eval_string( buf ); > > Would that work? That might work, but that's "ugly". Are you evaluating reading a file and evaluating it from C code? Even if this is the case, nothing prevents you from writing your own read/eval function in Scheme (along the lines of what I posted earlier) and using it from C: eval_proc = scm_c_eval_string ("eval-from-file"); result = scm_call_1 (eval_proc, scm_from_locale_string ("the-file.scm")); Hope this helps, Ludovic. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel