From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Using guile as an extension language for GNU make Date: Sun, 18 Sep 2011 23:28:37 +0200 Message-ID: <8762kp7d6i.fsf@gnu.org> References: <1316304616.28907.118.camel@homebase> <87pqiyaw5w.fsf@gnu.org> <1316367765.28907.153.camel@homebase> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1316381331 15653 80.91.229.12 (18 Sep 2011 21:28:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 18 Sep 2011 21:28:51 +0000 (UTC) Cc: guile-user@gnu.org To: psmith@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Sep 18 23:28:45 2011 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R5Ouq-0003wJ-IJ for guile-user@m.gmane.org; Sun, 18 Sep 2011 23:28:44 +0200 Original-Received: from localhost ([::1]:40642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Oup-0004Z0-T5 for guile-user@m.gmane.org; Sun, 18 Sep 2011 17:28:43 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:46003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Oum-0004Yj-V4 for guile-user@gnu.org; Sun, 18 Sep 2011 17:28:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5Oum-00089B-0G for guile-user@gnu.org; Sun, 18 Sep 2011 17:28:40 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:50432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5Oul-000897-Qu; Sun, 18 Sep 2011 17:28:39 -0400 Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id B473D441DB; Sun, 18 Sep 2011 23:28:38 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: Jour du =?iso-8859-1?Q?G=E9nie?= de =?iso-8859-1?Q?l?= =?iso-8859-1?Q?'Ann=E9e?= 219 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <1316367765.28907.153.camel@homebase> (Paul Smith's message of "Sun, 18 Sep 2011 13:42:45 -0400") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 80.67.169.19 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:8804 Archived-At: Hi Paul! Paul Smith skribis: > On Sun, 2011-09-18 at 14:10 +0200, Ludovic Courts wrote: >> There are two problems I can think of here: >>=20 >> - string unquoting is actually more complex than this (recall that >> =E2=80=98object->string=E2=80=99 merely calls =E2=80=98write=E2=80= =99): >> - =E2=80=98scm_c_eval_string=E2=80=99 can return any Scheme objects, s= ome of which >> have meaningless representations as strings: >>=20 >> The latter is probably the most serious question. I think you would >> really want to constrain expressions passed in $(guile ...) to return >> a string, and not any other type of objects. >>=20 >> In that case, you could solve the first problem by using (display ...) >> instead of (write ...). > > There's no question that the string conversion is a hack: that's mainly > why I'm asking here :-). Heh, understood. :-) > I don't want to restrict it to just strings; for example I'd have to > support numbers as well (one of GNU make's main issues right now is that > there is no math capability whatsoever). I'd like to be able to > possibly convert other things like t and nil (in GNU make's terms, > "false" is the empty string and "true" is any non-empty string). Maybe > there are other things as well (what about symbols like 'foobar?), I > don't know. OK, makes sense. What about defining the Scheme data types that would be acceptable to pass back at the make level? I think you pretty much listed them above: strings, numbers, and booleans. In your code, you would type-check them along these lines: char *c=C2=A0str; [...] if (scm_is_string (obj)) c_str =3D scm_to_locale_string (obj); /* No quoting issue here. */ else if (scm_is_number (obj)) c_str =3D scm_to_locale_string (object_to_string (obj)); else if (scm_is_false (obj)) c_str =3D strdup ("#f"); else if (scm_is_eq (obj, SCM_BOOL_T)) c_str =3D strdup ("#t"); else scm_wrong_type_arg (__func__, 0, obj); > As above, the double-quote stripping is intensely hacky :-). I'll look > into the concepts of display and write and see what I can figure out. > Any suggestions or pointers to example code are welcome. See info "(guile) Scheme Write". Thanks, Ludo=E2=80=99.