Re: [Chicken-users] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Christian Kellermann
* Alex Shinn  [111206 02:40]:
> On Tue, Dec 6, 2011 at 4:05 AM, Christian Kellermann
>  wrote:
> > Watson,
> >
> > * Mario Domenech Goulart  [111205 18:27]:
> >> >>> So what is the correct way to compile an SRFI-22 compliant script to
> >> >>> an executable?
> >
> >> Maybe you are assuming a `main' procedure would be automatically called
> >> when you run your compiled code?  If so, that's not going to happen, and
> >> AFAIK, there's no compiler option to do that.  You can just explicitly
> >> call your `main' procedure and run your scripts with csi -s" instead of
> >> "csi -ss".  The compiled code would just work this way.
> >
> > Out of curiousity: Did you just assume that chicken supports srfi-22?
> > If you got the idea by reading some of chicken's docs then this is
> > a bug and we need to clarify these bits, so the next person will
> > not be led astray.
> 
> csi does support SRFI-22 via the -ss option - it's basically
> the same as -s plus calling (main (command-line-arguments))
> at the end.
> 
> For csc you can either use
> 
>   csc -postlogue '(main (command-line-arguments))' foo.scm
> 
> or add to the end of foo.scm:
> 
>   (cond-expand
> ((and chicken compiling) (main (command-line-arguments)))
> (else #f))
> 
> so that it supports SRFI-22 both interpreted and compiled
> (untested).
> 
> Or you could just give up on SRFI-22 and use csi -s.

Thanks Alex for enlightening me.

Kind regards,

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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Alex Shinn
On Tue, Dec 6, 2011 at 4:05 AM, Christian Kellermann
 wrote:
> Watson,
>
> * Mario Domenech Goulart  [111205 18:27]:
>> >>> So what is the correct way to compile an SRFI-22 compliant script to
>> >>> an executable?
>
>> Maybe you are assuming a `main' procedure would be automatically called
>> when you run your compiled code?  If so, that's not going to happen, and
>> AFAIK, there's no compiler option to do that.  You can just explicitly
>> call your `main' procedure and run your scripts with csi -s" instead of
>> "csi -ss".  The compiled code would just work this way.
>
> Out of curiousity: Did you just assume that chicken supports srfi-22?
> If you got the idea by reading some of chicken's docs then this is
> a bug and we need to clarify these bits, so the next person will
> not be led astray.

csi does support SRFI-22 via the -ss option - it's basically
the same as -s plus calling (main (command-line-arguments))
at the end.

For csc you can either use

  csc -postlogue '(main (command-line-arguments))' foo.scm

or add to the end of foo.scm:

  (cond-expand
((and chicken compiling) (main (command-line-arguments)))
(else #f))

so that it supports SRFI-22 both interpreted and compiled
(untested).

Or you could just give up on SRFI-22 and use csi -s.

-- 
Alex

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


Re: [Chicken-users] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Christian Kellermann
Watson,

* Mario Domenech Goulart  [111205 18:27]:
> >>> So what is the correct way to compile an SRFI-22 compliant script to
> >>> an executable?

> Maybe you are assuming a `main' procedure would be automatically called
> when you run your compiled code?  If so, that's not going to happen, and
> AFAIK, there's no compiler option to do that.  You can just explicitly
> call your `main' procedure and run your scripts with csi -s" instead of
> "csi -ss".  The compiled code would just work this way.

Out of curiousity: Did you just assume that chicken supports srfi-22?
If you got the idea by reading some of chicken's docs then this is
a bug and we need to clarify these bits, so the next person will
not be led astray.

Thanks for your patience and support!

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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Mario Domenech Goulart
On Mon, 5 Dec 2011 11:03:44 -0600 Watson Ladd  wrote:

> On Mon, Dec 5, 2011 at 9:22 AM, Mario Domenech Goulart
>  wrote:
>>
>> On Mon, 5 Dec 2011 08:52:06 -0600 Watson Ladd  wrote:
>>
>>> csi has it for making scripts run. This could simply be a case of me
>>> assuming that the interpreter and compiler took similar options, which
>>> is likely. So now i see what happens: csc takes the -ss switch and
>>> interprets it as -s, which causes the result.
>>>
>>> So what is the correct way to compile an SRFI-22 compliant script to
>>> an executable?
>>
>> I'm not sure I understand your question.  Usually it's just a matter of
>>
>>    $ csc your-program.scm
>>
>> A binary executable file called `your-program' will be generated.
>
> So that works: I get an executable. But the executable does nothing
> but take up time when run. I've got a SRFI-22 compliant script: that
> is I want the executable to evaluate (main argslist) where argslist is
> a list containing strings corresponding to the entries of the argv
> vector. The interpreter has a flag for this: the compiler doesn't seem
> to. Do I need to put in a toplevel expression, and if so, which one?

Maybe you are assuming a `main' procedure would be automatically called
when you run your compiled code?  If so, that's not going to happen, and
AFAIK, there's no compiler option to do that.  You can just explicitly
call your `main' procedure and run your scripts with csi -s" instead of
"csi -ss".  The compiled code would just work this way.

Here's a very simple example:

$ cat foo.scm
#!/bin/sh
#| -*- scheme -*-
exec csi -s $0 "$@"
|#

(define (main)
  (display 'foo)
  (newline))

(main)

$ ./foo.scm
foo

$ csc foo.scm
$ ./foo
foo


Notice that there's nothing special about `main' in this case.  It can
be any valid identifier.  AFAIK, `main' is only relevant when you want
to use your scripts with the -ss option to csi (not csc).

Regarding scripts, I usually use the first tip from
http://wiki.call-cc.org/writing%20portable%20scripts (as shown in the
example above).


> Thanks for taking the time to answer my questions: I'm reasonably
> experienced with scheme, but recently needed to turn some scheme into
> something that can run on systems with only a C compiler.

You are welcome.


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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Christian Kellermann
* Watson Ladd  [111205 18:04]:
> On Mon, Dec 5, 2011 at 9:22 AM, Mario Domenech Goulart
>  wrote:
> > Hi Watson,
> >
> > On Mon, 5 Dec 2011 08:52:06 -0600 Watson Ladd  wrote:
> >
> >> csi has it for making scripts run. This could simply be a case of me
> >> assuming that the interpreter and compiler took similar options, which
> >> is likely. So now i see what happens: csc takes the -ss switch and
> >> interprets it as -s, which causes the result.
> >>
> >> So what is the correct way to compile an SRFI-22 compliant script to
> >> an executable?
> >
> > I'm not sure I understand your question.  Usually it's just a matter of
> >
> >    $ csc your-program.scm
> >
> > A binary executable file called `your-program' will be generated.
> 
> So that works: I get an executable. But the executable does nothing
> but take up time when run. I've got a SRFI-22 compliant script: that
> is I want the executable to evaluate (main argslist) where argslist is
> a list containing strings corresponding to the entries of the argv
> vector. The interpreter has a flag for this: the compiler doesn't seem
> to. Do I need to put in a toplevel expression, and if so, which one?
> Thanks for taking the time to answer my questions: I'm reasonably
> experienced with scheme, but recently needed to turn some scheme into
> something that can run on systems with only a C compiler.

Calling (main (argv)) should help. argv is similar to C's argument
list, it includes the program's name etc...

If you get stuck again, please show us some code. It is always
easier to talk about code...  It can be pasted here:
http://paste.call-cc.org

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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Watson Ladd
On Mon, Dec 5, 2011 at 9:22 AM, Mario Domenech Goulart
 wrote:
> Hi Watson,
>
> On Mon, 5 Dec 2011 08:52:06 -0600 Watson Ladd  wrote:
>
>> csi has it for making scripts run. This could simply be a case of me
>> assuming that the interpreter and compiler took similar options, which
>> is likely. So now i see what happens: csc takes the -ss switch and
>> interprets it as -s, which causes the result.
>>
>> So what is the correct way to compile an SRFI-22 compliant script to
>> an executable?
>
> I'm not sure I understand your question.  Usually it's just a matter of
>
>    $ csc your-program.scm
>
> A binary executable file called `your-program' will be generated.

So that works: I get an executable. But the executable does nothing
but take up time when run. I've got a SRFI-22 compliant script: that
is I want the executable to evaluate (main argslist) where argslist is
a list containing strings corresponding to the entries of the argv
vector. The interpreter has a flag for this: the compiler doesn't seem
to. Do I need to put in a toplevel expression, and if so, which one?
Thanks for taking the time to answer my questions: I'm reasonably
experienced with scheme, but recently needed to turn some scheme into
something that can run on systems with only a C compiler.
>
>
> Best wishes.
> Mario
> --
> http://parenteses.org/mario

Sincerely,
Watson Ladd



-- 
"Those who would give up Essential Liberty to purchase a little
Temporary Safety deserve neither  Liberty nor Safety."
-- Benjamin Franklin

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


Re: [Chicken-users] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Mario Domenech Goulart
Hi Watson,

On Mon, 5 Dec 2011 08:52:06 -0600 Watson Ladd  wrote:

> csi has it for making scripts run. This could simply be a case of me
> assuming that the interpreter and compiler took similar options, which
> is likely. So now i see what happens: csc takes the -ss switch and
> interprets it as -s, which causes the result.
>
> So what is the correct way to compile an SRFI-22 compliant script to
> an executable?

I'm not sure I understand your question.  Usually it's just a matter of

$ csc your-program.scm

A binary executable file called `your-program' will be generated.


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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Christian Kellermann
* Watson Ladd  [111205 15:52]:
> csi has it for making scripts run. This could simply be a case of me
> assuming that the interpreter and compiler took similar options, which
> is likely. So now i see what happens: csc takes the -ss switch and
> interprets it as -s, which causes the result.

The error lies in assuming that the interpreter accepts the same
switches as the compiler. This is not true for almost all switches.

> So what is the correct way to compile an SRFI-22 compliant
> script to an executable?

I fail to see the connection between srfi-22, that specifies a
script format for the interpreter and compiling a file.

Could you tell we what the actual problem is, please?

As for compiling files, there is documentation for using the compiler:
http://api.call-cc.org/doc/csc#sec:Compiling_and_running_your_program
the manual provides an example.

Maybe a basic tutorial for how to run things with chicken would
also help. Have a try here:
http://wiki.call-cc.org/chickenista-guide#using-chicken

Kind regards,

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] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Watson Ladd
csi has it for making scripts run. This could simply be a case of me
assuming that the interpreter and compiler took similar options, which
is likely. So now i see what happens: csc takes the -ss switch and
interprets it as -s, which causes the result.

So what is the correct way to compile an SRFI-22 compliant script to
an executable?
Sincerely,
Watson Ladd

On Mon, Dec 5, 2011 at 4:50 AM, Christian Kellermann
 wrote:
> Hello Watson,
>
> * Watson Ladd  [111205 11:32]:
>
>> man csc suggests sending bug reports to chicken-janit...@nongnu.org. I
>> did so, and received a message back indicating it was bounced as I was
>> not a subscriber. i
>
>> csc has no comprehensive listing of options. And
>> lastly, the bug that started this entire exercise, on Mac OS X csc -ss
>> generates a Mach O bundle, not an executable.
>
> csc -h produces this list for me, a detailed description might be
> found in the manual or on the online copy: http://api.call-cc.org/doc/csc
>
> From your description I am not able to guess what you want to do.
>
> To generate a "normal" executable with chicken from a scheme file
> called "foo.scm" one would call csc like this:
>
> $ csc foo.scm
>
> to generate a binary "foo".
>
> The -s switch is used to generate shared objects, usually used when
> compiling modules as extensions. See
> http://api.call-cc.org/doc/chicken/eggs for details on those.
>
> I am not sure where you got the "-ss" switch from, where did you
> find that and what did you intend to do?
>
> Kind regards,
>
> 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.



-- 
"Those who would give up Essential Liberty to purchase a little
Temporary Safety deserve neither  Liberty nor Safety."
-- Benjamin Franklin

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


Re: [Chicken-users] Spiffy SSL Connection handshake error

2011-12-05 Thread Peter Bex
On Mon, Dec 05, 2011 at 11:05:31AM +0100, Christian Kellermann wrote:
> This message is generated by spiffy's exception handler in spiffy.scm
> line 562.
> 
> However I could run your test program below without errors on a 64
> bit linux machine running
> 
> openssl . version: 1.5.1
> spiffy ... version: 4.12
> 
> with chicken master Version 4.7.4 (rev d439343)
> 
> Which version did you use to try this?
> 
> Maybe Peter has a better understanding of what's going on.

The SSL egg is a mess I don't fully understand either.  The code the OP
pasted looks correct, so you're right about checking the versions.

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
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Christian Kellermann
Hello Watson,

* Watson Ladd  [111205 11:32]:

> man csc suggests sending bug reports to chicken-janit...@nongnu.org. I
> did so, and received a message back indicating it was bounced as I was
> not a subscriber. i

> csc has no comprehensive listing of options. And
> lastly, the bug that started this entire exercise, on Mac OS X csc -ss
> generates a Mach O bundle, not an executable.

csc -h produces this list for me, a detailed description might be
found in the manual or on the online copy: http://api.call-cc.org/doc/csc

>From your description I am not able to guess what you want to do.

To generate a "normal" executable with chicken from a scheme file
called "foo.scm" one would call csc like this:

$ csc foo.scm

to generate a binary "foo".

The -s switch is used to generate shared objects, usually used when
compiling modules as extensions. See
http://api.call-cc.org/doc/chicken/eggs for details on those.

I am not sure where you got the "-ss" switch from, where did you
find that and what did you intend to do?

Kind regards,

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


[Chicken-users] Bugs in documentation and Mac OS X 10.6.8 executable generation broken

2011-12-05 Thread Watson Ladd
Dear Chicken Users,
man csc suggests sending bug reports to chicken-janit...@nongnu.org. I
did so, and received a message back indicating it was bounced as I was
not a subscriber. csc has no comprehensive listing of options. And
lastly, the bug that started this entire exercise, on Mac OS X csc -ss
generates a Mach O bundle, not an executable.
Sincerely,
Watson Ladd

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


Re: [Chicken-users] Spiffy SSL Connection handshake error

2011-12-05 Thread Christian Kellermann
* Vok Vojwo  [111205 10:43]:
> I got the following error while trying to use Spiffy with SSL:
> 
> primordial: Connection handshake error: "argument is not a port"

This message is generated by spiffy's exception handler in spiffy.scm
line 562.

However I could run your test program below without errors on a 64
bit linux machine running

openssl . version: 1.5.1
spiffy ... version: 4.12

with chicken master Version 4.7.4 (rev d439343)

Which version did you use to try this?

Maybe Peter has a better understanding of what's going on.

Kind regards,

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


[Chicken-users] Spiffy SSL Connection handshake error

2011-12-05 Thread Vok Vojwo
I got the following error while trying to use Spiffy with SSL:

primordial: Connection handshake error: "argument is not a port"

This is my simple test program:

#! /usr/local/bin/csi -s

(use spiffy openssl)

(server-port 8000)
(access-log (current-error-port))
(debug-log (current-error-port))

(let ((listener (ssl-listen (server-port
  (ssl-load-certificate-chain! listener "server.crt")
  (ssl-load-private-key! listener "server.key")
  (accept-loop listener ssl-accept))

#|
(let ((listener (tcp-listen (server-port
  (accept-loop listener tcp-accept))
|#

The TCP version works fine. I created the key and certificates with
the following Makefile:

all: server.key server.crt

clean:
-rm server.key server.csr server.crt

server.key:
openssl genrsa -out $@ 1024

server.csr: server.key
openssl req -new -batch \
-key $< -out $@ \
-subj /CN=`hostname -f`

server.crt: server.csr server.key
openssl x509 -req -days 365 \
-in $(filter %.csr,$^) \
-signkey $(filter %.key,$^) \
-out $@

Does anybody know who generates the error message? It does not seem to
be an exception. I have no idea where I should look for the error.

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