[Chicken-users] using md5 egg with interpreter

2005-11-06 Thread David Janssens
Hello,

Can anyone please help me with the following problem?

When I run a simple scheme script with csi that uses md5.scm, I get the following error:
Error: invalid sharp-sign read syntax in line 3: #\

The scheme script is for example: (require-extension md5)

Is there a way torun a scheme script with csi that uses the md5 module?

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


[Chicken-users] Making an extension of various files

2005-11-06 Thread Pupeno
How do I make an extension of two or more files ?
I have sc-mfl1.scm containing:

(define-extension sc-mfl1)
(declare (export sc-mfl1-proc))

(define (sc-mfl1-proc)
  (display Hello from sc-mfl1, the scons-chicken multiple-file-library 1.))

and then I have sc-mfl2.scm, more or less like this (more about this latter):

(declare (unit sc-mfl2))
(declare (export sc-mfl2-proc))

(define (sc-mfl2-proc)
  (display Hello from sc-mfl2, the scons-chicken multiple-file-library 2.))

then I compile that to C source:

chicken sc-mfl1.scm -output-file sc-mfl1.c -dynamic -feature 
chicken-compile-shared -feature compiling-extension
chicken sc-mfl2.scm -output-file sc-mfl2.c -dynamic -feature 
chicken-compile-shared -feature compiling-extension

and then I compile that to object code:

gcc `chicken-config -shared -cflags` -c -o sc-mfl1.os sc-mfl1.c
gcc `chicken-config -shared -cflags` -c -o sc-mfl2.os sc-mfl2.c

and then I link it together:

gcc -Wl,-R/usr/local//lib -Wl,-R/usr/local//lib -shared -o sc-mfl1.so 
sc-mfl1.os sc-mfl2.os `chicken-config -shared -libs`

and install it:

cp sc-mfl1.so /usr/local/lib/chicken/
cp sc-mfl1.setup /usr/local/lib/chicken/

then I use the extension:

#;1 (use sc-mfl1)
; loading /usr/local//lib/chicken/sc-mfl1.so ...
#;2 (sc-mfl1-proc)
Hello from sc-mfl1, the scons-chicken multiple-file-library 1.
#;3 (sc-mfl2-proc)
Error: unbound variable: sc-mfl2-proc
#;3

Where's sc-mfl2-proc ? it was supoused to be there, on sc-mfl1. Well, maybe 
not, so I starting playing with the 'header' of sc-mfl2.scm and I tried:

(declare (unit sc-mfl1))
(declare (export sc-mfl2-proc))

it compiles, I can't access sc-mfl2-proc. Then I tried:

(define-extension sc-mfl1)
(declare (export sc-mfl2-proc))

it doesn't compile:

sc-mfl2.os: In function `C_toplevel':
sc-mfl2.c:(.text+0x27): multiple definition of `C_toplevel'
sc-mfl1.os:sc-mfl1.c:(.text+0x27): first defined here
collect2: ld returned 1 exit status

Then I tried:

(define-extension sc-mfl2)
(declare (export sc-mfl2-proc))

It doesn't compile either, same error. Then I tried:

(declare (export sc-mfl2-proc))

that is, no define-extension or unit. Same error!
And now I am out of ides, can anybody help me please ?
Thank you
-- 
Pupeno [EMAIL PROTECTED] (http://pupeno.com)


pgpu03ZvXlb97.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Making an extension of various files

2005-11-06 Thread Thomas Chust

Am 06.11.2005, 16:13 Uhr, schrieb Pupeno [EMAIL PROTECTED]:


How do I make an extension of two or more files ?
[...]


Hello,

the short answer is: It's possible, but why on earth would you want to
do that ;)

The long answer is that CHICKEN generates a C-function executing the
top-level expressions for every file it processes. If you set normal
extension compilation mode, this function is called C_toplevel, if you
set unit compilation mode for a unit called my-unit, the function will
be called C_my_unit_toplevel.

The only way to circumvent this and to get only one toplevel for multiple
files is to give up separate compilation, to include all parts of the
extension in a central file (either directly or using the include
statement) and to compile that.

So to make the whole thing work *with* separate compilation, you have to
do some magic. First you must compile both files in your example with a
  (declare (unit sc-mfl1)) or
  (declare (unit sc-mfl2))
