[Chicken-users] Can't install srfi 47
There seems to be a problem with srfi 47 root@miro:~# chicken-install srfi-47 retrieving ... resolving alias `kitten-technologies' to: http://chicken.kitten- technologies.co.uk/henrietta.cgi connecting to host chicken.kitten-technologies.co.uk, port 80 ... requesting /henrietta.cgi?name=srfi-47mode=default ... reading response ... HTTP/1.1 200 OK Date: Tue, 06 Mar 2012 15:26:50 GMT Server: Apache Connection: close Transfer-Encoding: chunked Content-Type: text/plain reading chunks . reading files ... srfi-47 located at /tmp/tempb05a/srfi-47 Warning: extension `srfi-47' has no .meta file - assuming it has no dependencies install order: () ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Can't install srfi 47
Hi Mark! * Mark Carter mcar...@markcarter.me.uk [120306 17:07]: root@miro:~# chicken-install srfi-47 [...] Warning: extension `srfi-47' has no .meta file - assuming it has no This error message is misleading. There is no egg with that name. Newer chickens will give a more meaningful error message: Error: extension or version not found Why are you needing this srfi? 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] Can't install srfi 47
Christian Kellermann scripsit: * Mark Carter mcar...@markcarter.me.uk [120306 17:07]: root@miro:~# chicken-install srfi-47 [...] Warning: extension `srfi-47' has no .meta file - assuming it has no This error message is misleading. There is no egg with that name. Newer chickens will give a more meaningful error message: Error: extension or version not found Why are you needing this srfi? SRFI-47 has been superseded by SRFI-63, which has an egg. -- John Cowanhttp://ccil.org/~cowan co...@ccil.org Lope de Vega: It wonders me I can speak at all. Some caitiff rogue did rudely yerk me on the knob, wherefrom my wits yet wander. An Englishman: Ay, belike a filchman to the nab'll leave you crank for a spell. --Harry Turtledove, Ruled Britannia ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Making stack-allocated Chicken-managed objects from C
Hi guys! I would like to get a deeper understanding of Chicken's GC and its stack-allocation feature. I've numbered by questions, feel free to answer just one or two of them! I have been poking into the chicken-bind egg and I'd like to modify it slightly for my libraries' (Box2D, Chipmunk) heavy use of structs. Chicken-bind will generate helper utils for making C-structs inside Chicken. Please take a peek at http://paste.call-cc.org/paste?id=d8e38d5afb7daff73c5957e91dff21c6ee02d415 My C-snipped in foreign-primitive that's doing the stack-allocation is heavily inspired by http://wiki.call-cc.org/allocating-c-structures-under-control-of-the-chicken-gc. However, I've been getting feedback about this approach about it not being completely safe because it can't guarantee the stack won't overflow. From what I can make out of the docs, foreign-primitive automatically does a minor GC and we should be safe. 1. Is this method completely safe? If not, why is that the case? If not, how can you create blobs on the stack from C safely? 2. So let's say that we drop C_alloc for being unsafe. Could C_alloc be replaced with C_malloc and at least we'd get the struct/blob automatically garbage-collected by Chicken? Or are scheme-objects reserved for stack-allocated pointers? 3. When C-code returns a new scheme-object, does Chicken treat it like any other scheme-object created from within Chicken? (Along with GC and all the rest of it) 4. And just for clarity, is there any difference between C_bytes *ab = C_alloc( .. size ..) ; vs. C_bytes ab [ .. size ... ]; ? 5. And finally, how fast is stack-allocation/C_alloc compared to heap-allocation/C_malloc? (I'm interested in very small structs here!) And for reference, an easier approach probably goes something like this, where the blob is created in Chicken-land: (*define* %make-point (foreign-primitive void (((c-pointer (struct point)) dest) (float x) (float y)) #ENDdest-x = x;dest-y = y;C_return();END)) (define (make-point x y) (let ((loc (location (make-blob %get struct-size somehow% (%make-point loc x y) loc)) This is what I'm looking for, but I'd love to see make-blob lowered into C so that there is less overhead in creating structs (I'm a performance junkie). I've looked at runtime.c's C_allocate_vector and I must admit don't understand much! K. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] Creating my own extensions
I'm a bit confused about how to create extensions. I have the following files in an mccsl directory: mccsl.setup: (compile -s mccsl.scm) (install-extension 'mccsl mccsl.so) mccsl.scm: (module mccsl ( define-simple-syntax) (import scheme) ... ;; lots of definitions ) I have managed to load and use the library using csi, but creating a proper extension seems to not work. For starters, there is no exe named chicken-setup in Debian, although there is a chicken-install. The following wiki page suggests that there should be: http://wiki.call-cc.org/man/3/chicken-setup#install-program If I type chicken mccsl.setup it creates an mccsl.c file, but not an mccsl.so file. I'm thinking that's wrong?? So, there doesn't actually seem to be a way of installing a home- brewed extension. chicken-setup doesn't exists, and the install- extension function doesn't seem to install the extension. Presumably I'm making some schoolboy errors. I'm using the following version of chicken: CHICKEN (c)2008-2011 The Chicken Team (c)2000-2007 Felix L. Winkelmann Version 4.7.0 linux-unix-gnu-x86 [ manyargs dload ptables ] compiled 2011-09-06 on murphy (Linux) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Can't install srfi 47
Christian Kellermann ck...@pestilenz.org * Mark Carter mcar...@markcarter.me.uk [120306 17:07]: Warning: extension `srfi-47' has no .meta file - assuming it has no Why are you needing this srfi? I want to create a matrix, and populate it. I have a list of triplets consisting of a row number, a column number , and a value. I populate the given row/column cell with the value. Having processed the list of triplets, I print the table as a list of lists. Any cells that haven't been populated explicitly have the value '(), which is my desired result. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Creating my own extensions
Hi Mark, On Tue, 6 Mar 2012 16:57:11 + Mark Carter mcar...@markcarter.me.uk wrote: I'm a bit confused about how to create extensions. I have the following files in an mccsl directory: mccsl.setup: (compile -s mccsl.scm) (install-extension 'mccsl mccsl.so) mccsl.scm: (module mccsl ( define-simple-syntax) (import scheme) ... ;; lots of definitions ) I have managed to load and use the library using csi, but creating a proper extension seems to not work. For starters, there is no exe named chicken-setup in Debian, although there is a chicken-install. The following wiki page suggests that there should be: http://wiki.call-cc.org/man/3/chicken-setup#install-program The /3/ part in the path indicates that is the manual for CHICKEN 3.x. chicken-setup is for CHICKEN 3.x only. The tool to install eggs for CHICKEN 4.x is chicken-install. The documentation for the .setup things are here: http://wiki.call-cc.org/man/4/Extensions (if you intend to use the `make' macro, please, use the egg -- http://wiki.call-cc.org/egg/make -- since the core `make' macro is going to be deprecated). If I type chicken mccsl.setup it creates an mccsl.c file, but not an mccsl.so file. I'm thinking that's wrong?? To test the installation of your egg, you can just execute chicken-install in your egg directory. If you want to perform some extra tests, you can use salmonella: $ chicken-install salmonella $ cd my-egg # directory where you put your egg code $ salmonella --this-egg In case of errors, you may want to read the log file generated by salmonella: $ salmonella-log-viewer salmonella.log So, there doesn't actually seem to be a way of installing a home- brewed extension. chicken-setup doesn't exists, and the install- extension function doesn't seem to install the extension. Presumably I'm making some schoolboy errors. Maybe this document can be useful: http://wiki.call-cc.org/eggs%20tutorial 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] Creating my own extensions
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/06/2012 05:25 PM, Mario Domenech Goulart wrote: For starters, there is no exe named chicken-setup in Debian, although there is a chicken-install. The following wiki page suggests that there should be: http://wiki.call-cc.org/man/3/chicken-setup#install-program The /3/ part in the path indicates that is the manual for CHICKEN 3.x. chicken-setup is for CHICKEN 3.x only. The tool to install eggs for CHICKEN 4.x is chicken-install. Is it time we either: 1) Removed /3/ from the wiki? 2) Kept it online for archival purposes, but put it somewhere even more hidden-away and obviously not current? 3) Slapped a big warning banner on every /3/ page? ABS - -- Alaric Snell-Pym http://www.snell-pym.org.uk/alaric/ -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk9WSToACgkQRgz/WHNxCGoVKACffmJiR1mmEHzth3vifVWvp7iR JIkAnjuZ7cdVLpLrBHPytfCGdWaXCuuE =TVYa -END PGP SIGNATURE- ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Making stack-allocated Chicken-managed objects from C
Kristian Lein-Mathisen scripsit: My C-snipped in foreign-primitive that's doing the stack-allocation is heavily inspired by http://wiki.call-cc.org/allocating-c-structures-under-control-of-the-chicken-gc. However, I've been getting feedback about this approach about it not being completely safe because it can't guarantee the stack won't overflow. I'm not sure that concern is reasonable. The maximum stack size before GC is 256K on 32-bit systems and 1M on 64-bit systems, but the actual limit on the C stack on modern systems is many megabytes; even on 32-bit Windows it is 1M. So C stack overflow isn't very likely. 1. Is this method completely safe? If not, why is that the case? If not, how can you create blobs on the stack from C safely? Since the stack is a limited resource, you cannot create Really Big blobs on it safely. In that situation, the heap is your only recourse. -- A mosquito cried out in his pain, John Cowan A chemist has poisoned my brain! http://www.ccil.org/~cowan The cause of his sorrow co...@ccil.org Was para-dichloro- Diphenyltrichloroethane.(aka DDT) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Creating my own extensions
Alaric Snell-Pym scripsit: Is it time we either: 1) Removed /3/ from the wiki? 2) Kept it online for archival purposes, but put it somewhere even more hidden-away and obviously not current? 3) Slapped a big warning banner on every /3/ page? I favor 3. -- If you understand, John Cowan things are just as they are; http://www.ccil.org/~cowan if you do not understand, co...@ccil.org things are just as they are. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Can't install srfi 47
Mark Carter scripsit: I want to create a matrix, and populate it. I have a list of triplets consisting of a row number, a column number , and a value. I populate the given row/column cell with the value. Having processed the list of triplets, I print the table as a list of lists. Any cells that haven't been populated explicitly have the value '(), which is my desired result. SRFI-63 is definitely your friend. -- Newbies always ask: John Cowan Elements or attributes? http://www.ccil.org/~cowan Which will serve me best? co...@ccil.org Those who know roar like lions; Wise hackers smile like tigers. --a tanka, or extended haiku ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Making stack-allocated Chicken-managed objects from C
On Mar 6, 2012, at 10:31 AM, Kristian Lein-Mathisen wrote: (define %make-point (foreign-primitive void (((c-pointer (struct point)) dest) (float x) (float y)) #END dest-x = x; dest-y = y; C_return(); END )) (define (make-point x y) (let ((loc (location (make-blob %get struct-size somehow% (%make-point loc x y) loc)) %get struct-size somehow% - (foreign-value sizeof(struct point) int) Avoid the locative by using scheme-pointer instead of c-pointer. There's no reason I can think of to use foreign-primitive there instead of foreign-lambda*. Ideally wrap the blob in a define-record for safety issues (not done below, we stick with a bare pointer as in your example). Code: # struct point { float x; float y; }; # (define %make-point (foreign-lambda* void ((scheme-pointer b) (float x) (float y)) #END ((struct point *)b)-x = x; ((struct point *)b)-y = y; END )) (define (make-point x y) (let ((b (make-blob (foreign-value sizeof(struct point) int (%make-point b x y) b)) (define point-y (foreign-lambda* float ((scheme-pointer b)) return(((struct point *)b)-y);)) (print (point-y (make-point 1.5 2.5))) ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Can't install srfi 47
John Cowan co...@mercury.ccil.org SRFI-63 is definitely your friend. Thanks. I've converted my code to use that SRFI. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Creating my own extensions
Mario Domenech Goulart mario.goul...@gmail.com Maybe this document can be useful: http://wiki.call-cc.org/eggs%20tutorial OK, after many chicken sacrifices (strangely appropriate somehow), I was able to build my extension and load it. Just one comment: I think there is a doc fix needed at http://wiki.call-cc.org/man/4/Extensions In the section my-lib.setup, I think the following line needs to be included below the other two compile lines: (compile -c -O2 -d1 my-lib.scm -unit my-lib -j my-lib) Otherwise, the .o file isn't created, causing installation to fail. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] Creating my own extensions
Hi Mark, * Mark Carter mcar...@markcarter.me.uk [120306 19:59]: Mario Domenech Goulart mario.goul...@gmail.com Maybe this document can be useful: http://wiki.call-cc.org/eggs%20tutorial OK, after many chicken sacrifices (strangely appropriate somehow), I was able to build my extension and load it. Just one comment: I think there is a doc fix needed at http://wiki.call-cc.org/man/4/Extensions In the section my-lib.setup, I think the following line needs to be included below the other two compile lines: (compile -c -O2 -d1 my-lib.scm -unit my-lib -j my-lib) Otherwise, the .o file isn't created, causing installation to fail. Ah right, it needs a fix. But not the one you suggest :) The ID.o in the example is a leftover from old days. I will fix it. Your code does not need your line above. *Unless* you want to be able to link extensions statically which is technically possible, but no longer supported. 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