Re: [Chicken-users] iup cells draw callback

2015-11-16 Thread Martin DeMello
The intermittent not-working seems to be an artefact of the parameter
getting messed up (as I should have known!). Don't understand the bindings
well enough to see why the latter is happening.

martin

On Sun, Nov 15, 2015 at 1:49 AM, Martin DeMello <martindeme...@gmail.com>
wrote:

> Couple of weird problems with the code:
>
> 1. It works sometimes, and sometimes it just displays a grey grid, as
> though the draw callback didn't do anything (though it gets called, because
> the debug text does print out)
>
> 2. As per the debug printf, something odd happens to the xmin parameter,
> though passing it back to canvas-box! works fine.
>
> (display (list i j xmin xmax ymin ymax canvas)) prints out
>
> (8 1 75263102 50 17 67 #
>
> Code  below:
>
> $ cat chess.scm
> (use iup)
> (use canvas-draw)
> (import canvas-draw-iup)
>
> (define (nlines self) 8)
> (define (ncols self) 8)
> (define (height self line) 50)
> (define (width self col) 50)
>
> (define (draw self i j xmin xmax ymin ymax canvas)
>   (when (and (= i 8) (= j 1))
> (display (list i j xmin xmax ymin ymax canvas)))
>   (if (= (modulo (+ i j) 2) 0)
> (canvas-foreground-set! canvas #xFF)
> (canvas-foreground-set! canvas #x00))
>   (canvas-box! canvas xmin xmax ymin ymax))
>
> (define dlg
>   (dialog
> (vbox
>   (cells name: "chessboard"
>  height-cb: height
>  width-cb: width
>  nlines-cb: nlines
>  draw-cb: (make-cells-draw-cb draw)
>  ncols-cb: ncols)
>   (button title: 'E
>   expand: 'Yes
>   tip: "Close button"
>       action: (lambda (self) 'close)))
> title: 'IUP))
>
> (show dlg)
> (main-loop)
> (destroy! dlg)
> (exit 0)
>
>
> On Sat, Nov 7, 2015 at 2:58 PM, Martin DeMello <martindeme...@gmail.com>
> wrote:
>
>> Finally had time to finish this off. It needed one more change
>> (pointer->canvas was not being reexported from canvas-draw).
>>
>> Let me know when you've pushed the new egg, and I'll add the chessboard
>> example to the tutorial in the wiki.
>>
>> martin
>>
>> On Wed, Oct 14, 2015 at 11:00 PM, Thomas Chust <ch...@web.de> wrote:
>>
>>> On 2015-10-15 04:04, Martin DeMello wrote:
>>> > [...]
>>> > it looks like the cb-draw callback has format "iiC", which doesn't
>>> > match the sigil regex. I take it that means callbacks with a Canvas*
>>> > argument are unsupported in chicken-iup?
>>> > [...]
>>>
>>> Hello Martin,
>>>
>>> that is correct, however support is trivial to add: Add the #\C
>>> character to the regular expression for callback signatures, add a case
>>> for #\C typed arguments in the dispatcher that treats them identically
>>> to #\v typed arguments, use pointer->canvas from the canvas-draw egg in
>>> your callback code to add the right type tags to the raw pointer.
>>>
>>> I think that the #\C signature character has been introduced recently in
>>> IUP. Anyway, I added the necessary marshalling code as outlined above to
>>> the iup egg, it is available in the trunk version of the code.
>>>
>>> Ciao,
>>> Thomas
>>>
>>>
>>> --
>>> When C++ is your hammer, every problem looks like your thumb.
>>>
>>> ___
>>> Chicken-users mailing list
>>> Chicken-users@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/chicken-users
>>>
>>
>>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] iup cells draw callback

2015-11-16 Thread Martin DeMello
More debug info:

mouseclick-cb and mousemotion-cb have the same problem; the fourth argument
(counting the handle) is the one that gets messed up, and the messed-up
value is constant for a given callback, rather than depending on the value
that should have been passed.

Also, the values for the three callbacks are pretty close together and the
differences are always constant, so it looks like some sort of pointer is
getting passed in place of an arg.

martin

On Sun, Nov 15, 2015 at 1:49 AM, Martin DeMello <martindeme...@gmail.com>
wrote:

> Couple of weird problems with the code:
>
> 1. It works sometimes, and sometimes it just displays a grey grid, as
> though the draw callback didn't do anything (though it gets called, because
> the debug text does print out)
>
> 2. As per the debug printf, something odd happens to the xmin parameter,
> though passing it back to canvas-box! works fine.
>
> (display (list i j xmin xmax ymin ymax canvas)) prints out
>
> (8 1 75263102 50 17 67 #
>
> Code  below:
>
> $ cat chess.scm
> (use iup)
> (use canvas-draw)
> (import canvas-draw-iup)
>
> (define (nlines self) 8)
> (define (ncols self) 8)
> (define (height self line) 50)
> (define (width self col) 50)
>
> (define (draw self i j xmin xmax ymin ymax canvas)
>   (when (and (= i 8) (= j 1))
> (display (list i j xmin xmax ymin ymax canvas)))
>   (if (= (modulo (+ i j) 2) 0)
> (canvas-foreground-set! canvas #xFF)
> (canvas-foreground-set! canvas #x00))
>   (canvas-box! canvas xmin xmax ymin ymax))
>
> (define dlg
>   (dialog
> (vbox
>   (cells name: "chessboard"
>  height-cb: height
>  width-cb: width
>  nlines-cb: nlines
>  draw-cb: (make-cells-draw-cb draw)
>  ncols-cb: ncols)
>   (button title: 'E
>   expand: 'Yes
>   tip: "Close button"
>       action: (lambda (self) 'close)))
> title: 'IUP))
>
> (show dlg)
> (main-loop)
> (destroy! dlg)
> (exit 0)
>
>
> On Sat, Nov 7, 2015 at 2:58 PM, Martin DeMello <martindeme...@gmail.com>
> wrote:
>
>> Finally had time to finish this off. It needed one more change
>> (pointer->canvas was not being reexported from canvas-draw).
>>
>> Let me know when you've pushed the new egg, and I'll add the chessboard
>> example to the tutorial in the wiki.
>>
>> martin
>>
>> On Wed, Oct 14, 2015 at 11:00 PM, Thomas Chust <ch...@web.de> wrote:
>>
>>> On 2015-10-15 04:04, Martin DeMello wrote:
>>> > [...]
>>> > it looks like the cb-draw callback has format "iiC", which doesn't
>>> > match the sigil regex. I take it that means callbacks with a Canvas*
>>> > argument are unsupported in chicken-iup?
>>> > [...]
>>>
>>> Hello Martin,
>>>
>>> that is correct, however support is trivial to add: Add the #\C
>>> character to the regular expression for callback signatures, add a case
>>> for #\C typed arguments in the dispatcher that treats them identically
>>> to #\v typed arguments, use pointer->canvas from the canvas-draw egg in
>>> your callback code to add the right type tags to the raw pointer.
>>>
>>> I think that the #\C signature character has been introduced recently in
>>> IUP. Anyway, I added the necessary marshalling code as outlined above to
>>> the iup egg, it is available in the trunk version of the code.
>>>
>>> Ciao,
>>> Thomas
>>>
>>>
>>> --
>>> When C++ is your hammer, every problem looks like your thumb.
>>>
>>> ___
>>> Chicken-users mailing list
>>> Chicken-users@nongnu.org
>>> https://lists.nongnu.org/mailman/listinfo/chicken-users
>>>
>>
>>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] iup cells draw callback

2015-11-15 Thread Martin DeMello
Couple of weird problems with the code:

1. It works sometimes, and sometimes it just displays a grey grid, as
though the draw callback didn't do anything (though it gets called, because
the debug text does print out)

2. As per the debug printf, something odd happens to the xmin parameter,
though passing it back to canvas-box! works fine.

(display (list i j xmin xmax ymin ymax canvas)) prints out

(8 1 75263102 50 17 67 #

Code  below:

$ cat chess.scm
(use iup)
(use canvas-draw)
(import canvas-draw-iup)

(define (nlines self) 8)
(define (ncols self) 8)
(define (height self line) 50)
(define (width self col) 50)

(define (draw self i j xmin xmax ymin ymax canvas)
  (when (and (= i 8) (= j 1))
(display (list i j xmin xmax ymin ymax canvas)))
  (if (= (modulo (+ i j) 2) 0)
(canvas-foreground-set! canvas #xFF)
(canvas-foreground-set! canvas #x00))
  (canvas-box! canvas xmin xmax ymin ymax))

(define dlg
  (dialog
(vbox
  (cells name: "chessboard"
 height-cb: height
 width-cb: width
 nlines-cb: nlines
 draw-cb: (make-cells-draw-cb draw)
 ncols-cb: ncols)
  (button title: 'E
  expand: 'Yes
  tip: "Close button"
  action: (lambda (self) 'close)))
title: 'IUP))

(show dlg)
(main-loop)
(destroy! dlg)
(exit 0)


On Sat, Nov 7, 2015 at 2:58 PM, Martin DeMello <martindeme...@gmail.com>
wrote:

> Finally had time to finish this off. It needed one more change
> (pointer->canvas was not being reexported from canvas-draw).
>
> Let me know when you've pushed the new egg, and I'll add the chessboard
> example to the tutorial in the wiki.
>
> martin
>
> On Wed, Oct 14, 2015 at 11:00 PM, Thomas Chust <ch...@web.de> wrote:
>
>> On 2015-10-15 04:04, Martin DeMello wrote:
>> > [...]
>> > it looks like the cb-draw callback has format "iiC", which doesn't
>> > match the sigil regex. I take it that means callbacks with a Canvas*
>> > argument are unsupported in chicken-iup?
>> > [...]
>>
>> Hello Martin,
>>
>> that is correct, however support is trivial to add: Add the #\C
>> character to the regular expression for callback signatures, add a case
>> for #\C typed arguments in the dispatcher that treats them identically
>> to #\v typed arguments, use pointer->canvas from the canvas-draw egg in
>> your callback code to add the right type tags to the raw pointer.
>>
>> I think that the #\C signature character has been introduced recently in
>> IUP. Anyway, I added the necessary marshalling code as outlined above to
>> the iup egg, it is available in the trunk version of the code.
>>
>> Ciao,
>> Thomas
>>
>>
>> --
>> When C++ is your hammer, every problem looks like your thumb.
>>
>> ___
>> Chicken-users mailing list
>> Chicken-users@nongnu.org
>> https://lists.nongnu.org/mailman/listinfo/chicken-users
>>
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] iup cells draw callback

2015-11-07 Thread Martin DeMello
Finally had time to finish this off. It needed one more change
(pointer->canvas was not being reexported from canvas-draw).

Let me know when you've pushed the new egg, and I'll add the chessboard
example to the tutorial in the wiki.

martin

On Wed, Oct 14, 2015 at 11:00 PM, Thomas Chust <ch...@web.de> wrote:

> On 2015-10-15 04:04, Martin DeMello wrote:
> > [...]
> > it looks like the cb-draw callback has format "iiC", which doesn't
> > match the sigil regex. I take it that means callbacks with a Canvas*
> > argument are unsupported in chicken-iup?
> > [...]
>
> Hello Martin,
>
> that is correct, however support is trivial to add: Add the #\C
> character to the regular expression for callback signatures, add a case
> for #\C typed arguments in the dispatcher that treats them identically
> to #\v typed arguments, use pointer->canvas from the canvas-draw egg in
> your callback code to add the right type tags to the raw pointer.
>
> I think that the #\C signature character has been introduced recently in
> IUP. Anyway, I added the necessary marshalling code as outlined above to
> the iup egg, it is available in the trunk version of the code.
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] iup cells draw callback

2015-10-14 Thread Martin DeMello
Hi,

I'm trying to port the chessboard example from IUP to chicken. The C code
is here:

http://webserver2.tecgraf.puc-rio.br/iup/examples/C/cells_checkboard.c

I'm stuck when trying to add a draw callback - it crashes with

Error: (callback-set!) callback has bad signature

The code is here: https://gist.github.com/martindemello/2f8ba4ccfebed3bd4650
or below:

(use iup)

(define (nlines self) 8)
(define (ncols self) 8)
(define (height self line) 50)
(define (width self col) 50)

(define (draw self i j xmin xmax ymin ymax canvas) 'default)

(define dlg
  (dialog
(vbox
  (cells name: "Chessboard"
 height-cb: height
 width-cb: width
 nlines-cb: nlines
 ncols-cb: ncols
 draw-cb: draw)
  (button title: 'E
  expand: 'Yes
  tip: "Close button"
  action: (lambda (self) 'close)))
title: 'IUP))

(show dlg)
(main-loop)
(destroy! dlg)
(exit 0)

martin
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] iup cells draw callback

2015-10-14 Thread Martin DeMello
This is the code from which the error message was thrown:

(define-values (callback-set! callback)
  (letrec ([signature/raw
(foreign-lambda* c-string ([nonnull-ihandle handle]
[iname/upcase name])
  "C_return(iupClassCallbackGetFormat(handle->iclass, name));")]
   [set/pointer!
(foreign-lambda c-pointer "IupSetCallback" nonnull-ihandle
iname/upcase c-pointer)]
   [get/pointer
(foreign-lambda c-pointer "IupGetCallback" nonnull-ihandle
iname/upcase)]
   [sigils
(irregex "([bifdsvh]*)(?:=([bifdvh]))?")]
   [callback-set!
(lambda (handle name proc)
  (let* ([sig
  (cond
[(irregex-match sigils (or (signature/raw handle
name) ""))
 => (lambda (groups)
  (string-append
(or (irregex-match-substring groups 2) "i")
(irregex-match-substring groups 1)))]
[else
 (error 'callback-set! "callback has bad signature"
handle name)])]

Looking up iupClassCallbackGetFormat here:

http://webserver2.tecgraf.puc-rio.br/iup/doxygen/group__iclass.html#ga5733bfa0e0889ec4e4293c2a57205650

it looks like the cb-draw callback has format "iiC", which doesn't
match the sigil regex. I take it that means callbacks with a Canvas*
argument are unsupported in chicken-iup?

martin

On Wed, Oct 14, 2015 at 12:51 AM, Martin DeMello <martindeme...@gmail.com>
wrote:

> Hi,
>
> I'm trying to port the chessboard example from IUP to chicken. The C code
> is here:
>
> http://webserver2.tecgraf.puc-rio.br/iup/examples/C/cells_checkboard.c
>
> I'm stuck when trying to add a draw callback - it crashes with
>
> Error: (callback-set!) callback has bad signature
>
> The code is here:
> https://gist.github.com/martindemello/2f8ba4ccfebed3bd4650 or below:
>
> (use iup)
>
> (define (nlines self) 8)
> (define (ncols self) 8)
> (define (height self line) 50)
> (define (width self col) 50)
>
> (define (draw self i j xmin xmax ymin ymax canvas) 'default)
>
> (define dlg
>   (dialog
> (vbox
>   (cells name: "Chessboard"
>  height-cb: height
>  width-cb: width
>  nlines-cb: nlines
>  ncols-cb: ncols
>  draw-cb: draw)
>   (button title: 'E
>   expand: 'Yes
>   tip: "Close button"
>   action: (lambda (self) 'close)))
> title: 'IUP))
>
> (show dlg)
> (main-loop)
> (destroy! dlg)
> (exit 0)
>
> martin
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] performance of bignums

2015-06-25 Thread Martin DeMello
Post to /r/scheme about chicken's bignum performance. (Not my post,
just figured it could use some eyeballs.)

http://www.reddit.com/r/scheme/comments/3b1ujw/performance_of_chicken_scheme_numbers_bignums/

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Q] How can I convert this lisp(SBCL) macro to chicken scheme?

2014-11-07 Thread Martin DeMello
check out the clojurian egg too: http://wiki.call-cc.org/eggref/4/clojurian

martin

On Thu, Nov 6, 2014 at 6:21 PM, Sungjin Chun chu...@gmail.com wrote:

 Thank you. Though I'm not sure on my code is in good style, I managed to
 convert my
 code to chicken scheme like this;

 (set-read-syntax!
  #\[
  (lambda (port)
(let loop ((c (peek-char port)) (exps '()))
  (cond ((eof-object? c)
 (error EOF encountered while parsing [ ... ] clause))
((char=? c #\])
 (read-char port) ;
 discard

 `(vector ,@(reverse exps)))
((char-whitespace? c)
 (read-char port) ; discard
 whitespaces

 (loop (peek-char port) exps))
(else
 (let ((exp (read port)))
   (loop (peek-char port)
 (cons exp exps

 (print (with-input-from-string [1 2 3 4 5] read))

 (set-read-syntax!
  #\{
  (lambda (port)
(let loop ((c (peek-char port)) (exps '()))
  (cond ((eof-object? c)
 (error EOF encountered while parsing [ ... ] clause))
((char=? c #\})
 (read-char port) ;
 discard

 `(alist-hash-table (chop (list ,@(reverse exps)) 2)))
((char-whitespace? c)
 (read-char port) ; discard
 whitespaces

 (loop (peek-char port) exps))
((char=? c #\,)
 (read-char port) ; discard
 whitespaces

 (loop (peek-char port) exps))
(else
 (let ((exp (read port)))
   (loop (peek-char port)
 (cons exp exps

 (print (with-input-from-string {'a 10, 'b 20, 'c 30} read))
 (print (with-input-from-string {'a 10 'b 20 'c 30} read))

 I post these code for people with similar needs like myself :-).


 On Fri, Nov 7, 2014 at 10:33 AM, Evan Hanson ev...@foldling.org wrote:

 Hi Sungjin,

 These are typically referred to as reader extensions in the Scheme
 world: http://api.call-cc.org/doc/library#sec:Reader_extensions

 You'll probabably want `set-read-syntax!` in particular:
 http://api.call-cc.org/doc/library/set-read-syntax!

 Cheers,

 Evan



 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] chicken-iup - progressing nicely but have problem with canvas-draw

2014-02-03 Thread Martin DeMello
This might be useful:
http://fedoraproject.org/wiki/Features/Windows_cross_compiler

(not used it personally, just wanted to share the link)

martin


On Mon, Feb 3, 2014 at 7:58 AM, Stephen Eilert spedr...@gmail.com wrote:


 On Sat, Feb 1, 2014 at 11:32 PM, Matt Welland estifo...@gmail.com wrote:

 Ok, no takers on my lame attempt at a financial bribe for making the next
 chicken-iup so I took a stab at it myself. I've made pretty good progress,
 no doubt thanks to all the great work done by the Chicken devs, so far
 chicken 4.8.0.5 and iup have compiled and seem to run fine. I'm stuck at
 getting the canvas-draw egg installed. Does the error below mean anything
 to anyone? Thanks.

 Note: one thing I did different is apply a patch to ffcall that claims to
 fix the trampoline conflict with windows executable protection. ffcall
 compiled fine and I doubt it is related to this issue but I thought I'd
 mention it.


 I think the 'bribe' did not have anything to do with it. Some of us will
 gladly improve Chicken without any financial reward - but having a 'bounty'
 for open issues doesn't seem like a bad idea. Heck, I'd do it in exchange
 for booze! :)

 I think the issue is that Chicken for the moment does not seem to enjoy
 much popularity on Windows. Having an installer could help mitigate some of
 that, but I am not sure it's the only requirement. Perhaps being able to
 compile with Microsoft's C compile would be better to ensure compatibility
 with existing libraries? I took a stab at it some time ago and found the
 build system to be a major pain, so I dropped the project.

 That said, do you mind if I ask you what is it that you are working on
 which requires Windows? :)


 -- Stephen


 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] Chicken on Raspberry Pi

2012-08-02 Thread Martin DeMello
Wow, I've been wondering what to do with my Raspberry Pi and Alaric's
idea looks fantastic.

martin

On Thu, Aug 2, 2012 at 11:01 AM, Erik Falor ewfa...@gmail.com wrote:
 I want to announce that Chicken 4.7.0.6 builds  runs on a Raspberry
 Pi (http://www.raspberrypi.org/).

 I did this without the need to hack any files or pass any exotic
 arguments to make.  It just worked.

 I didn't time(1) the build, but judging by the timestamps on the
 artifacts I estimate that it took over 1 hour 40 minutes to complete.

 I've tested it by chicken-installing some eggs and rebuilding some
 projects that I've worked on.  So far, so good!

 As of this writing I'm still building some eggs on my Pi (as I said,
 it is a bit slow).  I suppose I should spend some time setting up a
 cross-compilation env on my Gentoo desktop.  I'll update my progress
 on my blog at unnovative.net.

 Now I'd like to see Alaric Snell-Pym's great idea come to fruition:

 http://www.snell-pym.org.uk/archives/2012/08/01/getting-kids-into-programming-and-what-the-raspberry-pi-is-lacking/

 --
 Erik Falor   http://unnovative.net
 Registered Linux User #445632  http://linuxcounter.net

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (GNU/Linux)

 iEYEARECAAYFAlAawI4ACgkQpMTu6iYtwschgwCfdjkU2bDIeIdtOqDHPWV8NUul
 BP0AoKmZGIVuhLwbU/VrSH33yRe+Y/TS
 =NAtW
 -END PGP SIGNATURE-

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] wish-list

2010-10-27 Thread Martin DeMello
On Mon, Oct 25, 2010 at 3:37 PM, Felix
fe...@call-with-current-continuation.org wrote:

 I added a wish-list to the wiki to hold stuff that would be nice to
 have. This is of course not meant as a replacement for the
 bug-tracker, but it may be worthwhile to have a place where to put
 more ambitious ideas.

  http://wiki.call-cc.org/wish-list

Good stuff! What is the current state of affairs with respect to this one?

* Make it easy to create monoliths with no run-time demands to run on
targets without chicken

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] wish-list

2010-10-27 Thread Martin DeMello
On Wed, Oct 27, 2010 at 12:42 PM, Felix
fe...@call-with-current-continuation.org wrote:
 From: Martin DeMello martindeme...@gmail.com

 Good stuff! What is the current state of affairs with respect to this one?

 * Make it easy to create monoliths with no run-time demands to run on
 targets without chicken

 You can always link statically. Most eggs can be statically linked
 (those that don't can in most cases be converted). Do you have a specific
 example?

No, I was wondering where exactly the problem lay (i.e. why that was
on the wishlist).

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] IUP Bindings

2010-09-30 Thread Martin DeMello
On Thu, Sep 30, 2010 at 3:02 AM, Thomas Chust ch...@web.de wrote:
 in case anybody else finds this useful: I have created fairly full-featured
 bindings for the IUP graphical user interface library [1] that work 
 identically
 (to the maximum possible extent) under the Racket [2] and CHICKEN [3]
 Scheme systems.

Very nice! How did you do the bindings? I had played around a little
with a ruby script to generate chicken bindings from the IUP header
files (extending some work by Alex Queiroz) but I didn't get too far
along. It's a very pleasant toolkit to work with, especially the cells
widget.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Qt egg - understanding it

2010-08-25 Thread Martin DeMello
On Wed, Aug 25, 2010 at 5:05 PM, Felix
fe...@call-with-current-continuation.org wrote:

 Parsing the headerfiles is not that easy - there is a lot of magic
 in there and complex macros. You also would end up with a huge pile
 of wrapper code. There appear to be ways to invoke object-methods
 dynamically, though. But as I said repeatedly: I need some time
 to look into it.

Another approach would be to try to bind to smoke - there are Ruby and
C# bindings to act as an example, though when I asked Andrei about it
he said smoke was complex and poorly documented. I'm coming around to
his pov, that adding widgets in the order that people feel the need
for them would get us more bang for the buck.

Also, as others have noted, I would love to help with the Qt egg; I
just don't know enough about Qt or FFI bindings to C++. I can happily
contribute gruntwork once someone else has pointed the way, though :)

As a personal priority, I'd like to have bindings for keystroke
events, QListWidgetItem and the whole QGraphicsView/QGraphicsScene
framework (the latter might be more of a pipe dream at this point :))
I tried looking at the development egg, but couldn't figure out how to
add a new widget type, or whether I could just manipulate it as a
QWidget.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Qt egg - understanding it

2010-08-25 Thread Martin DeMello
Yes, having the Qt egg concentrate on GUI support seems like the best
way to me too. If I manage to get some free time next week, I'll have
a proper try at putting in QListWidget support, since it seems like
reasonably low-hanging fruit and would help me get the hang of the
code to some extent. It's definitely nice to see the sudden surge of
interest in the Qt egg - there really aren't enough options for
writing native apps using Qt.

martin

On Thu, Aug 26, 2010 at 12:29 AM, Arthur Maciel arthurmac...@gmail.com wrote:
 Martin, indeed Smoke seems to do what it is proposed to, but Chicken team is
 at an unfavorable moment for it: there are few people with a good
 knowledge+time score to explore that kind of solution.

 I thought about setting the Qt egg to give the maximum of GUI support,
 leaving other functionalities to other eggs. For this, direct implementing
 each of GUI widgets seems to be the best way. However, one of the great
 advantages of Qt is to integrate many non-GUI functionalities into GUI
 (DBUS/IPC, networking,databases, XML processing support, etc.). With this in
 mind I imagine the only practical solution would be to build the giant
 wrapper or invest on porting Smoke.

 Let's wait for Felix and Andrei to have their time, even in order to point
 us a direction on where we can help. Until then I believe what we can do is
 exactly what you have done: to list what needs we expect the egg to support.
 If those resume to strict GUI stuff, we can dedicate our learning effort to
 extend the multiple GUI widgets after the guys set the coordinates.

 Regards,
 Arthur

 2010/8/25 Martin DeMello martindeme...@gmail.com

 On Wed, Aug 25, 2010 at 5:05 PM, Felix
 fe...@call-with-current-continuation.org wrote:
 
  Parsing the headerfiles is not that easy - there is a lot of magic
  in there and complex macros. You also would end up with a huge pile
  of wrapper code. There appear to be ways to invoke object-methods
  dynamically, though. But as I said repeatedly: I need some time
  to look into it.

 Another approach would be to try to bind to smoke - there are Ruby and
 C# bindings to act as an example, though when I asked Andrei about it
 he said smoke was complex and poorly documented. I'm coming around to
 his pov, that adding widgets in the order that people feel the need
 for them would get us more bang for the buck.

 Also, as others have noted, I would love to help with the Qt egg; I
 just don't know enough about Qt or FFI bindings to C++. I can happily
 contribute gruntwork once someone else has pointed the way, though :)

 As a personal priority, I'd like to have bindings for keystroke
 events, QListWidgetItem and the whole QGraphicsView/QGraphicsScene
 framework (the latter might be more of a pipe dream at this point :))
 I tried looking at the development egg, but couldn't figure out how to
 add a new widget type, or whether I could just manipulate it as a
 QWidget.

 martin



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] supporting a mingw-cygwin environment

2010-08-08 Thread Martin DeMello
I tried to compile chicken 4.5.0 under a cygwin-mingw environment
(cygwin with mingw/bin set as the first entry in $PATH) using

make PLATFORM=mingw-msys PREFIX=c:/mingw install

It errored in the middle with


cp -r chicken-uninstall.exe c:/mingw/bin
cp -r chicken-status.exe c:/mingw/bin
c:/mingw/bin/chicken-install -update-db

Error: (directory) cannot open directory: /usr/local/lib/chicken/5
make[1]: [install] Error 1 (ignored)
---

After the install finishes, csc likewise errors with

---
$ csc 1.scm
The system cannot find the path specified.

Error: shell command terminated with non-zero exit status 1:
\usr\local\bin\chicken.exe 1.scm -output-file 1.c
---

I gave up and installed msys and installed chicken, which then works
fine from cygwin. If someone more experienced than me knows how to fix
this, though, it would be worth supporting the mingw-within-cygwin use
case - I believe it's a reasonably common setup.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] supporting a mingw-cygwin environment

2010-08-08 Thread Martin DeMello
On Mon, Aug 9, 2010 at 2:10 AM, Felix
fe...@call-with-current-continuation.org wrote:

 If this is plain mingw (no MSYS), then you should do

  make PLATFORM=mingw PREFIX=c:/mingw install

That doesn't work because I'm running inside cygwin and it can't find `del`

 I gave up and installed msys and installed chicken, which then works
 fine from cygwin. If someone more experienced than me knows how to fix
 this, though, it would be worth supporting the mingw-within-cygwin use
 case - I believe it's a reasonably common setup.

 You could also try doung a regular cygwin build. mingw only provides
 the compiler in this setup, is that correct?

Yes, or at least that's what I'm trying to do. `make PLATFORM=cygwin`
doesn't work because sysexit.h is missing. `make PLATFORM=mingw-msys`
*almost* works; chicken compiles happily enough, but it dies at the
install stage due to the path issues.

In theory, I'm trying to do mingw build, since I want to end up with a
pure windows executable. I'm just using cygwin for the tool support
because msys is clunky.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] doto macro

2010-08-04 Thread Martin DeMello
I stole the doto macro from clojure. Quite useful for GUI code in
particular. It might make a nice addition to miscmacros too.

(define-syntax doto
  (lambda (f r c)
(let [(s (cadr f))
  (forms (cddr f))]
  `(let [(x ,s)]
 ,@(map (lambda (form)
  (if (list? form)
`(,(car form) x ,@(cdr form))
`(,form x)))
forms)
 x

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] getting to grips with multimethods

2010-07-31 Thread Martin DeMello
Coming from a traditional single-dispatch OOP background, one of the
biggest problems I'm finding with coops's CLOS-style multimethods is
that methods are no longer namespaced by their classes, but leak into
the current namespace. Thus, when I import a module containing some
classes, I have to be aware of all the methods and make sure I don't
have anything clashing with them in the importing code. How do people
generally deal with this?

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Martin DeMello
Here's some code I'm using to test various module features (attached,
and at http://github.com/martindemello/test-chicken-modules)

In cprog-binding.scm, I define a binding to a C enum via:

(define-foreign-enum-type (ccount int)
  (ccount-int int-ccount)
  (c:zero ZERO)
  (c:one ONE)
  (c:two TWO)
  (c:three THREE))

This works if I (include cprog-binding) directly in a scheme file
(see direct-load.scm). However, if I want to include it in a module,
then import the module, I cannot access the enum constants, though I
can access ccount-int and int-ccount (see test.scm). What's the
right way to do this?

martin


test-chicken-modules.tgz
Description: GNU Zip compressed data
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] using constants from define-foreign-enum-type via a module

2010-07-26 Thread Martin DeMello
On Tue, Jul 27, 2010 at 1:20 AM, Jim Ursetto zbignie...@gmail.com wrote:
 The right way is to use include, foreign variables are not visible outside 
 the compilation unit they are declared in.

 Alternatively if you want a user accessible interface to the constants, and 
 do not want to use the conversion procedures, use regular old define and 
 export that binding:

 (define zero c:zero) ; then export zero

 In short, if this is for internal use, use include. If it is for users, write 
 a nice API for them.

Thanks. If you're taking feature requests, it would be useful to have
an option to define-foreign-enum-type to create the exportable
bindings automatically too, for use cases like mine (I'm writing
bindings to a C library, so the enums are typically more useful to my
users than they are within the binding code).

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Re: Happy 10th birthday!

2010-07-20 Thread Martin DeMello
2010/7/20 Arthur Maciel arthurmac...@gmail.com:
 Congratulations to all who make this project as good as it is!

 Thanks for reminding us, Mario!

Seconded!!

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] compiling with a precompiled module

2010-07-18 Thread Martin DeMello
I have some scheme code that I want to wrap in a module and then use
as a shared library.

$ cat body.scm
(define (hello)
  (print hello world))

$ cat outer.scm
(module foo *
  (import chicken)
  (import scheme)
  (include body))

$ csc -s outer.scm

$ cat test.scm
(load outer.so)
(import foo)

(hello)

$ csi -s test.scm
hello world

So far so good. But now, how do I compile test.scm? I've not been able
to find the magical compiler incantation, and everything I could find
on the wiki just talks about the interpreter.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] unbound variable: make-hash-table

2010-07-09 Thread Martin DeMello
What's going wrong here?

$ cat t.scm

(define *hash* (make-hash-table))

$ csi t.scm

; loading t.scm ...
#;1 *hash*
#hash-table (0)

$ csc t.scm
$ ./t

Error: unbound variable: make-hash-table

Call history:

t.scm:1: make-hash-table--

$ csc -version
(c)2008-2010 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.5.0
linux-unix-gnu-x86 [ manyargs dload ptables ]
compiled 2010-07-07 on mercury (Linux)

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] unbound variable: make-hash-table

2010-07-09 Thread Martin DeMello
Thanks, Jim and Mario! And thanks for the pointer to the IRC channel,
will drop by if I have any more questions.

martin

On Fri, Jul 9, 2010 at 11:13 PM, Jim Ursetto zbignie...@gmail.com wrote:
 Martin, feel free to join us on freenode on #chicken as well, we can answer 
 all kinds of questions there.

 On Jul 9, 2010, at 12:04, Mario Domenech Goulart mario.goul...@gmail.com 
 wrote:

 Hi Martin

 On Fri, 9 Jul 2010 22:14:09 +0530 Martin DeMello martindeme...@gmail.com 
 wrote:

 What's going wrong here?

 $ cat t.scm

 (define *hash* (make-hash-table))

 $ csi t.scm

 ; loading t.scm ...
 #;1 *hash*
 #hash-table (0)

 $ csc t.scm
 $ ./t

 Error: unbound variable: make-hash-table

    Call history:

    t.scm:1: make-hash-table            --

 You need

   (require-extension srfi-69)


 To understand the difference between the compiled and the interpreted
 code, try adding

   (print (features))

 to your code.  Here's the documentation for `features':
 http://chicken.wiki.br/man/4/Unit%20library#feature-identifiers

 Best wishes.
 Mario
 --
 http://parenteses.org/mario

 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/chicken-users


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] qt egg hello world example broken

2010-07-06 Thread Martin DeMello
The qt egg example on http://chicken.wiki.br/eggref/4/qt doesn't work
out of the box - Qt seems to want

classForm/class

rather than

[class] Form

in the ui file, and likewise for all other such declarations.

martin

___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Qt egg

2009-12-03 Thread Martin DeMello
On Tue, Dec 1, 2009 at 10:42 PM, Nicholas Indy Ray arel...@gmail.com wrote:
 While the code is in egg form, It isn't actually ment for general
 consumption yet, If you are interested in trying it out, I can give
 you an overview of how to use it.

I'm interested! I've beaten my head against the qt egg before, before
realising how minimal it was. And so far, the only really good Qt
binding I've found is the Ruby one, which doesn't compile to native
code. I'd love to see a good scheme/qt implementation.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] working with bit- and byte-level structures

2008-04-16 Thread Martin DeMello
Interesting post on one of the advantages of C++ - I just wondered how
such problems are handled in the scheme world

--
What you can do in C++ that you *can't* do in Java is define a class
whose in-memory representation maps directly to the format of data in
memory, and then say I want to treat this large swath of memory as if
it were an array of Foo objects - and gain all of the abstraction of
calling object methods on that data, with zero performance penalty for
instantiating thousands of objects.

It's not something you want to do every day, but on the rare occasion
you need it, C++ comes closest to letting you have your cake and eat
it too.

-- Avdi Grimm on the pragmaticprogrammers mailing list
--

I ran into this exact problem when trying to access a packed C data
structure from OCaml - I had to write a bunch of code to index into
the block, pull out a chunk of bytes and then write accessor functions
to do bitshifting and bitmasking to retrieve the individual members
from the struct, without much higher level help from OCaml. I'm
imagining some combination of C and chicken would do a nicer job of
this, and naturally I'd want to do it with as little C as possible. I
found http://chicken.wiki.br/packedobjects but I couldn't tell if it
could work directly with a block of memory or it there'd be a lot of
from/to overhead.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] working with bit- and byte-level structures

2008-04-16 Thread Martin DeMello
Ah - okay, if it's serialisation-specific, it's not what I'm looking
for. I was looking for an analogue to the C trick of interpreting a
block of bits as a struct quickly and efficiently.

martin

On Wed, Apr 16, 2008 at 11:16 AM, john [EMAIL PROTECTED] wrote:
 The idea behind packedobjects is to be able to use an abstract syntax
  for describing what gets bit packed into messages to be sent across a
  network. The syntax is loosely based on ASN.1 but uses s-expressions
  to avoid the need for an ASN.1 compiler. The encoding is based on
  unaligned Packed Encoding Rules (PER). So if you are looking at
  packing data into messages in a machine independent way it might be
  useful.

  Cheers,

  John.



  On 16/04/2008, Martin DeMello [EMAIL PROTECTED] wrote:
   Interesting post on one of the advantages of C++ - I just wondered how
such problems are handled in the scheme world
  

 --
What you can do in C++ that you *can't* do in Java is define a class
whose in-memory representation maps directly to the format of data in
memory, and then say I want to treat this large swath of memory as if
it were an array of Foo objects - and gain all of the abstraction of
calling object methods on that data, with zero performance penalty for
instantiating thousands of objects.
  
It's not something you want to do every day, but on the rare occasion
you need it, C++ comes closest to letting you have your cake and eat
it too.
  
-- Avdi Grimm on the pragmaticprogrammers mailing list

 --
  
I ran into this exact problem when trying to access a packed C data
structure from OCaml - I had to write a bunch of code to index into
the block, pull out a chunk of bytes and then write accessor functions
to do bitshifting and bitmasking to retrieve the individual members
from the struct, without much higher level help from OCaml. I'm
imagining some combination of C and chicken would do a nicer job of
this, and naturally I'd want to do it with as little C as possible. I
found http://chicken.wiki.br/packedobjects but I couldn't tell if it
could work directly with a block of memory or it there'd be a lot of
from/to overhead.
  
martin
  
  
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users
  



___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] working with bit- and byte-level structures

2008-04-16 Thread Martin DeMello
On Wed, Apr 16, 2008 at 12:09 PM, Hans Bulfone [EMAIL PROTECTED] wrote:
  On Wed, Apr 16, 2008 at 11:38:44AM -0700, Martin DeMello wrote:
   Ah - okay, if it's serialisation-specific, it's not what I'm looking
   for. I was looking for an analogue to the C trick of interpreting a
   block of bits as a struct quickly and efficiently.

  maybe you can use define-foreign-record to define the struct.
  but this doesn't work at the bit level, afaik there is no way to say
  e.g. unsigned int flag : 1;

  see http://chicken.wiki.br/Accessing%20external%20objects
  and http://chicken.wiki.br/Foreign%20type%20specifiers

Thanks, define-foreign-record looks like what I wanted. The
bit-accessors were just a hope - C doesn't really have much support
for them either.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Some reorganization of Eggs Unlimited sections

2007-07-31 Thread Martin DeMello
On 7/31/07, Peter Bex [EMAIL PROTECTED] wrote:
 On Tue, Jul 31, 2007 at 09:47:46AM +0200, felix winkelmann wrote:
  On 7/31/07, Ivan Raikov [EMAIL PROTECTED] wrote:
  
   5. Create section `External library interfaces' and move the following
  eggs to it: svn-client, mpd-client, gettext, lirc-client, geoip

 I think this makes no sense.  There are many other 'external library
 interfaces'.  Just have a look at the bindings to fltk, qt, imlib2,
 ncurses, etc.

True enough. That raise another question, though - can an egg be in
multiple categories?

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] gdbm and windows

2007-07-16 Thread Martin DeMello

Does anyone know if chicken/gdbm works on windows? I have an app using
GDBM that I'd like to port to windows at some point, but I don't
actually have a windows setup to try it on right now. Should I be
making plans to move it over to sqlite3 or something?

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] gdbm and windows

2007-07-16 Thread Martin DeMello

On 7/17/07, Kon Lovett [EMAIL PROTECTED] wrote:


On Jul 16, 2007, at 10:34 AM, Martin DeMello wrote:

 Does anyone know if chicken/gdbm works on windows? I have an app using
 GDBM that I'd like to port to windows at some point, but I don't
 actually have a windows setup to try it on right now. Should I be
 making plans to move it over to sqlite3 or something?

GDBM works on Windows. However, I had to jump thru some hoops. The
binary installer doesn't install gdbm-dll.h, which I had to copy
from the source. Also, the Chicken compiler doesn't like pathnames
with spaces on Windows. I copied the gdbm files from the default
install location - C:\Program Files\GnuWin32 - to my mingw
directories. (For some reason a shortcut - C:\GnuWin32 - wasn't seen
by the compiler. If MSVC is used then will probably work. I use MinGW.)


Thanks, Kon :) Now that I know it works in theory I'm willing to sit
back and say I'll cross that bridge when I come to it.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] passing a string to foreign-lambda*

2007-07-09 Thread Martin DeMello

On 7/9/07, felix winkelmann [EMAIL PROTECTED] wrote:

On 7/8/07, Martin DeMello [EMAIL PROTECTED] wrote:

 No, I want a C function whose body is a string generated by combining
 a template and some arguments that fill in slots in the template.


(define-macro (foo name x)
  `(define ,name
  (foreign-lambda* void ((c-string arg))
,(format #f printf(\~a, %s!\\n\, arg); x) ) ) )

(foo hello Hello)
(hello martin)


Thanks! I was trying to use string-concatenate, but couldn't manage to
make it available at macro expansion time (is this possible?)

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] passing a string to foreign-lambda*

2007-07-08 Thread Martin DeMello

Is there any way to do this?

(define str hello)
(foreign-lambda* int ((int x)) str)

(Actually i'm trying to solve the more restricted problem of
generating a call to foreign-lambda* from a macro and synthesising the
string it's passed within the macro, so if the general case has no
answer I'm hoping that at least is doable)

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] passing a string to foreign-lambda*

2007-07-08 Thread Martin DeMello

On 7/8/07, Alex Queiroz [EMAIL PROTECTED] wrote:

On 7/8/07, Martin DeMello [EMAIL PROTECTED] wrote:
 Is there any way to do this?

 (define str hello)
 (foreign-lambda* int ((int x)) str)


(define str Hello)

(define my-func
 (let ((foreign (foreign-lambda* int ((int x) (c-string str))
  do stuff with x and str...)))
   (lambda (x)
 (foreign x str


No, I don't want to pass str into the foreign function, i want str to
*be* the foreign function. That is, I want to use a variable rather
than an explicit string, or a macro that generates and inserts a
string into the right place.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] passing a string to foreign-lambda*

2007-07-08 Thread Martin DeMello

On 7/8/07, John Cowan [EMAIL PROTECTED] wrote:

Martin DeMello scripsit:

 No, I don't want to pass str into the foreign function, i want str to
 *be* the foreign function. That is, I want to use a variable rather
 than an explicit string, or a macro that generates and inserts a
 string into the right place.

Since foreign-lambda* is itself a macro, your only hope is to write
a macro that generates a foreign-lambda* with everything in the right
places.


Thanks, will fight with that.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] passing a string to foreign-lambda*

2007-07-08 Thread Martin DeMello

On 7/9/07, John Cowan [EMAIL PROTECTED] wrote:


Yes, that works.  However, it occurs to me that if what Martin actually
wants is a C function whose body is some string whose value
is not known until run-time, no amount of fiddling with macros will
accomplish that; C functions have to be known before run time so
they can be compiled.


No, I want a C function whose body is a string generated by combining
a template and some arguments that fill in slots in the template.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] preferred gui library

2007-07-05 Thread Martin DeMello

On 7/4/07, Alex Queiroz [EMAIL PROTECTED] wrote:

 I was looking for something:

+ With native controls;
+ MIT or BSD-licensed;
+ Lightweight and *just* a GUI;
+ C, not C++;
+ Works in Linux  Windows, at least.

 I couldn't find anything that covered all of this, so started an
IUP[1] binding. Unfortunately, under X11, it uses OpenMotif as a
backend, but the upcoming 3.0 version will have GTK+ as well. So far,
OpenMotif works for me.


The Motif bit is offputting, but this looks like a very interesting
library - as you said, it's increasingly hard to find something that
is just a GUI. How did you discover it? I've never come across it
before.

I've decided to go with Qt4 for the time being (sweeping under the rug
the pending issue of getting it working on windows :)) but I'll be
watching your IUP binding with interest (sadly I'm just getting
started with scheme so I don't know enough to help out).

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] preferred gui library

2007-07-03 Thread Martin DeMello

On 7/3/07, Jong-Hyouk Yun [EMAIL PROTECTED] wrote:

Hi, I found some mailings in archive.

http://lists.gnu.org/archive/html/chicken-users/2007-02/msg00055.html


I went through that thread, but it seems to be mostly about future
directions for a toolkit. I want to know which if any of the current
eggs are recommended - I tried Qt, but ran into a problem with the
layout managers, and PS/Tk looks promising but very badly documented
(the docs seem to assume that you are already familiar with Tcl/Tk, a
problem that has plagued every Tk binding I've seen other than Perl/Tk
(ironically, the Ruby/Tk docs said 'go look at the Perl/Tk
documentation)).

I'm not really focused on a professional GUI - what I need is
i. A reasonably complete set of bindings
ii. A pleasant GUI development experience (I'd use OCaml, but lablgtk
is pretty ugly)
iii. The ability to deliver native executables on Linux and Windows at
least, preferably OS X as well

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] qt4 layouts

2007-07-03 Thread Martin DeMello

On 7/2/07, felix winkelmann [EMAIL PROTECTED] wrote:

On 7/1/07, Martin DeMello [EMAIL PROTECTED] wrote:
 The qt egg currently doesn't seem to support QLayoutWidget - it fails with

 QFormBuilder: Cannot create widget of class QLayoutWidget.

 Are there any plans to add this?


IIRC, this error comes from the QtGui XML-widget transformation
which is inside Qt. I assume we would have to handle this case by hand.
I have no plans in the moment to work on this, as I'm already more than
overwhelmed with daily chicken-and-egg maintenance.


This was my mistake - I was using a Qt3 UI file. Upgrading it to Qt4
fixed the issue.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] preferred gui library

2007-07-02 Thread Martin DeMello

What is the currently preferred cross-platform gui library to use with
chicken? Are there any examples of real-world gui applications?

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] qt4 layouts

2007-07-01 Thread Martin DeMello

The qt egg currently doesn't seem to support QLayoutWidget - it fails with

QFormBuilder: Cannot create widget of class QLayoutWidget.

Are there any plans to add this?

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] lighter weight alternatives to s11n?

2007-07-01 Thread Martin DeMello

I have a list of words (182260 words, 1.6MB) that I need to read into
a series of hashes, e.g.
(word = true) for quick lookups,(word = (anagrams)), etc. Rather
than do this every time the program is run, I want to serialise the
hashes and dump them to a file, and subsequently loading in the file
if it exists.

However, a quick test:

;;;--
(define word-list (file-list sowpods.txt))
(define dict (make-hash-table))
(define (each-word proc) (for-each proc word-list))

(with-output-to-file dict.s11n
   (lambda ()
 (each-word
   (lambda (word)
 (hash-table-set! dict word #t)))
 (serialize dict)))
;;;--

has spiked my cpu at 100% for the last several minutes, and seems to
be showing no signs of completing any time soon (it's taken a bit over
10 minutes to write out 600k of data).

Is there something I'm doing wrong, or some lighter way I can
serialise and deserialise the hash?

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: lighter weight alternatives to s11n?

2007-07-01 Thread Martin DeMello

Also, serializing a hash dies when it hits the end (and attempting to
deserialize the file segfaults). Here's a minimal example:

#;1 (use s11n)
; loading /usr/lib/chicken/1/s11n.so ...
#;2 (serialize (make-hash-table))
Error: (serialize) unable to serialize object - unable to serialize
procedure (no table entry found): #procedure (equal? x75 y76)


Chicken: Version 2.6 - linux-unix-gnu-x86 - [ dload ]

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] lighter weight alternatives to s11n?

2007-07-01 Thread Martin DeMello

On 7/2/07, Zbigniew [EMAIL PROTECTED] wrote:

Two options come to mind.

1) Use a database.


Good point! Will go the sqlite3 route.

martin


___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users