[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using Guile in C for program startup config
From: |
Neil Jerram |
Subject: |
Re: Using Guile in C for program startup config |
Date: |
29 Aug 2001 08:14:38 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 |
>>>>> "Luke" == Luke Hammer <address@hidden> writes:
Luke> Hello, Loving Emacs as I do, I jumped at the opportunity to
Luke> use a LISPish interface in a program of my own, and so I
Luke> have recently been tinkering with embedding Guile (using a
Luke> precompiled version of 1.4 for Win32) in an OpenGL particle
Luke> system program I've been playing with, in order to have it
Luke> load a Scheme config file and initialise some data
Luke> structures when the program loads. Currently, I use only one
Luke> SCM function to do this, namely load-gravdata, so the config
Luke> file looks something like this:
Luke> (load-gravdata 0 0 0 "save1")
Luke> (load-gravdata 0 0 1 12.0)
Luke> [...]
Luke> (grav-config "save1" (point 1 '(12 13 14 0.01 1)) (point 2
Luke> '(15 16 17 0.011 0)) [point 3 etc ...] )
Given that `load-gravdata' already works (so far as the Scheme/C
interface is concerned), you could simply implement `grav-config' on
the Scheme level as a procedure that calls `load-gravdata' as many
times as it needs to.
Something like this... (untested, in the best tradition :-)
(define (point num coord-list)
(cons num coord-list))
(define (grav-config name . points)
(load-gravdata 0 0 0 name)
(for-each (lambda (point)
(let ((num (list-ref point 0)))
(load-gravdata 0 num 1 (list-ref point 1))
(load-gravdata 0 num 2 (list-ref point 2))
(load-gravdata 0 num 3 (list-ref point 3))
(load-gravdata 0 num 4 (list-ref point 4))
(load-gravdata 0 num 5 (list-ref point 5))))
points))
Regards,
Neil