Re: Using guile as an extension language for GNU make

2011-09-21 Thread Hans Aberg
On 21 Sep 2011, at 04:42, Mark H Weaver wrote: >> And finally, currently I have all unknown types expanding to the empty >> string but now I'm thinking it would be better to start out more >> restrictive and throw errors. This would ensure that people write their >> Guile scripts correctly (givin

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Mark H Weaver
Hi Paul, Thanks for working on this! :) Paul Smith writes: > So far, I have these translations (see the C code I posted earlier): > > t => "t" (for make conditionals, non-empty is true) > nil => "" (for make conditionals, empty is false) Note that in modern Scheme, t and

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Thien-Thi Nguyen
() Paul Smith () Tue, 20 Sep 2011 15:02:09 -0400 I was thinking something like "gnu make" would be OK, but maybe there are already conventions for applications/application-specific module hierarchies that I should be following? None that i am aware of. If the module is completely inter

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Thien-Thi Nguyen
() Paul Smith () Tue, 20 Sep 2011 13:31:28 -0400 I showed the code in my original post, but the way I've implemented it is that the argument to the make "guile" function (that is, everything after the "$(guile " to the closing paren--it's handy that Guile parens will virtually always

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Paul Smith
On Tue, 2011-09-20 at 13:31 -0400, Paul Smith wrote: > > In Scheme, w/ SRFI 13, you could express this as: > > > > This is not so tricky, i think. > > Heh, cute! Thinking about this more it occurs to me that I will likely need a module defined for any GNU make specific procedures I write to avo

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Paul Smith
On Tue, 2011-09-20 at 18:17 +0200, Thien-Thi Nguyen wrote: > () Paul Smith > () Mon, 19 Sep 2011 11:14:34 -0400 > >In make, everything is just words: broken up on whitespace. So for >example, maybe someone writes a Guile function that computes a complex >set of prerequisites for a ta

Re: Using guile as an extension language for GNU make

2011-09-20 Thread Thien-Thi Nguyen
() Paul Smith () Mon, 19 Sep 2011 11:14:34 -0400 In make, everything is just words: broken up on whitespace. So for example, maybe someone writes a Guile function that computes a complex set of prerequisites for a target: target: $(guile (...some Guile program...)) Even bef

Re: Using guile as an extension language for GNU make

2011-09-19 Thread Hans Aberg
On 19 Sep 2011, at 23:56, Paul Smith wrote: > Rather, I need to define a translation from any Guile data type I want > to support into a make-appropriate string (char* buffer) so it can be > appended to make's read buffer, then parsed by make. For any Guile data > type I can't or don't want to tr

Re: Using guile as an extension language for GNU make

2011-09-19 Thread Hans Aberg
On 19 Sep 2011, at 23:56, Paul Smith wrote: > The first stage of make is reading in all the makefiles. As part of > this, variables and functions are expanded (one line at a time) and the > result is a string. Its parser is handwritten, and perhaps not easy to tweak, and get 'make' variables an

Re: Using guile as an extension language for GNU make

2011-09-19 Thread Paul Smith
On Mon, 2011-09-19 at 21:41 +0200, Hans Aberg wrote: > On 19 Sep 2011, at 17:14, Paul Smith wrote: > > > In make, everything is just words: broken up on whitespace. So for > > example, maybe someone writes a Guile function that computes a complex > > set of prerequisites for a target: > > > >

Re: Using guile as an extension language for GNU make

2011-09-19 Thread Hans Aberg
On 19 Sep 2011, at 17:14, Paul Smith wrote: > In make, everything is just words: broken up on whitespace. So for > example, maybe someone writes a Guile function that computes a complex > set of prerequisites for a target: > > target: $(guile (...some Guile program...)) > > The list of pr

Re: Using guile as an extension language for GNU make

2011-09-19 Thread Paul Smith
On Mon, 2011-09-19 at 02:28 +0200, Thien-Thi Nguyen wrote: > "Clean" in what way? Everything depends on what the expected (valid) use > of this facility would be. Could you give some examples (w/ failure cases)? In make, everything is just words: broken up on whitespace. So for example, maybe s

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Thien-Thi Nguyen
() Paul Smith () Sun, 18 Sep 2011 15:28:00 -0400 [new impl] That's better than what I had before, but I still have some concerns. For example, what if a Guile call wanted to return a list? I can use display as above, but the list will be enclosed in parentheses, which is not how

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Ludovic Courtès
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: >> >> - string unquoting is actually more complex than this (recall that >> ‘object->string’ merely calls ‘write’): >> - ‘scm_c_eval_string’ can return

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Paul Smith
On Sun, 2011-09-18 at 17:30 +0200, Thien-Thi Nguyen wrote: > The double-quote stripping is kind of hacky. I would create a port > and ‘display’ the result of ‘scm_c_eval_string’ to it. Thanks for the hints. I've reworked my code to implement a generic "SCM to make string" function; currently it

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Paul Smith
On Sun, 2011-09-18 at 14:10 +0200, Ludovic Courts wrote: > There are two problems I can think of here: > > - string unquoting is actually more complex than this (recall that > ‘object->string’ merely calls ‘write’): > - ‘scm_c_eval_string’ can return any Scheme objects, some of which >

Embedding vs. Extending (was: Re: Using guile as an extension language for GNU make)

2011-09-18 Thread Paul Smith
On Sun, 2011-09-18 at 14:10 +0200, Ludovic Courts wrote: > Ideally, when Guile support is enabled, GNU make would be turned into > a Guile extension (a shared library and its companion Scheme module > that loads it with ‘load-extension’) that would expose make’s > functionality. I'm not sure I'm i

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Thien-Thi Nguyen
() Paul Smith () Sat, 17 Sep 2011 20:10:16 -0400 char *str = scm_to_locale_string (scm_object_to_string (scm_c_eval_string (argv[0]), SCM_UNDEFINED)); char *s = str; unsigned int l = strlen (s); if (s[0] == '"' && s[l-1

Re: Using guile as an extension language for GNU make

2011-09-18 Thread Ludovic Courtès
Hi Paul, Paul Smith skribis: > I've been experimenting with using Guile as an extension language to GNU > make (optionally built-in of course). Sounds like great news! :-) > What I've done so far: > > * Modified GNU make's main to be invoked from scm_boot_guile(), if > Guile is