Re: [racket] FFI question again - how to get a string back from C

2011-06-11 Thread keyd...@gmx.de
Hi Thomas, thank you, too, very much for your solution! I had already successfully tried Ryan's way, but it's always good and instructive to learn several ways - now I know 2 ways to allocate a byte buffer and to cast it to a string afterwards :-) I've tried your solution, and it worked perfect

[racket] make-limited-input-port and Port Events

2011-06-11 Thread Milo Arvidsson
I'm getting contract violations when I use 'make-limited-input-port' with port events. For example, this program: #lang racket/base (require racket/port) (define in (open-input-string "12345\n")) (sync (read-line-evt (make-limited-input-port in 512))) fails like this: contract violation: expecte

Re: [racket] Embedding a GUI editor into Slideshows

2011-06-11 Thread Rodolfo Carvalho
Robby, your suggestion didn't work with 5.1.1 under Ubuntu. The difference is that multiple clicks instantiates multiple windows, but none of them were shown on top. Anyway I am satisfied with the current state. I can launch other apps using racket/system and they do take focus! For example I was

Re: [racket] Embedding a GUI editor into Slideshows

2011-06-11 Thread Robby Findler
That does work for me, in the latest pre-release under mac os x. I have a vague recollection that there was a linux bug related to this that has been fixed, but I'm not sure. One thing to try to work around it (if upgrading isn't an option) is to actually create the frame inside the callback: #la

Re: [racket] Embedding a GUI editor into Slideshows

2011-06-11 Thread Rodolfo Carvalho
I tried the following, but the new frame is not shown on top of the slide (I need to alt-tab to see it): #lang slideshow (require racket/gui) (define frame (new frame% [label "Example"])) (define msg (new message% [parent frame] [label "No events so far..."])) (new button% [pa

Re: [racket] regexp-match-evt and file-position

2011-06-11 Thread Matthew Flatt
Thanks for the report! I think the bug is more specifically in the implementation of `port-commit-peeked' for some kinds of ports, since the following program also has the wrong result: #lang racket/base (define-values (in out) (make-pipe)) (display "12345" out) (peek-bytes 3 0 in) (port-com

Re: [racket] Embedding a GUI editor into Slideshows

2011-06-11 Thread Matthew Flatt
You could have a clickback in a slide that creates a new frame on top of the Slideshow frame. That approach has worked ok for me. At Fri, 10 Jun 2011 17:58:21 -0300, Rodolfo Carvalho wrote: > Hello everybody, > > Has anyone had the experience of embedding a "live code editor" into > Slideshow? >

Re: [racket] FFI question again - how to get a string back from C

2011-06-11 Thread Thomas Chust
2011/6/11 keyd...@gmx.de : > [...] > I have a problem getting an output string from the C side... Hello Sigrid, it would be helpful if you mentioned the signature of the original C function, otherwise it is hard to decide whether your binding's signature is correct. I will assume that the functi

Re: [racket] FFI question again - how to get a string back from C

2011-06-11 Thread keyd...@gmx.de
Hi Ryan, thank you very much, this works very well! I am not sure yet whether it'd be desirable to pass in the buffer to the function,- it's more work for the client, but in any case, the client will have to specify the buffer length. Regarding garbage collection, it should not really make a dif

Re: [racket] FFI question again - how to get a string back from C

2011-06-11 Thread Ryan Culpepper
On 06/11/2011 12:54 AM, keyd...@gmx.de wrote: Hi again, sorry for again asking such a basic FFI question, but I have a problem getting an output string from the C side... E.g. in one case, in my first attempt (def-ocilib datetotext OCI_DateToText : (date_ptr : _pointer) (fmt : _string) (size