* set-program-arguments from scheme
@ 2007-01-13 22:25 Kevin Ryde
2007-01-13 23:08 ` Neil Jerram
0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2007-01-13 22:25 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
How about making scm_set_program_arguments() available at the scheme
level too? As say
(set-program-arguments lst)
(without the "first" arg business of the C level).
The C func is good for when you munch some options at the C level in
an scm_boot_guile, having it at the scheme level would be for the same
thing if do it in scheme instead.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: feature.c.set-prog-args.diff --]
[-- Type: text/x-diff, Size: 796 bytes --]
--- feature.c.~1.62.2.1.~ 2006-02-14 08:58:57.000000000 +1100
+++ feature.c 2007-01-13 17:41:19.000000000 +1100
@@ -76,6 +76,21 @@
scm_fluid_set_x (progargs_fluid, args);
}
+SCM_DEFINE (scm_set_program_arguments_scm, "set-program-arguments", 1, 0, 0,
+ (SCM lst),
+ "Set the command line arguments to be returned by\n"
+ "@code{program-arguments} (and @code{command-line}). @var{lst}\n"
+ "should be a list of strings, the first of which is the program\n"
+ "name (either a script name, or just @code{\"guile\"}).\n"
+ "\n"
+ "Program arguments are held in a fluid and therefore have a\n"
+ "separate value in each Guile thread.")
+#define FUNC_NAME s_scm_program_arguments
+{
+ return scm_fluid_set_x (progargs_fluid, lst);
+}
+#undef FUNC_NAME
+
\f
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set-program-arguments from scheme
2007-01-13 22:25 set-program-arguments from scheme Kevin Ryde
@ 2007-01-13 23:08 ` Neil Jerram
2007-01-15 21:24 ` Kevin Ryde
0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2007-01-13 23:08 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
> How about making scm_set_program_arguments() available at the scheme
> level too? As say
>
> (set-program-arguments lst)
>
> (without the "first" arg business of the C level).
>
> The C func is good for when you munch some options at the C level in
> an scm_boot_guile, having it at the scheme level would be for the same
> thing if do it in scheme instead.
That sounds good to me.
(I wondered about (set-program-arguments . lst) instead of
(set-program-arguments lst), but I suspect cases where you already
have a list in hand will be more common.)
> + "Program arguments are held in a fluid and therefore have a\n"
> + "separate value in each Guile thread.")
That's surprising; why is that? (I appreciate this isn't part of your
change though.)
Regards,
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set-program-arguments from scheme
2007-01-13 23:08 ` Neil Jerram
@ 2007-01-15 21:24 ` Kevin Ryde
2007-01-15 21:27 ` Kevin Ryde
2007-01-17 19:25 ` Neil Jerram
0 siblings, 2 replies; 5+ messages in thread
From: Kevin Ryde @ 2007-01-15 21:24 UTC (permalink / raw)
Cc: guile-devel
Neil Jerram <neil@ossau.uklinux.net> writes:
>
> (I wondered about (set-program-arguments . lst) instead of
> (set-program-arguments lst), but I suspect cases where you already
> have a list in hand will be more common.)
Yes, especially if you got it from a (program-arguments) call.
>> + "Program arguments are held in a fluid and therefore have a\n"
>> + "separate value in each Guile thread.")
>
> That's surprising; why is that?
Tell me and we'll both know :). scm_boot_guile can be called in each
thread with a different argc+argv, I suppose. I guess it lets you run
each thread like it's a separate program, though that sounds like an
unusual way to work.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set-program-arguments from scheme
2007-01-15 21:24 ` Kevin Ryde
@ 2007-01-15 21:27 ` Kevin Ryde
2007-01-17 19:25 ` Neil Jerram
1 sibling, 0 replies; 5+ messages in thread
From: Kevin Ryde @ 2007-01-15 21:27 UTC (permalink / raw)
Incidentally, I called the scheme func "scm_set_program_arguments_scm",
because plain "scm_set_program_arguments" is taken by the C interface.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: set-program-arguments from scheme
2007-01-15 21:24 ` Kevin Ryde
2007-01-15 21:27 ` Kevin Ryde
@ 2007-01-17 19:25 ` Neil Jerram
1 sibling, 0 replies; 5+ messages in thread
From: Neil Jerram @ 2007-01-17 19:25 UTC (permalink / raw)
Kevin Ryde <user42@zip.com.au> writes:
>>> + "Program arguments are held in a fluid and therefore have a\n"
>>> + "separate value in each Guile thread.")
>>
>> That's surprising; why is that?
>
> Tell me and we'll both know :).
Fair enough :-). I just thought you might have come across the reason.
> scm_boot_guile can be called in each
> thread with a different argc+argv, I suppose. I guess it lets you run
> each thread like it's a separate program, though that sounds like an
> unusual way to work.
Yes, it does sound unusual.
Regards,
Neil
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-01-17 19:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-13 22:25 set-program-arguments from scheme Kevin Ryde
2007-01-13 23:08 ` Neil Jerram
2007-01-15 21:24 ` Kevin Ryde
2007-01-15 21:27 ` Kevin Ryde
2007-01-17 19:25 ` Neil Jerram
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).