From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Binesh Bannerjee Newsgroups: gmane.lisp.guile.user Subject: Embedding guile in a C application. Date: Sun, 30 May 2004 02:32:56 -0400 (EDT) Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Trace: sea.gmane.org 1085898825 27399 80.91.224.253 (30 May 2004 06:33:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 30 May 2004 06:33:45 +0000 (UTC) Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun May 30 08:33:36 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BUJt1-0005LB-00 for ; Sun, 30 May 2004 08:33:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BUJt9-0005wx-9T for guile-user@m.gmane.org; Sun, 30 May 2004 02:33:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BUJt4-0005wd-V7 for guile-user@gnu.org; Sun, 30 May 2004 02:33:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BUJt0-0005wG-To for guile-user@gnu.org; Sun, 30 May 2004 02:33:38 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BUJt0-0005wC-Ba for guile-user@gnu.org; Sun, 30 May 2004 02:33:34 -0400 Original-Received: from [207.172.4.62] (helo=smtp03.mrf.mail.rcn.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BUJsX-0004Ym-U3 for guile-user@gnu.org; Sun, 30 May 2004 02:33:06 -0400 Original-Received: from 207-237-245-232.c3-0.nyw-ubr2.nyr-nyw.ny.cable.rcn.com ([207.237.245.232] helo=client.cablemodem.hex21.com) by smtp03.mrf.mail.rcn.net with esmtp (Exim 3.35 #7) id 1BUJsW-0000pc-00 for guile-user@gnu.org; Sun, 30 May 2004 02:33:04 -0400 Original-Received: by client.cablemodem.hex21.com (tmda-sendmail, from uid 500); Sun, 30 May 2004 02:33:03 -0400 (EDT) X-X-Sender: binesh@client.cablemodem.hex21.com Original-To: guile-user@gnu.org X-Delivery-Agent: TMDA/1.0.2 (Bold Forbes) X-TMDA-Fingerprint: HpixbFsxasWoOimuFdnO+aUS75U X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.4 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 Xref: main.gmane.org gmane.lisp.guile.user:3216 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3216 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi... I'm looking to code a genetic programming system a-la Koza ( http://www.geneticprogramming.com/Tutorial/ )... I'd like to embed a Guile interpreter inside the app, and have the C program generate Guile functions, and then get interpreted with Guile... I'm not sure how to go about doing this, and I haven't found any clear directions how to do so... (Although, I _have_ found hints that it should be possible.) http://www.swig.org/Doc1.3/Guile.html shows me how to embed guile... But, I don't think that's exactly what I want. What it does, is create a whole guile interpreter shell and all... All's I want is (something like) this: int main(int argc,char *argv[]) { guile_interpreter gi = create_guile_interpreter(); /* c = (define f (lambda (x) (+ 1 x))); */ cons c = new list_struct(); c->add("define"); c->add("f"); cons c2 = new list_struct(); c2->add("lambda"); const c3 = new list_struct(); c3->add("x"); c2->add_list(c3); const c4 = new list_struct(); c4->add("+"); c4->add("x"); c4->add("1"); c2->add_list(c4); c->add_list(c2); gi->interpret(c); cons r = new list_struct(); r->add("f"); r->add("6"); cons retVal = gi->interpret(r); printf("%d\n",retVal->value()); } and have that print out 7. How would I do that? Thanks! Binesh - -- PGP Key: http://www.hex21.com/~binesh/binesh-public.asc PGP Key fingerprint = 421D B4C2 2E96 B8EE 7190 A0CF B42F E71C 7FC3 AD96 SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub OpenSSH Key: http://www.hex21.com/~binesh/binesh-openssh.pub BubbleBabble = xibeb-voges-havez-pabaf-debop-cylil-lelyc-viruv-bygeg-zotoh-dixex Fingerprint = 9d:7c:84:5d:80:e3:65:8d:ee:9e:a3:b9:56:0a:e9:ad SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub CipherKnight Seals: http://www.hex21.com/~binesh/binesh-seal.tar.bz2.cs256 http://www.hex21.com/~binesh/binesh-seal.zip.cs256 http://www.hex21.com/~binesh/binesh-certificate.gif.cs256 Decrypt with CipherSaber2 N=256, Password="WelcomeJedi!" (No quotes) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/ iD8DBQFAuYAetC/nHH/DrZYRAnmJAJ9SlaBm8MqZnhvtATshsI3AYMjvtgCg9OT6 QNypnWlRqHi6cGD34YcA7gk= =AaF0 -----END PGP SIGNATURE----- _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user