[Chicken-users] Help test Chicken in OpenWRT (Linux distribution for wireless routers)

2019-03-19 Thread Jeronimo Pellegrini
Hello,

I have written a set of Makefiles for building some Lisps,
including Chicken, on OpenWRT, and would like to know if some
Chicken users would be interested in testing.

Here:
https://gitlab.com/jpellegrini/openwrt-packages

Please tell me if it works for you!

Thanks,
J.


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


Re: [Chicken-users] help on find a lisp paper by John McCarthy

2017-10-27 Thread Jinx

I think this is exactly what I wanted!
thank u for ur help!



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


Re: [Chicken-users] help on find a lisp paper by John McCarthy

2017-10-27 Thread Phil Bewig
http://delivery.acm.org/10.1145/81/808386/p215-mccarthy.pdf?ip=198.209.225.227=808386=ACTIVE%20SERVICE=F82E6B88364EF649%2EEA777AEEAA51B01B%2E4D4702B0C3E38B35%2E4D4702B0C3E38B35=999374817=78744412&__acm__=1509128711_9f195cf9fe92408377c1edaff75b3e69

On Fri, Oct 27, 2017 at 1:16 PM, Erik Falor  wrote:

> On Fri, Oct 27, 2017 at 05:35:32PM +0800, Jinx wrote:
> >
> > the Paper is about 2-3 pages long, at least can be  downloaded on
> > the internet for free in pdf,
> >
> > the content is on how to constuct lisp from several axioms, more in
> > a math paper fashion.
> >
> > the paper is a late time working paper McCarthy, not the
> > "Recursive Functions of ... Machine, Part I" , there might be some
> > co-author.
> >
> > I have downloaded the paper one year ago, and cant find it now,
> > and after a long search on the web, still get nothing, thats the
> > most elegent paper in constructing the lisp in the axiomatic way,
> > I am sure I will keep it carefully this time if u could help me
> > on finding it
>
> Is what you are looking for similar to Paul Graham's 2002 paper "The
> Roots of Lisp" [1], but authored by McCarthy himself?
>
> [1] http://3e8.org/pub/pdf-t1/the-roots-of-lisp.pdf
>
> --
> Erik Falor
> Registered Linux User #445632http://unnovative.net
>
> ___
> 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] help on find a lisp paper by John McCarthy

2017-10-27 Thread Erik Falor
On Fri, Oct 27, 2017 at 05:35:32PM +0800, Jinx wrote:
> 
> the Paper is about 2-3 pages long, at least can be  downloaded on
> the internet for free in pdf,
> 
> the content is on how to constuct lisp from several axioms, more in
> a math paper fashion.
> 
> the paper is a late time working paper McCarthy, not the 
> "Recursive Functions of ... Machine, Part I" , there might be some
> co-author.
> 
> I have downloaded the paper one year ago, and cant find it now,
> and after a long search on the web, still get nothing, thats the
> most elegent paper in constructing the lisp in the axiomatic way,
> I am sure I will keep it carefully this time if u could help me
> on finding it

Is what you are looking for similar to Paul Graham's 2002 paper "The
Roots of Lisp" [1], but authored by McCarthy himself?

[1] http://3e8.org/pub/pdf-t1/the-roots-of-lisp.pdf

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


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


[Chicken-users] help on find a lisp paper by John McCarthy

2017-10-27 Thread Jinx

the Paper is about 2-3 pages long, at least can be  downloaded on
the internet for free in pdf,

the content is on how to constuct lisp from several axioms, more in
a math paper fashion.

the paper is a late time working paper McCarthy, not the 
"Recursive Functions of ... Machine, Part I" , there might be some
co-author.

I have downloaded the paper one year ago, and cant find it now,
and after a long search on the web, still get nothing, thats the
most elegent paper in constructing the lisp in the axiomatic way,
I am sure I will keep it carefully this time if u could help me
on finding it


thank u !





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


Re: [Chicken-users] Help with columnar formatting in the fmt egg

2015-11-30 Thread Alex Shinn
On Fri, Nov 20, 2015 at 5:53 AM, Christian Kellermann 
wrote:

>
> I would like to ask some help for finding the right fmt expression to
> print entries formatted as like this:
>
> 2015-11-20 foo bar baz... Some·Label   Some·Other·Label
>  -123.23-100.00
>   Yet·Another·Label
>  -23.23
>
> The hard part is obviously the last columns. Both are fed in a list of
> entries consisting of (label amount).  All positive amounts should be
> printed in the first column the negative ones in the second.
>

Your example is split across 4 lines, is this what you intended?
It's not really clear what the rule is.

The columnar/tabular formatters are oriented around formatting
single rows, so if you want to use them you'd need to first group
the data accordingly.

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


[Chicken-users] Help with columnar formatting in the fmt egg

2015-11-20 Thread Christian Kellermann
Hi!

I would like to ask some help for finding the right fmt expression to
print entries formatted as like this:

2015-11-20 foo bar baz... Some·Label   Some·Other·Label
 -123.23-100.00
  Yet·Another·Label
 -23.23

The hard part is obviously the last columns. Both are fed in a list of
entries consisting of (label amount).  All positive amounts should be
printed in the first column the negative ones in the second.

Note that the labels should be left aligned and the amounts as well.

What I have tried so far are combinations of columnar and tabular but
none of these seem to do the alignment or laying out the column widths
correctly.

Do you know a way to achieve the above?

Kind regards,

Christian

--
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.

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


Re: [Chicken-users] Help with usage of process ...

2015-10-10 Thread Matt Welland
On Fri, Oct 9, 2015 at 7:25 PM, Evan Hanson  wrote:

> Hi Matt,
>
> My guess is that because you don't close the output port before waiting
> for results, dot(1) sits there waiting for more input and your procedure
> appears to hang.
>

Ah, yes, dot is not processing the input until it is read in its entirety.
Thanks Evan. The following works fine:

