unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Using guile to extend gaim
@ 2003-06-17  2:45 javabsp
  2003-06-17  8:05 ` Andreas Rottmann
  2003-06-19  0:28 ` Marius Vollmer
  0 siblings, 2 replies; 4+ messages in thread
From: javabsp @ 2003-06-17  2:45 UTC (permalink / raw)


Hi,
I am writing a plugin loader for gaim that would allow people to write
scheme code to extend gaim. For those who don't know, gaim is a
multi-protocol IM client. Its website is at http://gaim.sf.net/ .
I am having a couple issues, hopefully someone on this list will be able
to clearify them for me.
1) Because having 2 scheme scripts that interfere with each other is not
very desirable, I am creating an environment to load each script. The
snapshot of the relevant code is here:
env = scm_make_eval_environment(scm_system_environment->local,
scm_system_environment->imported);
scheme = scm_c_read_string(code);
scm_eval_body(scheme, env);
Where code is a char * containing the Scheme code. I wonder if this is the
right way to do it, or if there's a better way?
2) How to destroy the environment after it's no longer useful (to unload a
script)
3) Is there an example on calling a generic function with C?

Thanks,
- Ka-Hing





_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: Using guile to extend gaim
@ 2003-06-17 14:37 Mike Gran
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Gran @ 2003-06-17 14:37 UTC (permalink / raw)


<javabsp@javabsp.org> writes:

> 3) Is there an example on calling a generic function with C?

I don't know if this is right.  (The ref manual is a little unclear on what is the right way to do things.)  But I've done it this way.

-------------------------------
main.c
-------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <libguile.h>

int main (int argc, char *argv[])
{
	SCM func_symbol;
	SCM func;
	
	scm_init_guile();
	
	// Load the scheme function definitions
	scm_c_primitive_load ("script.scm");	
	
	// Call func "do-hello" with 0 args
	func_symbol = scm_c_lookup("do-hello");
	func = scm_variable_ref(func_symbol);
	scm_call_0 (func);

	exit(EXIT_SUCCESS);
} 
-------------------------------
script.scm
-------------------------------
(define do-hello
  (lambda ()
    (display "Hello world.") 
     (newline)))





_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-06-19  0:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-17  2:45 Using guile to extend gaim javabsp
2003-06-17  8:05 ` Andreas Rottmann
2003-06-19  0:28 ` Marius Vollmer
  -- strict thread matches above, loose matches on Subject: below --
2003-06-17 14:37 Mike Gran

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).