statement respectively to get toplevel functions with distinct names.
From then on you have several alternatives:

  1) Create an additional Scheme file containing
   (declare (uses sc-mfl1 sc-mfl2))
 and compile it in normal extension compilation mode. Link all three
 objects together to form your new extension.
 (I haven't tested it, but I remember faintly that someone has tried
  this already and it worked)
  2) Create a small C file by hand that defines C_toplevel and calls
 C_sc_mfl1_toplevel as well as C_sc_mfl2_toplevel from there. Compile
 it and all three objects together to form your new extension.
 (I would have to take a look at the CHICKEN internals again to see how
  this could be done)
  3) Just link the two objects for the units into a shared library and use
 load-library instead of require or require-extension to load the
 two units separately into chicken.
 (I haven't tested this either, but the documentation tells me that it
  should work)

The recommended path is probably (1) if you want to load all the  
expressions

from both original scheme files at once or (3) if you don't.

cu,
Thomas


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


Re: [Chicken-users] Making an extension of various files

2005-11-06 Thread Pupeno
On Sunday 06 November 2005 15:27, Thomas Chust wrote:
 Am 06.11.2005, 16:13 Uhr, schrieb Pupeno [EMAIL PROTECTED]:
  How do I make an extension of two or more files ?
[...]
 the short answer is: It's possible, but why on earth would you want to
 do that ;)
Because it makes sense to break big files into smaller ones. I do it with C. 
And I have one file that takes about 30 seconds to compile with Chicken, I 
don't want to recompile that code unless totally needed, and I don't want to 
make 10 different extensions for my Xlib wrappers.

 The long answer is that CHICKEN generates a C-function executing the
[...]
 The recommended path is probably (1) if you want to load all the
 expressions
  from both original scheme files at once or (3) if you don't.

Outch. :(
-- 
Pupeno [EMAIL PROTECTED] (http://pupeno.com)


pgpZcFHutVpZu.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Re: using md5 egg with interpreter

2005-11-06 Thread David Janssens
I removed md5.scm and did chicken-setup md5 and it works now...

David Janssens
On 11/6/05, David Janssens [EMAIL PROTECTED] wrote:

Hello,

Can anyone please help me with the following problem?

When I run a simple scheme script with csi that uses md5.scm, I get the following error:
Error: invalid sharp-sign read syntax in line 3: #\

The scheme script is for example: (require-extension md5)

Is there a way torun a scheme script with csi that uses the md5 module?

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


[Chicken-users] bug in hash tables?

2005-11-06 Thread David Janssens
I think there is a bug in the hash table implementation:

#;1 (set! h (make-hash-table))
#;2 (hash-table-exists? h foo)
Error: call of non-procedure: #(42)

(using chicken 2.2 under cygwin)

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


[Chicken-users] Packaging practices

2005-11-06 Thread sunnan
Hi,

What are, in this list's opinion, the recommended best practices for
distributing free software written in Chicken? I'm thinking proper
GNU-style source tar balls, since that's currently the basis for most
further (distro specific and other binary) packaging.

* Do you use autoconf, if so, what do you check for?
* What about automake?
* Do you make one distribution containing the full .scm-files and one
  with just the .c-files, or do you only make the .scm-distribution?
* How do you deal with third-party eggs from the
  call-with-current-continuation repo that your program uses?

I'd love to see example chicken projects, I'm especially interested in
autoconf and automake usage but other solutions are also of interest.

Sunnan



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


Re: [Chicken-users] bug in hash tables?

2005-11-06 Thread Sven . Hartrumpf
On 6 Nov 2005, David Janssens wrote:

 I think there is a bug in the hash table implementation:

 #;1 (set! h (make-hash-table))
 #;2 (hash-table-exists? h foo)
 Error: call of non-procedure: #(42)

 (using chicken 2.2 under cygwin)

This bug is fixed in 2.207.


pgpxogqGhlxXr.pgp
Description: PGP signature
___
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Patch for the futures egg

2005-11-06 Thread felix winkelmann
Oops. In fact I threw them out, but didn't run eggdoc again...
Damn, now I have to accept this patch. ;-)

Thanks!


cheers,
felix

On 11/5/05, Thomas Chust [EMAIL PROTECTED] wrote:
 Hello,

 I think, the futures egg should conform to its own documentation and
 export the future-complete?, -failed?, -condition procedures ;)

 A patch for futures-base.scm is attached.

 cu,
 Thomas

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






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