(define (tests:run-dot indat outtype) ;; outtype is plain, fig, dot, etc.
http://www.graphviz.org/content/output-formats
  (let-values (((inp oup pid)(process "dot" (list "-T" outtype
(with-output-to-port oup
  (lambda ()
(map print indat)))
(close-output-port oup)
(let ((res (with-input-from-port inp
 (lambda ()
   (read-lines)
  (close-input-port inp)
res)))



> I'd try closing `oup` once you've written your graph to the process, for
> example by making the thunk you use for the "dot writer" thread look like:
>
> (lambda ()
>   (with-output-to-port oup
>(lambda ()
>  (map print indat)
>  (close-output-port oup
>
> 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] Help with usage of process ...

2015-10-09 Thread Evan Hanson
Hi Matt,

My guess is that because you don't close the output port before waiting
for results, dot(1) sits there waiting for more input and your procedure
appears to hang.

I'd try closing `oup` once you've written your graph to the process, for
example by making the thunk you use for the "dot writer" thread look like:

(lambda ()
  (with-output-to-port oup
   (lambda ()
 (map print indat)
 (close-output-port oup

Cheers,

Evan

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


[Chicken-users] Help with usage of process ...

2015-10-09 Thread Matt Welland
I'm trying to use the posix process call to run the graphviz dot program,
hand it some input data and collect the output. I'm not able to figure out
how to correctly use process to do this. My code is below. Any hints would
be much appreciated.

(define (tests:run-dot indat outtype) ;; outtype is plain, fig, dot, etc.
http://www.graphviz.org/content/output-formats
  (print "indat: ")
  (map print indat)
  (let-values (((inp oup pid)(process "dot" (list "-T" outtype
(let ((th1 (make-thread (lambda ()
  (with-output-to-port oup
(lambda ()
  (map print indat
"dot writer")))
  (thread-start! th1)
  (let ((res (with-input-from-port inp
   (lambda ()
 (read-lines)
(thread-join! th1)
(close-output-port oup)
(close-input-port inp)
;; (process-wait pid)
res)))

For reference this is the equivalent of the following from the commandline:

matt@xena:~/data/megatest/ext-tests$ dot -Tplain << EOF
> digraph tests {
> a -> b
> }
> EOF
graph 1 0.75 1.5
node a 0.375 1.25 0.75 0.5 a solid ellipse black lightgrey
node b 0.375 0.25 0.75 0.5 b solid ellipse black lightgrey
edge a b 4 0.375 0.99579 0.375 0.88865 0.375 0.7599 0.375 0.64045 solid
black
stop
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help with udp6 / socket

2015-02-17 Thread Jim Ursetto
I’ve documented the family parameter to udp-open-socket and fleshed out the 
examples (including a daytime client/server pair).  
Hope this helps.

http://api.call-cc.org/doc/udp6

Jim

 On Feb 17, 2015, at 03:56, Scott McCoid mccoid.sc...@gmail.com wrote:
 
 Hi Jim,
 
 This completely worked for me, thanks for the clear example! I didn't even 
 think to check if (udp-open-socket) also accepted extra arguments. 
 
 Thanks again!
 Scott
 
 On Tue, Feb 17, 2015 at 4:17 AM, Jim Ursetto zbignie...@gmail.com 
 mailto:zbignie...@gmail.com wrote:
 Scott,
 
 This works on my system (10.10.2, CHICKEN 4.8.0.6).  Note the undocumented 
 argument to udp-open-socket… not sure what I was thinking.
 If this works for you, I will document the argument and add the example to 
 the wiki.
 
 
 (use udp6)
 
 (define s (udp-open-socket 'inet6))
 (udp-bind! s :: 1337);; unspecified address; accept both ipv4 and ipv6
 (let loop ()
   (receive (len str host port) (udp-recvfrom s 1024)
 (print received  len  bytes from [ host ]: port  :  str))
   (loop))
 (udp-close-socket s)
 
 
 ;; Then we can run netcats using IPv4 and IPv6:
 
 $ nc -6 -u localhost 1337
 hello
 ^C
 
 $ nc -4 -u localhost 1337
 hi
 ^C
 
 ;; And you should get the following output:
 
 received 6 bytes from [::1]:62028 : hello
 received 3 bytes from [:::127.0.0.1]:61031 : hi
 
 
 On Feb 16, 2015, at 07:06, Scott McCoid mccoid.sc...@gmail.com 
 mailto:mccoid.sc...@gmail.com wrote:
 
 Hi Christian!
 
 Thanks for the quick help and netcat tip. I was able to send from my script 
 and receive with netcat (for example: nc -u -6 -l 8000) without any 
 problems. (sending to port 8000 in my script)
 
 I've tried doing the reverse situation, where I receive on the script side 
 and send using netcat, but I haven't been able to get this to work. I don't 
 have any errors, but I'm not receiving anything for some reason. 
 
 I'll work on some chicken scripts that talk to each other and see if I can 
 get this to work properly. 
 
 Thanks again for your help!
 Scott
 
 On Mon, Feb 16, 2015 at 11:49 AM, Christian Kellermann ck...@pestilenz.org 
 mailto:ck...@pestilenz.org wrote:
 Hi Scott!
 
 Scott McCnoid mccoid.sc...@gmail.com mailto:mccoid.sc...@gmail.com 
 writes:
 
  I'm reasonably new to chicken-scheme (and scheme in general), and I'm
  having trouble with the udp6 (and likewise, socket) eggs. I'm trying to run
  the example code, but the connection is always refused.
 
  *Error: (socket-receive!) cannot read from socket - Connection refused:
  #socket fd:4 af/inet sock/dgram*
 
  I looked into the socket code and it seems that this is probably not the
  fault of these eggs per se, but probably something I'm doing wrong. For
  example, the *%socket-receive!* function makes a call to the sys/socket.h
  *recv* function, which always returns -1. I've tried using other port
  numbers to connect to, but this doesn't seem to make a difference.
 
  I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1 *(stability/4.9.0)
  (rev 8b3189b)
 
  I'm happy to help track this down if it's a bug, just let me know.
 
 The most likely reason is that on Mac OS X there is noone listening on
 port 13.
 
 You can check that manually with nc localhost 13.
 
 The next problem is that noone is actually listening on ipv6 for that
 port. I ran into this when trying to simulate the datetime service with:
 
 date | sudo nc -u -l -p 13
 
 Connecting with v4 works, with v6 it doesn't.
 
 My suggestion is to test this with a known open service on your system
 or by creating a server explicitly bound to a v6 address.
 
 Please don't hesitate to report further issues and troubles!
 
 Kind regards,
 
 Christian
 
 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.
 
 
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org mailto:Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users 
 https://lists.nongnu.org/mailman/listinfo/chicken-users
 
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org mailto:Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users 
 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 mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help with udp6 / socket

2015-02-17 Thread Scott McCoid
Hi Jim,

This completely worked for me, thanks for the clear example! I didn't even
think to check if (udp-open-socket) also accepted extra arguments.

Thanks again!
Scott

On Tue, Feb 17, 2015 at 4:17 AM, Jim Ursetto zbignie...@gmail.com wrote:

 Scott,

 This works on my system (10.10.2, CHICKEN 4.8.0.6).  Note the undocumented
 argument to udp-open-socket… not sure what I was thinking.
 If this works for you, I will document the argument and add the example to
 the wiki.


 (use udp6)

 (define s (udp-open-socket 'inet6))
 (udp-bind! s :: 1337);; unspecified address; accept both ipv4 and
 ipv6
 (let loop ()
   (receive (len str host port) (udp-recvfrom s 1024)
 (print received  len  bytes from [ host ]: port  :  str))
   (loop))
 (udp-close-socket s)


 ;; Then we can run netcats using IPv4 and IPv6:

 $ nc -6 -u localhost 1337
 hello
 ^C

 $ nc -4 -u localhost 1337
 hi
 ^C

 ;; And you should get the following output:

 received 6 bytes from [::1]:62028 : hello
 received 3 bytes from [:::127.0.0.1]:61031 : hi


 On Feb 16, 2015, at 07:06, Scott McCoid mccoid.sc...@gmail.com wrote:

 Hi Christian!

 Thanks for the quick help and netcat tip. I was able to send from my
 script and receive with netcat (for example: *nc -u -6 -l 8000*) without
 any problems. (sending to port 8000 in my script)

 I've tried doing the reverse situation, where I receive on the script side
 and send using netcat, but I haven't been able to get this to work. I don't
 have any errors, but I'm not receiving anything for some reason.

 I'll work on some chicken scripts that talk to each other and see if I can
 get this to work properly.

 Thanks again for your help!
 Scott

 On Mon, Feb 16, 2015 at 11:49 AM, Christian Kellermann 
 ck...@pestilenz.org wrote:

 Hi Scott!

 Scott McCnoid mccoid.sc...@gmail.com writes:

  I'm reasonably new to chicken-scheme (and scheme in general), and I'm
  having trouble with the udp6 (and likewise, socket) eggs. I'm trying to
 run
  the example code, but the connection is always refused.
 
  *Error: (socket-receive!) cannot read from socket - Connection refused:
  #socket fd:4 af/inet sock/dgram*
 
  I looked into the socket code and it seems that this is probably not the
  fault of these eggs per se, but probably something I'm doing wrong. For
  example, the *%socket-receive!* function makes a call to the
 sys/socket.h
  *recv* function, which always returns -1. I've tried using other port
  numbers to connect to, but this doesn't seem to make a difference.
 
  I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1
 *(stability/4.9.0)
  (rev 8b3189b)
 
  I'm happy to help track this down if it's a bug, just let me know.

 The most likely reason is that on Mac OS X there is noone listening on
 port 13.

 You can check that manually with nc localhost 13.

 The next problem is that noone is actually listening on ipv6 for that
 port. I ran into this when trying to simulate the datetime service with:

 date | sudo nc -u -l -p 13

 Connecting with v4 works, with v6 it doesn't.

 My suggestion is to test this with a known open service on your system
 or by creating a server explicitly bound to a v6 address.

 Please don't hesitate to report further issues and troubles!

 Kind regards,

 Christian

 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.


 ___
 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 mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help with udp6 / socket

2015-02-16 Thread Jim Ursetto
Scott,

This works on my system (10.10.2, CHICKEN 4.8.0.6).  Note the undocumented 
argument to udp-open-socket… not sure what I was thinking.
If this works for you, I will document the argument and add the example to the 
wiki.


(use udp6)

(define s (udp-open-socket 'inet6))
(udp-bind! s :: 1337);; unspecified address; accept both ipv4 and ipv6
(let loop ()
  (receive (len str host port) (udp-recvfrom s 1024)
(print received  len  bytes from [ host ]: port  :  str))
  (loop))
(udp-close-socket s)


;; Then we can run netcats using IPv4 and IPv6:

$ nc -6 -u localhost 1337
hello
^C

$ nc -4 -u localhost 1337
hi
^C

;; And you should get the following output:

received 6 bytes from [::1]:62028 : hello
received 3 bytes from [:::127.0.0.1]:61031 : hi


 On Feb 16, 2015, at 07:06, Scott McCoid mccoid.sc...@gmail.com wrote:
 
 Hi Christian!
 
 Thanks for the quick help and netcat tip. I was able to send from my script 
 and receive with netcat (for example: nc -u -6 -l 8000) without any problems. 
 (sending to port 8000 in my script)
 
 I've tried doing the reverse situation, where I receive on the script side 
 and send using netcat, but I haven't been able to get this to work. I don't 
 have any errors, but I'm not receiving anything for some reason. 
 
 I'll work on some chicken scripts that talk to each other and see if I can 
 get this to work properly. 
 
 Thanks again for your help!
 Scott
 
 On Mon, Feb 16, 2015 at 11:49 AM, Christian Kellermann ck...@pestilenz.org 
 mailto:ck...@pestilenz.org wrote:
 Hi Scott!
 
 Scott McCnoid mccoid.sc...@gmail.com mailto:mccoid.sc...@gmail.com writes:
 
  I'm reasonably new to chicken-scheme (and scheme in general), and I'm
  having trouble with the udp6 (and likewise, socket) eggs. I'm trying to run
  the example code, but the connection is always refused.
 
  *Error: (socket-receive!) cannot read from socket - Connection refused:
  #socket fd:4 af/inet sock/dgram*
 
  I looked into the socket code and it seems that this is probably not the
  fault of these eggs per se, but probably something I'm doing wrong. For
  example, the *%socket-receive!* function makes a call to the sys/socket.h
  *recv* function, which always returns -1. I've tried using other port
  numbers to connect to, but this doesn't seem to make a difference.
 
  I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1 *(stability/4.9.0)
  (rev 8b3189b)
 
  I'm happy to help track this down if it's a bug, just let me know.
 
 The most likely reason is that on Mac OS X there is noone listening on
 port 13.
 
 You can check that manually with nc localhost 13.
 
 The next problem is that noone is actually listening on ipv6 for that
 port. I ran into this when trying to simulate the datetime service with:
 
 date | sudo nc -u -l -p 13
 
 Connecting with v4 works, with v6 it doesn't.
 
 My suggestion is to test this with a known open service on your system
 or by creating a server explicitly bound to a v6 address.
 
 Please don't hesitate to report further issues and troubles!
 
 Kind regards,
 
 Christian
 
 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.
 
 
 ___
 Chicken-users mailing list
 Chicken-users@nongnu.org mailto:Chicken-users@nongnu.org
 https://lists.nongnu.org/mailman/listinfo/chicken-users 
 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 mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help with udp6 / socket

2015-02-16 Thread Scott McCoid
Hi Christian!

Thanks for the quick help and netcat tip. I was able to send from my script
and receive with netcat (for example: *nc -u -6 -l 8000*) without any
problems. (sending to port 8000 in my script)

I've tried doing the reverse situation, where I receive on the script side
and send using netcat, but I haven't been able to get this to work. I don't
have any errors, but I'm not receiving anything for some reason.

I'll work on some chicken scripts that talk to each other and see if I can
get this to work properly.

Thanks again for your help!
Scott

On Mon, Feb 16, 2015 at 11:49 AM, Christian Kellermann ck...@pestilenz.org
wrote:

 Hi Scott!

 Scott McCnoid mccoid.sc...@gmail.com writes:

  I'm reasonably new to chicken-scheme (and scheme in general), and I'm
  having trouble with the udp6 (and likewise, socket) eggs. I'm trying to
 run
  the example code, but the connection is always refused.
 
  *Error: (socket-receive!) cannot read from socket - Connection refused:
  #socket fd:4 af/inet sock/dgram*
 
  I looked into the socket code and it seems that this is probably not the
  fault of these eggs per se, but probably something I'm doing wrong. For
  example, the *%socket-receive!* function makes a call to the
 sys/socket.h
  *recv* function, which always returns -1. I've tried using other port
  numbers to connect to, but this doesn't seem to make a difference.
 
  I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1
 *(stability/4.9.0)
  (rev 8b3189b)
 
  I'm happy to help track this down if it's a bug, just let me know.

 The most likely reason is that on Mac OS X there is noone listening on
 port 13.

 You can check that manually with nc localhost 13.

 The next problem is that noone is actually listening on ipv6 for that
 port. I ran into this when trying to simulate the datetime service with:

 date | sudo nc -u -l -p 13

 Connecting with v4 works, with v6 it doesn't.

 My suggestion is to test this with a known open service on your system
 or by creating a server explicitly bound to a v6 address.

 Please don't hesitate to report further issues and troubles!

 Kind regards,

 Christian

 --
 May you be peaceful, may you live in safety, may you be free from
 suffering, and may you live with ease.


 ___
 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] Help with udp6 / socket

2015-02-16 Thread Christian Kellermann
Hi Scott!

Scott McCnoid mccoid.sc...@gmail.com writes:

 I'm reasonably new to chicken-scheme (and scheme in general), and I'm
 having trouble with the udp6 (and likewise, socket) eggs. I'm trying to run
 the example code, but the connection is always refused.

 *Error: (socket-receive!) cannot read from socket - Connection refused:
 #socket fd:4 af/inet sock/dgram*

 I looked into the socket code and it seems that this is probably not the
 fault of these eggs per se, but probably something I'm doing wrong. For
 example, the *%socket-receive!* function makes a call to the sys/socket.h
 *recv* function, which always returns -1. I've tried using other port
 numbers to connect to, but this doesn't seem to make a difference.

 I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1 *(stability/4.9.0)
 (rev 8b3189b)

 I'm happy to help track this down if it's a bug, just let me know.

The most likely reason is that on Mac OS X there is noone listening on
port 13.

You can check that manually with nc localhost 13.

The next problem is that noone is actually listening on ipv6 for that
port. I ran into this when trying to simulate the datetime service with:

date | sudo nc -u -l -p 13

Connecting with v4 works, with v6 it doesn't.

My suggestion is to test this with a known open service on your system
or by creating a server explicitly bound to a v6 address.

Please don't hesitate to report further issues and troubles!

Kind regards,

Christian

-- 
May you be peaceful, may you live in safety, may you be free from
suffering, and may you live with ease.


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


[Chicken-users] Help with udp6 / socket

2015-02-16 Thread Scott McCoid
Hello,

I'm reasonably new to chicken-scheme (and scheme in general), and I'm
having trouble with the udp6 (and likewise, socket) eggs. I'm trying to run
the example code, but the connection is always refused.

*Error: (socket-receive!) cannot read from socket - Connection refused:
#socket fd:4 af/inet sock/dgram*

I looked into the socket code and it seems that this is probably not the
fault of these eggs per se, but probably something I'm doing wrong. For
example, the *%socket-receive!* function makes a call to the sys/socket.h
*recv* function, which always returns -1. I've tried using other port
numbers to connect to, but this doesn't seem to make a difference.

I'm on Mac OS *10.10.2* using chicken scheme v.* 4.9.0.1 *(stability/4.9.0)
(rev 8b3189b)

I'm happy to help track this down if it's a bug, just let me know.


Thanks!
Scott

For reference I've tried this example as well as a simplified version
using *(udp-recv
s 64)*:

(use udp6)(define s (udp-open-socket))(udp-connect! s localhost 13)
; daytime service(udp-send s \n)(receive (n data host port)
(udp-recvfrom s 64)
  (print n  bytes from  host : port :  data))(udp-close-socket s)
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Help with foreign code and lists on the stack and heap

2014-05-06 Thread Alex Stuart
Greetings,

I need some help. I am calling a foreign C function that calls back to
Scheme (using CHICKEN_apply). The callback returns a list as its value.
The foreign function creates a static reference to this list (using
CHICKEN_new_gc_root). The foreign function then creates a different list
on the stack (using C_list).

I want to append the latter list to the former and pass it to a second
callback function. I'm trying to do this by setting the cdr of the first
list's last pair (using C_set_block_item). However, the appended list is
wrong.

I'm guessing that garbage collection is messing with the list even
though I dereference my GC root to read the first part of it. Things
work fine if I just pass that part, but appending the other part doesn't
work.

Is the problem that the first list is heap-allocated and the second list
is stack-allocated? Am I approaching this the wrong way? I would much
appreciate any advice I can get.

--Alex



Here is the kind of code I am using:

/* RETRIEVE LIST NUMBER 1 */
CHICKEN_apply( CHICKEN_gc_root_ref( callback1 ), arg_list, first_list );
void *gc_root = CHICKEN_new_gc_root();
CHICKEN_gc_root_set( gc_root, first_list );

...

... (no callbacks) ...

...

/* CREATE LIST NUMBER 2 */
C_word *second_list_mem = C_alloc( C_SIZEOF_LIST( second_list_size ) +
second_list_size * C_SIZEOF_POINTER );
C_word second_list = C_list( second_list_mem, second_list_size );
C_word list_pos = second_list
int k = 0;
while ( !C_truep( C_i_nullp( list_pos ) ) )
{
C_set_block_item( list_pos, 0, C_mpointer( second_list_mem,
second_list_array[k] ) );
list_pos = C_u_i_cdr( list_pos );
k += 1;
}

/* APPEND LIST 2 ONTO LIST 1 */
first_list = CHICKEN_gc_root_ref( gc_root );
if ( !C_truep( C_i_nullp( first_list ) ) )
{
list_pos = first_list;
for ( int k = 0; k  first_list_size; k++ )
{
list_pos = C_u_i_cdr( list_pos );
}
C_set_block_item( list_pos, 1, second_list );
}
else
{
first_list = second_list;
}

/* PASS THE COMBINED LIST TO THE OTHER CALLBACK */
callback2( first_list );


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


Re: [Chicken-users] Help needed on a project intended to promote some important ideas.

2014-01-22 Thread Matt Welland
To clarify, by do not reply to this email I meant do not reply to the
list but instead email me directly at estifo...@gmail.com. I'm trying to
be a good citizen here and not clog up the lists with email that will annoy
people.

Also, I need someone with illustration and or image skills.


On Tue, Jan 21, 2014 at 11:25 PM, Matt Welland estifo...@gmail.com wrote:

 Hi,

 This is a long shot and I apologize in advance for any time wasted and for
 cross-posting to unrelated groups. Please: DO NOT reply to this email.

 I have been working on a project that I believe will do a good job in
 raising awareness of alternative voting systems. Initially I want to
 contrast single-choice with approval and range but I'm interested in adding
 Condorcet also. I'm looking for people who would be willing to donate time.

 I don't want to reveal the exact nature of the project just yet so I'll
 make only a few general comments. The goal is to expose large numbers of
 people to a spectrum of ideas that currently get very little to no press.
 This includes the various voting methods, some alternative economic
 perspectives and ideas such as permaculture. Adding your favorite idea into
 the mix is definitely an option. Note that exposure and education, not
 advocacy is the intent here.

 This is a not-for-profit endeavor and the only reward would be in the
 success of the project and having your name on the credits.

 Any combination of the following skills needed:

 Scheme programming or a willingness to learn scheme
 Postgresql, schema design.
 Html Kickstarter/html5
 Possibly IOS app writing (android already covered)
 Maybe test writing?

 If any of this piques your interest and you think you could afford to
 spend several hours a week for a few months working on this please contact
 me at estifo...@gmail.com

 Thanks for reading and I hope you'll forgive the off-topic cross-post.
 --
 Matt
 -=-
 90% of the nations wealth is held by 2% of the people. Bummer to be in the
 majority...




-- 
Matt
-=-
90% of the nations wealth is held by 2% of the people. Bummer to be in the
majority...
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Help needed on a project intended to promote some important ideas.

2014-01-21 Thread Matt Welland
Hi,

This is a long shot and I apologize in advance for any time wasted and for
cross-posting to unrelated groups. Please: DO NOT reply to this email.

I have been working on a project that I believe will do a good job in
raising awareness of alternative voting systems. Initially I want to
contrast single-choice with approval and range but I'm interested in adding
Condorcet also. I'm looking for people who would be willing to donate time.

I don't want to reveal the exact nature of the project just yet so I'll
make only a few general comments. The goal is to expose large numbers of
people to a spectrum of ideas that currently get very little to no press.
This includes the various voting methods, some alternative economic
perspectives and ideas such as permaculture. Adding your favorite idea into
the mix is definitely an option. Note that exposure and education, not
advocacy is the intent here.

This is a not-for-profit endeavor and the only reward would be in the
success of the project and having your name on the credits.

Any combination of the following skills needed:

Scheme programming or a willingness to learn scheme
Postgresql, schema design.
Html Kickstarter/html5
Possibly IOS app writing (android already covered)
Maybe test writing?

If any of this piques your interest and you think you could afford to spend
several hours a week for a few months working on this please contact me at
estifo...@gmail.com

Thanks for reading and I hope you'll forgive the off-topic cross-post.
-- 
Matt
-=-
90% of the nations wealth is held by 2% of the people. Bummer to be in the
majority...
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] help with implicit renaming macro

2013-11-11 Thread Alan Post
I have a routine with several input arguments and one
output argument.  I want to write a macro to wrap my
output argument such that I can pass the results of
my input arguments to my output argument.  (See below)

I have this working with an explicit renaming macro,
but this is overkill.  I could find myself capturing
variables other than my input arguments.

I'd like to rewrite this macro as an implicit renaming
macro, which seems to require that I traverse form and
insert (inject arg1) wherever I find arg1, and to do
the same for arg2.

I do not otherwise need to transform the symbolic
expression bound to output.  Is there some idiomatic
way to traverse a tree and perform a set of replacement
operations on matching leaves?  

  (define (doit #!key arg1 arg2 output)
(output arg1: arg1 arg2: arg2))

  ; er-macro-transformer works, but it might capture
  ; more than arg1, arg2.  Can I rewrite this to
  ; explicitely inject arg1 and arg2?
  ;
  (define-syntax do-output
(er-macro-transformer
  (lambda (form rename compare?)
`(lambda (#!key arg1 arg2)
   (list ,@(cdr form))

   (doit arg1: hello
arg2: world
output: (do-output arg1 arg2))
  = (hello world)

Thank you,

-Alan
-- 
my personal website: http://c0redump.org/

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


Re: [Chicken-users] help with implicit renaming macro

2013-11-11 Thread Peter Bex
On Mon, Nov 11, 2013 at 01:22:40PM -0701, Alan Post wrote:
 I'd like to rewrite this macro as an implicit renaming
 macro, which seems to require that I traverse form and
 insert (inject arg1) wherever I find arg1, and to do
 the same for arg2.

Hi Alan,

Actually, you only need to inject the args where they
are introduced.  This will cause them to be bound
unhygienically, which means they'll capture any local
variables with that same literal name.

So unless I'm completely misunderstanding what you're
trying to do, this will suffice:

(define-syntax do-output 
  (ir-macro-transformer
(lambda (e i c)
  `(lambda (#!key ,(i 'arg1) ,(i 'arg2))
 (list ,@(cdr e))

 I do not otherwise need to transform the symbolic
 expression bound to output.  Is there some idiomatic
 way to traverse a tree and perform a set of replacement
 operations on matching leaves?  

SSAX has foldts which can fold over trees, but I think
it's overkill to load an XML library just to transform your
macros :)

Finally, you might want to take a look at some of Juergen Lorenz's
eggs, they provide some tools to deal with low-level macros a bit
more conveniently.

Cheers,
Peter
-- 
http://www.more-magic.net

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


Re: [Chicken-users] help with implicit renaming macro

2013-11-11 Thread Alan Post
On Mon, Nov 11, 2013 at 09:36:48PM +0100, Peter Bex wrote:
 On Mon, Nov 11, 2013 at 01:22:40PM -0701, Alan Post wrote:
  I'd like to rewrite this macro as an implicit renaming
  macro, which seems to require that I traverse form and
  insert (inject arg1) wherever I find arg1, and to do
  the same for arg2.
 
 Hi Alan,
 
 Actually, you only need to inject the args where they
 are introduced.  This will cause them to be bound
 unhygienically, which means they'll capture any local
 variables with that same literal name.
 
 So unless I'm completely misunderstanding what you're
 trying to do, this will suffice:
 
 (define-syntax do-output 
   (ir-macro-transformer
 (lambda (e i c)
   `(lambda (#!key ,(i 'arg1) ,(i 'arg2))
  (list ,@(cdr e))
 
  I do not otherwise need to transform the symbolic
  expression bound to output.  Is there some idiomatic
  way to traverse a tree and perform a set of replacement
  operations on matching leaves?  
 
 SSAX has foldts which can fold over trees, but I think
 it's overkill to load an XML library just to transform your
 macros :)
 
 Finally, you might want to take a look at some of Juergen Lorenz's
 eggs, they provide some tools to deal with low-level macros a bit
 more conveniently.
 

Aha, I missed the quote to the inject parameter, got an error about
arg1, and assumed it was happening during expansion to report an
unbound variable.  pebkac.

This does indeed work, fantastic.  Really stellar feature, ir-macros.
I have the most experience with defmacro, and it took me some time
to come to terms with define-syntax/syntax-rules, though the vast
majority of my macros fit easily and comfortably in that rubric.

This was the first time in a long while I've wanted to do something
more than simple transformation.  I appreciate your guidance here!

-a
-- 
my personal website: http://c0redump.org/

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


[Chicken-users] help :)

2013-06-05 Thread nehal singhal
Hi,
   I am a newbie to chicken.Can i get some aid as to how to start
coding through chicken. I was recently learning racket and also have
know-how of Python-2.6.
   Please guide a little.

regards,
Nehal Singhal.

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


Re: [Chicken-users] help :)

2013-06-05 Thread Matt Gushee
Hi, Nehal--

Have you seen the Chicken for Python programmers tutorial?

http://wiki.call-cc.org/chicken-for-python-programmers

That would be a good place to start. Then if you are still unsure how
to proceed, you will probably get more help if you ask more specific
questions.
Best of luck with Chicken!

--
Matt Gushee

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


Re: [Chicken-users] help :)

2013-06-05 Thread Mario Domenech Goulart
Hi,

On Wed, 5 Jun 2013 16:07:56 +0200 nehal singhal nehalsingha...@gmail.com 
wrote:

I am a newbie to chicken.Can i get some aid as to how to start
 coding through chicken. I was recently learning racket and also have
 know-how of Python-2.6.
Please guide a little.

Welcome.

There's the Getting started chapter from the manual:
http://wiki.call-cc.org/man/4/Getting%20started

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

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


Re: [Chicken-users] help :)

2013-06-05 Thread Dan Leslie

Feel free to ask questions in the IRC channel, #chicken on irc.freenode.net

-Dan

On 6/5/2013 7:07 AM, nehal singhal wrote:

Hi,
I am a newbie to chicken.Can i get some aid as to how to start
coding through chicken. I was recently learning racket and also have
know-how of Python-2.6.
Please guide a little.

regards,
Nehal Singhal.

___
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] help :)

2013-06-05 Thread Pedro Melendez
Hey Dan,

What's the preferred method to ask? I didn't know about the IRC channel and
now I am dubious what would be better if asking over there or using the
email list...

Cheers,

Pedro.


On Wed, Jun 5, 2013 at 11:44 AM, Dan Leslie d...@ironoxide.ca wrote:

 Feel free to ask questions in the IRC channel, #chicken on
 irc.freenode.net

 -Dan


 On 6/5/2013 7:07 AM, nehal singhal wrote:

 Hi,
 I am a newbie to chicken.Can i get some aid as to how to start
 coding through chicken. I was recently learning racket and also have
 know-how of Python-2.6.
 Please guide a little.

 regards,
 Nehal Singhal.

 __**_
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/**mailman/listinfo/chicken-usershttps://lists.nongnu.org/mailman/listinfo/chicken-users



 __**_
 Chicken-users mailing list
 Chicken-users@nongnu.org
 https://lists.nongnu.org/**mailman/listinfo/chicken-usershttps://lists.nongnu.org/mailman/listinfo/chicken-users




-- 
T: +1 (416) - 357.5356
Skype ID: pmelendezu
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Help request for zmq egg porting from zmq 2.2.0 to 3.2.2

2013-01-20 Thread Matt Welland
I'm trying to port the zmq egg from using zmq 2.2 to 3.2.2 and I'm not
making very good progress. I'm hoping someone can provide some insight.
Attached is the modified zmq egg code and a test case that exercises zmq in
the way I'm using it in my application.

the problem

I get Resource temporarily unavailable warnings in code that works fine
with the zmq 2.2.0 version:

Warning (#thread: do access): in thread: (send-message) Resource
temporarily unavailable: 11

Call history:

mockupclientlib.scm:11: print
mockupclientlib.scm:12: zmq#send-message  --

Error: uncaught exception: #condition: (exn)

resources

http://zguide.zeromq.org/page:all#Upgrading-from-MQ-to-MQ

the diff

diff -Naur zmq-orig/zmq.scm zmq/zmq.scm
--- zmq-orig/zmq.scm2013-01-20 06:29:41.387900097 +
+++ zmq/zmq.scm2013-01-20 20:10:42.722357739 +
@@ -29,6 +29,8 @@
   ((sub) ZMQ_SUB)
   ((req) ZMQ_REQ)
   ((rep) ZMQ_REP)
+  ((dealer) ZMQ_DEALER)
+  ((router) ZMQ_ROUTER)
   ((xreq) ZMQ_XREQ)
   ((xrep) ZMQ_XREP)
   ((pull) ZMQ_PULL)
@@ -36,23 +38,25 @@

 (define-foreign-enum-type (socket-option int)
   (socket-option-int int-socket-option)
-  ((hwm) ZMQ_HWM)
-  ((swap) ZMQ_SWAP)
+  ;; ((hwm) ZMQ_HWM)
+  ((snd-hwm) ZMQ_SNDHWM)
+  ((rcv-hwm) ZMQ_RCVHWM)
+  ;; ((swap) ZMQ_SWAP)
   ((affinity) ZMQ_AFFINITY)
   ((identity) ZMQ_IDENTITY)
   ((subscribe) ZMQ_SUBSCRIBE)
   ((unsubscribe) ZMQ_UNSUBSCRIBE)
   ((rate) ZMQ_RATE)
   ((recovery-ivl) ZMQ_RECOVERY_IVL)
-  ((mcast-loop) ZMQ_MCAST_LOOP)
+  ;; ((mcast-loop) ZMQ_MCAST_LOOP)
   ((sndbuf) ZMQ_SNDBUF)
   ((rcvbuf) ZMQ_RCVBUF)
   ((rcvmore) ZMQ_RCVMORE)
   ((fd) ZMQ_FD))

 (define socket-options
-  '((integer hwm swap affinity rate recovery-ivl sndbuf rcvbuf)
-(boolean rcvmore mcast-loop)
+  '((integer snd-hwm rcv-hwm affinity rate recovery-ivl sndbuf rcvbuf)
+(boolean rcvmore) ;; mcast-loop)
 (string subscribe unsubscribe identity)))

 (define-foreign-enum-type (socket-flag int)
@@ -233,7 +237,7 @@

 (define (socket-option-set! socket option value)
   (or (zero? (case option
-   ((hwm affinity sndbuf rcvbuf swap rate recovery-ivl
mcast-loop)
+   ((rcv-hwm snd-hwm affinity sndbuf rcvbuf swap rate
recovery-ivl mcast-loop)
 (if (integer? value)
 ((foreign-safe-lambda* int
((scheme-object error)
@@ -311,27 +315,27 @@
 (define (send-message socket data #!key non-blocking send-more)
   (mutex-lock! (socket-mutex socket))
   (let* ((message (initialize-message (socket-message socket) data))
- (result ((foreign-lambda int zmq_send socket message int)
-  (socket-pointer socket)
+ (result ((foreign-lambda int zmq_msg_send message socket int)
   message
+  (socket-pointer socket)
   (bitwise-ior (if non-blocking zmq/noblock  0)
(if send-more zmq/sndmore 0)

 (close-message message)
 (mutex-unlock! (socket-mutex socket))
-(or (zero? result) (zmq-error 'send-message
+(or ( -1 result) (zmq-error 'send-message


 (define (receive-message socket #!key non-blocking (as 'string))
   (mutex-lock! (socket-mutex socket))
   (let* ((message (initialize-message (socket-message socket)))
- (result ((foreign-lambda int zmq_recv socket message int)
-  (socket-pointer socket)
+ (result ((foreign-lambda int zmq_msg_recv message socket int)
   message
+  (socket-pointer socket)
   (if non-blocking zmq/noblock 0


-(if (zero? result)
+(if ( -1 result)
 (let ((data (message-data message as)))
   (mutex-unlock! (socket-mutex socket))
   (close-message message)


zmq-egg-with-testcode.tar.gz
Description: GNU Zip compressed data
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help building latest sources

2011-10-10 Thread Christian Kellermann
* Toby Thain t...@telegraphics.com.au [111009 23:05]:
 On 08/10/11 8:27 AM, Vitaly Magerya wrote:
 Did you build a boot chicken for bootstrapping? Note that you will need a
 chicken installed for this.
 
 $ gmake PLATFORM=bsd boot-chicken
 $ gmake PLATFORM=bsd CHICKEN=./chicken-boot
 $ gmake PLATFORM=bsd install
 
 I have put up a little tutorial on the wiki for this here
 http://wiki.call-cc.org/chickenista-guide#building-a-development-snapshot-or-from-git
 
 The wiki seems to have the target name wrong in the first step,
 while your note above is correct.

Ah, I am sorry for this, this has been reported before and I must
have missed it in this version before converting it to the wiki.
You are free to change any other mistakes that you are finding (or
awkward / misleading wordings, since I am not a native speaker)
yourself. It is a wiki and every page is under version control, so
don't be afraid of mistakes!

Thanks for your report,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

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


Re: [Chicken-users] Help building latest sources

2011-10-09 Thread Toby Thain

On 08/10/11 8:27 AM, Vitaly Magerya wrote:

Did you build a boot chicken for bootstrapping? Note that you will need a
chicken installed for this.

$ gmake PLATFORM=bsd boot-chicken
$ gmake PLATFORM=bsd CHICKEN=./chicken-boot
$ gmake PLATFORM=bsd install

I have put up a little tutorial on the wiki for this here
http://wiki.call-cc.org/chickenista-guide#building-a-development-snapshot-or-from-git


The wiki seems to have the target name wrong in the first step, while 
your note above is correct.



--Toby



That works, thank you.

___
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] Help building latest sources

2011-10-08 Thread Vitaly Magerya
 Did you build a boot chicken for bootstrapping? Note that you will need a
 chicken installed for this.

 $ gmake PLATFORM=bsd boot-chicken
 $ gmake PLATFORM=bsd CHICKEN=./chicken-boot
 $ gmake PLATFORM=bsd install

 I have put up a little tutorial on the wiki for this here
 http://wiki.call-cc.org/chickenista-guide#building-a-development-snapshot-or-from-git

That works, thank you.

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


[Chicken-users] Help building latest sources

2011-10-07 Thread Vitaly Magerya
Hi, folks. I'm trying to build the latest git sources (I've got 4.7.0
installed); the build proceeds for a while and then fails like this:

$ gmake PLATFORM=bsd
...
chicken setup-api.scm [...] -output-file setup-api.c

Syntax error (import): cannot import from undefined module

scheme

Expansion history:

syntax  (##core#begin (module setup-api ..
syntax  (module setup-api ((run execute) ..
syntax  (##core#module setup-api ((run execute) ..
syntax  (import scheme chicken foreign irregex ..   --

The system is a FreeBSD 8.2 amd64 box. The full log is at [1].

So, any ideas as to what am I doing wrong?

For the record, building 4.7.0 sources in the same way (after gmake
spotless to remove pregenerated sources) works flawlessly.

[1] http://tx97.net/~magv/chicken-2011-10-08-gmake.log

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


Re: [Chicken-users] Help building latest sources

2011-10-07 Thread Christian Kellermann
Hi Vitaly!

* Vitaly Magerya vmage...@gmail.com [111008 00:06]:
 Hi, folks. I'm trying to build the latest git sources (I've got 4.7.0
 installed); the build proceeds for a while and then fails like this:

Did you build a boot chicken for bootstrapping? Note that you will need a 
chicken installed for this.

$ gmake PLATFORM=bsd boot-chicken
$ gmake PLATFORM=bsd CHICKEN=./chicken-boot
$ gmake PLATFORM=bsd install

I have put up a little tutorial on the wiki for this here
http://wiki.call-cc.org/chickenista-guide#building-a-development-snapshot-or-from-git

HTH,

Christian

-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

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


Re: [Chicken-users] Help using Chicken in Windows 7

2011-07-09 Thread Felix
From: William Tarimo wtar...@conncoll.edu
Subject: Re: [Chicken-users] Help using Chicken in Windows 7
Date: Fri, 8 Jul 2011 14:32:15 -0400

 Hello All,
 Thanks for the reply. I'm using Windows 7 32 bit machine. I reinstalled
 Mingw (mingw-get-inst-20110530.exe) from the new link, thanks. But I can't
 use the compiler or compile anything, I have attached a screenshot of the
 interpreter window, assuming I'm supposed to run the compiler from this
 window. I'm not sure I'm doing right with the syntax either, please help.
 Thanks,
 William
 

You compile code via a separate program (called csc). It should be
in C:\chicken\bin. If you open a console window (cmd.exe), you should
be able to compile code like this:

  C:\ c:\chicken\bin\csc myprogram.scm

Assuming the mingw tools are in your PATH (check by entering echo %PATH%
at the command-prompt), this should work ok.


cheers,
felix

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


Re: [Chicken-users] Help using Chicken in Windows 7

2011-07-08 Thread William Tarimo
Hello All,
Thanks for the reply. I'm using Windows 7 32 bit machine. I reinstalled
Mingw (mingw-get-inst-20110530.exe) from the new link, thanks. But I can't
use the compiler or compile anything, I have attached a screenshot of the
interpreter window, assuming I'm supposed to run the compiler from this
window. I'm not sure I'm doing right with the syntax either, please help.
Thanks,
William

On Fri, Jul 8, 2011 at 12:54 AM, Steve Graham jsgraha...@yahoo.com wrote:

 When I tried to compile (Win 7-64), I also had problems.  Turned out that
 my copy of mingw did not contain gcc.

 Steve

 On Thu Jul 7th, 2011 11:26 AM EDT William Tarimo wrote:

 Hello Chicken Users,
 I have been trying to use Chicken to compile Scheme programs to C, but the
 compiler isn't working for me.
 I followed the installation procedures at
 http://www.kiatoa.com/cgi-bin/chicken-iup/home to install Mingw and
 chicken-iup,
 I couldn't find Mingw on the page so I search elsewhere with google.
 However
 after installation, the compiler fails to compile, not recognizing the
 commands.
 Please help!
 
 --
 William Tarimo
 Mathematics  Computer Science
 Connecticut College '12
 8605017893




-- 
William Tarimo
Mathematics  Computer Science
Connecticut College '12
attachment: Interpreter Command Window.PNG___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help using Chicken in Windows 7

2011-07-08 Thread Steve Graham
I know little about Chicken, but I would imagine you need to call csc at the 
cmd prompt, not within Chicken itself.

--- On Fri, 7/8/11, William Tarimo wtar...@conncoll.edu wrote:

From: William Tarimo wtar...@conncoll.edu
Subject: Re: [Chicken-users] Help using Chicken in Windows 7
To: Steve Graham jsgraha...@yahoo.com
Cc: chicken-users@nongnu.org
Date: Friday, July 8, 2011, 2:32 PM

Hello All,Thanks for the reply. I'm using Windows 7 32 bit machine. I 
reinstalled Mingw (mingw-get-inst-20110530.exe) from the new link, thanks. But 
I can't use the compiler or compile anything, I have attached a screenshot of 
the interpreter window, assuming I'm supposed to run the compiler from this 
window. I'm not sure I'm doing right with the syntax either, please help.
Thanks,William
On Fri, Jul 8, 2011 at 12:54 AM, Steve Graham jsgraha...@yahoo.com wrote:

When I tried to compile (Win 7-64), I also had problems.  Turned out that my 
copy of mingw did not contain gcc.



Steve



On Thu Jul 7th, 2011 11:26 AM EDT William Tarimo wrote:



Hello Chicken Users,

I have been trying to use Chicken to compile Scheme programs to C, but the

compiler isn't working for me.

I followed the installation procedures at

http://www.kiatoa.com/cgi-bin/chicken-iup/home to install Mingw and

chicken-iup,

I couldn't find Mingw on the page so I search elsewhere with google. However

after installation, the compiler fails to compile, not recognizing the

commands.

Please help!



--

William Tarimo

Mathematics  Computer Science

Connecticut College '12

8605017893






-- 
William TarimoMathematics  Computer ScienceConnecticut College '12


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


Re: [Chicken-users] Help using Chicken in Windows 7

2011-07-08 Thread John Cowan
William Tarimo scripsit:

 Hello All, Thanks for the reply. I'm using Windows 7 32 bit machine. I
 reinstalled Mingw (mingw-get-inst-20110530.exe) from the new link,
 thanks. But I can't use the compiler or compile anything, I have
 attached a screenshot of the interpreter window, assuming I'm supposed
 to run the compiler from this window.

The Chicken compiler csc is a file compiler that runs directly from
the command line; there is no compiler embedded in the interpreter.
(Indeed, the interpreter is written in Scheme and compiled with csc.)

-- 
John Cowan   co...@ccil.orghttp://ccil.org/~cowan
I am he that buries his friends alive and drowns them and draws them
alive again from the water. I came from the end of a bag, but no bag
went over me.  I am the friend of bears and the guest of eagles. I am
Ringwinner and Luckwearer; and I am Barrel-rider.  --Bilbo to Smaug

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


[Chicken-users] Help using Chicken in Windows 7

2011-07-07 Thread William Tarimo
Hello Chicken Users,
I have been trying to use Chicken to compile Scheme programs to C, but the
compiler isn't working for me.
I followed the installation procedures at
http://www.kiatoa.com/cgi-bin/chicken-iup/home to install Mingw and
chicken-iup,
I couldn't find Mingw on the page so I search elsewhere with google. However
after installation, the compiler fails to compile, not recognizing the
commands.
Please help!

-- 
William Tarimo
Mathematics  Computer Science
Connecticut College '12
8605017893
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help using Chicken in Windows 7

2011-07-07 Thread Matt Welland
Hi William,

I have corrected the link on the chicken-iup page to point to
http://mingw.org, is this where you downloaded mingw from?

At exactly what stage did compilation fail and are you able to run the
interpreter? Does (load example.scm) work? Are you able to compile a small
C program with mingw?

Matt
-=-

On Thu, Jul 7, 2011 at 8:26 AM, William Tarimo wtar...@conncoll.edu wrote:

 Hello Chicken Users,
 I have been trying to use Chicken to compile Scheme programs to C, but the
 compiler isn't working for me.
 I followed the installation procedures at
 http://www.kiatoa.com/cgi-bin/chicken-iup/home to install Mingw and 
 chicken-iup,
 I couldn't find Mingw on the page so I search elsewhere with google. However
 after installation, the compiler fails to compile, not recognizing the
 commands.
 Please help!

 --
 William Tarimo
 Mathematics  Computer Science
 Connecticut College '12
 8605017893


 ___
 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] Help using Chicken in Windows 7

2011-07-07 Thread Steve Graham
When I tried to compile (Win 7-64), I also had problems.  Turned out that my 
copy of mingw did not contain gcc.

Steve

On Thu Jul 7th, 2011 11:26 AM EDT William Tarimo wrote:

Hello Chicken Users,
I have been trying to use Chicken to compile Scheme programs to C, but the
compiler isn't working for me.
I followed the installation procedures at
http://www.kiatoa.com/cgi-bin/chicken-iup/home to install Mingw and
chicken-iup,
I couldn't find Mingw on the page so I search elsewhere with google. However
after installation, the compiler fails to compile, not recognizing the
commands.
Please help!

-- 
William Tarimo
Mathematics  Computer Science
Connecticut College '12
8605017893


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


Re: [Chicken-users] help -- segmentation fault when (import chicken)

2011-06-18 Thread Christian Kellermann
* HP Wei hpwe...@gmail.com [110618 03:53]:
 
 Machine: iMac Mac OS X 10.6.7
 
 I installed chicken by the following command:
 
 sudo port install chicken
 
 -
 
 The resulting csc is used to compile the (print hello) successfully.
 
 csi can also be invoked ok.  
 (version 4.4.0)  macosx-unix-gnu-x86-64 [ 64 bit manyargs dload ptables ].
 
 However, in csi,  the following results in Segmentation fault !!
 
 #;1 (import chicken)
 
 Can anyone tell me how I can resolve this ?

This is a really old chicken version. Does it bother you to retry with
the latest release version?  You can download it here:

http://code.call-cc.org/releases/4.7.0/chicken-4.7.0.tar.gz

If this does still not work for you, I will happily take another look.

Kind regards  sorry for your troubles,

Christian

P.S.: My machine says this:
$ csi

CHICKEN
(c)2008-2011 The Chicken Team
(c)2000-2007 Felix L. Winkelmann
Version 4.7.0 
openbsd-unix-gnu-mips [ 64bit dload ptables ]
compiled 2011-06-13 on thalia.my.domain (OpenBSD)

#;1 (import chicken)
; loading /home/ckeen/chickens/4.7.0/lib/chicken/6/chicken.import.so ...
#;2 


-- 
Who can (make) the muddy water (clear)? Let it be still, and it will
gradually become clear. Who can secure the condition of rest? Let
movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 

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


Re: [Chicken-users] help -- segmentation fault when (import chicken)

2011-06-18 Thread David N Murray
On Jun 18, Christian Kellermann scribed:

 * HP Wei hpwe...@gmail.com [110618 03:53]:
 
  Machine: iMac Mac OS X 10.6.7
 
  I installed chicken by the following command:
 
  sudo port install chicken

I have no problem building chicken from sources on OS X 10.6.7.  You need
XCode installed and this works fine for me:

# make install PLATFORM=macosx ARCH=x86-64

hth,
dnm

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


Re: [Chicken-users] help -- segmentation fault when (import chicken)

2011-06-18 Thread HP Wei
I downloaded  4.7.0.tar 
and when I built I got the following error:

sudo make PLATFORM=macosx
Password:
...
make -f ./Makefile.macosx CONFIG= all
gcc  -c apply-hack.x86.S -o apply-hack.x86.o
apply-hack.x86.S:35:suffix or operands invalid for `call'
make[1]: *** [apply-hack.x86.o] Error 1
make: *** [all] Error 2

Is this 64bit vs 32bit issue ?

HOw do I proceed from here ?

--

btw,  my machine has the following info:

uname -m
i386

Thanks
HP



On Jun 18, 2011, at 5:57 AM, Christian Kellermann wrote:

 * HP Wei hpwe...@gmail.com [110618 03:53]:
 
 Machine: iMac Mac OS X 10.6.7
 
 I installed chicken by the following command:
 
 sudo port install chicken
 
 -
 
 The resulting csc is used to compile the (print hello) successfully.
 
 csi can also be invoked ok.  
 (version 4.4.0)  macosx-unix-gnu-x86-64 [ 64 bit manyargs dload ptables ].
 
 However, in csi,  the following results in Segmentation fault !!
 
 #;1 (import chicken)
 
 Can anyone tell me how I can resolve this ?
 
 This is a really old chicken version. Does it bother you to retry with
 the latest release version?  You can download it here:
 
 http://code.call-cc.org/releases/4.7.0/chicken-4.7.0.tar.gz
 
 If this does still not work for you, I will happily take another look.
 
 Kind regards  sorry for your troubles,
 
 Christian


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


Re: [Chicken-users] help -- segmentation fault when (import chicken)

2011-06-18 Thread HP Wei

OK,  I also noticed David Murray's suggestion after I sent my previous email 
(on Sat eve) --
about 64 vs 32 bit issue.

Now,
** from the src of 4.7.0
** using David Murray's  'make install PLATFORM=macosx ARCH=x86-64

==  it compiled ok !!

and (import chicken)   gives NO segmentation fault.

Thanks a LOT,
HP


On Jun 18, 2011, at 5:57 AM, Christian Kellermann wrote:

 * HP Wei hpwe...@gmail.com [110618 03:53]:
 
 Machine: iMac Mac OS X 10.6.7
 
 I installed chicken by the following command:
 
 sudo port install chicken
 
 -
 
 The resulting csc is used to compile the (print hello) successfully.
 
 csi can also be invoked ok.  
 (version 4.4.0)  macosx-unix-gnu-x86-64 [ 64 bit manyargs dload ptables ].
 
 However, in csi,  the following results in Segmentation fault !!
 
 #;1 (import chicken)
 
 Can anyone tell me how I can resolve this ?
 
 This is a really old chicken version. Does it bother you to retry with
 the latest release version?  You can download it here:
 
 http://code.call-cc.org/releases/4.7.0/chicken-4.7.0.tar.gz
 
 If this does still not work for you, I will happily take another look.
 
 Kind regards  sorry for your troubles,
 
 Christian
 
 P.S.: My machine says this:
 $ csi
 
 CHICKEN
 (c)2008-2011 The Chicken Team
 (c)2000-2007 Felix L. Winkelmann
 Version 4.7.0 
 openbsd-unix-gnu-mips [ 64bit dload ptables ]
 compiled 2011-06-13 on thalia.my.domain (OpenBSD)
 
 #;1 (import chicken)
 ; loading /home/ckeen/chickens/4.7.0/lib/chicken/6/chicken.import.so ...
 #;2 
 
 
 -- 
 Who can (make) the muddy water (clear)? Let it be still, and it will
 gradually become clear. Who can secure the condition of rest? Let
 movement go on, and the condition of rest will gradually arise.
 -- Lao Tse. 


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


[Chicken-users] help -- segmentation fault when (import chicken)

2011-06-17 Thread HP Wei

Machine: iMac Mac OS X 10.6.7

I installed chicken by the following command:

sudo port install chicken

-

The resulting csc is used to compile the (print hello) successfully.

csi can also be invoked ok.  
(version 4.4.0)  macosx-unix-gnu-x86-64 [ 64 bit manyargs dload ptables ].

However, in csi,  the following results in Segmentation fault !!

#;1 (import chicken)

Can anyone tell me how I can resolve this ?

Thanks
HP



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


[Chicken-users] Help with writing a macro

2011-03-20 Thread Patrick Li
Hello everyone,

I'm trying to write the following macro using the syntax-rules system, and
got stuck trying to figure out the ellipsis. Would someone mind giving me a
hand with this? I really appreciate it.

I'm trying to write a macro that will tranform:
(temp (a b c) do-this do-that do-other)

into this:
(do (do-this a b c)
(do-that a b c)
(do-other a b c))

And here's my attempt at it:
(define-syntax temp
  (syntax-rules ()
((temp args fs ...) (do (fs args ...) ...

Obviously it doesn't work, as the ellipsis are not balanced on both sides. I
think I might need some sort of helper macro, but don't know what.

Thanks for your help!
  -Patrick
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help with writing a macro

2011-03-20 Thread Thomas Chust
2011/3/21 Patrick Li patrickli.2...@gmail.com:
 [...]
 I'm trying to write a macro that will tranform:
 (temp (a b c) do-this do-that do-other)
 into this:
 (do (do-this a b c)
     (do-that a b c)
     (do-other a b c))
 [...]

Try this:

(define-syntax temp
  (syntax-rules ()
[(temp args command ...)
 (do (command . args) ...)]))

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.

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


Re: [Chicken-users] Help with writing a macro

2011-03-20 Thread Patrick Li
Hi Thomas,

Your solution does in fact do what I was asking for. The example I gave was
just a simplified version of what I want to do. Sorry for being unclear. The
following is closer to what I actually need to accomplish:

transform:
(temp (a b c) do-this do-that do-other)

to:
(do (do-this a b c some-more-args)
(do-that a b c some-more-args)
(do-other a b c some-more-args))

The dot trick doesn't work in this circumstance.
  -Patrick

On Sun, Mar 20, 2011 at 10:36 PM, Thomas Chust ch...@web.de wrote:

 2011/3/21 Patrick Li patrickli.2...@gmail.com:
  [...]
  I'm trying to write a macro that will tranform:
  (temp (a b c) do-this do-that do-other)
  into this:
  (do (do-this a b c)
  (do-that a b c)
  (do-other a b c))
  [...]

 Try this:

 (define-syntax temp
  (syntax-rules ()
 [(temp args command ...)
 (do (command . args) ...)]))

 Ciao,
 Thomas


 --
 When C++ is your hammer, every problem looks like your thumb.

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


Re: [Chicken-users] Help with writing a macro

2011-03-20 Thread Thomas Chust
2011/3/21 Patrick Li patrickli.2...@gmail.com:
 [...]
 transform:
 (temp (a b c) do-this do-that do-other)
 to:
 (do (do-this a b c some-more-args)
     (do-that a b c some-more-args)
     (do-other a b c some-more-args))
 The dot trick doesn't work in this circumstance.
 [...]

Hello Patrick,

in that case I'm afraid you have to use some sort of helper macro or
recursive definition, given the current implementation of syntax-rules
in CHICKEN. Try something like this:

(define-syntax temp
  (syntax-rules ()
[(temp (arg ...) command)
 (command arg ... some-more-args)]
[(temp args command ...)
 (do (temp args command) ...)]))

Ciao,
Thomas


-- 
When C++ is your hammer, every problem looks like your thumb.

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


Re: [Chicken-users] Help solving this phasing problem.

2011-02-13 Thread Felix
From: Peter Bex peter@xs4all.nl
Subject: Re: [Chicken-users] Help solving this phasing problem.
Date: Sat, 12 Feb 2011 22:51:05 +0100

 On Sat, Feb 12, 2011 at 04:35:23PM -0500, Patrick Li wrote:
 
 I have a *very* ugly workaround right now.
 I define the convenience function twice. Once normally. And again within a
 begin-for-syntax form.
 
 You can do the same trick as before:
 
 (module module-a (convenience-function)
   (import chicken scheme)
 
   (define (convenience-function)
 (display do convenience things\n)))
 
 (module module-b (my-macro convenience-function)
   (import chicken scheme module-a)
   (import-for-syntax module-a)
   (define-syntax my-macro
 (lambda (expression rename comparison)
   (convenience-function)
My Macro Output)))
 
 This imports module-a (which can be internal and nobody has to know it's
 there) both for syntax and normally, and then re-exports the convenience
 function.
 
 Yes, this is ugly.

Well, is it? What could be an alternative? Perhaps something like

(define-syntax begin-yes...what?
  (syntax-rules ()
((_ forms ...)
  (begin
(begin-for-syntax forms ...)
forms ...


?


cheers,
felix

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


Re: [Chicken-users] Help solving this phasing problem.

2011-02-13 Thread Felix
From: Taylor Venable tay...@metasyntax.net
Subject: Re: [Chicken-users] Help solving this phasing problem.
Date: Sat, 12 Feb 2011 18:04:13 -0500

 On Sat, Feb 12, 2011 at 16:51, Peter Bex peter@xs4all.nl wrote:
 This imports module-a (which can be internal and nobody has to know it's
 there) both for syntax and normally, and then re-exports the convenience
 function.
 
 Pardon the interruption, but I wanted to check for my own
 understanding: is import-for-syntax roughly the Chicken equivalent of
 the (import (for (module-a) expand)) from chapter 7 of R6RS? 

It basically is, yes.


cheers,
felix

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


Re: [Chicken-users] Help solving this phasing problem.

2011-02-13 Thread Peter Bex
On Sun, Feb 13, 2011 at 01:59:47PM +0100, Felix wrote:
  This imports module-a (which can be internal and nobody has to know it's
  there) both for syntax and normally, and then re-exports the convenience
  function.
  
  Yes, this is ugly.
 
 Well, is it?

Not having an alternative doesn't make it less ugly ;)

 What could be an alternative? Perhaps something like
 
 (define-syntax begin-yes...what?
   (syntax-rules ()
 ((_ forms ...)
   (begin
 (begin-for-syntax forms ...)
   forms ...

begin-also-for-syntax? begin-for-both-environments? :)

Maybe we should have a different define form that allows
you to add things to both the expansion and macro definition
environments.  Or maybe simpler: add a special form that lifts
a definition to the macro definition environment.

So you'd do something like

(define foo 1)
(add-to-syntax-env foo)

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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


Re: [Chicken-users] Help solving this phasing problem.

2011-02-13 Thread John Cowan
Peter Bex scripsit:

 begin-also-for-syntax? begin-for-both-environments? :)

I like this idea best, though better names are needed.
Personally, I would prefer begin-utriusque-phasidis, but
I can see why people might not like that.

-- 
As you read this, I don't want you to feel  John Cowan
sorry for me, because, I believe everyone   co...@ccil.org
will die someday.   http://www.ccil.org/~cowan
--From a Nigerian-type scam spam

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


[Chicken-users] Help solving this phasing problem.

2011-02-12 Thread Patrick Li
Hello everyone,

I'm creating a module that exports two things, a macro and a function. The
definition of the macro happens to require the use of the function. I am
having problems creating this module. The defined macro cannot access the
function.

--Example--
(module tempmodule (convenience-function my-macro)

(import chicken scheme)

(define (convenience-function)
  (display do convenience things\n))

(define-syntax my-macro
  (lambda (expression rename comparison)
(convenience-function)
My Macro Output))

);;END MODULE


(import tempmodule)
(my-macro)

= Error: during expansion of (my-macro ...) - unbound variable:
convenience-function

---

I have a *very* ugly workaround right now.
I define the convenience function twice. Once normally. And again within a
begin-for-syntax form.

---Example-
(module tempmodule (convenience-function my-macro)

(import chicken scheme)

(define (convenience-function)
  (display do convenience things\n))

(begin-for-syntax
 (define (convenience-function)
  (display do convenience things\n)))

(define-syntax my-macro
  (lambda (expression rename comparison)
(convenience-function)
My Macro Output))

);;END MODULE

---

I would appreciate your help if someone knows how to solve this problem
properly. Thank you!
  -Patrick
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help solving this phasing problem.

2011-02-12 Thread Peter Bex
On Sat, Feb 12, 2011 at 04:35:23PM -0500, Patrick Li wrote:
 
 I have a *very* ugly workaround right now.
 I define the convenience function twice. Once normally. And again within a
 begin-for-syntax form.

You can do the same trick as before:

(module module-a (convenience-function)
  (import chicken scheme)

  (define (convenience-function)
(display do convenience things\n)))

(module module-b (my-macro convenience-function)
  (import chicken scheme module-a)
  (import-for-syntax module-a)
  (define-syntax my-macro
(lambda (expression rename comparison)
  (convenience-function)
   My Macro Output)))

This imports module-a (which can be internal and nobody has to know it's
there) both for syntax and normally, and then re-exports the convenience
function.

Yes, this is ugly.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth

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


Re: [Chicken-users] Help solving this phasing problem.

2011-02-12 Thread Taylor Venable
On Sat, Feb 12, 2011 at 16:51, Peter Bex peter@xs4all.nl wrote:
 This imports module-a (which can be internal and nobody has to know it's
 there) both for syntax and normally, and then re-exports the convenience
 function.

Pardon the interruption, but I wanted to check for my own
understanding: is import-for-syntax roughly the Chicken equivalent of
the (import (for (module-a) expand)) from chapter 7 of R6RS? (That may
be an oversimplification on my part, this gets into some of the parts
of Scheme I don't understand very well yet.)

Thanks,

-- 
Taylor C. Venable
http://metasyntax.net/

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


Re: [Chicken-users] Help with tokyocabinet, C const

2009-12-31 Thread Peter Bex
On Thu, Dec 31, 2009 at 01:26:40AM -0600, Evan E. wrote:
 Using easyffi, I've declared the foreign type and procedure. TCMAP is
 a hash map struct, tcmapget returns a value for a given key from the
 map object:
 
 ___declare(type, MAP;(nonnull-c-pointer \TCMAP\);tc-map-ptr)
 const void *tcmapget(MAP map, ___scheme_pointer kbuf, int ksiz,  
 ___pointer int *sp);

It returns a pointer to the value as it's stored in the hashmap.
It does not make a copy of the value.  That means you shouldn't free it!

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth


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


[Chicken-users] Help with tokyocabinet, C const

2009-12-30 Thread Evan E.

This may be beyond the scope of this mailing list, but here goes. I'm
working on extending the tokyocabinet egg to include more
functionality. It's gone well, but I'm running into an issue with one
type/procedure.

Using easyffi, I've declared the foreign type and procedure. TCMAP is
a hash map struct, tcmapget returns a value for a given key from the
map object:

___declare(type, MAP;(nonnull-c-pointer \TCMAP\);tc-map-ptr)
const void *tcmapget(MAP map, ___scheme_pointer kbuf, int ksiz,  
___pointer int *sp);


Based on the example of the original egg, I've created the scheme
function tc-map-get to return a string value by calling the procedure
tcmapget. (Source code below.) Here's what happens when I try to use
tc-map-get on a tc-map type:

#;1 (tc-map-get atcmap key)
value
#;2 (tc-map-get atcmap key)
csi(3208) malloc: *** error for object 0x111360: double free
*** set a breakpoint in malloc_error_break to debug
value

I assume the issue has something to do with the function
sized-c-string*, which is used by tc-map-get to create strings from
the pointers returned by Tokyo Cabinet.

A number of other procedures in Tokyo Cabinet return a pointer to the
region of a value, and sized-c-string* works without issue when
applied to these get procedures. tcmapget is unique in that it
returns a pointer to a constant, while the other get procedures just
return a pointer.

I've been stumped by this for a while -- my knowledge of C is
minimal. Is there a direction I should go? Can I re-write the
sized-c-string* function to account for the possibility of a constant?
Is there something I can change in the ffi declaration? Any help would
be greatly, greatly appreciated.

Evan

*** source ***

(declare
  (foreign-declare 

#define copy_string_result(ptr, len, str)  
(C_memcpy(C_c_string(str), (char *)C_block_item(ptr, 0),  
C_unfix(len)), C_SCHEME_UNDEFINED)


))

(define-foreign-variable +max-string-length+ int C_HEADER_SIZE_MASK)

;; Copy size bytes from ptr into new string and free ptr.
;; Like c-string* return type but does not use null terminator.
;; Note: Exception handling imposes an unacceptable overhead.
(define (sized-c-string* ptr size #!optional (where 'sized-c-string*))
  (when ( size +max-string-length+)
(free ptr)
(error where string length too long size))
  (let ((val (make-string size)))
(##core#inline copy_string_result ptr size val)
(free ptr)
val))


(define (tc-map-get tc-map key)
  (let-location ((size int))
(and-let* ((ptr (%tc-map-get tc-map key
 (string-length key) (location size
  (sized-c-string* ptr size 'tc-map-get


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


[Chicken-users] Help with srfi 46 and syntax-case

2009-11-13 Thread Thomas Bushnell BSG
I have some code which currently uses syntax-case, and because it has
nested macro definitions, it needs the (... ...) hack.  

When we migrate to Chicken 4.0, we'll need to convert that to the
superior srfi 46 choose-your-own-ellipsis method.  What I'd like to do,
to facilitate migrate, is write a version of syntax-rules, for
syntax-case, that accepts the CYOE parameter.

At present, the syntax-case egg defines syntax-rules thus:

(define-syntax syntax-rules
  (lambda (x)
(syntax-case x ()
  ((_ (k ...) ((keyword . pattern) template) ...)
   (syntax (lambda (x)
(syntax-case x (k ...)
  ((dummy . pattern) (syntax template))
  ...)

I would like to add a clause something like:
 ((_ ellipsis (k ...) ((keyword . pattern) template) ...)
   (syntax
(lambda (x)
  (with-syntax ((ellipsis (syntax (... ...
(syntax-case x (k ...)
  ((dummy . pattern) (syntax template))
  ...)))

to match the CYOE pattern.  But try as I might, it doesn't work.  good
grief, I do dislike syntax-case.  But in any case, does anyone have any
idea what I should be doing?

Thomas





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


Re: [Chicken-users] Help with the mysql egg

2008-01-23 Thread Jean-Philippe Theberge

Toby Butzon wrote:

On Jan 22, 2008 2:41 PM, Kon Lovett [EMAIL PROTECTED] wrote:
  

You might want to contact [EMAIL PROTECTED], the author. I don't know
if he is active with egg maintenance though.



I'm an active lurker... :)

Any of those options is fine by me -- if a patch comes my way, I'll
make sure it gets included.

  


Thanks!

The patch is attached.
It add  Ken's mysql-fetch-field-list
and mysql-fetch-alist.

--
BuddyPilots http://www.buddypilots.com
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307



139a140,142
 mysql-fetch-field-list
 mysql-fetch-alist
 
735a738,756
 
 (define mysql-fetch-field-list
   (let ([get-field-name
   (foreign-lambda* c-string ([c-pointer fields] [unsigned-integer idx])
return (((MYSQL_FIELD *)fields)[idx].name);)])
 (lambda (conn)
   (and-let* ([res (mysql-connection-result conn)])
 (let ([fields (foreign-mysql-fetch-fields res)])
   (let loop ([count (foreign-mysql-num-fields res)] [names '()])
 (if (zero? count)
 names
 (let ([nxtcnt (sub1 count)])
   (loop nxtcnt (cons (get-field-name fields nxtcnt) names)) ) ) ) ) ) ) ) )
 
 (define (mysql-fetch-alist conn)
   (define row (mysql-fetch-row conn))
   (define fields-list (mysql-fetch-field-list conn))
   (map (lambda (f) (cons f (row f))) fields-list))
 

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


[Chicken-users] Help with the mysql egg

2008-01-22 Thread Jean-Philippe Theberge

Hi,

I am having some trouble with the mysql egg mostly die to my 
misunderstanding of c-pointers


With the egg you get data either by index or by name.  What I would like 
is more something like this example from the mysql-api documentation


unsigned int num_fields;

unsigned int i;
MYSQL_FIELD *fields;

num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i  num_fields; i++)
{
  printf(Field %u is %s\n, i, fields[i].name);
}

The egg provide the foreign-mysql-fetch-fields. it return a #pointer object

How can I extract the name from this object in scheme?  
I want to do what fields[i].name do in the example above? 


Thanks

--



BuddyPilots http://www.buddypilots.com
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307





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


Re: [Chicken-users] Help with the mysql egg

2008-01-22 Thread Kon Lovett


On Jan 22, 2008, at 6:42 AM, Jean-Philippe Theberge wrote:


Hi,

I am having some trouble with the mysql egg mostly die to my  
misunderstanding of c-pointers


With the egg you get data either by index or by name.  What I would  
like is more something like this example from the mysql-api  
documentation


unsigned int num_fields;

unsigned int i;
MYSQL_FIELD *fields;

num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i  num_fields; i++)
{
  printf(Field %u is %s\n, i, fields[i].name);
}

The egg provide the foreign-mysql-fetch-fields. it return a  
#pointer object


How can I extract the name from this object in scheme?  I want to  
do what fields[i].name do in the example above?

Thanks


I have never used the mysql egg so keep that in mind.

(define conn (mysql-connect ...))

;; (mysql-fetch-field-list DB) - LIST | BOOLEAN
;; Returns a list of field names for the current connection result, or
;; #f when no result.
(define mysql-fetch-field-list
  (let ([get-field-name
  (foreign-lambda* c-string ([c-pointer fields] [unsigned- 
integer idx])

   return (((MYSQL_FIELD *)fields)[idx].name);)])
(lambda (conn)
  (and-let* ([res (mysql-connection-result conn)])
(let ([fields (foreign-mysql-fetch-fields res)])
  (let loop ([count (foreign-mysql-num-fields res)] [names  
'()])

(if (zero? count)
names
(let ([nxtcnt (sub1 count)])
  (loop nxtcnt (cons (get-field-name fields nxtcnt)  
names)) ) ) ) ) ) ) ) )


HTH



--



BuddyPilots http://www.buddypilots.com
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307





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


Best Wishes,
Kon




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


Re: [Chicken-users] Help with the mysql egg

2008-01-22 Thread Jean-Philippe Theberge
OK, I keep in mind that you can easily and succesfully modify an egg you 
had never used. 

I think this should be added to the mysql egg. I can provide a diff or 
add it myself to the egg if I am provided with a repository access.


Thanks a lot!

--
JP Theberge


Kon Lovett wrote:


On Jan 22, 2008, at 6:42 AM, Jean-Philippe Theberge wrote:


Hi,

I am having some trouble with the mysql egg mostly die to my 
misunderstanding of c-pointers


With the egg you get data either by index or by name.  What I would 
like is more something like this example from the mysql-api 
documentation


unsigned int num_fields;

unsigned int i;
MYSQL_FIELD *fields;

num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i  num_fields; i++)
{
  printf(Field %u is %s\n, i, fields[i].name);
}

The egg provide the foreign-mysql-fetch-fields. it return a 
#pointer object


How can I extract the name from this object in scheme?  I want to do 
what fields[i].name do in the example above?

Thanks


I have never used the mysql egg so keep that in mind.

(define conn (mysql-connect ...))

;; (mysql-fetch-field-list DB) - LIST | BOOLEAN
;; Returns a list of field names for the current connection result, or
;; #f when no result.
(define mysql-fetch-field-list
  (let ([get-field-name
  (foreign-lambda* c-string ([c-pointer fields] 
[unsigned-integer idx])

   return (((MYSQL_FIELD *)fields)[idx].name);)])
(lambda (conn)
  (and-let* ([res (mysql-connection-result conn)])
(let ([fields (foreign-mysql-fetch-fields res)])
  (let loop ([count (foreign-mysql-num-fields res)] [names '()])
(if (zero? count)
names
(let ([nxtcnt (sub1 count)])
  (loop nxtcnt (cons (get-field-name fields nxtcnt) 
names)) ) ) ) ) ) ) ) )


HTH



--



BuddyPilots http://www.buddypilots.com
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307





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


Best Wishes,
Kon







--
BuddyPilots http://www.buddypilots.com
*Jean-Philippe Théberge*
*Programmeur Architecte*
Tel: (514) 353-2307





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


Re: [Chicken-users] Help with the mysql egg

2008-01-22 Thread Kon Lovett


On Jan 22, 2008, at 2:29 PM, Jean-Philippe Theberge wrote:

OK, I keep in mind that you can easily and succesfully modify an  
egg you had never used.


Sorry, not sure what you mean. A compliment? ;-)

I think this should be added to the mysql egg. I can provide a diff  
or add it myself to the egg if I am provided with a repository access.


Thanks a lot!


You might want to contact [EMAIL PROTECTED], the author. I don't know  
if he is active with egg maintenance though.




--
JP Theberge



I forgot to add the following to the code snippet (kinda necessary):

#
#include mysql.h
#

Note that the 'foreign-mysql-*' bindings are exported so the 'mysql- 
fetch-field-list' procedure doesn't need to be part of the egg.


Personally I think it a little too specific. Probably a 'define- 
foreign-record' should be added to the egg for the 'MYSQL_FIELD'  
struct, this would allow Scheme access to the entries from a pointer.


I can look into this if you need it.

snip

Best Wishes,
Kon




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


Re: [Chicken-users] help with intermittent crash (?)

2007-12-16 Thread Rick Taube
OK i managed to trigger the crash using the Debug version of chicken.  
Here is the trace in case anything is jumping out this is with  
Chicken init: heap=50 stack=64000.




Date/Time:  2007-11-23 11:15:03.020 -0600
OS Version: 10.4.11 (Build 8S165)
Report Version: 4

Command: Grace
Path:/Lisp/grace/build/Grace.app/Contents/MacOS/Grace
Parent:  bash [1887]

Version: ??? (???)

PID:2588
Thread: 3

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:  KERN_INVALID_ADDRESS (0x0001) at 0xc24bc194

Thread 3 Crashed:
0   libchicken.dylib  	0x01385084 mark + 944 (runtime.c: 
3012)
1   libchicken.dylib  	0x01383f5c C_reclaim + 1512  
(runtime.c:2724)
2   libchicken.dylib  	0x01383958 lock_tospace + 0  
(runtime.c:2607)
3   libchicken.dylib  	0x010a544c f_6799 + 104 (library.c: 
28932)
4   libchicken.dylib  	0x010a56f4 f_6823 + 0 (library.c: 
28964)

5   libchicken.dylib0x011303f0 f_4034 + 0 (eval.c:18725)
6   libchicken.dylib0x01119a24 f_5889 + 0 (eval.c:15524)
7   libchicken.dylib  	0x010a557c f_6799 + 408 (library.c: 
28945)
8   libchicken.dylib  	0x010a53e4 f_6799 + 0 (library.c: 
28923)

9   libchicken.dylib0x01119928 f_5891 + 0 (eval.c:15512)
10  libchicken.dylib0x01130f34 f_3958 + 0 (eval.c:18839)
11  libchicken.dylib0x01119758 f_5885 + 0 (eval.c:15496)
12  libchicken.dylib0x0112dcd0 f_4386 + 0 (eval.c:18318)
13  libchicken.dylib0x0112ed58 f_4249 + 0 (eval.c:18480)
14  libchicken.dylib  	0x013bbee0 C_i_nequalp + 0  
(runtime.c:)

15  libchicken.dylib0x0111c2e8 f_5725 + 0 (eval.c:15837)
16  libchicken.dylib0x01130f34 f_3958 + 0 (eval.c:18839)
17  libchicken.dylib0x0111c26c f_5775 + 0 (eval.c:15829)
18  libchicken.dylib0x0113152c f_4008 + 0 (eval.c:18900)
19  libchicken.dylib0x0111c104 f_5772 + 0 (eval.c:15816)
20  libchicken.dylib0x0113152c f_4008 + 0 (eval.c:18900)
21  libchicken.dylib0x0111bf84 f_5768 + 0 (eval.c:15803)
22  libchicken.dylib0x0112ec84 f_4276 + 0 (eval.c:18468)
23  libchicken.dylib0x0112666c f_4905 + 0 (eval.c:17276)
24  libchicken.dylib  	0x0138ff60 C_do_apply + 688  
(runtime.c:6011)
25  libchicken.dylib  	0x013ba144 C_u_call_with_values +  
0 (runtime.c:6179)
26  libchicken.dylib  	0x010a3530 f_7048 + 0 (library.c: 
28564)
27  libchicken.dylib  	0x010609dc f_14252 + 0 (library.c: 
16219)
28  libchicken.dylib  	0x010a3354 f_7039 + 0 (library.c: 
28546)
29  libchicken.dylib  	0x01060824 f_14422 + 0 (library.c: 
16193)

30  libchicken.dylib0x0111c2e8 f_5725 + 0 (eval.c:15837)
31  libchicken.dylib0x01130f34 f_3958 + 0 (eval.c:18839)
32  libchicken.dylib0x0111c26c f_5775 + 0 (eval.c:15829)
33  libchicken.dylib0x01133168 f_3655 + 0 (eval.c:19259)
34  libchicken.dylib0x010f01b8 f_9618 + 0 (eval.c:8432)
35  libchicken.dylib  	0x013be4f8 C_string_to_symbol + 0  
(runtime.c:7197)
36  libchicken.dylib  	0x013be07c allocate_vector_2 + 0  
(runtime.c:7147)
37  libchicken.dylib  	0x010b9698 f_4306 + 0 (library.c: 
33025)
38  libchicken.dylib  	0x010b9568 f_4309r + 220  
(library.c:33004)
39  libchicken.dylib  	0x010b948c f_4309r + 0 (library.c: 
32993)

40  libchicken.dylib0x010f00fc f_9635 + 0 (eval.c:8420)
41  libchicken.dylib0x011330c4 f_3676 + 0 (eval.c:19249)
42  libchicken.dylib  	0x010b76b8 f_4526 + 0 (library.c: 
32619)
43  libchicken.dylib  	0x013be4f8 C_string_to_symbol + 0  
(runtime.c:7197)
44  libchicken.dylib  	0x013be07c allocate_vector_2 + 0  
(runtime.c:7147)
45  libchicken.dylib  	0x010b9698 f_4306 + 0 (library.c: 
33025)
46  libchicken.dylib  	0x010b9568 f_4309r + 220  
(library.c:33004)
47  libchicken.dylib  	0x010b948c f_4309r + 0 (library.c: 
32993)
48  libchicken.dylib  	0x010b75e8 f_4581 + 0 (library.c: 
32609)
49  libchicken.dylib  	0x0106dcc0 f_12783 + 268  
(library.c:18755)
50  libchicken.dylib  	0x010a0410 f_7335r + 160  
(library.c:27945)
51  libchicken.dylib  	0x010a0370 f_7335r + 0 (library.c: 
27931)
52  libchicken.dylib  	0x0106dbb4 f_12783 + 0 (library.c: 
18737)
53  libchicken.dylib  	0x010a0888 f_18663 + 0 (library.c: 
27987)
54  libchicken.dylib  	0x010a06d4 f_7307r + 0 (library.c: 
27967)
55  libchicken.dylib  	0x0106da74 f_12780 + 0 (library.c: 
18724)

56  libchicken.dylib0x01133048 

Re: [Chicken-users] help with intermittent crash (?)

2007-12-16 Thread Rick Taube
I dont know how this (very stale) post took so long to arrive to the  
users list but this bug has already been fixed by felix in the svn  
version of chicken so please disregard...




On Nov 23, 2007, at 11:19 AM, Rick Taube wrote:

OK i managed to trigger the crash using the Debug version of  
chicken. Here is the trace in case anything is jumping out this is  
with Chicken init: heap=50 stack=64000.




Date/Time:  2007-11-23 11:15:03.020 -0600
OS Version: 10.4.11 (Build 8S165)
Report Version: 4






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


Re: [Chicken-users] help with intermittent crash (?)

2007-11-25 Thread felix winkelmann
On Nov 23, 2007 2:20 PM, Rick Taube [EMAIL PROTECTED] wrote:

  - Try to run with different stack-sizes. The stack-allocation pattern


 I noticed yesterday that if i change heap size 4x larger than default
 i cant seem to trigger the crash. but when the bug happens there is
 no message about heap size running out so im not sure what this means.

Running out of heap size just means that an exorbitant amount was
attempted to allocated - this almost always means some pointer
was treated as a block header, with the pointer value being an allocation
size.


  - Try to run with different stack-sizes. The stack-allocation pattern


 ok this is easy enough, so should i keep the heap fixed at the
 default size while i play with stack size?

Whatever. Keeping the heap fixed takes away one more moving part,
so that would be preferable.

  We have to disable optimizations.

 how do i do that?

make PLATFORM=... DEBUGBUILD=1 ...


cheers,
felix


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


Re: [Chicken-users] help with intermittent crash (?)

2007-11-23 Thread Rick Taube


On Nov 23, 2007, at 5:32 AM, felix winkelmann wrote:


- Try to run with different stack-sizes. The stack-allocation pattern
  of an application will greatly influence the frequency and point of
  GCs taking place, so sometimes changing the stack size (-:s)
  will change the pattern and make it easier to reproduce the
  crash.


ive been playing around with stack and heap sizes for the past few  
hours, and this is what i can determine:


1. if i keep the heap at default 50 it seems as if increasing the  
stack size has no effect on the crash until its 7x larger, ie 448000  
(!)  at that point i can try for a few minutes and i cant trigger the  
crash


2. if i keep the stack at default 64000 and enlarge the heap 2x  
(100) then I dont get the crash either, at least trying a few  
minutes. ill try some longer sessions tomorrow.


thanks for your help!
--rick


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


Re: [Chicken-users] help with intermittent crash (?)

2007-11-23 Thread felix winkelmann
Hi, Rick!


In the moment I'm pretty clueless about what might go wrong here,
but I can give you a few tips that perhaps help us find the cause of
this trouble:

- Is storage consumption constant (top(1)) over a longer run?
- Try to run with a fixed heap (-:h... runtime options, enter -:?
  to see a list)
- Try to run with different stack-sizes. The stack-allocation pattern
  of an application will greatly influence the frequency and point of
  GCs taking place, so sometimes changing the stack size (-:s)
  will change the pattern and make it easier to reproduce the
  crash.
- Build with debugging options (-g), we will have to go there anyway
  at some stage... At least we can poke around. We also want to
  reproduce the bug with debugging turned on.
- Use a custom built chicken for this, probably the latest trunk, so
  we have the same environment when we start debugging.
- Can you try on a different environment? Linux?

(if your app is embedded, you have to set the heap- and/or stack-size
via CHICKEN_initialize() of course. Fixing the heap size should be possible
by setting C_heap_size_is_fixed to 1).

Those recursive invocations of C_rereclaim look wrong. But possibly
the stack trace is borked. We have to disable optimizations.

Sorry, this is not much, but I need more info.


cheers,
felix


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


Re: [Chicken-users] help with intermittent crash (?)

2007-11-23 Thread Rick Taube
ok I switched to the latest chicken in trunk that i compiled with  
debuggin like this:

make PLATFORM=macosx DEBUGBUILD=1
sudo make PLATFORM=maxosx install
then I ran my app with
heap=50
stack=64000
C_heap_size_is_fixed = 1;

and it didnt crashed in 15 trys. The only thing my trace showed  
differently is that with the new lib i tended to get FOUR minor gc  
messages instead of three per callback.



now i switch back to the OLD libs (doing make uninstall and then make  
install in the 2.731) and now i cant trigger the bug there either.  
ill keep trying...










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


[Chicken-users] help with intermittent crash (?)

2007-11-21 Thread Rick Taube
Help! Im having an intermittent crash that Im fairlt sure is happing  
in gc under a callback into ChickenScheme.  Ive spent several days  
trying to debug it without any luck. Ive included the crash report,  
the Thread 3 is my dedicated Scheme thread where the crash is  
happening. I am hoping the info in the crash report will make sense  
to someone familiar with chicken and  GC and/or can tell me what Im  
doing wrong. The strange thing is the crash is _very_ intermittent, i  
can attempt to trigger the crash for 20 minutes without any luck,  
othertimes when I start the app it tends to happen in the first few  
evals. Im hoping someone can spot what im doing wrong that would  
cause this to (occassionally) happen


this is what happens:

[1] the user defines a process closure to run in a scheduler. for  
examle the chime function below returns such a clousure created by  
the go macro:


(define (chime n r)
  (go ((i 0 (+ i 1))
   (l '(1 3 6 8 10 13))
   (k (+ 36 (* 12 (ran 6
   )
  ((= i n) #f)
(send mp:note 0 (ran 2.0 4.0)
  (+ k (list-ref l (ran 6)))
  (interp i 0 90 n 30))
(wait r)))
-void

(chime 40 .1)
- #procedure (? g0)


[2] now the user evals an expression that actually creates a chime  
process (scheme closure)  and sprouts it (adds it) into our  
scheduler:


(sprout (chime 40 .1) )
- void

The user can eval any number of 'sprouts', each eval will result in a  
new chime process being added to the scheduler, each process will  
play 40 notes.  When a chime process is 'spouted' the C side puts it  
in a C++ node with its own gcroot (since its an anonymous clouser  
with no scheme variable holding it) and adds to the scheduler's  
queue. This is what the gcroot buisness looks like, the clouser is  
the procedure returned by chime:


(define sprout
  (foreign-safe-lambda void scheduler_sprout scheme-object double))

void scheduler_sprout( C_word closure, double time)
{
  ProcessNode *node=new ProcessNode();

  node-closureGCRoot = CHICKEN_new_gc_root();
  CHICKEN_gc_root_set(node-closureGCRoot, closure);
  addNodeToScheduler(node, time);
}

This is how the scheduler invokes a process closuer passing it a  
float holding the elapsed time:

 {
  double nexttime;
  node-closure = CHICKEN_gc_root_ref(node-closureGCRoot);   
  node-elapsed_ptr = C_alloc(C_SIZEOF_FLONUM);
  node-elapsed_word = C_flonum( elapsed_ptr, (double)((time -  
start)/1000.0));

  C_save( node-elapsed_word );
  // this runs the process and passes it elapsed time in seconds
  nexttime = C_c_double( C_callback(node-closure, 1));
 [...]
 }

The vast majroity of the time things work really well, I can sprout  
many processes with tons of midi notes being sent out. But every once  
in a while it crashes, here is a trace showing that it happen under  
the callback . Im using a GC hook to thelp me trace,  I notice that  
each time a chime process runs a minor GC tends to happens 3 times  
inside the callback:



calling process node 1001...
minor GC
minor GC
minor GC
...done calling process node 1001
reinserting process node 1001...
...done reinserting process node 1001

USUALLY  I can sprout 10+ or more simultaneous processes and  
everything works. but occasionally my app crashes as shown below.  
notice that, in the case below, process #1005 runs but no GC is shown  
-- my app died. It looks like its inside the Chicken GC when this  
happens. But im not sure if its the symptom or the cause.  Any help  
or advice on how to debug would be greatly appreciated, this  
intermittent crash is the last thing stopping this from being a very  
cool app in chicken!


thanks -rick


calling process node 1005...

Thread 3 Crashed:

0   libchicken.dylib0x01c15a7c mark + 616
1   libchicken.dylib0x01c1604c C_reclaim + 1040
2   libchicken.dylib0x01c16998 C_copy_closure + 0
3   libchicken.dylib0x01a5f1c0 f_4346 + 232
4   libchicken.dylib0x01a8770c f_9731 + 0
5   libchicken.dylib0x01aabbb0 f_3703 + 0
6   libchicken.dylib0x01a5e1d0 f_4563r + 0
7   libchicken.dylib0x01c13818 C_rereclaim + 0
8   libchicken.dylib0x01c1827c C_string_to_symbol + 0
9   libchicken.dylib0x01a5f018 f_4346r + 0
10  libchicken.dylib0x01a5f0a8 f_4346r + 144
11  libchicken.dylib0x01a5f214 f_4343 + 0
12  libchicken.dylib0x01a5e178 f_4618 + 0
13  libchicken.dylib0x01a3db40 f_12994 + 96
14  libchicken.dylib0x01a510f8 f_7372r + 72
15  libchicken.dylib0x01a512a4 f_7344r + 0
16  libchicken.dylib0x01a3dae0 f_12994 + 0
17  libchicken.dylib0x01a512f8 f_7344r + 84
18  libchicken.dylib 

Re: [Chicken-users] Help w/ PCRE 7.4 migration

2007-09-27 Thread Andre Kuehne

Kon Lovett wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I need the config.h files produced by PCRE 7.4 
(ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/) 'configure 
--enable-unicode-properties' from the following OS:


Solaris 9Sparc

NetBDSPowerPC  x86-64

LinuxPowerPC  x86-64  x86  Alpha  ARM/XScale



Attached config.h is from Linux x86

Andre
/* config.h.  Generated from config.h.in by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */


/* On Unix-like systems config.h.in is converted by configure into config.h.
Some other environments also support the use of configure. PCRE is written in
Standard C, but there are a few non-standard things it can cope with, allowing
it to run on SunOS4 and other close to standard systems.

If you are going to build PCRE by hand on a system without configure you
should copy the distributed config.h.generic to config.h, and then set up the
macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
all of your compile commands, so that config.h is included at the start of
every source.

Alternatively, you can avoid editing by using -D on the compiler command line
to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.

PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
them both to 0; an emulation function will be used. */

/* By default, the \R escape sequence matches any Unicode line ending
   character or sequence of characters. If BSR_ANYCRLF is defined, this is
   changed so that backslash-R matches only CR, LF, or CRLF. The build- time
   default can be overridden by the user of PCRE at runtime. On systems that
   support it, configure can be used to override the default. */
/* #undef BSR_ANYCRLF */

/* If you are compiling for a system that uses EBCDIC instead of ASCII
   character codes, define this macro as 1. On systems that can use
   configure, this can be done via --enable-ebcdic. */
/* #undef EBCDIC */

/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1

/* Define to 1 if you have the bits/type_traits.h header file. */
/* #undef HAVE_BITS_TYPE_TRAITS_H */

/* Define to 1 if you have the dirent.h header file. */
#define HAVE_DIRENT_H 1

/* Define to 1 if you have the dlfcn.h header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the inttypes.h header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the limits.h header file. */
#define HAVE_LIMITS_H 1

/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1

/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1

/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the stdint.h header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the stdlib.h header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1

/* Define to 1 if you have the string header file. */
#define HAVE_STRING 1

/* Define to 1 if you have the strings.h header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the string.h header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1

/* Define to 1 if you have the `strtoq' function. */
#define HAVE_STRTOQ 1

/* Define to 1 if you have the sys/stat.h header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the sys/types.h header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the type_traits.h header file. */
/* #undef HAVE_TYPE_TRAITS_H */

/* Define to 1 if you have the unistd.h header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if the system has the type `unsigned long long'. */
#define HAVE_UNSIGNED_LONG_LONG 1

/* Define to 1 if you have the windows.h header file. */
/* #undef HAVE_WINDOWS_H */

/* Define to 1 if you have the `_strtoi64' function. */
/* #undef HAVE__STRTOI64 */

/* The value of LINK_SIZE determines the number of bytes used to store links
   as offsets within the compiled regex. The default is 2, which allows for
   compiled patterns up to 64K long. This covers the vast majority of cases.
   However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
   for longer patterns in extreme cases. On systems that support it,
   configure can be used to override this default. */
#define LINK_SIZE 2

/* The value of MATCH_LIMIT determines the default number of times the
   internal match() function can be called during a single execution of
   pcre_exec(). There is a runtime interface for setting a different limit.
   The limit exists in order to catch runaway regular expressions that take
   for ever to determine that they do not match. The default is set very large
   so that it does not accidentally catch legitimate cases. 

[Chicken-users] Help w/ PCRE 7.4 migration

2007-09-24 Thread Kon Lovett

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I need the config.h files produced by PCRE 7.4 (ftp:// 
ftp.csx.cam.ac.uk/pub/software/programming/pcre/) 'configure --enable- 
unicode-properties' from the following OS:


Solaris 9   Sparc

NetBDS  PowerPC  x86-64

Linux   PowerPC  x86-64  x86  Alpha  ARM/XScale

(http://galinha.ucpel.tche.br/portability except for MacOS PowerPC   
Windows/MinGW32)


Thank you for your help,
Kon

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (Darwin)

iEYEARECAAYFAkb3xCUACgkQJJNoeGe+5O63YQCfQ/888btnkc7UbJi15ZBCLWeY
zLkAnjRU04H9hIAEG/fWng6ykSr6mVDZ
=dhhd
-END PGP SIGNATURE-


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


Re: [Chicken-users] Help w/ PCRE 7.4 migration

2007-09-24 Thread Graham Fawcett
On 9/24/07, Kon Lovett [EMAIL PROTECTED] wrote:
 I need the config.h files produced by PCRE 7.4 (ftp://
 ftp.csx.cam.ac.uk/pub/software/programming/pcre/) 'configure --enable-
 unicode-properties' from the following OS:

I've been meaning to add Solaris 10/SPARC to the portability list (a
couple of tests to finish first); here's the config.h from that
platform.

Graham


config.h
Description: Binary data
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Help w/ PCRE 7.4 migration

2007-09-24 Thread Peter Bex
On Mon, Sep 24, 2007 at 07:05:24AM -0700, Kon Lovett wrote:
 Hi all,
 
 I need the config.h files produced by PCRE 7.4 (ftp:// 
 ftp.csx.cam.ac.uk/pub/software/programming/pcre/) 'configure --enable- 
 unicode-properties' from the following OS:
 
 NetBDSPowerPC  x86-64

Here are the config.h files for NetBSD on both platforms.  The macppc
system is running NetBSD-4.0RC1 and the amd64 is running NetBSD-3.0

Peter
-- 
http://sjamaan.ath.cx
--
The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music.
-- Donald Knuth
/* config.h.  Generated from config.h.in by configure.  */
/* config.h.in.  Generated from configure.ac by autoheader.  */


/* On Unix-like systems config.h.in is converted by configure into config.h.
Some other environments also support the use of configure. PCRE is written in
Standard C, but there are a few non-standard things it can cope with, allowing
it to run on SunOS4 and other close to standard systems.

If you are going to build PCRE by hand on a system without configure you
should copy the distributed config.h.generic to config.h, and then set up the
macro definitions the way you need them. You must then add -DHAVE_CONFIG_H to
all of your compile commands, so that config.h is included at the start of
every source.

Alternatively, you can avoid editing by using -D on the compiler command line
to set the macro values. In this case, you do not have to set -DHAVE_CONFIG_H.

PCRE uses memmove() if HAVE_MEMMOVE is set to 1; otherwise it uses bcopy() if
HAVE_BCOPY is set to 1. If your system has neither bcopy() nor memmove(), set
them both to 0; an emulation function will be used. */

/* By default, the \R escape sequence matches any Unicode line ending
   character or sequence of characters. If BSR_ANYCRLF is defined, this is
   changed so that backslash-R matches only CR, LF, or CRLF. The build- time
   default can be overridden by the user of PCRE at runtime. On systems that
   support it, configure can be used to override the default. */
/* #undef BSR_ANYCRLF */

/* If you are compiling for a system that uses EBCDIC instead of ASCII
   character codes, define this macro as 1. On systems that can use
   configure, this can be done via --enable-ebcdic. */
/* #undef EBCDIC */

/* Define to 1 if you have the `bcopy' function. */
#define HAVE_BCOPY 1

/* Define to 1 if you have the bits/type_traits.h header file. */
#define HAVE_BITS_TYPE_TRAITS_H 1

/* Define to 1 if you have the dirent.h header file. */
#define HAVE_DIRENT_H 1

/* Define to 1 if you have the dlfcn.h header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if you have the inttypes.h header file. */
#define HAVE_INTTYPES_H 1

/* Define to 1 if you have the limits.h header file. */
#define HAVE_LIMITS_H 1

/* Define to 1 if the system has the type `long long'. */
#define HAVE_LONG_LONG 1

/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1

/* Define to 1 if you have the memory.h header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if you have the stdint.h header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the stdlib.h header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1

/* Define to 1 if you have the string header file. */
#define HAVE_STRING 1

/* Define to 1 if you have the strings.h header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the string.h header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1

/* Define to 1 if you have the `strtoq' function. */
#define HAVE_STRTOQ 1

/* Define to 1 if you have the sys/stat.h header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the sys/types.h header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the type_traits.h header file. */
/* #undef HAVE_TYPE_TRAITS_H */

/* Define to 1 if you have the unistd.h header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if the system has the type `unsigned long long'. */
#define HAVE_UNSIGNED_LONG_LONG 1

/* Define to 1 if you have the windows.h header file. */
/* #undef HAVE_WINDOWS_H */

/* Define to 1 if you have the `_strtoi64' function. */
/* #undef HAVE__STRTOI64 */

/* The value of LINK_SIZE determines the number of bytes used to store links
   as offsets within the compiled regex. The default is 2, which allows for
   compiled patterns up to 64K long. This covers the vast majority of cases.
   However, PCRE can also be compiled to use 3 or 4 bytes instead. This allows
   for longer patterns in extreme cases. On systems that support it,
   configure can be used to override this default. */
#define LINK_SIZE 2

/* The value of MATCH_LIMIT determines the default 

Re: [Chicken-users] Help w/ PCRE 7.4 migration

2007-09-24 Thread Alex Queiroz
Hallo,

On 9/24/07, Kon Lovett [EMAIL PROTECTED] wrote:

 I need the config.h files produced by PCRE 7.4 (ftp://
 ftp.csx.cam.ac.uk/pub/software/programming/pcre/) 'configure --enable-
 unicode-properties' from the following OS:

 Solaris 9   Sparc

 NetBDS  PowerPC  x86-64

 Linux   PowerPC  x86-64  x86  Alpha  ARM/XScale

 (http://galinha.ucpel.tche.br/portability except for MacOS PowerPC 
 Windows/MinGW32)


 Attached there is the config file for Linux x86-64.

Cheers,
-- 
-alex
http://www.ventonegro.org/


config.h
Description: Binary data
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] help on embedding

2007-09-23 Thread Thomas Christian Chust
Todd Ingalls wrote:

 [...] I can generate the c file just fine ( chicken
 chicken-bridge.scm -output-file chicken-bridge.cpp -quiet -no-trace
 -optimize-level 2  ...)  and then when compiling the larger c
 executable I pass DC_EMBEDDED and everything compiles and links just
 fine. However, the new procedures I have define are not available. I am
 sure I am missing some simple step here , could anyone help me out on
 how to do this? [...]

Hello,

maybe you forgot to run the function representing the top level of your
scheme code. Something like this should work:

  % cat unit-say-hello.scm
  (declare
(unit say-hello)
(export say-hello))

  (define (say-hello)
(print Hello world!))

  (return-to-host)

  % cat host-say-hello.c
  #include chicken.h

  extern void C_ccall C_say_hello_toplevel(C_word c, C_word self, C_word
k) C_noret;

  int main(int nargs, char **args) {
int heap, stack, symbols;

CHICKEN_parse_command_line(nargs, args, heap, stack, symbols);
CHICKEN_initialize(heap, stack, symbols, (void *)C_say_hello_toplevel);

CHICKEN_run(NULL);

return CHICKEN_eval_string((say-hello), NULL);
  }

  % csc -embedded -c unit-say-hello.scm
  % csc -c host-say-hello.c
  % csc unit-say-hello.o host-say-hello.o -o say-hello
  % ./say-hello
  Hello world!


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


Re: [Chicken-users] help on embedding

2007-09-23 Thread Todd Ingalls

Yes, Thank you so much that is exactly what I was overlooking.



On Sep 23, 2007, at 8:20 AM, Thomas Christian Chust wrote:


Todd Ingalls wrote:


[...] I can generate the c file just fine ( chicken
chicken-bridge.scm -output-file chicken-bridge.cpp -quiet -no-trace
-optimize-level 2  ...)  and then when compiling the larger c
executable I pass DC_EMBEDDED and everything compiles and links just
fine. However, the new procedures I have define are not available.  
I am

sure I am missing some simple step here , could anyone help me out on
how to do this? [...]


Hello,

maybe you forgot to run the function representing the top level of  
your

scheme code. Something like this should work:

  % cat unit-say-hello.scm
  (declare
(unit say-hello)
(export say-hello))

  (define (say-hello)
(print Hello world!))

  (return-to-host)

  % cat host-say-hello.c
  #include chicken.h

  extern void C_ccall C_say_hello_toplevel(C_word c, C_word self,  
C_word

k) C_noret;

  int main(int nargs, char **args) {
int heap, stack, symbols;

CHICKEN_parse_command_line(nargs, args, heap, stack, symbols);
CHICKEN_initialize(heap, stack, symbols, (void *) 
C_say_hello_toplevel);


CHICKEN_run(NULL);

return CHICKEN_eval_string((say-hello), NULL);
  }

  % csc -embedded -c unit-say-hello.scm
  % csc -c host-say-hello.c
  % csc unit-say-hello.o host-say-hello.o -o say-hello
  % ./say-hello
  Hello world!




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


[Chicken-users] help on embedding

2007-09-22 Thread Todd Ingalls

Hi,
I have successfully gotten chicken embedded in a c executable I am  
working on (actually very easy) . I can use csc to compile a dynamic  
library to load into the embedded chicken to extend functionality. In  
the end what I was hoping to do was to generate a .c file using  
chicken which could then simply be added to the rest of the files in  
my main source tree. I can generate the c file just fine ( chicken  
chicken-bridge.scm -output-file chicken-bridge.cpp -quiet -no-trace - 
optimize-level 2  ...)  and then when compiling the larger c  
executable I pass DC_EMBEDDED and everything compiles and links just  
fine. However, the new procedures I have define are not available. I  
am sure I am missing some simple step here , could anyone help me out  
on how to do this?




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


Re: [Chicken-users] help needed on egg repository maintenance

2007-08-23 Thread Elf


i'd be happy to put the time in if we can discuss it a bit more.  i already
have ~80% of the eggs installed locally so its to my benefit as well. :)

-elf


On Thu, 23 Aug 2007, felix winkelmann wrote:


Hello, everybody.

The time has come again, where I'm getting down on my knees
humbly begging for help: keeping the egg repository in shape
currently takes too much of the little time I have. I want to get a new
release out, but the whole build situation and the texinfo manual
integration makes this more labour-intensive than I expected.

Would someone (the more the better) be willing to take an eye
on the repository? It means waiting for an e-mail by the post-commit
script and checking/repairing/kicking someone's ass in case
something breaks.

Anybody? Hey, it's fun!


cheers,
felix


___
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] help needed on egg repository maintenance

2007-08-23 Thread Mario Domenech Goulart
Hi Felix and folks,

On Thu, 23 Aug 2007 02:07:04 +0200 felix winkelmann [EMAIL PROTECTED] wrote:

 The time has come again, where I'm getting down on my knees
 humbly begging for help: keeping the egg repository in shape
 currently takes too much of the little time I have. I want to get a new
 release out, but the whole build situation and the texinfo manual
 integration makes this more labour-intensive than I expected.
 
 Would someone (the more the better) be willing to take an eye
 on the repository? It means waiting for an e-mail by the post-commit
 script and checking/repairing/kicking someone's ass in case
 something breaks.

Some further suggestions:

* have the e-mail address of each egg developer and send the author a
  message in case of breakage.

* egg developers can always use salmonella before checking the changes
  in the svn repo.  I think this action would dramatically reduce the
  number of failures.  Here's a tip:

$ salmonella '(chicken-setup-args (lambda () (string-append -d -destdir  
(repo-test-dir)  -local chicken-eggs-repo-dir))) (eggs (lambda () (list 
my-egg)))'

Replace chicken-eggs-repo-dir by the path to your local repository and
my-egg by the egg you want to test.

Alternatively, you can use an input file with the code above and pass
this file as argument to salmonella.  Example:

,[ salmonella.conf ]
| (chicken-setup-args
|  (lambda ()
|(string-append -d -destdir  (repo-test-dir)
|-local chicken-eggs-repo-dir)))
| 
| (eggs (lambda () (list my-egg)))
`

$ salmonella salmonella.conf

Best wishes,
Mario


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


[Chicken-users] Help with and-let* please.

2007-02-03 Thread Robin Lee Powell
I'm trying to work from http://srfi.schemers.org/srfi-2/srfi-2.html
because the Chicken site is down, and I can't make and-let* work for
me at all.  I've shown two attempts below.

In the chicken source, in csi.scm, there's:

(and-let* ([(fx= a len)]
   [o (fxmod len 16)]
   [(not (fx= o 0))] )
{stuff}

which looks like it's trying to do something like my first example
below.  As you can see, though, mine doesn't actually work in any
useful sense.

The goal, in case it's subtle, is to have and-let* return #f after
the display of foo.\n.

-Robin

- ---

(define land
  (and-let*
(
 (begin (display foo.\n) #t)
 ((= 2 1))
 (begin (display bar.\n) #t)
 )
(begin
  (display Still here.\n
(display land: )
(write land)
(display \n)

- ---

$ /tmp/land   
foo.
Error: call of non-procedure: #unspecified

- ---

- ---

(define land
  (and-let*
(
 (begin (display foo.\n) #t)
 (= 2 1)
 (begin (display bar.\n) #t)
 )
(begin
  (display Still here.\n
(display land: )
(write land)
(display \n)

- ---

[EMAIL PROTECTED] /tmp/land   
foo.
bar.
Still here.
Error: call of non-procedure: #unspecified

- ---

-- 
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: Homonyms: Their Grate!
Proud Supporter of the Singularity Institute - http://singinst.org/


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


Re: [Chicken-users] Help with and-let* please.

2007-02-03 Thread Kon Lovett

On Feb 3, 2007, at 2:33 PM, Robin Lee Powell wrote:


I'm trying to work from http://srfi.schemers.org/srfi-2/srfi-2.html
because the Chicken site is down, and I can't make and-let* work for
me at all.  I've shown two attempts below.

In the chicken source, in csi.scm, there's:

(and-let* ([(fx= a len)]
   [o (fxmod len 16)]
   [(not (fx= o 0))] )
{stuff} 

which looks like it's trying to do something like my first example
below.  As you can see, though, mine doesn't actually work in any
useful sense.

The goal, in case it's subtle, is to have and-let* return #f after
the display of foo.\n.

-Robin

- ---

(define land
  (and-let*
(
 (begin (display foo.\n) #t)
 ((= 2 1))
 (begin (display bar.\n) #t)
 )
(begin
  (display Still here.\n
(display land: )
(write land)
(display \n)

- ---

$ /tmp/land
foo.
Error: call of non-procedure: #unspecified

- ---

- ---

(define land
  (and-let*
(
 (begin (display foo.\n) #t)
 (= 2 1)
 (begin (display bar.\n) #t)
 )
(begin
  (display Still here.\n
(display land: )
(write land)
(display \n)

- ---

[EMAIL PROTECTED] /tmp/land
foo.
bar.
Still here.
Error: call of non-procedure: #unspecified

- ---


  (and-let*
([(begin (display foo.\n) #t)]
 [(= 2 1)]
 [(begin (display bar.\n) #t)] )
(begin
  (display Still here.\n)))

You forgot the enclosing braces for each sub-form. ('[...]' is not  
necessary, '(...)' is fine.)




--
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: Homonyms: Their Grate!
Proud Supporter of the Singularity Institute - http://singinst.org/


___
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] Help with and-let* please.

2007-02-03 Thread Robin Lee Powell
On Sat, Feb 03, 2007 at 03:42:38PM -0800, Kon Lovett wrote:
 
   (and-let*
 ([(begin (display foo.\n) #t)]
  [(= 2 1)]
  [(begin (display bar.\n) #t)] )
 (begin
   (display Still here.\n)))
 
 You forgot the enclosing braces for each sub-form. ('[...]' is not  
 necessary, '(...)' is fine.)

Huh.  Dunno why I didn't try that.  Thanks!

-Robin

-- 
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: Homonyms: Their Grate!
Proud Supporter of the Singularity Institute - http://singinst.org/


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


Re: [Chicken-users] Help with foreign-lambda

2006-05-16 Thread Hans Bulfone
hi,

On Mon, May 15, 2006 at 11:59:09PM -0400, Jim Miller wrote:
 I'm trying to least expensive way to wrap a C function into scheme.  The
 following is the C interface to the function I need:
 
 typedef long int integer;
 typedef float real;
 
 int gtd6_(integer *iyd, real *sec, real *alt, real *glat, real *glong, real
 *stl, real *f107a, real *f107, real *ap, integer *mass, real *d__, real *t);
 
 (Its actually a fortran function so the pointers to the function are not my
 choice)
 
 The first 10 arguments (iyd - mass) are actually pointers to single values.
 The final two must be pointers to arrays.  d must be capable of holding 8
 elements while t must be capable of 2.
 
 [...]
 
 when I run the program I get the error:
 Error: bad argument type - not a pointer: 138
 
 So my questions are
 
 a) If I have to pass a pointer to an allocated array of memory in the C
 function am I doing this correctly when I use the make-f32vector function?
 I'm not sure if this is where the error is occurring but it seems like its
 the only place that it could?

the error occurs because c-pointer objects are expected as
arguments to gtd6.  you can use let-location to make c-pointer
objects pointing to scheme data.  imho the following should work:

(define gtd6
  (foreign-lambda integer gtd6_
  (nonnull-c-pointer integer)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer float)
  (nonnull-c-pointer integer)
  nonnull-f32vector
  nonnull-f32vector))

(let-location
([iyd   integer 138]
 [sec   float   345.0]
 [lat   float   50.0]
 [alt   float   100.0]
 [lon   float   50.0]
 [stl   float   100.0]
 [f107a float   150.0]
 [f107  float   150.0]
 [apfloat   8.0]
 [mass  integer 48])
  (let ([d (make-f32vector 8)]
[t (make-f32vector 2)])
(gtd6 #$iyd #$sec #$alt #$lat #$lon #$stl #$f107a #$f107 #$ap #$mass d t)))


regards,
hans.


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


[Chicken-users] Help with foreign-lambda

2006-05-15 Thread Jim Miller
I'm trying to least expensive way to wrap a C function into
scheme. The following is the C interface to the function I need:

typedef long int integer;
typedef float real;

int gtd6_(integer *iyd, real *sec, real *alt, real *glat, real *glong,
real *stl, real *f107a, real *f107, real *ap, integer *mass, real *d__,
real *t);

(Its actually a fortran function so the pointers to the function are not my choice)

The first 10 arguments (iyd - mass) are actually pointers to single
values. The final two must be pointers to arrays. d must be
capable of holding 8 elements while t must be capable of 2.

Here is my scheme:

(require 'srfi-4)

(foreign-declare typedef long int integer;)

(foreign-declare typedef float real;)

(foreign-declare/parse
int gtd6_(integer *iyd, real *sec, real *alt, real *glat, 
real *glong, real *stl, real *f107a, real *f107,
real *ap, integer *mass, real *d__, real *t);)


(let ([iyd 138]
 [sec 345.0]
 [lat 50.0]
 [alt 100.0]
 [lon 50.0]
 [stl 100.0]
 [f107a 150.0]
 [f107 150.0]
 [ap 8.0 ]
 [mass 48]
 [d (make-f32vector 8)]
 [t (make-f32vector 2)])
 (gtd6 iyd sec alt lat lon stl f107a f107 ap mass d t))


I compile the program using the command line (msislib.o is the f77 compiled file containing the gtd6_ function)

csc -L/opt/local/lib chapman.scm ../Science/msisr/msislib.o -lg2c

when I run the program I get the error:

Error: bad argument type - not a pointer: 138

So my questions are

a) If I have to pass a pointer to an allocated array of memory in the C
function am I doing this correctly when I use the make-f32vector
function? I'm not sure if this is where the error is occurring
but it seems like its the only place that it could?

b) What ways do I have to debug or more tightly trace this to track down these types of errors?

c) Is there an easier way to do this?

d) Being new to scheme (but not new to programming) I'd appreciate gentle comments on the style

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


[Chicken-users] Help debugging windows build

2006-02-03 Thread Patrick Brannan
This email addresses a problem that is unique to a particular Windows
XP installation. If you have no interest in this, then stop reading now.
I normally don't submit this kind of stuff, but I am stuck and need some ideas. 
My hope is that someone who understands Windows compilation and
shared library loading better than I do can give me an idea or two that will help me
work through this. If you have any suggestions, links to articles, or whatever, you will have my undying gratitude.

I recently had to switch computers and haven't gotten chicken to build
properly since. Whether I use the build script or the makefile the
result is the same. The build appears to complete normally, but when I
run anything I end up with a windows dialog box (details at bottom) unless
I have a few very odd directories in my path. 

My suspicion is that one of my library files (with a mingw or vc environment)
is incompatible with a dll in the system32 directory on this machine.
My reason for that suspicion is that I can make things run if I add
certain directories to the path when running. I have had scenarios
where the app would run until I eliminated a certain Java bin directory -- oracle 1.8 java if you have to know --
from the path. When I would look in the directory there would be an
msvcrt.dll in there. Unfortunately, dropping the mscvrt.dll in the chicken's dir doesn't fix anything.

If I run chicken.exe with PATH1 I get the error listed at the bottom even though this is how it was compiled.

So my theory is that the import libraries being picked during the
compilation do not match the dlls being loaded at runtime. I just don't
know if there is a quick way to work through the problem. 

If I run it with PATH2 it runs fine. 

PATH1
set
PATH=C:\working\cmake\chicken-2.216;C:\programs\darcs-w32;C:\Programs\CMake_2.2\bin;C:\ProgramFiles\Microsoft
Visual C++ Toolkit
2003\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\WINDOWS\SYSTEM32\;C:\Program
Files\Microsoft Platform SDK\Bin;C:\Program Files\Microsoft Platform
SDK\Bin\WinNT;C:\Program Files\Microsoft Platform SDK\Bin\win64

PATH2
set PATH=C:\working\cmake\chicken-2.216;C:\Program Files\Microsoft
Platform SDK\Bin\;C:\Program Files\Microsoft Platform
SDK\Bin\WinNT\;C:\Program Files\Microsoft Visual C++ Toolkit
2003\bin\;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\Program
Files\Microsoft Platform SDK\Bin\win64\;C:\WINDOWS\SYSTEM32\;C:\Program
Files\Java\jdk1.5.0_04\bin;C:\Oracle\Ora92\bin;C:\Oracle\Ora92\jre\1.4.2\bin\client;C:\Oracle\Ora92\jre\1.4.2\bin;C:\Program
Files\Oracle\jre\1.3.1\bin;C:\Program
Files\Oracle\jre\1.1.8\bin;C:\PROGRAM
FILES\THINKPAD\UTILITIES;C:\Program
Files\Java\j2re1.4.2_01\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;

ERROR DIALOG INFO

Error signature
AppName: chicken.exe AppVer: 0.0.0.0 ModName: ntdll.dll
ModVer: 5.1.2600.2180 Offset: 0003426d

Error Report
?xml version=1.0 encoding=UTF-16?
DATABASE
EXE NAME=chicken.exe FILTER=GRABMI_FILTER_PRIVACY
 MATCHING_FILE NAME=chicken.dll SIZE=1806336
CHECKSUM=0xF81C5AD3 MODULE_TYPE=WIN32 PE_CHECKSUM=0x0
LINKER_VERSION=0x0 LINK_DATE=02/03/2006 17:01:14
UPTO_LINK_DATE=02/03/2006 17:01:14 /
 MATCHING_FILE NAME=chicken.exe SIZE=1441792
CHECKSUM=0xA161AEF4 MODULE_TYPE=WIN32 PE_CHECKSUM=0x0
LINKER_VERSION=0x0 LINK_DATE=02/03/2006 17:01:15
UPTO_LINK_DATE=02/03/2006 17:01:15 /
 MATCHING_FILE NAME=test\chicken.dll
SIZE=1806336 CHECKSUM=0x71B75D6 MODULE_TYPE=WIN32
PE_CHECKSUM=0x0 LINKER_VERSION=0x0 LINK_DATE=02/01/2006 22:33:12
UPTO_LINK_DATE=02/01/2006 22:33:12 /
 MATCHING_FILE NAME=test\foo.exe SIZE=27136
CHECKSUM=0xCDC6BC44 MODULE_TYPE=WIN32 PE_CHECKSUM=0x0
LINKER_VERSION=0x0 LINK_DATE=02/01/2006 23:30:36
UPTO_LINK_DATE=02/01/2006 23:30:36 /
/EXE
EXE NAME=ntdll.dll FILTER=GRABMI_FILTER_THISFILEONLY
 MATCHING_FILE NAME=ntdll.dll SIZE=708096
CHECKSUM=0x9D20568 BIN_FILE_VERSION=5.1.2600.2180
BIN_PRODUCT_VERSION=5.1.2600.2180 PRODUCT_VERSION=5.1.2600.2180
FILE_DESCRIPTION=NT Layer DLL COMPANY_NAME=Microsoft Corporation
PRODUCT_NAME=Microsoft Windows Operating System
FILE_VERSION=5.1.2600.2180 (xpsp_sp2_rtm.040803-2158)
ORIGINAL_FILENAME=ntdll.dll INTERNAL_NAME=ntdll.dll
LEGAL_COPYRIGHT= Microsoft Corporation. All rights reserved.
VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x40004
VERFILETYPE=0x2 MODULE_TYPE=WIN32 PE_CHECKSUM=0xAF2F7
LINKER_VERSION=0x50001 UPTO_BIN_FILE_VERSION=5.1.2600.2180
UPTO_BIN_PRODUCT_VERSION=5.1.2600.2180 LINK_DATE=08/04/2004
07:56:36 UPTO_LINK_DATE=08/04/2004 07:56:36 VER_LANGUAGE=English
(United States) [0x409] /
/EXE
EXE NAME=kernel32.dll FILTER=GRABMI_FILTER_THISFILEONLY
 MATCHING_FILE NAME=kernel32.dll SIZE=983552
CHECKSUM=0x4CE79457 BIN_FILE_VERSION=5.1.2600.2180
BIN_PRODUCT_VERSION=5.1.2600.2180 PRODUCT_VERSION=5.1.2600.2180
FILE_DESCRIPTION=Windows NT BASE API Client DLL
COMPANY_NAME=Microsoft Corporation PRODUCT_NAME=Microsoft Windows
Operating System FILE_VERSION=5.1.2600.2180
(xpsp_sp2_rtm.040803-2158) ORIGINAL_FILENAME=kernel32
INTERNAL_NAME=kernel32 

Re: [Chicken-users] Help with problem involving GC mixing C/Scheme

2005-05-09 Thread felix winkelmann
On 5/7/05, Alejandro Forero Cuervo [EMAIL PROTECTED] wrote:
 
 Hello.
 
 Some of my code that involved calling Scheme code from C recently
 started crashing (probably because the input it handles grew
 significantly).  After investigation, I managed to isolate the error;
 the following program reproduces it:
 
 ;--- begin ---
 
 (use format)
 
 (define-external (funccall (scheme-object func)) void (func))
 
 (define run
   (foreign-callback-lambda* void ((long n) (scheme-object func))
 while (n--) funccall(func);))
 
 (run 100 (lambda () format #t ~%))
 
 ;--- end ---
 
 When I use Chicken 1.935 to build this program and run it, I get:
 
  Error: call of non-procedure: error in error
 
 Interestingly, if I (set-gc-report! #t), a garbage collection is shown
 right before the error.
 
 Could anybody please point out what am I doing wrong?  Or is this a
 problem in Chicken?
 

Since funccall may trigger a garbage collection, the value func
in your run procedure may not be valid, once a GC occurred.
Chicken uses a moving garbage collector, so after a GC, func
still points to the old (dead) version in the previous heap-space.
Errors like this mostly result in random crashes or very strange
behaviour (like the error in error message above).

Here is an alternative version:

(use format)

(define-external (funccall (scheme-object func)) void (func))

(define run
  (foreign-callback-lambda* void ((long n) (scheme-object func))
void *r = CHICKEN_new_gc_root();
CHICKEN_gc_root_set(r, func);
while (n--) funccall(CHICKEN_gc_root_ref(r));
CHICKEN_delete_gc_root(r);) )

(run 100 (lambda () (format #t ~%)))


cheers,
felix


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