Re: Guile 1.8 Garbage Collection Question

2011-10-25 Thread Cedric Cellier
I cant see anything wrong with your function, so I suspect there is something wrong with the function you pass your string to. Maybe it's trying to write into s but does write out of bounds insead, damaging the heap ?? Note: it is my understanding that s is allocated on C's heap and so will not

Re: Guile, Emacs, and smartphones

2011-06-18 Thread Cedric Cellier
I run guile on my N900, but I suggest you wait a little for there are rumors of a new maemo phone from nokia this summer.

AgentX implementation in guile

2010-10-22 Thread Cedric Cellier
Like announced on the IRC channel some days ago, I'm writting an agentX implementation for Guile (this is a way to talk easily to a SNMP master agent). Here is the first version : http://github.com/rixed/guile-agentx This is very easy to use but also probably full of bugs and missing features. A

sharing a file descriptor with a port

2010-09-17 Thread Cedric Cellier
Support I open a file, then make a port with the file description (with scm_fdopen), then I close the file description. When the port will be garbage collected the GC will attempt to close the port->fdes, ignoring the EBADF error, so everything is OK. Now supose I do this in a loop. The next open

Memory leak with threads + guile 1.8.7 ?

2010-09-15 Thread Cedric Cellier
Hello dear hackers ! I'm using guile in an C program that spawn a lot of short lived threads, each of which passing in guile mode (guile 1.8.7), and I'm facing a memory leak even when the threads does nothing (ie. the C function called by scm_with_guile consists only of a return NULL. After some t

scm_with_continuation_barrier returning #f on throws ?

2010-09-06 Thread Cedric Cellier
Hello ! With guile-1.8.7, scm_with_continuation_barrier does not seam to return SCM_BOOL_F on error. I did this : static void *load_file(void *filename) { scm_c_primitive_load((char const *)filename); scm_force_output(scm_current_output_port()); return NULL; } ... SCM res = scm_with

Re: Can't define in (if...) after (use-syntax (ice-9 syncase)) ?

2010-09-01 Thread Cedric Cellier
-[ Fri, Aug 27, 2010 at 04:04:25PM +0200, Andreas Rottmann ] > > guile> (use-syntax (ice-9 syncase)) > > guile> (if #t (define foo "bar")) > > ERROR: invalid context for definition of foo > > (...) > > > I think it's establishing stricter rules for `define' placement. Note > that your code is

Can't define in (if...) after (use-syntax (ice-9 syncase)) ?

2010-08-27 Thread Cedric Cellier
guile> (use-syntax (ice-9 syncase)) guile> (if #t (define foo "bar")) ERROR: invalid context for definition of foo ABORT: (misc-error) guile> (version) $1 = "1.8.7" apparently syncase module is altering the if or define behavior somehow ?

Re: Latest guile 1.9 segfault in GC

2010-08-23 Thread Cedric Cellier
-[ Wed, Aug 18, 2010 at 09:16:15AM -0700, Andy Wingo ] > You're probably not hitting the compiler for some reason. I think that > scm_primitive_load doesn't support autocompilation, where it probably > should. Is that the function you're using to load your Scheme code? Ok, the file I load with

Re: Latest guile 1.9 segfault in GC

2010-08-17 Thread Cedric Cellier
Ok, this bug was fixed but not the actual bug I was after. But finaly, thanks to libgc's debug message, I got it. Actually, libgc overwrite pthread_create (and pthread_sigmask, and a few more) to know when a new thread is started. But this overloading is done "softly", ie. by a define in a C heade

Re: Latest guile 1.9 segfault in GC

2010-08-17 Thread Cedric Cellier
I'm using libgc v 7.2alpha4. Apparently the value of GC_all_interior_pointers is 1 when initializing the GC (so GC_old_normal_bl is not initialized) and suddenly is set to 1 so that the next call to GC_is_black_listed dereference it and thus crash. It's set to 0 by scm_storage_prehistory in ligui

Latest guile 1.9 segfault in GC

2010-08-17 Thread Cedric Cellier
% cat main.c #include #include #include pthread_t dumper; static void *call_gc(void *null) { scm_gc(); return NULL; } void *thread_dumper(void *null) { scm_with_guile(call_gc, NULL); return NULL; } int main(void) { while (1) { pthread_create(&dumper, NULL, t

thread safe functions

2010-08-05 Thread Cedric Cellier
Is there somewhere a list of guile functions that are (/are not) thread safe ? I ask since this morning I was after a strange bug because I was using the format module in two different thread, then learnt that these functions are not reentrant. I'm also interrested in the thread-safeness of gc-sta

Re: Thread and guile environment

2010-07-12 Thread Cedric Cellier
This works if I explicitely define a module _and_ export the hug symbol. (define-module (bug)) (export hug) (use-modules (ice-9 format)) (define (hug x) (format #t "HUG ~a !\n" x)) #include #include #include static void *load_file_with_guile(void *filename) { scm_c_primitive_load((char *)fil

Re: Thread and guile environment

2010-07-09 Thread Cedric Cellier
-[ Thu, Jul 08, 2010 at 08:48:33PM +0100, Andy Wingo ] > Interestingly, the first thread has you in (guile-user), but the second > has you in (guile). So you don't see the full definition of format, nor > do you see hug. Interresting indeed. Is there a definition of these modules and their pur

Re: Best way to call a user defined hook (written in guile) from C when the hook need plenty parameters

2010-07-07 Thread Cedric Cellier
(resend since previous mail was not delivered) First, let's give more details about what we are trying to implement. The main C program is continuously measuring some realtime evolving values, and periodically (lets say every 30 seconds) it must dump all measurements in a CSV file. As there are ma

Re: Thread and guile environment

2010-07-07 Thread Cedric Cellier
By the way, I'm using guile v1.8.7(+1-3ubuntu1)

Re: Best way to call a user defined hook (written in guile) from C when the hook need plenty parameters

2010-07-06 Thread Cedric Cellier
-[ Mon, Jul 05, 2010 at 09:18:30PM +0100, Neil Jerram ] > But you could get a similar effect - which I think will still work in > 1.9/2.0 - by creating a module, defining values in it, and then > evaluating in that module. (In Guile, module == top level > environment.) I was trying to avoid b

Re: Thread and guile environment

2010-07-06 Thread Cedric Cellier
-[ Mon, Jul 05, 2010 at 08:52:44PM +0100, Neil Jerram ] > ri...@happyleptic.org writes: > Hm. I think I recall a bug to do with different threads starting in > different modules. Does it work if you add > > (define-module (guile-user)) > > at the start of your bug.scm ? Same behavior : ERRO

Re: eval and exceptions

2008-08-11 Thread cedric cellier
> Well, you can call your "eval-string" inside a catch, for example: > (catch #t (lambda()(eval-string packet)) (lambda (key . args) #f)) Yes, it works ! I've tried it with srfi-34 extention module (guard) but for some reason guard does not catch this kind of errors, while the genuine catch works.

eval and exceptions

2008-08-10 Thread Cedric Cellier
Hi you all in there ! In the attempt to drastially reduce the work required for a little project (a small wargame), I want to use guile to "box" the game engine (that is to be) written in C. I also want the players GUI to be connected to the game via sockets established by guile (15 lines of code,