[Chicken-users] amb, rpc, packrat, json eggs

2005-11-06 Thread felix winkelmann
Hi!

Thanks, Thomas for your new eggs! They are uploaded and should
be available, now.

Additionally, Tony Garnock-Jones allowed me to eggify
his packrat parsing library and JSON parser (built on top of packrat):

http://www.call-with-current-continuation.org/eggs/packrat.html
http://www.call-with-current-continuation.org/eggs/json.html


cheers,
felix


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


Re: [Chicken-users] Making an extension of various files

2005-11-06 Thread felix winkelmann
On 11/6/05, Pupeno [EMAIL PROTECTED] wrote:
 How do I make an extension of two or more files ?
 I have sc-mfl1.scm containing:

 (define-extension sc-mfl1)
 (declare (export sc-mfl1-proc))

 (define (sc-mfl1-proc)
   (display Hello from sc-mfl1, the scons-chicken multiple-file-library 1.))

 and then I have sc-mfl2.scm, more or less like this (more about this latter):

 (declare (unit sc-mfl2))
 (declare (export sc-mfl2-proc))

 (define (sc-mfl2-proc)
   (display Hello from sc-mfl2, the scons-chicken multiple-file-library 2.))

 then I compile that to C source:

 chicken sc-mfl1.scm -output-file sc-mfl1.c -dynamic -feature
 chicken-compile-shared -feature compiling-extension
 chicken sc-mfl2.scm -output-file sc-mfl2.c -dynamic -feature
 chicken-compile-shared -feature compiling-extension

 and then I compile that to object code:

 gcc `chicken-config -shared -cflags` -c -o sc-mfl1.os sc-mfl1.c
 gcc `chicken-config -shared -cflags` -c -o sc-mfl2.os sc-mfl2.c

 and then I link it together:

 gcc -Wl,-R/usr/local//lib -Wl,-R/usr/local//lib -shared -o sc-mfl1.so
 sc-mfl1.os sc-mfl2.os `chicken-config -shared -libs`

 and install it:

 cp sc-mfl1.so /usr/local/lib/chicken/
 cp sc-mfl1.setup /usr/local/lib/chicken/

 then I use the extension:

 #;1 (use sc-mfl1)
 ; loading /usr/local//lib/chicken/sc-mfl1.so ...
 #;2 (sc-mfl1-proc)
 Hello from sc-mfl1, the scons-chicken multiple-file-library 1.
 #;3 (sc-mfl2-proc)
 Error: unbound variable: sc-mfl2-proc
 #;3


I think, adding a

(declare (uses sc-mfl2))

in sc-mfl1.scm should work.


cheers,
felix


cheers,
felix


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


Re: [Chicken-users] Packaging practices

2005-11-06 Thread felix winkelmann
On 11/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

 What are, in this list's opinion, the recommended best practices for
 distributing free software written in Chicken? I'm thinking proper
 GNU-style source tar balls, since that's currently the basis for most
 further (distro specific and other binary) packaging.

 * Do you use autoconf, if so, what do you check for?
 * What about automake?
 * Do you make one distribution containing the full .scm-files and one
   with just the .c-files, or do you only make the .scm-distribution?
 * How do you deal with third-party eggs from the
   call-with-current-continuation repo that your program uses?


One example of using the autotools is here:

http://chicken.humankraft.com/wiki.ssp?page=Using%20the%20GNU%20Autotools%20with%20compiled%20code

It's rather minimalistic, but should show the general procedure.
Apart from Chicken itself, I try to avoid autoconf/automake as much
as possible, but it certainly is a standard way of handling the build
of source packages.
I would add the .scm sources. Then you can bootstrap the .c files from
those - it's the same as in chicken: the .c files are compiled by default,
only if someone touches the .scm files, they get recompiled.
If you use eggs, things might get a bit tricky, but it is always possible to
include the sources (provided, the license issues are clear) and compile
them into something that can be statically linked into the executable
(try the csc -E option). If you have problems figuring out the right
incantations to include the egg of your choice, ask here.


cheers,
felix


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