Re: Advises and feedback

2024-03-24 Thread Kristian Lein-Mathisen
Hi Miguel,

and welcome to the Chicken community! Your project looks very thourogh and
the Scheme code looks good.

There are a couple of issues related to building that I thought I'd point
out.

Like Felix points out, load and load-relative open files at runtime. So sdb
fails when run outside of its repo directory because of these:

> make
> ./sdb -h
> cd ~
~> ~/opt/simple_db/sdb
Error: (load) cannot open file: "./db-utils.scm"



In the same manner, the help-file is opened and read at runtime here:
https://github.com/MigAP/simple_db/blob/main/cli.scm#L31. This results in a
similar problem when sdb is used outside its repo directory:

> ~/opt/simple_db/sdb -h
Error: (open-input-file) cannot open file - No such file or directory:
"./cli-interface.txt"

In Scheme, the ordinary string syntax can have multiple lines. So if you
wanted to, you could wrap the content of cli-interface.txt in double-qoutes
and embed it directly into your sources. That'll eliminate these kinds of
runtime issues. You could also use include or read cli-interface.txt at
compile time using define-syntax or let-syntax.



There are also egg dependencies in use which don't seem to be mentioned
anywhere. Without these, I get this error message.

> ./sdb -h
Error: (import) during expansion of (import ...) - cannot import from
undefined module: list-utils.basic

I'm guessing I need to install list-utils, but that olso fails because of
transitive dependencies. So I need to run `chicken-install check-errors`,
then `chicken-install list-utils`. Then another `chicken-install
gnuplot-pipe`.

Manual dependency management like quickly gets out of hand. You can use
egg-files, which you've probably come across. Here's a bare minimum to get
dependencies and transitive dependencies installed:

~/o/simple_db (main)> cat sdb.egg
((dependencies list-utils gnuplot-pipe))
~/o/simple_db (main)> chicken-install
...
building gnuplot-pipe
installing gnuplot-pipe
building sdb
installing sdb

chicken-install runs for the current directory if nothing is specified, so
it picks up sdb.egg. I often use egg files even for small toy project that
I don't tend to release because of this, amongst other things. You can also
use egg files to install programs like sdb if you wish.

If you run chicken-install with -test, it'll run test/run.scm, where you
can put your unit tests. This is all chicken-specific stuff, other Schemes
do it their way. A Makefile like you have is a pretty global mechanism so
it has its advantages.

===
I hope none of this is discouraging! Looking forward to seeing what else
you produce.

Hoppy holidays,
K.


On Fri, Mar 22, 2024, 19:54  wrote:

> > Hello everyone!
> >
> > My name is Miguel, and I am interested in developing in Chicken Scheme.
> >
> > I just created a toy project to put in practice what I have been
> > learning in the Little Schemer and SICP books, you can find it here:
> >
> > https://github.com/MigAP/simple_db
> >
> > It is a simple database to store urls. I am not a developer, so I would
> > appreciate any feedback from you. In particular, it is the first time I
> > write unit tests, and I am not sure if this is the correct way of
> doing-it.
> >
> > I thank you in advance for any feedback. I am looking forward to start
> > building stuff using Chicken Scheme!
> >
> > I wish you all a good day.
>
> Hi!
>
> Your code looks good to me. I haven't examined it in detail, but
> the overall impression is fine. Also, the unit-tests seem to be similar
> to what I've seen in other code by more experienced Schemers.
>
> Note that you compile your program but load additional files via
> "load-relative". This technically works, but if you want all code to
> be compiled, I recommend to use "include" instead: that way,
> the parts are inserted into your main program and fully compiled,
> which is of course more efficient and also makes it easier to
> move the compiled program around or call it from a different
> location.
>
> > PS: Is there any small/medium project that I could study to learn the
> > "good practices" for Chicken Scheme? One of my goals is to use Chicken
> > Scheme for scientific computing and embedded applications.
>
> The egg sources are usually good examples for how to structure
> libraries. Some of these have example programs that you might
> want to study. Also, you can look at
>
> http://wiki.call-cc.org/Software
>
> which lists a couple of larger projects that use CHICKEN.
>
>
> cheers,
> felix
>
>
>


Upcoming Chicken Event: Gosling 2024

2024-02-22 Thread Kristian Lein-Mathisen
Hi everyone!

I'd like to announce an upcoming CHICKEN event I'm hosting this summer. The
location is Oslo, Norway. The time is Tue 10th ~ Sun 15th September, which
should leave plenty of room for hacking.

See the wiki for more info: https://wiki.call-cc.org/event/gosling-2024

I'm very much looking forward to this, and I hope to see you there!
K.


Re: compile-time deserialization

2023-12-26 Thread Kristian Lein-Mathisen
Hi,

You could try to put everything you're doing with read-string / read /
open-input-file inside syntax. For example:

~/tmp> cat ./compile-time-io.scm
(define file-contents
  (let-syntax
  ((load
(er-macro-transformer
 (lambda (x r t)
   (import chicken.io chicken.port)
   `(quote
 ,(with-input-from-file
 "/proc/cpuinfo"
   read-lines))
(load)))

(write file-contents)
(newline)

~/tmp> csc compile-time-io.scm && ./compile-time-io
( "Processor\t: AArch64 Processor rev 14 (aarch64)"
  "processor\t: 0"
  "BogoMIPS\t: 38.40" ... )

~/tmp> grep BogoMIPS ./compile-time-io
grep: ./compile-time-io: binary file matches


K.

On Tue, Dec 26, 2023, 21:07 Al  wrote:

> Hi, suppose I need to reference data from "file.txt" in my Scheme
> program. I could use read-char / read / open-input-file etc (or other
> (chicken io) procedures) to read the the contents of the file into a
> variable.
>
> However, such deserialization happens at run-time. If I compile my
> program into an executable, it will try to open "file.txt" at run-time.
> How can I arrange for "file.txt" to be read at compile-time, and inlined
> into the executable, so that the executable doesn't require access to
> the original file?
>
> The only way I can think of is to convert "file.txt" to a scheme string
> definition in a separate file:
>
> ; file.scm
> (define file-contents " ... ")
>
> and include it via (include "file.scm"). Then the definition would occur
> at compile-time.
>
> But of course this requires encoding (possibly binary) files as scheme
> strings, and probably an extra Makefile step to convert file.txt into
> file.scm. This is not attractive -- are there other options?
>
>
>


Re: Deprecated current-milliseconds

2023-12-07 Thread Kristian Lein-Mathisen
I've seen this too, and I wish the deprecation warning mentioned this
alternative. I think in this particular example, it's just a rename - bu
I'm guessing.

Would it be possible to mark deprecations with alternatives/documentation
to point users in the new direction?

K.

On Wed, Dec 6, 2023, 23:12 Kon Lovett  wrote:

>
>
> > On Dec 6, 2023, at 1:58 PM, Lassi Kortela  wrote:
> >
> > Hi,
> >
> > Version 5.3 csc gives the warning:
> >
> > Use of deprecated identifier `current-milliseconds' from module
> `chicken.time'.
> >
> > for (at least) these modules:
> >
> > * scheme.time (r7rs)
> > * sendfile
> > * srfi-18
> >
> > Is there a drop-in replacement for this procedure?
>
> chicken time current-process-milliseconds
>
> >
> > -l
> >
>
>
>


Re: How can I use arrows in csi?

2023-08-13 Thread Kristian Lein-Mathisen
Hi Oskar,

As an alternative to getting readline support into the chicken runtire, you
can use rlwrap. It adds readline support to any process. I like to use it
on things like netcat and csi.

> rlwrap csi

K.

On Sun, Aug 13, 2023, 15:55 Oskar Werner  wrote:

> It works, I just installed linenoise and follow instruction from eggref,
> thanks for kind reply. First time using mailing list, its nice to have good
> first impression.
>
> niedz., 13 sie 2023, 14:51 użytkownik siiky 
> napisał:
>
>> Hi,
>>
>> csi doesn't doesn't use readline or similar by default. You need to
>> install and configure one of the line-editing eggs (search for readline
>> in the eggs list[0], there 3 eggs as of now). As an example to get you
>> started, I use breadline with this config in ~/.csirc (adapted from the
>> breadline example IIRC):
>>
>>
>> (let ()
>>(import breadline breadline-scheme-completion)
>>
>>(history-file (format "~a/.config/chicken/csi_history"
>> (get-environment-variable "HOME")))
>>(stifle-history! 1)
>>(completer-word-break-characters-set! "\"\'`;|(")
>>(completer-set! scheme-completer)
>>(basic-quote-characters-set! "\"|")
>>(variable-bind! "blink-matching-paren" "on")
>>(paren-blink-timeout-set! 20)
>>(current-input-port (make-readline-port)))
>>
>>
>> I used to use linenoise with this config before (don't remember why I
>> switched):
>>
>> (import linenoise)
>> (current-input-port (make-linenoise-port))
>>
>>
>> [0]: https://eggs.call-cc.org/5/
>>
>>
>>


Re: Pass argument to function

2023-03-10 Thread Kristian Lein-Mathisen
Hi Brandon,

What you are doing looks right to me. What exactly is the error message?

"string-append" is automaticalli imported, so it should be available
without any imports. Perhaps you redifined "string-append" elsewhere in
your code? If not, there may me a problem with your CHICKEN installation.

~> rlwrap csi
#;1> (list "a" "b")
("a" "b")
#;2> (list "a" (string-append "b" "c"))
("a" "bc")


K.

On Fri, Mar 10, 2023, 15:15 Brandon Booth  wrote:

> I'm trying to learn Chicken and having issues. I'm trying to create a
> function that takes a docker container name and runs "docker inspect
> [container]."
>
> This works:
> (define test (capture "docker inspect hello-world"))
>
> This works:
> (define (str-concat str)
> (string-append "docker inspect " str))
>
> This doesn't:
> (define (inspect str)
> (capture (string-append "docker inspect " str)))
>
> I get an error that string-append is not found. How do a call capture with
> the result of string-append?
>
> Thanks.
>
> Brandon
>
>
>


Re: Threading, mailboxes, and exceptions

2023-03-06 Thread Kristian Lein-Mathisen
On Mon, Mar 6, 2023, 01:45 jared jennings  wrote:

>
>
> > Have you looked at http://api.call-cc.org/5/doc/gochan ?
>
> I haven't ever used Go so it didn't seem more comfortable than mailbox.
> I'll take another look.
>

My bad! I shound have called something more meaningful, the egg has nothing
to do with go other than that I started my API design around go's channels.
It's probably closer to Clojure's core.async.

The egg has been around for a while and should be pretty stable now. It is
a bit complicated though, and prabably inefficient. Let me know if you run
into trouble using it.

K.


Re: How does process-fork affect mailbox and threads

2022-09-26 Thread Kristian Lein-Mathisen
It's worth noting that srfi-18, mailbox and gochan operate within a single
OS process. Green threads  they
are called. Forking a process is a very different beast to tame.



K.


On Fri, Sep 23, 2022, 11:17  wrote:

> > 1) The SRFI-18 egg has not reached version 1. Which threading egg do you
> > recommend for my simple case?
>
> There is really just this one egg for threading. The version number
> you should ignore - the code is in production use for ages.
>
>
> felix
>
>
>


Re: bug passing a % sign to uri-common / spiffy

2022-01-04 Thread Kristian Lein-Mathisen
Hi,

Are you calling intarweb#read-urlencoded-request-data [1] with the JSON
data? I think that procedure only handles form-data. You have to parse JSON
yourself, using json,medea or cjson.

[1] http://api.call-cc.org/5/doc/intarweb/read-urlencoded-request-data

K.

On Tue, Jan 4, 2022, 05:21 masukomi  wrote:

> I'm working on a small webapp with a JSON api. I've stumbled across a bug
> where I can't POST JSON with a % sign in it or it'll blow up.
>
> for example if i POST this json:
>
> ```
> {
> "foo": "%"
> }
> ```
>
> i get this stack trace
> ```
> [Mon Jan  3 23:08:44 2022] "POST http://localhost:5749/json/sanity-check/
> HTTP/1.1" Error: (string->symbol)
> bad argument type - not a string
> #f
>
> [bunch of irrelevant stuff]
> router.scm:249: intarweb#read-urlencoded-request-data
> spiffy.scm:509: k625
> spiffy.scm:497: g628
> spiffy.scm:511: handle-exception
> spiffy.scm:512: chicken.port#with-output-to-string
> ```
>
> (router.scm is mine)
>
> Unfortunately that section of spiffy is a long and complex method and the
> error handler is surrounding a LOT of functionality, so it's not clear to
> what's blowing up.
>
> I tried bringing the uri-common.scm (since it seems plausible that this is
> a decoding issue) and spiffy.scm into my project and compiling them into
> the app (one at a time) but I always end up with this error:
>
> ```
> Error: during expansion of (import-syntax ...) - unbound variable: 
> ```
>
> I'm happy to debug things but I could really use some help. Maybe if
> someone could tell me the magic incantation to include a file from an egg
> without that error so that I could then start breaking it down and
> eliminating problems?
>
>
> Any insight would be appreciated.
> Thanks.
>
> - Kay Rhodes
> https://masukomi.org
>


Re: possible bug in the fmt egg?

2021-12-28 Thread Kristian Lein-Mathisen
Hi Kurt,

Thank you for reporting that. Looks like it's been fixed upstream now. The
egg seems to be at 8.11.2 still, but I guess the fix will reach the egg on
next merge/release.

K.



On Sat, Dec 25, 2021, 02:37 T. Kurt Bond  wrote:

> I'll note that SRFI 166 (which seems to have replaced fmt in chibi-scheme
> 0.10, which I *think* is Alex Shinn's own scheme) has a issue that seems
> similar, but not quite the same:
>
> $ chibi-scheme
> > (import (srfi 166))
> > (show #f (numeric/si 1024))
> "1k"
> > (show #f (numeric/si 0))
> ERROR in "inexact->exact": exact: not a finite number: +inf.0
> > (show #f (numeric/si -1))
> ERROR in "floor": invalid type, expected Number: 0.0+0.45479211794728047i
> >
>
>
>  I suspect the fmt code is related to the SRFI 166 code.  I just tried
> this with chibi-scheme head, and it has the same result.  I've add an
> issue on the chibi-scheme github repo:
> https://github.com/ashinn/chibi-scheme/issues/801
>
> On Thu, Dec 23, 2021 at 4:51 PM Mario Domenech Goulart <
> ma...@parenteses.org> wrote:
>
>> Hi Kristian,
>>
>> On Mon, 18 Oct 2021 23:27:25 +0200 Kristian Lein-Mathisen <
>> kristianl...@gmail.com> wrote:
>>
>> > I'm playing with the fmt egg and I think I've stumbled upon a problem:
>> >
>> > ~> csi -R fmt -P '(fmt #f (num/si 1024))'
>> > "1Ki"
>> > ~> csi -R fmt -P '(fmt #f (num/si 0))'
>> > Error: (log) log of exact 0 is undefined: 0
>> > klm@pisa ~ [70]> csi -R fmt -P '(fmt #f (num/si -1))'
>> > Error: (floor) bad argument type - not a real: 0.0+0.453236014182719i
>> >
>> > I couldn't find the upstream repo to report to, so I thought I'd try
>> here.
>>
>> The upstream repository is the CHICKEN Subversion repository.
>>
>> You can get a copy of it with:
>>
>>   $ svn co
>> https://anonym...@code.call-cc.org/svn/chicken-eggs/release/5/fmt/trunk
>> fmt
>>
>> The author of fmt is Alex (Cc'ed).
>>
>> All the best.
>> Mario
>> --
>> http://parenteses.org/mario
>>
>>
>
> --
> T. Kurt Bond, tkurtb...@gmail.com, https://tkurtbond.github.io
>
>


new egg: opencl

2021-10-19 Thread Kristian Lein-Mathisen
Hi!

I've been experimenting with OpenCL these past few days. I think the code
might be worthy of becoming an egg. I did learn OpenCL as I went along
writing this, so problems are very possible. I still hope it can be useful
to someone. I was surprised how easy this was to test, unlike code
associated with OpenGL and other sibling projects.

test-new-egg says "Egg looks ok!".
release-info file is here:
https://raw.githubusercontent.com/kristianlm/chicken-opencl/master/opencl.release-info
Wiki page is up here: http://wiki.call-cc.org/eggref/5/opencl

Thank you!
K.


possible bug in the fmt egg?

2021-10-18 Thread Kristian Lein-Mathisen
Hi,

I'm playing with the fmt  egg and I
think I've stumbled upon a problem:

~> csi -R fmt -P '(fmt #f (num/si 1024))'
"1Ki"
~> csi -R fmt -P '(fmt #f (num/si 0))'
Error: (log) log of exact 0 is undefined: 0
klm@pisa ~ [70]> csi -R fmt -P '(fmt #f (num/si -1))'
Error: (floor) bad argument type - not a real: 0.0+0.453236014182719i

I couldn't find the upstream repo to report to, so I thought I'd try here.

Thanks,
K.


Egg: chicken-rocksdb

2021-06-25 Thread Kristian Lein-Mathisen
Hi,

I've written some bindings for Facebook's RocksDB which I wish to publish.
Here's my release-info file:
https://raw.githubusercontent.com/kristianlm/chicken-rocksdb/master/rocksdb.release-info

test-new-egg reports "Egg looks ok!"

Thanks,
K.


Re: Build static binaries of chicken apps in a docker container

2021-06-20 Thread Kristian Lein-Mathisen
Hi Theo,

Thanks for sharing that! I had I similar problem and wanted to share what I
arrived at.

If there is a C-compiler on the target, you could compile to .c or even .o
and link on the target side. Unfortunately, that needs fiddling a bit
around with compiler and linker flags.

Another solution is to compile the static chicken as a static executable.
-static to csc makes it compile the Chicken runtime (so no libchicken.so)
and eggs in statically. But you can tell gcc to take it a step further and
link statically as well (-L -static). This will grab libc and friends from
your build machine. Sometimes that might work and requires very little
fiddling around with compiler flags.

csc -L -static -static mymod.scm

K.


On Sun, Jun 20, 2021, 17:53 Théo Cavignac  wrote:

> Hi,
>
> I wanted to write and compile Chicken apps on my linux laptop and use
> them on some super computer I have access to.
>
> I naturally chose to compile static app with "csc -static main.scm -o
> main" which would link my app against a shared glibc version.
>
> While that is what I wanted, I encountered the problem that my Arch
> based distro has a very recent libc version, hence producing
> incompatible binary with the CentOS 6 supercomputer (for stability sake
> those are always running on super old OS).
>
> As a solutions I came up with a simple procedure that build my app
> inside a Debian Stable based docker container and extract the file.
>
> I figured it may be interesting for other people here so I want to share
> my script with you: https://github.com/Lattay/chicken-build-static.
>
> Currently is uses my own Chicken docker images (Images:
> https://hub.docker.com/r/lattay/chicken , Dockerfile:
> https://github.com/Lattay/chicken_docker ) so it can work on AMD64 or
> ARMv7 (nice for RPi 2 and 3), but it is very simple and can easily be
> used for other base images.
>
> If you are interested in this but the script does not does exactly do
> what you want, feel free to submit an issue, a PR or to send me a mail.
>
> Cheers,
>
> Théo
>
>
>
>


Re: Trying to link in modules

2021-06-20 Thread Kristian Lein-Mathisen
Hi Kurt,

I think the problem is missing flags and parameters when fuilding a static
extension. I'm afraid I don't know exactly what they are, but hopefully I
can give some pointers to how you can find them.

chicken-install will extensions first as a shared object, and then as a
static one by default.

~/p/t/chicken-mtest > cat mymod.egg
((components
(extension mymod)))
~/p/t/chicken-mtest > chicken-install -v

/data/data/com.termux/files/home/prj/tmp/chicken-mtest/mymod.link -host -D
compiling-extension -c -unit mymod -D compiling-static-extension -C
-I/data/data/com.termux/files/home/prj/tmp/chicken-mtest -O2 -d1 mymod.scm
-o
/data/data/com.termux/files/home/prj/tmp/chicken-mtest/mymod.static.o


That gives a lot of output, but notice it installs a mymod.o file that
trymod can use when compiled statically. Let's see how trymod behaves as
normally:

~/p/t/chicken-mtest > csc trymod.scm
~/p/t/chicken-mtest > strace ./trymod ^&1 |grep mymod
newfstatat(AT_FDCWD,
"/data/data/com.termux/files/usr/lib/chicken/11/mymod.so",
{st_mode=S_IFREG|0755, st_size=13232, ...}, 0) = 0
newfstatat(AT_FDCWD,
"/data/data/com.termux/files/usr/lib/chicken/11/mymod.so",
{st_mode=S_IFREG|0755, st_size=13232, ...}, 0) = 0
openat(AT_FDCWD, "/data/data/com.termux/files/usr/lib/chicken/11/mymod.so",
O_RDONLY|O_CLOEXEC) = 3
 openat(AT_FDCWD,
"/data/data/com.termux/files/usr/lib/chicken/11/mymod.so",
O_RDONLY|O_CLOEXEC) = 3
 write(1, "Hello, World, I'm in mymod!\n", 28Hello, World, I'm in mymod!


And now with static compilation:

~/p/t/chicken-mtest > csc -static trymod.scm
~/p/t/chicken-mtest > strace ./trymod ^&1 |grep mymod
write(1, "Hello, World, I'm in mymod!\n", 28Hello, World, I'm in mymod!


I hope that is what you're after. Note this uses the installed version of
mymod (chicken-status), not the one in PWD. You can inspect the *.build.sh
files that chicken-install produces for inspiration, or tweak the .egg-file
to suit your needs.

Cheers,
Kris

On Sun, Jun 20, 2021, 09:57 T. Kurt Bond  wrote:

> I've got a module mymod in mymod.scm:
>
> (module mymod (hello)
>   (import scheme)
>   (define (hello)
> (display "Hello, World, I'm in mymod!")
> (newline)))
>
> and I've got a module trymod in trymod.scm:
>
> (module trymod ()
>   (import scheme)
>   (import mymod)
>   (hello)
>   )
>
> and when I compile them like this:
>
> csc -s -J mymod.scm
> csc -s mymod.import.scm
> csc trymod.scm
>
> it produces an executable trymod that runs and dynamically loads mymod.so,
> unloads it, and loads it again, then produces the expected output, calling
> the function hello in mymod as running it on macOS with 
> DYLD_PRINT_LIBRARIES=YES
> ./trymod shows.
>
> ...
> dyld: loaded: <59A8239F-C28A-3B59-B8FA-11340DC85EDC>
> /usr/lib/libc++.1.dylib
> dyld: loaded:  ./mymod.so
> dyld: unloaded:  ./mymod.so
> dyld: loaded:  ./mymod.so
> Hello, World, I'm in mymod!
>
>  However, I can't figure out how to do the same thing with mymod as
> non-shared objects.   I tried
>
> csc -c -J mymod.scm
> csc -c mymod.import.scm
> csc -static -o trymod.static mymod.o mymod.import.o trymod.scm
>
> but I got
>
> Undefined symbols for architecture x86_64:
>
>   "_C_mymod_toplevel", referenced from:
>   _f_138 in trymod.o
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> Error: shell command terminated with non-zero exit status 256: 'clang'
> 'mymod.import.o' 'mymod.o' 'trymod.o' -o 'trymod.static' -m64
> -L/usr/local/Cellar/chicken/5.2.0/lib
> /usr/local/Cellar/chicken/5.2.0/lib/libchicken.a -lm
>
>
> What am I doing wrong?
> --
> T. Kurt Bond, tkurtb...@gmail.com, https://tkurtbond.github.io
>


Re: Chicken git egg: bug & patch

2021-06-14 Thread Kristian Lein-Mathisen
Hi Megane,

Like Evan says, the libgit2 project doesn't keep your pointers around so
that should be safe. But thanks for pointing that out, errors caused by
these things are very hard to track down.

I'd actually never thought about a off-gc memory heap before. That is a
very interesting idea! I'm sure it's overkill for the git egg, but I will
definitely keep it in mind on my next memory management adventures.

K.


On Mon, Jun 14, 2021, 10:42 Evan Hanson  wrote:

> I think we can probably just use blobs and locatives to keep things
> simple, without needing to involve finalizers or similar tricks.  This
> library is pretty good about leaving memory management up to the client,
> and they provide an object for indirection (the git_buf) when that's not
> possible. I'll have a look when I get a chunk of spare time.
>
> Thank you Kristian for digging into this, it is very helpful.
>
> Evan
>
>


Re: Chicken git egg: bug & patch

2021-06-14 Thread Kristian Lein-Mathisen
Hi,

Indeed. We could malloc and set-finalizer! and that should work and be
safe. However, as far as I understand, this approach has some disadvantages:

- malloc is relatively slow compared to chicken's internal allocation (eg
make-string) that uses the stack
- there is a practical limit on finalizers that Chicken can handle
- large number of set-finalizer!s will slow things down

I forgot to mention that I don't want to go for this approach in this case
because it will impact us heavily, since we allocate oid objects a lot. I
believe that is why Evan went for the alternative make-primitive method. So
I think we really _want_ to involve the Chicken GC, but we need to give it
some more info than just a #.

I've used this make-blob approach that is in the attached patches before,
with success. Unfortunately, it doesn't integrate well with the foreigners
egg, but I hope it is still a good candidate here for the oid, buf and
revspec structures.

K.


On Mon, Jun 14, 2021, 07:10 megane  wrote:

>
> Kristian Lein-Mathisen  writes:
>
> > From what I gather, there is no way to allocate memory and return a
> pointer
> > to it, safely, in CHICKEN.
> > Won't the garbage collector potentially overwrite whatever region was
> > allocated since it has no way of knowing it?
>
> There's allocate from chicken.memory that does just that. It allocates
> using 'malloc', and chicken GC will have no knowledge or way of
> interfering with the memory. Free the memory using 'free' from the same
> module.
>
>


Re: Chicken git egg: bug & patch

2021-06-13 Thread Kristian Lein-Mathisen
Hi Evan,

And thanks for getting back to me. I found another problem related to
memory corruption and I've been digging around. I have patches for that
too, but I don't know if they suffice. They sort of break existing
conventions of everything in libgit2 being foreigners and c-pointers.

I'm attaching my patches here in case you have time to look into this.
The attachments here include the fixes in the previous mail too, so please
ignore that one.

>From what I gather, there is no way to allocate memory and return a pointer
to it, safely, in CHICKEN.
Won't the garbage collector potentially overwrite whatever region was
allocated since it has no way of knowing it?
That's why I made (make-oid) and friends return chicken blobs instead. Let
me know if there's a better way!

K.

On Sun, Jun 13, 2021 at 11:19 PM Evan Hanson  wrote:

> Hi Kristian,
>
> On 2021-06-12 15:36, Kristian Lein-Mathisen wrote:
> > I think I may have come across a bug in the git egg.
>
> You're right! THanks for pointing this out, I guess you must be the
> first person to use that `frombuffer` procedure.
>
> Everything you've said looks correct to me, I'll try to publish a fix
> for this soon.
>
> Evan
>
From 602f415a5fe769b786efb2abd03a480661b6e0c4 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen 
Date: Sun, 13 Jun 2021 22:56:18 +0200
Subject: [PATCH 1/3] Fix mismatched blob-create-frombuffer signature

Before this patch, the new test case would produce an error like this:

Error: bad argument count - received 2 but expected 3: #
---
 git.scm   | 2 +-
 libgit2.scm   | 2 +-
 tests/run.scm | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/git.scm b/git.scm
index b33cd45..c8762d1 100644
--- a/git.scm
+++ b/git.scm
@@ -785,7 +785,7 @@
  (git-blob-lookup
   repo*
   (cond ((chicken-blob? source)
- (git-blob-create-frombuffer repo* source))
+ (git-blob-create-frombuffer repo* source (number-of-bytes source)))
 ((string? source)
  (if (regular-file? source)
  (git-blob-create-fromdisk repo* source)
diff --git a/libgit2.scm b/libgit2.scm
index a1e095c..83334c3 100644
--- a/libgit2.scm
+++ b/libgit2.scm
@@ -295,7 +295,7 @@
 (define blob-lookup-prefix  (foreign-lambda/allocate blob* git_blob_lookup_prefix repository oid unsigned-int))
 (define blob-create-fromdisk(foreign-lambda/allocate oid git_blob_create_fromdisk repository nonnull-c-string))
 (define blob-create-fromworkdir (foreign-lambda/allocate oid git_blob_create_fromworkdir repository nonnull-c-string))
-(define blob-create-frombuffer  (foreign-lambda/allocate oid git_blob_create_frombuffer repository nonnull-c-string unsigned-int))
+(define blob-create-frombuffer  (foreign-lambda/allocate oid git_blob_create_frombuffer repository nonnull-scheme-pointer size_t))
 (define blob-id (foreign-lambda/copy oid git_blob_id blob*))
 (define blob-free   (foreign-lambda void git_blob_free blob*))
 (define blob-rawcontent (foreign-lambda c-pointer git_blob_rawcontent blob*))
diff --git a/tests/run.scm b/tests/run.scm
index b73e97f..7ede8da 100644
--- a/tests/run.scm
+++ b/tests/run.scm
@@ -393,6 +393,7 @@
 
 (test-group "blob"
   (test-error "blob with nonexistent sha" (blob repo (make-string 40 #\a)))
+  (test "create-blob from memory source" 4 (blob-length (create-blob repo #${41424344})))
   (let ((t (commit-tree commit)))
 (with-current-directory repo-path
  (lambda ()
-- 
2.31.1

From 621f8a0178d2f66470ca978716b4a62f33f2dd90 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen 
Date: Mon, 14 Jun 2021 01:17:20 +0200
Subject: [PATCH 3/3] Fix for memory corruption

There seems to be a problem with foreign-primitive related
allocations. If the garbage collector runs right after (make-oid) and
friends, the returned pointer is no longer valid.

~/p/chicken-git (master)> cat stress.scm
(import git)
(define repo (create-repository "tmp" #t))
(let loop ()
  (create-blob repo #${4142})
  (loop))
~/p/chicken-git (master)> valgrind csi -s stress.scm
...
==56676== Invalid read of size 1
==56676==at 0x5479264: git_oid_is_zero (in /usr/lib/libgit2.so.1.1.0)
==56676==by 0x5474509: git_odb_read (in /usr/lib/libgit2.so.1.1.0)
==56676==by 0x547154A: git_object_lookup_prefix (in /usr/lib/libgit2.so.1.1.0)
==56676==by 0x53DF95E: f_12197 (in /usr/lib/chicken/11/git.libgit2.so)
==56676==by 0x48F4FF0: ??? (in /usr/lib/libchicken.so.11)
==56676==by 0x491900A: ??? (in /usr/lib/libchicken.so.11)
==56676==by 0x49267B4: ??? (in /usr/lib/libchicken.so.11)
==56676==by 0x4B012B7: CHICKEN_run (in /usr/lib/libchicken.so.11)
==56676==by 0x4B02813: CHICKEN_main (in /usr/lib/libchicken.so.11)
==56676==by 0x4D7BB24: (below main) (in /usr/lib/libc-2.33.so)
==56676==  A

Chicken git egg: bug & patch

2021-06-12 Thread Kristian Lein-Mathisen
Hi!

I think I may have come across a bug in the git egg.

klm@pisa ~/.c/chicken-install> chicken-status  | grep git
git . version: 0.1.0
klm@pisa ~/.c/chicken-install> csi -R git -P '(define r (create-repository
"/tmp/repo")) (create-blob r #${abba})'
#

Error: bad argument count - received 2 but expected 3: #
...

I have managed to put together this patch which seems to fix the problem:

klm@pisa ~/.c/c/git (master)> git diff
diff --git a/git.scm b/git.scm
index b33cd45..c8762d1 100644
--- a/git.scm
+++ b/git.scm
@@ -785,7 +785,7 @@
  (git-blob-lookup
   repo*
   (cond ((chicken-blob? source)
- (git-blob-create-frombuffer repo* source))
+ (git-blob-create-frombuffer repo* source (number-of-bytes
source)))
 ((string? source)
  (if (regular-file? source)
  (git-blob-create-fromdisk repo* source)
diff --git a/libgit2.scm b/libgit2.scm
index a1e095c..0c724dd 100644
--- a/libgit2.scm
+++ b/libgit2.scm
@@ -295,7 +295,7 @@
 (define blob-lookup-prefix  (foreign-lambda/allocate blob*
git_blob_lookup_prefix repository oid unsigned-int))
 (define blob-create-fromdisk(foreign-lambda/allocate oid
git_blob_create_fromdisk repository nonnull-c-string))
 (define blob-create-fromworkdir (foreign-lambda/allocate oid
git_blob_create_fromworkdir repository nonnull-c-string))
-(define blob-create-frombuffer  (foreign-lambda/allocate oid
git_blob_create_frombuffer repository nonnull-c-string unsigned-int))
+(define blob-create-frombuffer  (foreign-lambda/allocate oid
git_blob_create_frombuffer repository nonnull-scheme-pointer unsigned-int))
 (define blob-id (foreign-lambda/copy oid git_blob_id
blob*))
 (define blob-free   (foreign-lambda void git_blob_free blob*))
 (define blob-rawcontent (foreign-lambda c-pointer
git_blob_rawcontent blob*))
@@ -303,9 +303,9 @@
 (define blob-is-binary  (foreign-lambda bool git_blob_is_binary
blob*))

 (define blob*-lookup blob-lookup)
-(define blob*-create-frombuffer  blob-create-fromdisk)
-(define blob*-create-fromdiskblob-create-fromworkdir)
-(define blob*-create-fromworkdir blob-create-frombuffer)
+(define blob*-create-frombuffer  blob-create-frombuffer)
+(define blob*-create-fromdiskblob-create-fromdisk)
+(define blob*-create-fromworkdir blob-create-fromworkdir)
 (define blob*-free   blob-free)
 (define blob*-id blob-id)
 (define blob*-is-binary  blob-is-binary)

The fix has 3 parts:

- adding the missing number-of-bytes to blob-create-frombuffer
- changes blob-create-frombuffer signature to accept nonnull-scheme-pointer
instead of nonnull-c-string so that we don't have to blob->string
- rearranges mismatched fromworkdir, frombuffer and fromdisk (although I
don't know if that's necessary to fix the problem above)

I don't know if this is sufficient to qualify for a commit upstream, but
now my code snippet works:

klm@pisa /t/repo (master)> csi -R git -P '(define r (create-repository
"/tmp/repo")) (create-blob r #${abba})'
#
#
klm@pisa /t/repo (master)> git cat-file blob 79efd60 | xxd
: abba ..

I'm hoping this can be looked into.
Thanks,
K.


Re: "Live coding" on Mac OS X

2021-05-27 Thread Kristian Lein-Mathisen
Hi Arnaud,

I know I'm a bit late here, but did you get this working? When you say "not
working", what is/isn't happening? Is it your REPL that's not responding,
or your game-thread?

Sometimes these things are caused by the REPL i/o blocking the game-thread.
That is, the read on stdin from the main thread is blocking the
game-threads Perhaps that is what you are seeing. If so, just giving the
REPL a newline should unfreeze the game-thread.

For various technical reasons, this blocking i/o is often less
problematical on a REPL that's over a network port instead of just stdin.
You could try hosting the repl with the nrepl egg, start it outside of
emacs, and connect to it from emacs with `C-u run-scheme nc localhost 1234`
for example.

This sort of thing is a pretty common problem, unfortunately, were srfi-18
threads can easily block each other. Here is one session where we worked
through this. Maybe the code here might be helpful to you:
https://paste.call-cc.org/paste?id=dc1ec82557b9ea5846ec976a9987d53d83f401e3

K.

On Tue, May 11, 2021, 16:26 Arnaud Bailly  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA256
>
> Thanks for your answer Vasilij!
>
> You're right, this works when I copy/paste in the REPL And define from
> there, but not when I evaluate it from Emacs buffer.
> I am using basic scheme-mode with run-scheme function and using C-M-x to
> evaluate top-level definition and send it to the REPL which "should" work
> but seems like it's not.
>
> - --
> - --
> Arnaud Bailly - @dr_c0d3
>
> On 2021-05-11 at 14:16, m...@vasilij.de wrote:
> > Hello Arnaud,
> >
> > > But it's not working properly: What I observe is that when I change a
> > > procedure that's called from the background thread, the thread becomes
> > > blocked. Is this some new behaviour that's not taken into account in
> > > those posts?
> >
> > It's tricky to reproduce such issues without a minimal repro. I wrote my
> > own and I do not experience such behavior. When I run the attached file
> > with `csi -:x test.scm`, I see it printing 1 every 10s. I can then
> > copy-paste `(define (game-loop-iteration) (print 2))` into the REPL and
> > if I wait another 10 seconds, it prints 2. Do you have the same
> > behavior? If yes, then chances are it's the fault of the code change
> > (for example it might perform a thread blocking operation).
> >
> > > $ csi -version
> > > CHICKEN
> > > (c) 2008-2020, The CHICKEN Team
> > > (c) 2000-2007, Felix L. Winkelmann
> > > Version 5.2.0 (rev 317468e4)
> > > macosx-unix-clang-x86-64 [ 64bit dload ptables ]
> > >
> > > I am on Mac OS X Catalina 10.15.7.
> >
> > I'm on the same CHICKEN version, but on Arch Linux.
> >
> > Vasilij
> -BEGIN PGP SIGNATURE-
> Version: FlowCrypt Email Encryption 8.0.6
> Comment: Seamlessly send and receive encrypted email
>
> wsFzBAEBCAAGBQJgmpP7ACEJEAgADOwkMld2FiEENp8aNWMznkzbE41KCAAM
> 7CQyV3bwGA//djzC+xN0djgNOs29OWsCPayOnVTZg1UN138Onk72m6QzaDs2
> DozVEWL11hg2uJOvOQVDWSYdPFdau6+gIdsK3MIHmrREhYknMU3zp5S7axVg
> 8zT3sU3451/6LHLxpnv8ObmuwBEzGXfxj4UieXlWv7pVkhbFxSLy0n8JJtAN
> z6Dbt3l/WDjRPYqAJGiQo0AapZqVmRRcXGSa4z7pcBPY2dbHPVuxAP4/vLuN
> 43zZDQ+em7oKn5Q7k7tLXF+Ho3/0AX04Cd8pS1TERp+mAAuKqRK52mIKxpoh
> nQHewJxLuklaQdATI6uuzPmTQUkGYVzoWmgsSfqy0eRnSNtymLgAs/roWkrD
> /fgw2A81VTb4Q+D8rEQ7E/pIk4ARUH7yRM8UTbB/l5pAdjGlJfgbz0A35eLy
> ENsCUU7x/jnWPJuhe2Oa0JSwOhsS6Bz4vie1CpsDRJftqr+jyg+E3Wg/32sw
> ECuWO/+uDHUYYsoannCwuSuZA/OZe51F0V2FuwqYYkSLL16oBJ665CzWtnpX
> bfSuj8ACe5qD4zGOQlfVVQeFD4ig/etjkHpKHTctGq1cPa9v6VCHUr+CiDJm
> JuyKEhKO5LYW23IapTfoyS9o30yv3HYfaKVSrz5KbaoPsbFBYI3SMmV5V2PP
> yxDja2AuMAp0v+McZi5+AzR1yRUWs70kWUk=
> =5yE8
> -END PGP SIGNATURE-
>


Re: 【Deployment】

2020-08-29 Thread Kristian Lein-Mathisen
oplevel(C_word
> c,C_word *av) C_noret;$/;" v
> C_port_toplevel port.c /^void C_ccall C_port_toplevel(C_word c,C_word
> *av){$/;"f
>
> It seemed that "port.c" must have C_port_toplevel. I copied that in the
> directory I was working, and tried compiling the files again.
>
> ➜  poichan-01 gcc -DHAVE_CHICKEN_CONFIG_H poichan-01-1.c -I . runtime.c
> library.c eval.c expand.c modules.c internal.c chicken-syntax.c
> build-version.c extras.c data-structures.c format.c port.c -lm -o
> poichan-01-1
>
> /usr/bin/ld: /tmp/cc0KJnH4.o: in function `main':
> format.c:(.text+0x50772): multiple definition of `main';
> /tmp/ccs80BV2.o:poichan-01-1.c:(.text+0x4610): first defined here
> /usr/bin/ld: /tmp/cc0KJnH4.o: in function `C_toplevel':
> format.c:(.text+0x5079f): multiple definition of `C_toplevel';
> /tmp/ccs80BV2.o:poichan-01-1.c:(.text+0x463d): first defined here
> collect2: error: ld returned 1 exit status
>
> AGAAIN!  What the hens happened???
>
> So, I've tried fixing this problem and taken time...
>
> Well, there are some things I've noticed.
>
> 1. Don't use egg libraries if I want to compile my script into a C source.
> Stay in Chicken.
> 2. Arguments of the compiler become too long. Now is the time to learn
> how to make Makefile.
>
> Well, this was a tough adventure.
>
> Thanks.
>
> 2020年8月15日(土) 18:42 Kristian Lein-Mathisen :
>
>>
>> Hi,
>>
>> I'm glad that helped. But I suppose I should have explained my process,
>> instead of just giving you the end result - which clearly doesn't work once
>> you start adding imports like you have.
>>
>> The error messages you're seeing (undefined reference to
>> `C_extras_toplevel') are coming from your C compilier. They mean that
>> your program is using a function which isn't defined anywhere, so we need
>> to find where C_extras_toplevel is defined.
>>
>> There are probably a hundred different ways of finding the .c file which
>> defines a function. Here's and one. Install ctags and then run this:
>>
>>  ~/o/chicken-5.2.0rc1  ➤ ctags *.c
>> # creates a "grepable" file called tags
>>
>> ~/o/chicken-5.2.0rc1  ➤ grep C_extras_toplevel tags
>> C_extras_toplevel   extras.c/^void C_ccall
>> C_extras_toplevel(C_word c,C_word *av){$/;"f   typeref:typename:void
>> C_ccall
>> # so it seems we need extras.c too
>>
>>  ~/o/chicken-5.2.0rc1  ➤ grep C_data_2dstructures_toplevel tags
>> C_data_2dstructures_topleveldata-structures.c   /^void C_ccall
>> C_data_2dstructures_toplevel(C_word c,C_word *av){$/;"   f
>>  typeref:typename:void C_ccall
>> # and data-structures.c
>>
>>  ~/o/chicken-5.2.0rc1  ➤ gcc -DHAVE_CHICKEN_CONFIG_H hello.c -I .
>> runtime.c library.c eval.c expand.c modules.c internal.c chicken-syntax.c
>> build-version.c extras.c data-structures.c -lm -llog -o hello
>>
>> Adding those two files to the gcc command should get your program to
>> compile properly. If not, you can find the missing .c files by grepping
>> `tags`.
>>
>> Hope that helps.
>> K.
>>
>> On Sat, Aug 15, 2020, 02:57 亀田馬志  wrote:
>>
>>> Hello.
>>>
>>> >  gcc -DHAVE_CHICKEN_CONFIG_H hello.c -I . runtime.c library.c eval.c
>>> expand.c modules.c internal.c chicken-syntax.c build-version.c -lm -o hello
>>>
>>> Oh, yes. It works! Great! Thank you!
>>>
>>> But..
>>>
>>> I wrote a script like this.
>>>
>>> (import format (chicken io) (chicken string) (chicken process-context))
>>>
>>> (require-extension srfi-13)
>>>
>>> (let ((file-name (car (command-line-arguments
>>>   (with-input-from-file file-name
>>> (lambda ()
>>>   (let loop ((ls0 '()) (c (read-line)))
>>> (if (eof-object? c)
>>> (for-each (lambda (x)
>>> (format #t
>>> "時刻:~A秒,北緯:~A度~A分,東経:~A度~A分~%"
>>> (+ (* (cadar x) 60) (caddar x))
>>> (string-take (cadr x) 2)
>>> (string-drop (cadr x) 2)
>>> (string-take (caddr x) 3)
>>> (string-drop (caddr x) 3)))
>>>   (reverse ls0))
>>> (let ((ls1 (string-split c ",")))
>>>   (if (string=? (car ls1) "$GPGGA")
>>>   (loop (cons `(,(map string->nu

Re: 【Deployment】

2020-08-15 Thread Kristian Lein-Mathisen
Hi,

I'm glad that helped. But I suppose I should have explained my process,
instead of just giving you the end result - which clearly doesn't work once
you start adding imports like you have.

The error messages you're seeing (undefined reference to
`C_extras_toplevel') are coming from your C compilier. They mean that your
program is using a function which isn't defined anywhere, so we need to
find where C_extras_toplevel is defined.

There are probably a hundred different ways of finding the .c file which
defines a function. Here's and one. Install ctags and then run this:

 ~/o/chicken-5.2.0rc1  ➤ ctags *.c
# creates a "grepable" file called tags

~/o/chicken-5.2.0rc1  ➤ grep C_extras_toplevel tags
C_extras_toplevel   extras.c/^void C_ccall
C_extras_toplevel(C_word c,C_word *av){$/;"f   typeref:typename:void
C_ccall
# so it seems we need extras.c too

 ~/o/chicken-5.2.0rc1  ➤ grep C_data_2dstructures_toplevel tags
C_data_2dstructures_topleveldata-structures.c   /^void C_ccall
C_data_2dstructures_toplevel(C_word c,C_word *av){$/;"   f
 typeref:typename:void C_ccall
# and data-structures.c

 ~/o/chicken-5.2.0rc1  ➤ gcc -DHAVE_CHICKEN_CONFIG_H hello.c -I . runtime.c
library.c eval.c expand.c modules.c internal.c chicken-syntax.c
build-version.c extras.c data-structures.c -lm -llog -o hello

Adding those two files to the gcc command should get your program to
compile properly. If not, you can find the missing .c files by grepping
`tags`.

Hope that helps.
K.

On Sat, Aug 15, 2020, 02:57 亀田馬志  wrote:

> Hello.
>
> >  gcc -DHAVE_CHICKEN_CONFIG_H hello.c -I . runtime.c library.c eval.c
> expand.c modules.c internal.c chicken-syntax.c build-version.c -lm -o hello
>
> Oh, yes. It works! Great! Thank you!
>
> But..
>
> I wrote a script like this.
>
> (import format (chicken io) (chicken string) (chicken process-context))
>
> (require-extension srfi-13)
>
> (let ((file-name (car (command-line-arguments
>   (with-input-from-file file-name
> (lambda ()
>   (let loop ((ls0 '()) (c (read-line)))
> (if (eof-object? c)
> (for-each (lambda (x)
> (format #t
> "時刻:~A秒,北緯:~A度~A分,東経:~A度~A分~%"
> (+ (* (cadar x) 60) (caddar x))
> (string-take (cadr x) 2)
> (string-drop (cadr x) 2)
> (string-take (caddr x) 3)
> (string-drop (caddr x) 3)))
>   (reverse ls0))
> (let ((ls1 (string-split c ",")))
>   (if (string=? (car ls1) "$GPGGA")
>   (loop (cons `(,(map string->number
>   (string-chop (list-ref ls1 1) 2))
> ,(list-ref ls1 2)
> ,(list-ref ls1 4)) ls0) (read-line))
>   (loop ls0 (read-line)
>
> Sorry, some Japanese are mixed. But. Anyway.
> I try compiling with your way, and gcc gives me an error like this.
>
> /usr/bin/ld: /tmp/ccxVWfZy.o: in function `f_223':
> poichan-01-1.c:(.text+0x765): undefined reference to `C_extras_toplevel'
> /usr/bin/ld: /tmp/ccxVWfZy.o: in function `f_226':
> poichan-01-1.c:(.text+0x92d): undefined reference to
> `C_data_2dstructures_toplevel'
> collect2: error: ld returned 1 exit status
>
> H Is there something wrong on the code?
> What are the C_extras_toplevel and C_data_wdstructures_toplevel?
>
> If I used some libraries from chicken-install, should I use the compiled
> "scheme to c" file too?
>
> There must be something more to learn around the Chicken Scheme more.
>
> Anyway, you have helped me a lot! Thank you.
>
>
> 2020年8月13日(木) 14:56 Kristian Lein-Mathisen :
>
>>
>> Hi,
>>
>> I managed to get something working on my termux, maybe that can help you:
>>
>> ~/o/chicken-5.2.0rc1  ➤
>> echo '(print "hello")' > hello.scm   ~/o/chicken-5.2.0rc1  ➤
>> ./csc -t hello.scm
>>  ~/o/chicken-5.2.0rc1  ➤
>> gcc -DHAVE_CHICKEN_CONFIG_H hello.c -I . runtime.c library.c eval.c
>> expand.c modules.c internal.c chicken-syntax.c build-version.c -lm -llog -o
>> hello
>>  ~/o/chicken-5.2.0rc1  ➤ ldd hello
>> libm.so
>> liblog.so
>> libdl.so
>> libc.so
>>  ~/o/chicken-5.2.0rc1  ➤ ./hello
>> hello
>>
>> You can ignore -llog unless you're on Android.
>>
>> So you don't need buildtag.h. Is there a reason you can't "csc -static
>> hello.scm" or "csc -static -C -static hello.scm" which is a more common
>> use-case?
>&g

Re: 【Deployment】

2020-08-12 Thread Kristian Lein-Mathisen
Hi,

It seems there is a chicken-bin for U20.04LTS [1], did you try compiling
hello.scm to hello.c with that? What is it that you're trying to acheive?

I don't seem to have any buildtag.h either, perhaps the manual is outdated?

Are you reading the manual for Chicken 5 [2]?

K.
[1]: https://packages.ubuntu.com/focal/interpreters/chicken-bin
  [2]:
http://wiki.call-cc.org/man/5/Deployment#distributing-compiled-c-files


On Mon, Aug 10, 2020, 21:28 亀田馬志  wrote:

> Hello.
>
> I tried following and obeying the instructions described in Deployment,
> the manual of Chicken Scheme, in order to cock-a-do-do "Distributing
> compiled C files", but it did not work well.
>
> 1. Ubuntu Repository provides no source code of Chicken Scheme
>
> I'm using Ubuntu 20.04 LTS, currently an OS under the feather, and I could
> not find the source code of Chicken Scheme in its repository. Neither in
> Debian? I do not know.
> Hen_ce, I had to build Chicken Scheme from its source code.
>
> 2. Where the chick can I find buildtag.h?
>
> I switched to using Windows 10, and made an environment of Ubuntu with
> WSL(Windows Subsystem for Linux). There I built a Chicken Scheme from its
> source, and followed the instructions. BUT. I could not find buildtag.h
> there even though the manual says "generated by the build process". Did
> I miss something? Is there any special way to get buildtag.h?
>
> 3. Anyway tried compiling "Hello World", but getting a bunch of error
> messages.
>
> I did not know whether compiling with gcc worked well or not without
> buildtag.h, but I tried. The result was a bunch of errors, something like
> this:
>
> "/usr/bin/ld: /tmp/ccJKB9L5.o: in function `C_modules_toplevel':
> modules.c:(.text+0xad58): undefined reference to
> `C_chicken_2dsyntax_toplevel'
> collect2: error: ld returned 1 exit status"
>
> Something related to toplevel stuff did not work well. As egg-spected?
> Maybe, yes.
>
> Well, is there any technique of "Distributing compiled C files" outside of
> the manual, or is there anything I did wrong(especially in the building
> process)?
>
> Thanks,
>
>
>
>
>
> 
>  ウイルス
> フリー。 www.avast.com
> 
> <#m_6593347720704535955_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>


Re: csi on Windows, Emacs and srfi 18

2020-07-05 Thread Kristian Lein-Mathisen
Hi George,

I think the problem may also be that your primordial thread is blocking all
srfi-18 threads in it's (read) call. Possibly in addition to the missing
output-flush calls.

I used to get around this in Chicken 4 by using the 'perley' egg, but it's
not available for Chicken 5. You could simply (current-input-port
(make-perley-port)) and have a non-srfi18-blocking stdin.

Maybe you could see if http://wiki.call-cc.org/eggref/5/breadline or
http://wiki.call-cc.org/eggref/5/linenoise could fix it?


Also, I found an old paste where I was having similar issues for
subprocesses. You could see if there are some useful tricks in there:
http://paste.call-cc.org/paste?id=dc1ec82557b9ea5846ec976a9987d53d83f401e3

In particular, you could try the last snippet:

;; don't block while reading anything from port p. port p must have
an;; associated filedescriptor.(define (make-nonblocking-input-port p)
  (make-input-port (lambda ()
 (thread-wait-for-i/o! (port->fileno p))
 (read-char p))
   (lambda () (char-ready? p))
   (lambda () (close-input-port p


And then add:

(current-input-port (make-nonblocking-input-port (current-input-port)))

K.


On Sun, Jul 5, 2020, 21:34 George Oliver  wrote:

> Hello Kristian and thanks for looking into this.
>
> On Sun, Jul 5, 2020 at 12:51 AM Kristian Lein-Mathisen
>  wrote:
>
> > The sys##flush-output here is what you're looking for I think. It's
> problably not being called due to tty-input? returning #f. But it might
> work to redefine it to our needs:
>
> I think this could possibly work but I couldn't get it working on my
> system. Example session on my Emacs:
>
> ===
>
> CHICKEN
> (c) 2008-2020, The CHICKEN Team
> (c) 2000-2007, Felix L. Winkelmann
> Version 5.2.0 (rev 317468e4)
> mingw32-windows-gnu-x86-64 [ 64bit dload ptables ]
>
> Type ,? for help.
> #;1> ; loading C:/Users/george/AppData/Roaming/chicken/11/
> srfi-18.import.so ...
> ; loading C:/Users/george/AppData/Roaming/chicken/11/srfi-18.so ...
> #;2>
> <   here I evaluated define foo from the example code in
> my first email in the thread
> #;3> ##sys#read-prompt-hook
> #
> #;4> (set! ##sys#read-prompt-hook (lambda () (display "test> ")
> (flush-output)))
> test> #  <--
> here I evaluated thread-start!
> test> foo
> 10
> test> foo
> 10
> test> foo
> 10
> test> ,q
>
>
> Process scheme finished
>
> ===
>
> Curiously this behavior is different than evaluating the test without
> redefining the read-prompt-hook; in that first case repeated evals of
> foo will iterate the loop in the thread-start!.
>
> I got the same result running csi from the WIndows console.
>
> I say it could possibly work because it seems like output buffering is
> an issue here, for reference see
> https://lists.gnu.org/archive/html/help-gnu-emacs/2006-04/msg00250.html.
>
> However I got farther with solution 2!
>
> >
> > = possible solution 2 =
> >
> > It's possible that using a real socket might be a feasable workaround.
> `chicken-install nrepl` and start a session (outside of emacs) with
> >
> > > csi -R nrepl -e '(nrepl 1234)'
>
> I actually had tried this earlier, but since Windows doesn't have the
> nc utility it wasn't straightforward. I found the netcat Windows
> utility but it took me a couple of tries to realize Windows was
> disabling it (via Windows Security protection).
>
> Example session:
>
> ==
>
> ;; nrepl on (C:\Users\george\bin\chicken-5.2.0\bin\csi.exe -R nrepl -e
> (nrepl 1234))
> #;><--  here I evaluate the
> import, not sure why it doesn't print the output
> #;><-- here I evaluate define foo
> #;> #  <--  evaluating thread-start!
> #;> #
> #
> #
> #
> #
> #
> #
> #
> #
> #
> 0<--- evaluating foo
> #;>
>
> 
>
> So this seems like it could work!
>
> One wrinkle is that csi toplevel commands don't seem to pass through
> netcat correctly (for example ',q' returns 'Error: unbound variable:
> unquote'). But that doesn't seem like a show stopper.
>
> There is also a possibly more robust long-term solution that I just
> learned about it. In recent Windows 10 updates MS released ConPTY,
> which is a new pseudo tty API. See
>
> https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
> .
> Currently, when Emacs creates an asynchronous subprocess, it assumes
> Windows has no PTY and defaults to using a pipe. It seems workable to
> patch Emacs to use the new ConPTY. I'm going to see about getting this
> into Emacs.
>
> thanks again, George
>
>


Re: csi on Windows, Emacs and srfi 18

2020-07-05 Thread Kristian Lein-Mathisen
Hi George,
and welcome to the community!

I made that video and I'm glad it caught your interest.

I don't know a lot about the inner workings of Chicken or Win10
pretend-tty's, and I don't have a machine available where I can test. But I
thought I'd throw in a couple of things you can try.

= possible solution 1 =

In csi.scm, I found:

 262 | (define (tty-input?)
 261   │   (or (##core#inline "C_i_tty_forcedp")
 262   │   (##sys#tty-port? ##sys#standard-input)))
 263   │
 264   │ (set! ##sys#break-on-error #f)
 265   │
 266   │ (set! ##sys#read-prompt-hook
 267   │   (let ([old ##sys#read-prompt-hook])
 268   │ (lambda ()
 269   │   (when (tty-input?) (old)) ) ) )

It seems the csi is trying to disable the input prompt unless we're
interactive.

In repl.scm, I found the hook:

(define ##sys#read-prompt-hook
  61   │   (let ((repl-prompt repl-prompt))
  62   │ (lambda ()
  63   │   (##sys#print ((repl-prompt)) #f ##sys#standa
   │ rd-output)
  64   │   (##sys#flush-output ##sys#standard-output)))
   │ )

The sys##flush-output here is what you're looking for I think. It's
problably not being called due to tty-input? returning #f. But it might
work to redefine it to our needs:

me@termux > csi
(c) 2008-2020, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.2.0rc1 (prerelease) (rev 44ea9ed5)
Type ,? for help.
#;1> ##sys#read-prompt-hook
#
#;2> (set! ##sys#read-prompt-hook (lambda () (display "test> ")
(flush-output)))
test> "new prompt!"
"new prompt!"
test> ^C

I hope that works on your win10-emacs session too. If not, you could try
this:

= possible solution 2 =

It's possible that using a real socket might be a feasable workaround.
`chicken-install nrepl` and start a session (outside of emacs) with

> csi -R nrepl -e '(nrepl 1234)'

Then, from emacs, do
C-u M-x run-scheme  nc localhost 1234
To have emacs use the networked REPL.

Best of luck!
K.

On Sat, Jul 4, 2020, 04:46 George Oliver  wrote:

> hello,
>
> I'm a new Chicken user and new to Scheme in general, and I'm working
> through an issue with csi and srfi 18 in Emacs on Windows 10 (though
> the same problem seems to exist with csi in the native terminal).
> Basically Windows doesn't properly flush output from a non-primordial
> thread. An example of what I'm trying to replicate is in this tutorial
> video, https://youtu.be/eXB3I3S3vJc?t=387 , and sample code would be:
>
> (import
>   (srfi 18))
>
> (define foo 10)
>
> (thread-start!
>  (lambda ()
>(let loop ()
>  (when (< 0 foo)
>(set! foo (sub1 foo))
>(print foo)
>(thread-sleep! 1)
>(loop)
>
>
> I think this is a general problem with Windows and was mentioned on
> this list some time ago,
> https://lists.nongnu.org/archive/html/chicken-users/2006-09/msg00222.html.
> As a reply in that thread noted,
>
> > This is a Windows-specific problem - isatty() returns #f on Windows
> inside
> > emacs. I assume select() (which is AFAIK not particularly efective on
> non-socket
> > fd's under Windows) is the problem, since either -:c or
> > ##sys#tty-port? -> #t should
> > block the thread waiting for input on fd 0 (and thus letting other
> threads run).
>
> I'm interested in trying to solve this problem and I'm wondering what
> input Chicken users have on possible solutions and workarounds (other
> than of course not using Windows or Windows/WSL). An Emacs maintainer
> commented,
>
> > Evidently, the Scheme interpreter you run assumes it is always connected
> to a terminal device.
> > But MS-Windows doesn't have Unix PTYs, so subordinate processes are run
> by Emacs via pipes,
> > and the Scheme interpreter you are using doesn't seem to like it.
>
> > The way to solve this is in the Scheme interpreter:
> > it should provide an optional behavior whereby the interactive features
> work
> > even if the standard streams are connected to a pipe, and it should
> disable buffering
> > of the standard streams in this case.
>
> Is that optional behavior workable? Or perhaps there is some other
> indirection that could achieve the same result.
>
> In case it matters my ultimate goal here is to interactively develop
> while the program is running.
>
> thanks for any advice, George
>
>


Re: Tidy way to test and set when using test egg?

2020-01-10 Thread Kristian Lein-Mathisen
Hi Matt,

So you want to keep the result for more upcoming test? Why? Just curious.

I've for the most part been content with:

(test-group
 "-"
  (define res (- 2 1))
  (test 1 res)
 (print "res: " res) )
;; res out of scope here (good thing, no?)

K.



On Fri, Jan 10, 2020, 16:22 John Cowan  wrote:

> Mixing definitions and expressions in a block isn't actually legal Scheme,
> though it does work in Chicken.  All defines are supposed to come first and
> all expressions afterwards.  Since the test library is shared with Chibi,
> and since Chibi doesn't allow this extension, I can't see adding this to
> the library.
>
> On Fri, Jan 10, 2020 at 10:18 AM Matt Welland 
> wrote:
>
>> I find myself doing stuff like this very often when writing tests using
>> the test egg:
>>
>> ;; A trivial example where  the function under test is "-"
>> (define data #f)
>> (test #f 1 (let ((res (- 2 1)))(set! data res) res))
>>
>> I'd really prefer to do something like:
>>
>> (test-and-define data #f 1 (- 2 1))
>>
>> But the closest I could get was:
>>
>> (define-syntax test-and-set
>>   (syntax-rules ()
>> ((_ name arg1 arg2 body ...)
>>  (test arg1 arg2
>>   (let ((res (begin body ...)))
>> (set! name res)
>> res
>> )
>>
>> So I can do:
>>
>> (define data #f)
>> (test-and-set data #f 1 (- 2 1))
>>
>> Questions:
>>
>> 1. Is there a generally better way to test and gather the result for use
>> in downstream tests?
>>
>> 2. Is there a way to write a macro that can create the toplevel binding?
>>
>>
>> --
>> --
>> Complexity is your enemy. Any fool can make something complicated.
>> It is hard to keep things simple. - Richard Branson.
>>
>


Gosling: This year's CHICKEN event

2019-12-11 Thread Kristian Lein-Mathisen
Hi everyone!

I've decided to try to host another Chicken even, and I'm hoping you will
attend! Please see the wiki for information:

http://wiki.call-cc.org/event/gosling-2020

Looking forward to seeing each of you there :)
K.


Re: It would be nice if glob "/*/*" worked

2019-11-27 Thread Kristian Lein-Mathisen
I may be missing the point here, but is'nt it just easier to use find-files?

http://wiki.call-cc.org/man/5/Module%20(chicken%20file)#find-files

K.

On Wed, Nov 27, 2019, 23:32 Evan Hanson  wrote:

> Hi Matt,
>
> This would be nice indeed, I've also found myself wanting this feature
> before. I don't know of an existing solution, but I think it would be
> best if we made it "just work" with the existing glob procedure.
>
> I've created a ticket for that: https://bugs.call-cc.org/ticket/1657
>
> Cheers,
>
> Evan
>


Re: Why has the language reference been removed?

2019-11-03 Thread Kristian Lein-Mathisen
Hi Cleverson,

Oh your're right - I didn't realize there is no
http://wiki.call-cc.org/man/4/The%20R5RS%20standard equivalent for C5. The
core team can probably clarify why this is (moving towards R7RS?).

Meanwhile, maybe http://api.call-cc.org/5/doc/scheme can help you?

K.

On Sun, Nov 3, 2019, 18:49 Cleverson Casarin Uliana  wrote:

> Hi all, I notice that the document called The R5RS standard.html isn't
> any longer available in Chicken 5, as well as other documentation. Those
> documents are very valuable as quick references, especially for
> beginners. Can I use such Chicken 4 docs as learning references even
> though I'm on Chicken 5?
>
> Greetings,
> Cleverson
>
>


Re: Path problem when trying to compile under Windows

2019-11-01 Thread Kristian Lein-Mathisen
Good to hear! Let us know when you stumble upon the next obstacles,
Cleverson.

K.

On Fri, Nov 1, 2019, 03:08 Cleverson Casarin Uliana  wrote:

> Hi, just to update, I've successfully built Chicken 5.1 inside MSys with
> MinGW 64 bit as per the hints received in this group, and have just
> compiled a "hello-world" successfully to a Windows executable. So,
> probably everythings working alright.
>
> Thank you all,
> Cleverson
>
>


Re: Path problem when trying to compile under Windows

2019-10-30 Thread Kristian Lein-Mathisen
Hi,

If you like the linux-terminal, I'd strongly recommend msys2.org. It gives
you all the familiar tools like make This wiki page describes the
build process:

http://wiki.call-cc.org/msys2

But if you're not a linux user I don't know if that just makes things
worse...

Regarding eggs, there is the sdl2 egg which covers some of your needs. I
think you can play sounds with it, but sdl2-mixer hasn't been ported to
Chicken 5 though.

K.


On Wed, Oct 30, 2019, 13:55 Cleverson Casarin Uliana  wrote:

> Hi Kristian,
>
> For now, I'm willing to try programming a little game just for fun, so I
> would need basic audio management (i.e. playing and stopping audio files).
> So, probably something like sdl-mixer should work. Also, I'd like a
> keyboard manager, e.g. listening and reacting to any key press. I'm not
> sure whether chicken have something for that.
>
> BTW, yesterday I tried to build Chicken again, but it complained there is
> no rule for building a given library, which I haven't copied the name, as
> it was too late and I was sleepy. It's probably some 32 vs. 64 bit issue.
> I'll investigate it again later today, or, in case someone has Windows
> binaries and are willing to send them to me, it might save me time and I'd
> be grateful.
>
> Greetings,
> Cleverson
>
>
>


Re: Path problem when trying to compile under Windows

2019-10-29 Thread Kristian Lein-Mathisen
Hi,


On Tue, Oct 29, 2019, 14:14 Cleverson Casarin Uliana  wrote:

> Hi Kristian, thanks for your kind welcome.
>
> I haven't saved the output when building Chicken, and don't recall it
> anymore. However, building it again is probably easy, so I'll do it later
> today or tomorrow, taking your hints in account.
>
> Just for info, I have chosen Chicken 4.13 over 5.1, as it has more egs
> available.
>

Fair enough. Which eggs do you need?


> Greetings,
> Cleverson
>
>


Re: Path problem when trying to compile under Windows

2019-10-28 Thread Kristian Lein-Mathisen
Hi Cleverson,
and welcome to the community!

I have only built Chicken for Win using msys2, but maybe I can help still.

How did you build Chicken? Are you building from cmd.exe? Is there any more
output from csc that we can see? Please send full transcripts of your make
and csc invokation.

Sometimes problems with your build setup doesn't show until you try to use
it.

Did you read the Readme-section under Windows? In particular, the PREFIX is
really picky:

> When installing under mingw, with a windows shell
>  ("cmd.exe"), pass an absolute pathname (including the
>drive letter) as PREFIX and use forward slashes. If you
>are building the sources from git, use backslashes to
>specify the path to `chicken' (the "CHICKEN" variable).

It seems your path is missing a backslash in C:, I wonder if there is a
forgottet escaped \ somewhere (one \ instead of two). Or maybe that's just
msys pickery.

Your choice of PATH looks good to me.

K.

On Mon, Oct 28, 2019, 21:39 Cleverson Casarin Uliana  wrote:

> Hello all,
>
> I'm new to Scheme and Chicken in particular. I have successfully built
> Chicken under Windows 10 using MinGW, but the sources' README says
> nothing on how to properly set the PATH environment variable under
> Windows, so I've simply included the c:\chicken\bin dir.
>
> When I issue this command:
> csc -o test test.scm
> as per the Getting-started section in the manual, the command prompt
> returns:
> The system cannot find the specified path.
>
> Error: shell command terminated with non-zero exit status 1:
> ""C:chicken/bin/chicken.exe" "test.scm" -output-file "test.c""
>
> What path is it wanting? Is it another subdir in C:\chicken or a MinGW
> path? Where should I put it please?
>
> Greetings,
> Cleverson
>
>


Re: [Chicken-users] memory monitoring and leak debugging? (should the advice be in a web page?)

2019-08-10 Thread Kristian Lein-Mathisen
Hi Daniel,

Sorry for the late reply, I'm on vacation.



Q1: no, you are not calling back into Scheme (you'd need define-external or
something).
Q2: What it seems you are doing there is construct a compound object using
the Chicken C-api. I try to avoid doing that.

Constructing Scheme objects in C is easy to get wrong. Everything is
allocated on the stack so I think you have to use foreign-primitive to be
safe, not foreign-lambda (I think). This may be an easier way:

You can define-external a simple scheme procedure that takes the three ints
and returns list of them:

(define-external
  (list_int3 (int a) (int b) (int c))
scheme-object
   (list a b c))
;;C_word  list_int3(int t0,int t1,int t2)

And use this to produce your compound object. However, keep in mind that
the GC will move your objects around: Don't store lst anywhere in C between
Scheme callbacks because it will be invalidated after gc. Note that this
does violates the "don't use callbacks" advice!

Another trick which is useful to be aware of is using let-location. You can
allocate  objects in Scheme and pass them as pointers to your C procedures,
which in turn can mutate them and we can multiple return values from Scheme
side. I'm doing that here, for example:

https://github.com/kristianlm/chicken-stb-image/blob/79475a5d256ef3d8bd7e932b0d16c10e0bd9e1e3/stb-image.scm#L14

My advice for beginners would be:

## don't allocate compound scheme objects in C because it is hard
but allocating "C objects" is usually not that hard though. if a library
allocates a struct for you, go for it. and you can even use set-finalizer!
on it.

## avoid Scheme callbacks if you can because it makes things hard

## whenever you can, allocate in Scheme and mutate in C
because it is generally safe and fast. I'm doing that here, for example:
https://github.com/kristianlm/chicken-minissh/blob/8d5cccb9a561704aacf1464a8e3d0315499ec2c6/chacha20.scm#L10

## box C structs in define-record's even if you feel it is slow
so you don't start mixing up types

Safety is always harder and more important that it seems. I've had so many
cases where I have considered my bindings complete only to find I get the
occational segfault - typically caused by the GC moving object around. But
reproducing GC-related bugs can be hard.

Hope this helps a bit!
K.

On Wed, Aug 7, 2019, 23:10 Daniel Ortmann  wrote:

> I have Scheme calling the C yylex() and can easily get all of the token
> ints.
>
> I am trying to return '(tok,lineno) '(tok,lineno,intval) or
> '(tok,lineno,strval)
> C_word *ptr, *sptr;
> C_word lst;
> ...
> case TOK_G_R_SECT:
> printf("gettoken:(TOK_G_R_SECT,line,text) = (%2d,%3d,'%s')\n",
> tok, lineno, yylval.sptr);
> ptr = C_alloc(C_SIZEOF_LIST(3));
> lst = C_list(, 3, C_fix(tok), C_fix(lineno), C_fix(0));
> /*C_string2(, yylval.sptr));*/
> return callin(lst);
>
> Question 1:
> Does this stumbling attempt fall under that warning about not calling from
> C to Scheme?  Or is that warning for something else?
>
> Question 2:
> Do I need a bit better magic words to get that 'lst =' line working?  Or
> am I missing something more major?
>
> Thank you!
>
>
> On 8/7/19 3:00 PM, Kristian Lein-Mathisen wrote:
>
>
> Hi Daniel and welcome to the Chicken mailing list.
>
> Another thing to keep in mind is that the Chicken garbage-collector will
> move objects around during gc. That can cause a lot of hard-to-find bugs,
> and is probably one of the reasons for Joerg advice on not calling back
> into Scheme from your foreign-lambdas.
>
> Another cause of problems with the relocations is that you cannot
> reference Chicken objects in C long-term, because the gc won't be able to
> update those pointers.
>
> Having said that, the ffi in Chicken is really nice to use, so much that I
> often use it to explore new C api's.
>
> And also, I sometimes use valgrind to check for memory leaks.
>
> Best of luck!
> K.
>
> On Tue, Aug 6, 2019, 22:18 Jörg F. Wittenberger <
> joerg.wittenber...@softeyes.net> wrote:
>
>> Hello Daniel,
>>
>> welcome here.
>>
>> Since CHICKEN compiles into C, all the tools you are used with C to use
>> are still there.
>>
>> Personally I'm not a fan of fancy debuggers, since most of the things I
>> write tend to depend on external (network) events.  I'd welcome tips
>> how to automate those jobs using better tools than printing log
>> messages.
>>
>> Memory use in code mixing C and CHICKEN Scheme can be hairy.  I tend to
>> recommend to abstain from calling back from C into Scheme until you
>> know what you are doing.
>> http://wiki.call-cc.org/man/5/C%20interface#notes
>> <https://urldefense.proofpoint.com/v2/url?

Re: [Chicken-users] memory monitoring and leak debugging? (should the advice be in a web page?)

2019-08-07 Thread Kristian Lein-Mathisen
That is possible, but it is quite hard to use correctly in my opinion. It's
also not in core anymore. If I understand things correctly, there is a
performance penalty in every new gc root. Maybe some of the core team
members can comment. To me, object-evict has been a last-resort (and as
such, I've never used it) but I don't know how others might feel about it.

K.


On Wed, Aug 7, 2019, 22:52 Dan Leslie  wrote:

> Isn't it possible to pin items, and avoid these relocation and garbage
> collection issues, with object-evict?
>
> https://wiki.call-cc.org/eggref/5/object-evict
>
> -Dan
>
>
> Sent with ProtonMail <https://protonmail.com> Secure Email.
>
> ‐‐‐ Original Message ‐‐‐
> On Wednesday, August 7, 2019 1:00 PM, Kristian Lein-Mathisen <
> kristianl...@gmail.com> wrote:
>
>
> Hi Daniel and welcome to the Chicken mailing list.
>
> Another thing to keep in mind is that the Chicken garbage-collector will
> move objects around during gc. That can cause a lot of hard-to-find bugs,
> and is probably one of the reasons for Joerg advice on not calling back
> into Scheme from your foreign-lambdas.
>
> Another cause of problems with the relocations is that you cannot
> reference Chicken objects in C long-term, because the gc won't be able to
> update those pointers.
>
> Having said that, the ffi in Chicken is really nice to use, so much that I
> often use it to explore new C api's.
>
> And also, I sometimes use valgrind to check for memory leaks.
>
> Best of luck!
> K.
>
> On Tue, Aug 6, 2019, 22:18 Jörg F. Wittenberger <
> joerg.wittenber...@softeyes.net> wrote:
>
>> Hello Daniel,
>>
>> welcome here.
>>
>> Since CHICKEN compiles into C, all the tools you are used with C to use
>> are still there.
>>
>> Personally I'm not a fan of fancy debuggers, since most of the things I
>> write tend to depend on external (network) events.  I'd welcome tips
>> how to automate those jobs using better tools than printing log
>> messages.
>>
>> Memory use in code mixing C and CHICKEN Scheme can be hairy.  I tend to
>> recommend to abstain from calling back from C into Scheme until you
>> know what you are doing.
>> http://wiki.call-cc.org/man/5/C%20interface#notes
>>
>> Otherwise I used to run my code under valgrind, which helped me a lot
>> to catch some errors.
>>
>> Best Regards
>>
>> /Jörg
>>
>> Am Tue, 6 Aug 2019 10:37:06 -0500
>> schrieb Daniel Ortmann :
>>
>> > Hello all,
>> > I am new to Chicken Scheme and experimenting with binding scheme to a
>> > C scanner built with Flex.  The results are fast but I feel the need
>> > to monitor memory use and watch for leaks.
>> >
>> > The only relevant thing I find on call-cc.org is this url:
>> > http://wiki.call-cc.org/chicken-for-emacs-lisp-programmers#tooling
>> >
>> > What are your experiences, tools, and practices with debugging mixed
>> > Scheme + C code?
>>
>>
>>
>> ___
>> 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] memory monitoring and leak debugging? (should the advice be in a web page?)

2019-08-07 Thread Kristian Lein-Mathisen
Hi Daniel and welcome to the Chicken mailing list.

Another thing to keep in mind is that the Chicken garbage-collector will
move objects around during gc. That can cause a lot of hard-to-find bugs,
and is probably one of the reasons for Joerg advice on not calling back
into Scheme from your foreign-lambdas.

Another cause of problems with the relocations is that you cannot reference
Chicken objects in C long-term, because the gc won't be able to update
those pointers.

Having said that, the ffi in Chicken is really nice to use, so much that I
often use it to explore new C api's.

And also, I sometimes use valgrind to check for memory leaks.

Best of luck!
K.

On Tue, Aug 6, 2019, 22:18 Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Hello Daniel,
>
> welcome here.
>
> Since CHICKEN compiles into C, all the tools you are used with C to use
> are still there.
>
> Personally I'm not a fan of fancy debuggers, since most of the things I
> write tend to depend on external (network) events.  I'd welcome tips
> how to automate those jobs using better tools than printing log
> messages.
>
> Memory use in code mixing C and CHICKEN Scheme can be hairy.  I tend to
> recommend to abstain from calling back from C into Scheme until you
> know what you are doing.
> http://wiki.call-cc.org/man/5/C%20interface#notes
>
> Otherwise I used to run my code under valgrind, which helped me a lot
> to catch some errors.
>
> Best Regards
>
> /Jörg
>
> Am Tue, 6 Aug 2019 10:37:06 -0500
> schrieb Daniel Ortmann :
>
> > Hello all,
> > I am new to Chicken Scheme and experimenting with binding scheme to a
> > C scanner built with Flex.  The results are fast but I feel the need
> > to monitor memory use and watch for leaks.
> >
> > The only relevant thing I find on call-cc.org is this url:
> > http://wiki.call-cc.org/chicken-for-emacs-lisp-programmers#tooling
> >
> > What are your experiences, tools, and practices with debugging mixed
> > Scheme + C code?
>
>
>
> ___
> 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] The (chicken time) time macro gets in my way

2019-05-12 Thread Kristian Lein-Mathisen
Hi Mathieu,

I tried (import (except chicken.time time)) and friends (exclude, rename)
without success. I also tried import-syntax. I don't know why it's not
possible to hide this default import from the current namespace.

However, by wrapping the file in a main module (using csc -m main
time-test.scm), which clearly has different default imports, I'm able to
get rid of the warning. I don't know if that's acceptable for you.

K.


On Sun, May 12, 2019, 11:33 PM Mario Domenech Goulart 
wrote:

> Hi Mathieu,
>
> On Sun, 12 May 2019 20:52:47 + Mathieu  wrote:
>
> > Hello Schemers,
> >
> > When I compile the following code :
> >
> > (define-record time hour minute)
> >
> > And compile in version 5 like so :
> >
> > csc5 source.scm
> >
> > I get the following warning :
> >
> > assigment to syntax `time'
> >
> > A clean build would make be happy.
> > I think the clash is caused by the time
> > macro from the (chicken time) module.
> >
> > Any idea how to suppress said warning ?
> > I would rather not disable warnings
> > for the whole unit.
>
> Do you actually import chicken.time in your code?  If you don't, you
> should not get that warning.
>
> Can you provide a complete minimal test case that can be used to
> reproduce the problem?
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
> ___
> 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] Is it possible to change the list of included modules when compiling Chicken?

2019-05-12 Thread Kristian Lein-Mathisen
Perhaps an option would be to cross-compile CHICKEN for your target, and
run chicken-install with that? That should give you the eggs as shared libs
for your target, which you could simply copy over. That'd require a C
compiler for your target on your host, though.

K.

On Sun, May 12, 2019, 9:01 AM Peter Bex  wrote:

> On Sat, May 11, 2019 at 08:28:23PM -0300, Jeronimo Pellegrini wrote:
> > Hello,
> >
> > I was wondering if it is possible to remove or add modules to
> > the list of default included modules that come with Chicken.
> >
> > I am compiling it for wireless routers, and so far I could not yet
> > package csc -- so getting modules with chicken-install doesn't
> > work for me.
>
> Hi Jeronimo,
>
> I'm not sure what you're trying to do, but are statically linked
> binaries of your program not an option for you?  This would be one
> single binary file you can just put onto the router.
>
> > Would it be possible to
> >
> > - get the source of a couple of eggs, and put them somewhere with
> >   the Chicken sources,
> > - add their name/path to a list,
> >
> > and have them compiled and included in $PREFIX/lib/chicken/9/
> > when Chicken is compiled?
>
> Technically this should be possible I think, but I don't know of an
> easy way to do this currently.
>
> Cheers,
> Peter
> ___
> 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] Incomplete geiser setup instructions for Chicken 5

2019-04-24 Thread Kristian Lein-Mathisen
Hi Andrew,

That is a mistake, the instructions should definitely include installing
srfi-18.
Thanks for fixing the wiki!

K.


On Wed, Apr 24, 2019, 04:40 Andrew Eggenberger 
wrote:

> Hi everyone,
>
> I tried to set up geiser for Chicken 5 on a fresh installation of Arch
> Linux. None of the eval commands appeared to have an effect. I checked the
> log and saw an error for a missing Srfi-18 module. Once I installed that
> module, geiser seemed to be fully functional. Should this be added as a
> step on the page with tips for using Chicken with Emacs (
> https://wiki.call-cc.org/emacs)? It looks like I can make the edit if no
> one objects.
>
>
> *Andrew Eggenberger*
> ___
> 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] hahn: chicken 5 port

2019-04-12 Thread Kristian Lein-Mathisen
Hi Robert,

If you want to support both C4 and C5. one way of doing it is to make two
module files which does all the initial imports, and use one from the .egg
file and the other from the .setup file. I'm doing this in
https://github.com/kristianlm/chicken-minissh, for example. One module file
is used by the .egg file for C5, and the other module file is pointed to be
the setup script for C4.

Another approach is to have a single module file and then start with an
(import chicken) which works on both C4 and C5, like this:
https://github.com/Adellica/chicken-nanomsg/blob/master/nanomsg-module.scm

Hope that comes in handy,
K.

On Fri, Apr 12, 2019 at 11:35 PM Mario Domenech Goulart <
ma...@parenteses.org> wrote:

> Hi Robert,
>
> On Fri, 12 Apr 2019 17:04:08 -0400 Robert Jensen <
> robert.cole.jen...@gmail.com> wrote:
>
> > My apologies, I'm a little confused - I did remove the meta and setup
> > file from the 0.10 tag, is that what's causing the issue here?
>
> Indeed.  If you intend to use the same repo for both CHICKEN 4 and 5,
> the egg must be installable by both CHICKEN 4 and 5 (you probably need
> cond-expand to achieve that).
>
> All the best.
> Mario
>
> > On Fri, Apr 12, 2019 at 4:20 PM Mario Domenech Goulart <
> ma...@parenteses.org> wrote:
> >
> >  On Thu, 11 Apr 2019 23:19:10 -0400 Robert Jensen <
> robert.cole.jen...@gmail.com> wrote:
> >
> >  > I ported hahn to chicken 5. You can find the release here:
> >  >
> >  > https://github.com/klutometis/hahn/releases/tag/0.10
> >
> >  Apparently support for CHICKEN 4 has been removed, causing a significant
> >  breakage in the CHICKEN 4 coop:
> >
> http://salmonella-linux-x86.call-cc.org/chicken-4-debugbuild/gcc/linux/x86/2019/04/12/yesterday-diff/
> >
> >  Please, restore CHICKEN 4 support for hahn.
> --
> http://parenteses.org/mario
>
> ___
> 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] zlib for chicken 5

2019-04-09 Thread Kristian Lein-Mathisen
Hi Robert,

and thanks for doing this. It seems the sources for zlib for C4 has
disappeared! That makes things awkward.

You have both a README.md and a README.org, could those be merged perhaps?

K.

On Tue, Apr 9, 2019 at 4:11 AM Robert Jensen 
wrote:

> Hello,
>
> I ported [1] to Chicken 5. You can find the source at [2].
>
> All the best,
> Rob
>
> [1] http://wiki.call-cc.org/eggref/4/zlib
> [2] https://github.com/r1b/zlib/releases/tag/0.6
> ___
> 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] benchmarking tight u8vector loop

2019-04-08 Thread Kristian Lein-Mathisen
Hi,

Attached is a benchmarking test that resizes a u8vector of RGB pixels into
half the size in each dimension using a pixel average.

I applied Peter's patch which inlines vector-ref and vector-set! procedures:
http://lists.nongnu.org/archive/html/chicken-hackers/2019-04/msg00041.html

With this patch, I see about a 2x speedup which is nice. I see vector_ref
and vector_set in the generated C code. However, the C code still has a
continuation call inside the main loop. Maybe someone can look into why
this is happening.

K.
PS. `convert` comes from imagemagick on most distros
;;; srfi-4 chicken benchmarking test
;;; /.chickens/be678994/bin/csc -k -m main -O5 srfi-4-stress-test.scm
;;;
;;; $ convert wizard: -resize 2000x-1 png:- | ./srfi-4-stress-test /tmp/wizard.png
(import stb-image stb-image-write
(only (chicken process-context) command-line-arguments)
(only (chicken time) time)
srfi-4)

(define fn-out (car (command-line-arguments)))

(define (image-half pixels w h c)
  (define (half n) (quotient n 2))
  (define hw (- (half w) 1))
  (define hh (- (half h) 1))
  (define (average a b c d) (quotient (+ a b c d) 4))
  (define (ref p x y z) (u8vector-ref p (+ z (* c (+ x (* w y))
  (let ((out (make-u8vector (* w h c
(do ((y 0 (+ y 1)))
((>= y hh))
  (do ((x 0 (+ x 1)))
  ((>= x hw))
(do ((z 1 (+ z 1)))
((> z c))
  (u8vector-set! out (+ z (* c (+ x (* hw y
 (average (ref pixels (+ (* x 2) 0) (+ (* y 2) 0) z)
  (ref pixels (+ (* x 2) 0) (+ (* y 2) 1) z)
  (ref pixels (+ (* x 2) 1) (+ (* y 2) 0) z)
  (ref pixels (+ (* x 2) 1) (+ (* y 2) 1) z) )
(values out hw hh c)))

(receive (pixels w h c) (read-image)
  (with-output-to-file fn-out
(lambda ()
  (receive (pixels w h c) (time (image-half pixels w h c))
(write-png pixels w h c)
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] error when building freetype egg

2019-04-07 Thread Kristian Lein-Mathisen
Hi,

When I chicken-install freetype, I get this:

/home/klm/.chicken-install/cache/freetype/freetype.c: In function
‘stub2714’:
/home/klm/.chicken-install/cache/freetype/freetype.c:820:6: error:
‘FT_GlyphSlotRec’ {aka ‘struct FT_GlyphSlotRec_’} has no member named
‘reserved’
 g2615->reserved = g2616;

Here's the line that's causing that the problem:

http://bugs.call-cc.org/browser/project/release/5/freetype/trunk/freetype.scm#L262

If comment that out, it seems to work. I'm on Arch Linux with freetype2
Version 2.10.0-1.

Maybe someone can look into a proper fix for this. Thanks,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [Q] Macro for defining function from string

2019-04-05 Thread Kristian Lein-Mathisen
I'm doing that fort of thing here:
https://github.com/kristianlm/chicken-minissh/blob/master/minissh-parsing.scm#L5-L11

Here's another example, perhaps easier to follow:

(import-for-syntax (only (chicken string) conc))
(define-syntax syntax-conc
  (er-macro-transformer
   (lambda (x r t)
 (string->symbol (apply conc (intersperse (cdr x) '-))

(expand '(syntax-conc "a" "b" "c")) ;; ==> a-b-c

I would recommend using syntax-rules whenever possible,
and only using er-macro-transformer when you have to. So, your syntax-rules
could
expand to syntax-conc.
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] how to compile files, modules, shared libraries, programs

2019-03-28 Thread Kristian Lein-Mathisen
I'm glad you got it working, Marco!

The Makefile is a bit complicated, and since I'm not sure of what you're
trying to acheive, it's a bit hard to help out. What's the reason you don't
want to use chicken-install to build?

K.

On Wed, Mar 27, 2019, 15:14 Marco Maggi  Marco Maggi wrote:
>
> > [...] I want to make the following package work:
>
> > 
>
> I managed to make it work, I think.  I am not quite "there", yet.
>
>   I still  have some problems with  modules: if a source  file defines a
> module, and  it is linked  into a library, can  such source file  have a
> name different from the module name itself?  When I tried I succeeded in
> one case but failed in another...
> --
> Marco Maggi
>
> ___
> 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] how to compile files, modules, shared libraries, programs

2019-03-26 Thread Kristian Lein-Mathisen
Hi Marco,

So what is it that you want? Your Makefile looks ok to me, though I think
all of it might have been less complicated to do with just an .egg-file.

K.

On Tue, Mar 26, 2019, 11:23 Marco Maggi  Peter Bex wrote:
>
> > On Tue, Mar 26, 2019 at 06:52:44AM +0100, Marco Maggi wrote:
> >> Ciao,
>
> >>   I was  not able to find  documentation about how to  compile libraries
> >> and programs with Chicken 5, using  a Makefile.  There are bits here and
> >> there but nothing complete enough for a newbie like me.
>
> >>   Is there a project somewhere that does this?
>
> > Hi Marco,
>
> > Perhaps git-fs by Evan, one of our core maintainers will be helpful:
> > http://git.foldling.org/git-fs.git/
>
> > Just git clone it (I think there's no code browser on the site).
>
> Thanks for  the suggestion, but  that project  only has a  single source
> file; not what I need.  I want to make the following package work:
>
> 
>
> Notice that I  am still in the  phase: I know what I  want, I understand
> nothing of what I need.
>
> TIA
> --
> Marco Maggi
>
> ___
> 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] microhttpd bindings and FFI

2019-03-26 Thread Kristian Lein-Mathisen
Hi,

I thought I'd mention that Caolan did some experiments [1] with the parser
from node.js. The idea was to get all the parsing done fast in C. I don't
know the it's current status, and it looks like it's written for CHICKEN 4
only.

[1]: https://github.com/caolan/snowy

In my opinion, spiffy is quite fast. Can I ask why you want to use
microhttpd?

K.


On Mon, Mar 25, 2019, 18:17 Peter Bex  On Mon, Mar 25, 2019 at 03:56:30PM +0100, Massimo Nocentini wrote:
> > Dear list,
> >
> > this is my first message so I take the opportunity to greet everyone.
> >
> > I'm working on a minimal set of bindings [1] for the microhttpd library
> [2]
> > and I'm heading against the following error:
> >
> >[panic] callback invoked in non-safe context - execution terminated
> >
> > To set the context: the variadic function MHD_start_daemon starts the
> server
> > to accept connection and calls back a Scheme function that provides the
> > content to the client.
>
> Hello Massimo,
>
> From the microhttpd documentation, it seems that it will always start
> a new native thread.  The problem here is that CHICKEN can only run
> inside one native thread and requires complete control of the stack
> within that thread.
>
> When the Scheme callback you passed to MHD_Daemon is called, it is called
> from the thread which microhttpd starts.  It will try to read/write data
> from the nursery (stack) of a different thread, and on GC it will try to
> longjmp back to a stack state in a different thread, which is not going
> to work.  CHICKEN's garbage collector does not play well at all with
> native multithreading.
>
> There might be a way to get it to work but it would require some sort
> of communication between the native threads (all in C), and you'd need to
> set up a green thread in CHICKEN that handles the response somehow.  I
> don't think this is a good approach.  You're probably better off wrapping
> a different library (or just use Spiffy).
>
> Cheers,
> Peter
> ___
> 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] NULL in calls to C functions with bind

2019-03-23 Thread Kristian Lein-Mathisen
Hi Christoph,

I think that NULL should be correct and work - since you're creating a
pointer object to address 0. However, the FFI has a convenience for
null-pointers: you can pass in #f instead. That's easier and requires one
less GC object. It's mentioned in the manual on c-pointer foreign type:
http://wiki.call-cc.org/man/5/Foreign%20type%20specifiers#pointers

That takes me to my personal experience which I want to share: when
creating foreign bindings, just use foriegn-lambda and skip the bind
dependency. Maybe when you have huge API's, bind can save you some time.
But I'd say that hand-written foreign-lambdas give you more control of
what's going on, force you to think about every function and make sure it's
safe and generally produce better interfaces.

I hope this may give you some pointers.
K.


On Fri, Mar 22, 2019, 17:50 Christoph Lange  I wrote the following in my attempt to interface to the mosquitto MQTT
> library:
>
>
> (bind* "struct mosquitto *mosquitto_new(const char *id,
> ___bool clean_session,
> void *obj);")
>
> (define NULL (object->pointer 0))
> (define mqttc (mosquitto-new NULL #t NULL))
>
>
> But I'm unsure about my adventurous definition of `NULL`. It works, but is
> it correct?
>
>
> Another thing: on the bind egg's documentation page, `___blob` is not
> mentioned, but I luckily found it in the sql-de-lite code, and it saved me
> a lot of headaches :-) Shouldn't it be there?
>
> /Christoph
> ___
> 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] is the readline egg dead?

2019-03-23 Thread Kristian Lein-Mathisen
Hi Marco,

It seems the readline egg isn't available for CHICKEN 5.

You could try [breadline] or [linenoise]?

  [breadline]: http://wiki.call-cc.org/eggref/5/breadline
  [linenoise]: http://wiki.call-cc.org/eggref/5/linenoise

I don't know about the status on the C4 readline egg, whether a C5 port is
planned or whether it's considered obsolete.

Hope this helps,
K.

On Sat, Mar 23, 2019, 10:12 Marco Maggi  I'm a newbie on a x84_64-pc-linux-gnu.
>
> $ chicken-install readline -sudo
> Server error:
>
> Error: [Server] no such extension or version
> "readline"
> #f
> Server error:
>
> Error: [Server] no such extension or version
> "readline"
> #f
>
> Error: extension or version not found: "readline"
>
> TIA
> --
> Marco Maggi
>
> ___
> 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] Difficulty installing eggs on Chicken 5 on Windows 7 MSYS2

2019-02-28 Thread Kristian Lein-Mathisen
Hi guys,

This is caused by a bug in CHICKEN 5. I reported a duplacate of it here:
https://bugs.call-cc.org/ticket/1584

It is caused by MAX_PATH being too small and chicken-do not able to store
all of its arguments.

You can apply commit *1e006b65* to your 5.0.0 sources or simply change line
79 in chicken-do.c to read "static TCHAR cmdline[ 1 ];" instead of
MAX_PATH. That solved things for me.

K.

On Fri, Mar 1, 2019, 08:00 John Croisant  On 2/28/19 6:50 AM, dignified face wrote:
>
> Hello,
>
> I installed Chicken 5.0.0 on Windows 7 64bit with MSYS2, following the 
> instructions found here: http://wiki.call-cc.org/msys2
> All works fine, but when I try to install an egg - for instance 
> "chicken-install matchable" - I get the following error:
>
> building matchable
>C:/msys64/usr/local/bin/csc -host -D compiling-extension -J -s -setup-mode 
> -I C:\msys64\home\username\.chicken-install\cache\matchable -C 
> -IC:\msys64\home\username\.chicken-install\cache\matchable -O2 -d1 
> matchable.scm -o 
> C:\msys64\home\username\.chicken-install\cache\matchable\matchable.so
> creating subprocess failed
>
> Error: shell command terminated with nonzero exit code
> 1
> "C:\\msys64\\home\\username\\.chicken-install\\cache\\matchable\\matchable.build.bat"
>
> chicken-do seems to be the problem. I managed to build the egg by copying the 
> csc invocations from matchable.build.bat then running matchable.install.bat 
> manually, but this seems like a bad approach. Any help would be greatly 
> appreciated!
>
> Thanks in advance,
> JJ
>
> Unfortunately I don't have a solution, but I have the same problem on
> Windows 10 MSYS2. Here is a paste with a bunch of information in case it
> helps someone debug the problem:
>
>
> http://paste.call-cc.org/paste?id=d8878c03d3dbdc1e49f642f3255c893efa18db95
>
> One thing I didn't mention in the paste is that I did a "make check" after
> compiling and installing CHICKEN, and it seemed to pass. I didn't paste the
> output of make check because it is extremely long.
>
> - John Croisant
> ___
> 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] Allegro ported to Chicken 5 (Coop update?)

2019-02-12 Thread Kristian Lein-Mathisen
Thanks Dan!

Just to mention, the wiki page is missing:
http://wiki.call-cc.org/eggref/5/allegro

K.



On Tue, Feb 12, 2019, 10:06 Mario Domenech Goulart  Hi Dan,
>
> On Tue, 12 Feb 2019 06:00:39 + Dan Leslie  wrote:
>
> > Thanks in large part to a Pull Request from Olivier Matz the Allegro Egg
> has been ported to Chicken 5.
> >
> > I've attempted to follow the information in the wiki[0] with regards to
> how to port an egg from C4 to C5 in the simple manner, and so
> > Henrietta likely needs to track the new
> allegro.chicken-5.release-info[1] file.
> >
> > 0:
> https://wiki.call-cc.org/chicken-5-roadmap#the-simplest-approach-just-carry-on
> > 1:
> https://raw.githubusercontent.com/dleslie/allegro-egg/master/allegro.chicken-5.release-info
>
> Thanks a lot.  Your egg has been added to the coop.
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
> ___
> 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] Has hypergiant been used on Android?

2019-01-07 Thread Kristian Lein-Mathisen
Hi Matt,

I don't know if anyone has tried Hypergiant, but I've been playing around
with SDL2:

https://github.com/chicken-mobile/chicken-sdl2-android-builder

The Android tooling makes most things extremely painful. The Dockerfile
instructions for SDL might be of help to you if you choose to experiment
yourself.

Best of luck!
K.


On Sun, Jan 6, 2019, 02:42 Matt Welland  From the eggs page it looks like hypergiant should work on android. Can
> anyone report sucessfully doing so? Is the work flow for deploying on
> android documented or tested?
>
> I'm considering using hypergiant instead of godot for a project.
> Deploying on Android is a primary goal and being able to use Chicken
> would be a welcome boon. Any insight or advice appreciated.
>
> Thanks.
>
> ___
> 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] Is Android not unix?

2018-11-25 Thread Kristian Lein-Mathisen
I don't know how UserLand works, but there's no containerization in Termux.
It's just an terminal emulator with its own package manager with quite a
few packeges like emacs, gnu make and clang. So building CHICKEN is pretty
straight forward.

K.

On Mon, Nov 26, 2018, 06:46 elf  I had no problem compiling chicken in termux (though occasionally there
> are linkage warnings on android6).
>
> My understanding is that android is basically stripped down linux with a
> java overlord layer. No compatibility layer necessary. This is borne out by
> my current work on cross-system randomness - it behaves exactly like a
> linux machine, with the same syscalls, etc.
>
> (Which reminds me. If anyone has a bsd box i can get a login for, it would
> be much appreciated. Im trying to do a chicken wrapper for true randomness
> using sidechannel effects... so something that looks platform independent.)
>
> -elf
>
> On 26 November 2018 5:15:03 GMT+02:00, Matt Welland 
> wrote:
> >Isn't Termux similar to UserLand - a compatibility layer of sorts
> >similar to LXC or LXD? If so, I would not be surprised to see
> >incompatibilities. I had to do several hacks to get IUP working on
> >UserLand.
> >
> >On Mon, 2018-11-19 at 13:10 +0100, Thomas Chust wrote:
> >> On Mon, 19 Nov 2018 13:19:10 +0300 Kristian Lein-Mathisen  >> i...@gmail.com> wrote:
> >>
> >> >
> >> > [...]
> >> > I was trying tweetnacl on Termux on Android 9 and ran into this
> >> > problem:
> >> >
> >> > u0_a191@localhost ~/p/chicken-5.0.0>
> >> > csi -R tweetnacl -p '(make-symmetric-sign-key)'
> >> >
> >> > Error: (read-u8vector) bad argument type - not a port: #f
> >> > 
> >> >
> >> > This happens because tweetnacl creates its current-entropy-port
> >> > using
> >> > cond-expand with unix, windows or else, the latter which is
> >> > yielding the #f
> >> > error above.
> >> > [...]
> >> Hello,
> >>
> >> interesting, I would have thought that Android would qualify as a
> >> unixoid system since it has a Linux kernel! If there is some other
> >> feature identifier I should use that would indicate the system likely
> >> supports /dev/random, please let me know so I can adapt the tweetnacl
> >> code.
> >>
> >> Anyway, as a workaround to get tweetnacl running, you can simply do
> >>
> >>   (current-entropy-port (open-input-file "/dev/random"))
> >>
> >> by hand.
> >>
> >> I hope that helps :-)
> >>
> >> Ciao,
> >> Thomas
> >>
> >>
> >> ___
> >> 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
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Is Android not unix?

2018-11-25 Thread Kristian Lein-Mathisen
Thanks for following up on this, Thomas! tweetnacl 1.4.1 now works ootb on
Termux.

K.


On Sun, Nov 25, 2018, 14:51 Thomas Chust  On Mon, 19 Nov 2018 13:19:10 +0300 Kristian Lein-Mathisen <
> kristianl...@gmail.com> wrote:
>
> > [...]
> > I was trying tweetnacl on Termux on Android 9 and ran into this problem:
> > [...]
>
> Hello,
>
> a new version of tweetnacl (v1.4.1) should soon be available. Since I
> replaced the system-specific code dealing with entropy sources using
> the new portable random-bytes function from (chicken random),
> cond-expand is no longer necessary and these Android troubles should
> hopefully vanish into thin air :-)
>
> Ciao,
> Thomas
>
>
> --
> Life is not a battle to win but a melody to sing.
> -- Amit Ray
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Is Android not unix?

2018-11-19 Thread Kristian Lein-Mathisen
Hi guys,

I was trying tweetnacl on Termux on Android 9 and ran into this problem:

u0_a191@localhost ~/p/chicken-5.0.0>
csi -R tweetnacl -p '(make-symmetric-sign-key)'

Error: (read-u8vector) bad argument type - not a port: #f


This happens because tweetnacl creates its current-entropy-port using
cond-expand with unix, windows or else, the latter which is yielding the #f
error above.

I found this surprising as I'd expect Android to be unix. As I'm sure you
know, it isn't:

csi -p '(cond-expand (unix 1))'

Error: during expansion of (cond-expand ...) - no matching clause in
`cond-expand' form: unix
u0_a191@localhost ~/p/chicken-5.0.0>
csi -p '(cond-expand ((or android unix) 1))'
1

But tweetnacl isn't much use without current-entropy-port, and I hove its
/dev/random requirement:

u0_a191@localhost ~/p/chicken-5.0.0>
dd if=/dev/random bs=1 count=12 ^/dev/null |xxd -p
44ca8634752db3243ac222f0

So, my questions:

1. Is Android non-unix intentionally?
2. Could tweetnacl cond-expand with (or unix android) so it works
out-of-the-box on Android?


Thanks in advance,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Chicken on Windows 10 - Was: [ANN] CHICKEN 5.0.0 release candidate 2 available

2018-09-17 Thread Kristian Lein-Mathisen
Hi Jorg,

If I'm not mistaken, the Readme mentions says that you have to specify a
PREFIX for Windows builds. I'm guilty os trying the same "shortcut". And
obs: use forward slashes and include the drive letter and colon!

I don't know what's happing with the absolute-pathname trouble - I never
ran into that issue. Could the generated absolute pathnames be wrong due to
the same issue?

K.

On Sat, Sep 15, 2018, 15:26 Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Hi Kristian,
>
> I don't have the Windows machine close. I'm not perfectly sure, but I
> should not have specify a PREFIX at all. My intention was first and
> foremost to test that a default installation done by a windows novice
> using
> hints from the wiki works.
>
> Surprisingly this went well up to the compile.
>
> The first issue I ran in could likely go away using your suggestion.
>
> The second I'm afraid will not. The generated build scripts just do not
> work on my system. As I'm a windows novice using msys2 first time, I'm
> cautious to actually assign the blame. My guess is that the windows
> cmd.exe
> should eventually execute the build scripts. If that's true than it does
> not work because, wait for it, my cmd.exe does not accept the command when
> it is given with path. It wants to do the lookup itself. At least that's
> what it looks alike. I changed the "@echo off" to "@echo on" and it
> perfectly works until there is this '/usr/local/bin/chicken-do' ... if I
> replace this with just chicken-do it starts... just to break down when it
> tries to execute csc the same way.
>
> Anything I could do to track this down?
>
> Best
>
> /Jörg
>
> On Sep 14 2018, Kristian Lein-Mathisen wrote:
>
> >Hi Joerg,
> >
> >I was trying C5rc1 on win10 i few weeks ago and had to do some tweaking to
> >get it working og msys2 (which was surprisingly comfortable to use).
> >
> > I also had a problem with chicken-install not downloading anything at
> > first. The symptom became clearer when I did chicken-install -update-db.
> > I realised I wasn't using an absolute path for PREFIX when invoking
> make.
> > Doing something like make PLATFORM=mingw-msys PREFIX=C:/c5/ solved the
> > issue, maybe you've run into the same problem?
> >
> >I never tried to change the defaults, so this may be completely unrelated.
> >K.
> >
> >On Wed, Sep 12, 2018, 16:15 Jörg F. Wittenberger <
> >joerg.wittenber...@softeyes.net> wrote:
> >
> >> Hi all,
> >>
> >> who is running chicken on Windows 10 here? How do you manage? I'm not
> >> sold to msys; I just tried first time and failed miserably.
> >>
> >> Any idea how to do a better setup (for chicken 5 release candidates)
> >> welcome.
> >>
> >>
> >> Maybe we can fix the support for msys2 nevertheless;
> >> So far I found two issues on Windows 10 + msys2 + mingw-w64:
> >>
> >> 1. chicken-install does not pick up the contents of setup.defaults by
> >> itself.
> >>
> >>Workaround: chicken-install -defaults
> >> /usr/local/share/chicken/setup.defaults
> >>
> >>-- which is saying: give the defaults from the installation on the
> >> command line again.
> >>-- This does the download and generates the build scripts
> >> (*.build.bat)
> >>
> >> 2. Using "start" to open a window running cmd.exe I found that I can
> >> not call chicken-do using the full path. As it is in the PATH variable
> I
> >> tried to copy the invocation line with only the path leading to
> >> chicken-do removed.
> >>
> >>This leads to:
> >>/usr/local/bin/csc -host -D compiling-extension -J -s -setup-mode -I
> >> C:\msys64\home\... ... so
> >>creating subprocess failed
> >>
> >> Best
> >>
> >> /Jörg
> >>
> >>
> >> On Sep 12 2018, Jörg F. Wittenberger wrote:
> >>
> >> >On Sun, Sep 09, 2018 at 02:30:12PM +0200, Peter Bex wrote:
> >> >> If you can, please let us know the following information about the
> >> >> environment on which you test the RC:
> >> >
> >> >Operating system: MINGW64_NT-10.0
> >> >Hardware platform: x86-64
> >> >C Compiler: gcc.exe (Rev1, Built by MSYS2 project) 8.2.0
> >> >Installation works?: yes
> >> >Tests work?: yes
> >> >Installation of eggs works?: no
> >> >
> >> >Installation of eggs fails like this (for all eggs; immediately):
> >> >
> >> >$ chicken-install.exe pastiche
> >> >
> >> >Error: extension or version not found: "pastiche"
> >>
> >>
> >> ___
> >> Chicken-users mailing list
> >> Chicken-users@nongnu.org
> >> https://lists.nongnu.org/mailman/listinfo/chicken-users
> >>
> >
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] CHICKEN 5.0.0 release candidate 2 available

2018-09-15 Thread Kristian Lein-Mathisen
And a Win10 test:


  Operating system: win 10 (msys2)
  Hardware platform: x86-64
  C Compiler: GCC
  Installation works?: yes
  Tests work?: -not tested-
  Installation of eggs works?: yes (nrepl)


This is the make command that worked for me:

make PLATFORM=mingw-msys PREFIX=C:/c5/ ARCH=x86_64 install

I tried with PREFIX=C:/msys64/c5 first, which produced errors when running
`chicken-install -update-db`, but I don't have enough battery to
investagate this, sorry! It's reporting a funny path like
`C:/msys64/c5/share/\\modules.db`. But with `PREFIX=C:/c5`, it works.

K.

On Fri, Sep 14, 2018, 22:31 Kristian Lein-Mathisen 
wrote:

> Hi,
>
> Tested on my main laptop:
>
>
>>   Operating system: arch linux
>>   Hardware platform: x86-64
>>   C Compiler: GCC 8.20
>>   Installation works?: yes
>>   Tests work?: yes
>>   Installation of eggs works?: yes (but not pastiche)
>>
>
> And on my phone:
>
>
>   Operating system: android 8.0.0
>   Hardware platform: arm
>   C Compiler: clang 6.0.1
>   Installation works?: yes
>   Tests work?: yes
>   Installation of eggs works?: yes (but not pastiche)
>
>
> I'm og solar power right now and can't test on Win10.
>
> K.
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] CHICKEN 5.0.0 release candidate 2 available

2018-09-14 Thread Kristian Lein-Mathisen
>
> Hi,

Tested on my main laptop:


>   Operating system: arch linux
>   Hardware platform: x86-64
>   C Compiler: GCC 8.20
>   Installation works?: yes
>   Tests work?: yes
>   Installation of eggs works?: yes (but not pastiche)
>

And on my phone:


  Operating system: android 8.0.0
  Hardware platform: arm
  C Compiler: clang 6.0.1
  Installation works?: yes
  Tests work?: yes
  Installation of eggs works?: yes (but not pastiche)


I'm og solar power right now and can't test on Win10.

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


Re: [Chicken-users] Chicken on Windows 10 - Was: [ANN] CHICKEN 5.0.0 release candidate 2 available

2018-09-14 Thread Kristian Lein-Mathisen
Hi Joerg,

I was trying C5rc1 on win10 i few weeks ago and had to do some tweaking to
get it working og msys2 (which was surprisingly comfortable to use).

I also had a problem with chicken-install not downloading anything at
first. The symptom became clearer when I did chicken-install -update-db. I
realised I wasn't using an absolute path for PREFIX when invoking make. Doing
something like make PLATFORM=mingw-msys PREFIX=C:/c5/ solved the issue,
maybe you've run into the same problem?

I never tried to change the defaults, so this may be completely unrelated.
K.

On Wed, Sep 12, 2018, 16:15 Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Hi all,
>
> who is running chicken on Windows 10 here? How do you manage? I'm not sold
> to msys; I just tried first time and failed miserably.
>
> Any idea how to do a better setup (for chicken 5 release candidates)
> welcome.
>
>
> Maybe we can fix the support for msys2 nevertheless;
> So far I found two issues on Windows 10 + msys2 + mingw-w64:
>
> 1. chicken-install does not pick up the contents of setup.defaults by
> itself.
>
>Workaround: chicken-install -defaults
> /usr/local/share/chicken/setup.defaults
>
>-- which is saying: give the defaults from the installation on the
> command line again.
>-- This does the download and generates the build scripts (*.build.bat)
>
> 2. Using "start" to open a window running cmd.exe I found that I can not
> call chicken-do using the full path. As it is in the PATH variable I tried
> to copy the invocation line with only the path leading to chicken-do
> removed.
>
>This leads to:
>/usr/local/bin/csc -host -D compiling-extension -J -s -setup-mode -I
> C:\msys64\home\... ... so
>creating subprocess failed
>
> Best
>
> /Jörg
>
>
> On Sep 12 2018, Jörg F. Wittenberger wrote:
>
> >On Sun, Sep 09, 2018 at 02:30:12PM +0200, Peter Bex wrote:
> >> If you can, please let us know the following information about the
> >> environment on which you test the RC:
> >
> >Operating system: MINGW64_NT-10.0
> >Hardware platform: x86-64
> >C Compiler: gcc.exe (Rev1, Built by MSYS2 project) 8.2.0
> >Installation works?: yes
> >Tests work?: yes
> >Installation of eggs works?: no
> >
> >Installation of eggs fails like this (for all eggs; immediately):
> >
> >$ chicken-install.exe pastiche
> >
> >Error: extension or version not found: "pastiche"
>
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] [ANN] CHICKEN 5.0.0 release candidate 1 available

2018-08-20 Thread Kristian Lein-Mathisen
Hi all,
and sorry about the late response on this one.

On my main Arch Linux, everything I tested has worked except building
statically against `check-errors` (ticket 1506
).

Operating system: Arch Linux
Hardware platform:  x86-64
C Compiler: GCC 8.2.0
Installation works?: yes
Tests work?: yes
Installation of eggs works?: yes

I also tested this on a win10 with make PLATFORM=mingw-msys install check:

Operating system: Win10
Hardware platform:  x86-64
C Compiler: GCC 8.2.0 (rev1 msys2)
Installation works?: yes
Tests work?: yes
Installation of eggs works?: yes

Note that I had to install the "diff" tool to make the check succeed.
Here's a summary of the problems I encoutered with C5rc1 on Windows 10:

- when linking statically, csc is looking for ".o" files (Kooda is looking
into this I think) , improper patch here

- pathname wierdness, see this paste

- generated .install.bat file produces copy syntax error (see this
paste

)

Apart from these minor glitches, the CHICKEN 5 experience has been
wonderful.

I wanted to try static linking with CHICKEN 5 and this is the result, a
poor man's TeamViewer:
https://gist.github.com/kristianlm/16bbe626b54ad9b4e00fb8617d026bec
K.

On Sun, Aug 12, 2018 at 9:02 PM Peter Bex  wrote:

> Hi all,
>
> I also took some time to test on an old Hurd VM I had lying around.
>
> Operating system: Debian GNU/Hurd 0.9 (Mach 1.8+git20171101)
> Hardware platform: x86
> C Compiler: GCC 7.2.1
> Installation works?: yes
> Tests work?: yes
> Installation of eggs works?: yes
>
> Cheers,
> Peter
> ___
> 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] porting eggs experiences and questions

2018-08-17 Thread Kristian Lein-Mathisen
Hi Jörg,


> How would I mark a release for C5?
>
>
Create a new release-info file and let the chicken core team add it to the
CHICKEN 5 coop.
I both in the same repo, eg nanomsg5.release-info for C5 and
nanomsg.release-info for C4.


> Any thought on how to have both a C4 and C5 version in the same repo? I'll
> have to support C4 for quite a while. Now I wonder how best reorganize the
> code to work for both.
>

I've kept C4 support by using cond-expand, like this

:

(import scheme) ;; make sure we have cond-expand
(cond-expand (chicken-5 (import (chicken base) (chicken foreign)))
 (else (import chicken foreign)))


>
> * Observation: chicken-install does not install dependencies
>
> This is just odd: The .egg file contains (dependencies srfi-18);
> chicken-install did the download but not install it. So compilation failed
> until I manually did
>
> chicken-install srfi-18
>
>
That seems like a bug. No error messages after downloading?


> * chicken-install -n -test
>
> Fails.  One needs to actually install first, then run the test.
>
> Better at least warn that we test the installed version, not the
> current one. (I recall this bite me before.)
>
> Best: just load the version from the working directory.
>
> Thanks for all the work which went into C5.
>
> /Jörg
>
>
> ___
> 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] 3 new CHICKEN eggs: stb-image, stb-image-write and stb-image-resize

2018-06-11 Thread Kristian Lein-Mathisen
Thanks!
K.

On Fri, Jun 8, 2018 at 11:36 PM, Evan Hanson  wrote:

> On 2018-06-08 14:35, Kristian Lein-Mathisen wrote:
> > CHICKEN 4 release-info files:
> > https://github.com/kristianlm/chicken-stb-image/raw/master/
> stb-image4.release-info
> > https://github.com/kristianlm/chicken-stb-image-write/raw/
> master/stb-image-write4.release-info
> > https://github.com/kristianlm/chicken-stb-image-resize/raw/
> master/stb-image-resize4.release-info
> >
> > CHICKEN 5 release-info files:
> > https://github.com/kristianlm/chicken-stb-image/raw/master/
> stb-image5.release-info
> > https://github.com/kristianlm/chicken-stb-image-write/raw/
> master/stb-image-write5.release-info
> > https://github.com/kristianlm/chicken-stb-image-resize/raw/
> master/stb-image-resize5.release-info
> >
> > Please inspect and, if worthy, add to the coop!
>
> Added! Nice work, thanks Kristian.
>
> Evan
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] 3 new CHICKEN eggs: stb-image, stb-image-write and stb-image-resize

2018-06-08 Thread Kristian Lein-Mathisen
Hi folks,

I've written some wrappers for some small C libraries for image reading,
writing and resizing. They are part of Sean Barrett's collection
 which some of you may know. What's nice
about them is that they don't have any external dependencies. I don't know
how well they behave on corrupt images and things like that, however. They
are intended to be used for games where you're in control of you asset pool.

They should work for CHICKEN 4 and 5.

CHICKEN 4 release-info files:
https://github.com/kristianlm/chicken-stb-image/raw/master/stb-image4.release-info
https://github.com/kristianlm/chicken-stb-image-write/raw/master/stb-image-write4.release-info
https://github.com/kristianlm/chicken-stb-image-resize/raw/master/stb-image-resize4.release-info

CHICKEN 5 release-info files:
https://github.com/kristianlm/chicken-stb-image/raw/master/stb-image5.release-info
https://github.com/kristianlm/chicken-stb-image-write/raw/master/stb-image-write5.release-info
https://github.com/kristianlm/chicken-stb-image-resize/raw/master/stb-image-resize5.release-info

Please inspect and, if worthy, add to the coop!
Thank you,
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Longboat Chicken Event - Spring 2018

2018-02-22 Thread Kristian Lein-Mathisen
Hi Everyone!

The Chicken Longboat event is closing up! The official event page is here:
http://wiki.call-cc.org/event/longboat-chicken-2018

I'd like to confirm that free booking has been arranged for the event, as
promised, with questionable standards and a "just a place to sleep" charm
to it.
There are 4 nearby apartments waiting renovation that we can use. They are
completely empty, and that unfortunately also means no beds.
However, the apartments do offer: heating, water (hot and cold), bathrooms,
the company of other CHICKENers and about 1 minute walk from the office
space.
I imagine there's is room for about 10 people. See the attached pictures.

If you want to go for this free accommodation option, do this:

- Let me know before 1st of April
- Bring sleeping mat
- Bring sleeping bag

If you booked your ticket, please set the time on the wiki
<http://wiki.call-cc.org/event/longboat-chicken-2018#attendants>. I'm
really looking forward to this and I hope to see you all there!

K.

On Tue, Nov 14, 2017 at 10:26 AM, Kristian Lein-Mathisen <
kristianl...@gmail.com> wrote:

>
> Dear CHICKENers!
>
> As some of you may know, Adellica would like to arrange the next Chicken
> event! As always, everyone is of course welcome.
>
> Where: Bergen, Norway
> <https://www.google.no/maps/place/Bergen/@60.3648911,5.1490036,10z/data=!3m1!4b1!4m5!3m4!1s0x46390d4966767d77:0x9e42a03eb4de0a08!8m2!3d60.3912628!4d5.3220544>
>  BGO
> When: Thursday 26th ~ Sunday 29th, April 2018
>
> Check out the event's wiki page:
> http://wiki.call-cc.org/event/longboat-chicken-2018
>
> I would like to make it a full 4-day event this time, more time for
> hacking! So see if you can set aside Wednesday 25th for travelling. Note
> that Adellica will be offering free accommodation, starting Wednesday
> night.
>
> Looking forward to seeing everyone there!
> K.
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Longboat Chicken Event - Spring 2018

2017-11-14 Thread Kristian Lein-Mathisen
Dear CHICKENers!

As some of you may know, Adellica would like to arrange the next Chicken
event! As always, everyone is of course welcome.

Where: Bergen, Norway

 BGO
When: Thursday 26th ~ Sunday 29th, April 2018

Check out the event's wiki page:
http://wiki.call-cc.org/event/longboat-chicken-2018

I would like to make it a full 4-day event this time, more time for
hacking! So see if you can set aside Wednesday 25th for travelling. Note
that Adellica will be offering free accommodation, starting Wednesday
night.

Looking forward to seeing everyone there!
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] Working with Spiffy incrementally

2017-11-10 Thread Kristian Lein-Mathisen
Hi Lucas,

I try to explore this in my screencast:
https://m.youtube.com/watch?v=eXB3I3S3vJc

Perhaps that can help you out.
K.

On Friday, November 10, 2017, Peter Bex  wrote:

> On Thu, Nov 09, 2017 at 06:00:14PM -0500, Jack Lucas wrote:
> > Is anyone aware of a method where I can work with spiffy incrementally?
> >
> > Current workflow as I see it would look like editing the source and then
> running csi -s script.scm.
> >
> > It'd be very nice if I could (start-server) in a repl in emacs and be
> able to re-evaluate vhost-map and any functions mapped in vhost-map.  I
> tried doing this but when I refreshed the page in my browser it didn't seem
> like it updated to the new evaluation.
>
> Hi!
>
> vhost-map is a parameter, which is thread-local, so if you modify it in
> the repl, that's not going to affect the thread running the server.
>
> I presume you're not going to change the vhost entries all that much,
> so perhaps an extra layer of indirection would solve the problem:
>
> (vhost-map `(("localhost" . ,(lambda (c) (my-proc c)
>
> Then you should be able to redefine my-proc, and the lambda in the vhost
> should pick it up.
>
> HTH,
> Peter
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


[Chicken-users] Dockerfile for building Android app with Chicken and SDL2

2017-05-17 Thread Kristian Lein-Mathisen
Hi guys,

I just though I'd announce that I've created a Dockerfile which should
hopefully make it simpler to build Android-apps with CHICKEN. You'll need
docker  to build this,
along with lots of bandwidth and patience. I called the project
chicken-sdl2-android-builder in lack of a better name:

https://github.com/chicken-mobile/chicken-sdl2-android-builder

Unfortunately, building this docker image takes really long and needs to
download around 1GB of data. The resulting docker image is around 6GB which
is why I decided to not push it to the docker hub. Hopefully, though,
building this docker image is still better than spending three days trying
to get Android.mk-files to cooperate (like I just did - for the third time).

Hopefully it can be of use to anyone wanting to experiment with CHICKEN on
their Android device!

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


[Chicken-users] problems string-trimming on UTF8

2017-01-27 Thread Kristian Lein-Mathisen
Dear CHICKEN mailing list,

I encountered a strange issue with string-trim-right and some UTF8 string:

$ csi -R srfi-13 -p '(string-trim "Zazà")'
Zazà


So far so good!

$ csi -R srfi-13 -p '(string-trim-right "Zazà")'
Zaz�


Oh no, what happened?

$ csi -R utf8 -R srfi-13 -p '(string-trim-right "Zazà")'
Zaz�


utf8 doesn't seem to do it! But utf8, at least, gets the string-length
right:

$ csi -R srfi-13 -p '(string-length "Zazà")'
5
$ csi -R utf8 -R srfi-13 -p '(string-length "Zazà")'
4


It took me a while to figure out what was going on. These are the bytes of
Zazà:

$ printf 'Zazà' | xxd
: 5a61 7ac3 a0 Zaz..


So it seems like string-trim-right just looks at the last byte, \xa0 which
is a non-breaking space  in
itself, and then dropping that off. It should be looking at the last utf8
codepoint instead.

I don't know if this is a known bug or if I've come across something
undiscovered. I suppose the fix belongs in the utf8 egg.

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


Re: [Chicken-users] FOSDEM

2017-01-23 Thread Kristian Lein-Mathisen
Hi Mario,

I'd love to go to this one! If a CHICKEN crowd is going, I'm in! (Peder
can't join this time)

K.

On Sat, Jan 21, 2017 at 9:57 AM, Mario Domenech Goulart <
ma...@parenteses.org> wrote:

> Hi,
>
> Is anybody here going to attend FOSDEM next weekend?
>
> All the best.
> Mario
> --
> http://parenteses.org/mario
>
> ___
> 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] New egg - directory-tree

2016-11-25 Thread Kristian Lein-Mathisen
Hi Peter,

I though I'd just mention that you can generate wiki page from a
markdown-file using markdown-svnwiki
. So what I usually do
is to have everything in a Readme.md and then convert this to the wiki
syntax and then paste that (a manual process, like Evan says) into the wiki
page on wiki.call-cc.org.


So, for example,
https://github.com/Adellica/chicken-nanomsg/blob/master/readme.md becomes
http://wiki.call-cc.org/eggref/4/nanomsg

This may be particularly useful if you're not keen on learning yet another
markup format. See http://wiki.call-cc.org/eggref/4/markdown-svnwiki

Cheers,
K.

On Wed, Nov 2, 2016 at 1:24 AM, Evan Hanson  wrote:

> Hi Peter,
>
> On 2016-11-01 13:59, Peter Nagy wrote:
> > while working on a small home project I decided to port gauche's
> > (create|check)-directory-tree functions over to chicken and release my
> > first (small) egg.
>
> Looks useful, thanks!
>
> > Let me know if anything else is needed from my side, if not I will
> > make a tag on gitlab to finalize the release.
>
> Everything looks good to me, it just needs a tag. I've just added it to
> the repository, so it will become accessible shortly after the tag is
> created.
>
> > I think I managed to get everything done based on the wiki except
> > documentation. Can I create it within my project in some format and it
> > would get linked in wiki.call-cc.org/eggref/4 ? Or should I just
> > create the page for my egg there and add the docs there?
>
> The latter. Some people keep a version of the documentation in the
> project tree, but actually putting it on the wiki is a manual process.
>
> 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] Nuremberg Meetup

2016-09-29 Thread Kristian Lein-Mathisen
Indeed, it was great fun seeing everyone again, in the friendly and
inspiring
atmosphere that always surrounds these CHICKEN meetups. And yes,
special thanks to Christian who organized it all!

Looking very much forward to our next gathering :)

K.

On Wed, Sep 28, 2016 at 1:16 PM, Kooda  wrote:

> On Tue, 27 Sep 2016 16:38:19 +0200,
> Andy Bennett wrote:
> Indeed! Thanks everyone!
>
> It was really nice to meet you all at last!
>
> I hope to be there next time as well. :)
>
> ___
> 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] Two dimensional linked lists

2016-09-11 Thread Kristian Lein-Mathisen
Hi mfv,

I'm not sure this will help you but I just put up a egg I made for myself
that might be useful to you in this context.

https://gist.github.com/kristianlm/9d7e5c1bdae8c443c7deb676d6f4a7d0

Maybe the vector-grid procedure

might be of use.
K.

On Fri, Sep 9, 2016 at 3:21 AM, Justin Ethier 
wrote:

> A vector of vectors would be more efficient to traverse for large values
> of [n], but if the vectors are not the same length you need to check to
> make sure index [n] exists in each one. If you are going to handle random
> insertions of data you also have to worry about growing a vector(s) if the
> requested [n] is larger than the vector size.
>
> A simple and elegant (though perhaps not the most efficient?) solution is
> to use a hashtable to store the cell values:
> https://wiki.call-cc.org/man/4/Unit%20srfi-69
>
> This example is in Python but you get the idea:
> http://code.activestate.com/recipes/355045-spreadsheet/
>
> Thanks,
>
> Justin
>
>
> On Thu, Sep 8, 2016 at 7:07 AM, mfv  wrote:
>
>> Hi,
>>
>> what would be the best way to implement two dimensional linked lists into
>> Scheme? I was thinking about fooling around with spreadsheet calculations
>> in
>> Scheme, but it seems to me tha there are not proper data structures for it
>> here.
>>
>> As I understand, making linked lists from linked lists will create a
>> structure that can not be traverse efficiently in all directions:
>>
>> With the structure being
>>
>> (list (list-A) (list-B) (...) (list-Z) (list-AA))
>>
>> it would be trivial to quick to traverse from A[0] to A[n], but long to
>> get to A[n] to B[n].
>>
>> Would the same thing apply to vectors?
>>
>> Regards,
>>
>>mfv
>>
>>
>>
>> ___
>> 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] I'm looking for suggestions regarding vectors vs. records vs. coops (again).

2016-07-29 Thread Kristian Lein-Mathisen
I'd like to thank you too Peter, for this very informative overview of
typed-records which I'm looking forward to start using!

K.

On Wed, Jul 27, 2016 at 6:31 PM, Matt Welland 
wrote:

> Top posting just to say thanks to Peter, typed-records are a huge benefit
> for me. I much appreciate the detailed response.
>
> On Mon, Jul 25, 2016 at 11:49 PM, Peter Bex  wrote:
>
>> On Sun, Jul 24, 2016 at 11:06:32AM -0700, Matt Welland wrote:
>> > For years now I've been using inlined vectors instead of records or
>> coops
>> > for data structures due to performance concerns. Recently I was training
>> > someone on how to maintain my code and I felt quite lame explaining the
>> > vector records. So I started switching to defstruct records. However
>> I've
>> > started to hit some performance issues and one factor seems to be the
>> > records (more work to do to confirm this).
>> >
>> > Below is a simplistic benchmark comparing using inlined vectors, inlined
>> > vectors with a type check, defstruct and coops. Where performance
>> matters
>> > using vectors or type checked vectors seems to help. The benchmark seems
>> > enough to hint to me to switch back to vectors - especially in cases
>> where
>> > I'm slinging around 10's of thousands of records.
>>
>> Hello Matt,
>>
>> The reason for this is pretty simple: record types do not have inlineable
>> accessors.  This means that accessors (and constructors) will require
>> that they are invoked in full CPS context.  If you have a procedure which
>> calls such an accessor, it will always be split up into at least 2 C
>> functions.
>>
>> This is because records have an API defined by the procedures which are
>> created by the define-record(-type)/defstruct macros; the objects
>> themselves do not contain enough information to have a generic accessor,
>> and when you're calling an accessor, the compiler doesn't know that it's
>> a record accessor.  Vectors, on the other hand, have a common interface:
>> they can be referenced by one and the same accessor: vector-ref.
>> This is inlineable in C, as C_i_vector_ref().  In the next version of
>> CHICKEN, we'll even be able to rewrite those directly to C_slot() if
>> the vector is of a known length and the index is within bounds.
>>
>> > My question: can anyone offer insight into a better way to balance
>> > performance with elegance/flexibility of records?
>>
>> Luckily, there's a simple solution.  Felix wrote a wonderful little egg
>> called "typed-records", which provides drop-in replacements for
>> define-record(-type) *and* defstruct which will emit specialisations
>> for records.
>>
>> That is, if an object is known to be a record of the given type, the
>> accessor is rewritten to (##sys#slot  ).
>>
>> For instance, with (defstruct foo bar qux), (foo-qux x) is rewritten
>> to (##sys#slot x 2) if x is known to be of type (struct foo).
>> The only disadvantage of this is that if you change your definition
>> of a record, you'll need to recompile all the units that access these
>> records, because they've been inlined as numbered slot references.
>>
>> Changing the sample code in your e-mail by simply replacing "defstruct"
>> in your "use" line with "typed-records" results in noticeable
>> performance improvement:
>>
>> Using vectors
>> 1.148s CPU time, 33162750 mutations, 0/2309 GCs (major/minor)
>> Using vectors (safe mode)
>> 2.308s CPU time, 0.02s GC time (major), 49744125 mutations, 15/20266 GCs
>> (major/minor)
>> Using defstruct
>> 1.66s CPU time, 33162750 mutations, 5/11665 GCs (major/minor)
>> Using coops
>> 20.608s CPU time, 0.628s GC time (major), 33162760 mutations, 960/231731
>> GCs (major/minor)
>>
>> Before making that one-word replacement, it was:
>>
>> Using vectors
>> 1.112s CPU time, 33162750 mutations, 0/2309 GCs (major/minor)
>> Using vectors (safe mode)
>> 2.34s CPU time, 0.02s GC time (major), 49744125 mutations, 15/20266 GCs
>> (major/minor)
>> Using defstruct
>> 4.224s CPU time, 0.012s GC time (major), 33162750 mutations, 36/40736 GCs
>> (major/minor)
>> Using coops
>> 20.572s CPU time, 0.608s GC time (major), 33162760 mutations, 938/231753
>> GCs (major/minor)
>>
>> Not too bad, especially considering that typed-records is _safe_: it
>> will only perform the rewrites when the compiler can prove that the given
>> object is of the required type.
>>
>> If it cannot, you can always add a check to your code like this:
>> (if (not (my-type? x)) (error "wrong type") (begin ...))
>> The use of a predicate will tell the compiler that in the else branch,
>> x can only be of the required type.
>>
>> If you're using separate compilation, you need to remember to ask the
>> compiler to emit the type declarations to a file, and use that file while
>> compiling the users of the API.
>>
>> Cheers,
>> Peter
>>
>> ___
>> Chicken-users mailing list
>> Chicken-users@nongnu.org
>> 

Re: [Chicken-users] Asynchronous I/O Egg Release

2016-07-09 Thread Kristian Lein-Mathisen
Not that I know of, unfortunately. You can do a regex search on
api.call-cc.org and see what you find. But it is my understanding that this
is actually how it's meant to work from core, and so it shouldn't be
necessary in the first place. I am guessing there is a bug ticket somewhere
waiting for someone to fix?

It would be nice to fix this once and for all, perhaps also making stdin
nonblocking so that you don't need parley for that.

K.

On Friday, July 8, 2016, Robert Smiley <yarnoiser...@gmail.com> wrote:

> In all honesty, I hadn't used the make-input-port procedure before. It
> didn't occur to me to use that to make a nonblocking input port. Your code
> snippet seems to solve the problem quite a bit better than my egg does.
>
> Is open-input-file*/nonblock in a currently released egg?
>
> On Thu, Jul 7, 2016 at 6:04 AM, Kristian Lein-Mathisen <
> kristianl...@gmail.com
> <javascript:_e(%7B%7D,'cvml','kristianl...@gmail.com');>> wrote:
>
>> I don't know how useful this is, but I though I'd throw in a test I use
>> as we've encountered this a few times as well in the posix egg:
>>
>>
>> (use posix srfi-18)
>>
>> (define mythread
>>   (thread-start!
>>(lambda ()
>>  (let loop ()
>>(define start (current-milliseconds))
>>(thread-sleep! 0.1)
>>(define elap (- (current-milliseconds) start))
>>(if (> elap 500) ;; the 0.1 second sleep took > 0.5 seconds!
>>(print "OBS! elap = " elap)
>>(loop))
>>
>> (print "cmd: sleep 1 ; echo hi" (with-input-from-pipe "sleep 1.5 ; echo
>> hi" read-string))
>> (thread-join! mythread)
>>
>> $ csi -version
>> Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
>> linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
>> bootstrapped 2014-06-07
>> $ csi -s blocking-io-test.scm
>> cmd: sleep 1 ; echo hihi
>>
>> OBS! elap = 1512.0
>>
>>
>> And this is a code-snippet
>> <http://paste.call-cc.org/paste?id=69742cf6f54afbe2401e0ee8c67ade35a3d6a07a> 
>> we
>> use to solve it.
>>
>>
>> K.
>>
>> On Fri, Jul 1, 2016 at 6:53 PM, Matt Welland <mattrwell...@gmail.com
>> <javascript:_e(%7B%7D,'cvml','mattrwell...@gmail.com');>> wrote:
>>
>>>
>>>
>>> On Fri, Jul 1, 2016 at 3:11 AM, Andy Bennett <andy...@ashurst.eu.org
>>> <javascript:_e(%7B%7D,'cvml','andy...@ashurst.eu.org');>> wrote:
>>>
>>>> Hi,
>>>>
>>>> > And of course, reads of files on the file
>>>> > system never block at all
>>>>
>>>> A read from a file can block when the operating system needs to go to
>>>> disk for the data. This happens when the buffer empties and it cannot be
>>>> refilled before the next read call.
>>>>
>>>
>>> I don't know if it applies to this discussion but read blocking can be
>>> quite a pain when a network fileserver such as NFS goes offline. It would
>>> be nice if other threads would continue so that the program could detect
>>> the issue and potentially take appropriate action such as let the user know
>>> *why* the program is hung.
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Regards,
>>>> @ndy
>>>>
>>>> --
>>>> andy...@ashurst.eu.org
>>>> <javascript:_e(%7B%7D,'cvml','andy...@ashurst.eu.org');>
>>>> http://www.ashurst.eu.org/
>>>> 0290 DA75 E982 7D99 A51F  E46A 387A 7695 7EBA 75FF
>>>>
>>>>
>>>> ___
>>>> Chicken-users mailing list
>>>> Chicken-users@nongnu.org
>>>> <javascript:_e(%7B%7D,'cvml','Chicken-users@nongnu.org');>
>>>> https://lists.nongnu.org/mailman/listinfo/chicken-users
>>>>
>>>
>>>
>>> ___
>>> Chicken-users mailing list
>>> Chicken-users@nongnu.org
>>> <javascript:_e(%7B%7D,'cvml','Chicken-users@nongnu.org');>
>>> https://lists.nongnu.org/mailman/listinfo/chicken-users
>>>
>>>
>>
>> ___
>> Chicken-users mailing list
>> Chicken-users@nongnu.org
>> <javascript:_e(%7B%7D,'cvml','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] Asynchronous I/O Egg Release

2016-07-07 Thread Kristian Lein-Mathisen
I don't know how useful this is, but I though I'd throw in a test I use as
we've encountered this a few times as well in the posix egg:


(use posix srfi-18)

(define mythread
  (thread-start!
   (lambda ()
 (let loop ()
   (define start (current-milliseconds))
   (thread-sleep! 0.1)
   (define elap (- (current-milliseconds) start))
   (if (> elap 500) ;; the 0.1 second sleep took > 0.5 seconds!
   (print "OBS! elap = " elap)
   (loop))

(print "cmd: sleep 1 ; echo hi" (with-input-from-pipe "sleep 1.5 ; echo hi"
read-string))
(thread-join! mythread)

$ csi -version
Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)
linux-unix-gnu-x86-64 [ 64bit manyargs dload ptables ]
bootstrapped 2014-06-07
$ csi -s blocking-io-test.scm
cmd: sleep 1 ; echo hihi

OBS! elap = 1512.0


And this is a code-snippet
 we
use to solve it.


K.

On Fri, Jul 1, 2016 at 6:53 PM, Matt Welland  wrote:

>
>
> On Fri, Jul 1, 2016 at 3:11 AM, Andy Bennett 
> wrote:
>
>> Hi,
>>
>> > And of course, reads of files on the file
>> > system never block at all
>>
>> A read from a file can block when the operating system needs to go to
>> disk for the data. This happens when the buffer empties and it cannot be
>> refilled before the next read call.
>>
>
> I don't know if it applies to this discussion but read blocking can be
> quite a pain when a network fileserver such as NFS goes offline. It would
> be nice if other threads would continue so that the program could detect
> the issue and potentially take appropriate action such as let the user know
> *why* the program is hung.
>
>
>>
>>
>>
>>
>>
>> Regards,
>> @ndy
>>
>> --
>> andy...@ashurst.eu.org
>> http://www.ashurst.eu.org/
>> 0290 DA75 E982 7D99 A51F  E46A 387A 7695 7EBA 75FF
>>
>>
>> ___
>> 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] extension loading in sqlite3 egg

2016-06-07 Thread Kristian Lein-Mathisen
Thank you very much, Thomas! Works great for my purposes. Any chance of
giving this a new tag for release?

K.

On Tue, May 24, 2016 at 11:26 PM, Thomas Chust <ch...@web.de> wrote:

> On 2016-05-24 11:25, Kristian Lein-Mathisen wrote:
> > [...]
> > In the sqlite3 command-line, this works fine. The solution was to enable
> > extension loading which is not allowed by default:
> > https://www.sqlite.org/c3ref/enable_load_extension.html
> >
> > However, this Sqlite3 function isn't available in the egg.
> > [...]
>
> Hello,
>
> I have added an enable-load-extension! procedure to the trunk version of
> the sqlite3 egg. In addition to what your patch did, I added some
> boilerplate error checking code, which can't hurt, and a feature flag to
> turn the procedure into a stub, in case someone wants to compile the egg
> with an old or otherwise restricted version of SQLite3.
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] HEADS-UP! Next CHICKEN meetup @ Nuremberg, Germany on the horizon!

2016-05-24 Thread Kristian Lein-Mathisen
Thanks for the initiative, Christian! Looking forward to see everybody
again :)

K.

On Mon, May 23, 2016 at 10:29 AM, Christian Kellermann 
wrote:

> * Christian Kellermann  [160520 12:53]:
> > It will take place in Nuremberg, Germany, Europe, Planet Earth.
> > The date is to be choosen from the following three:
> > * September 23-25th
>
> That's the date with the most votes. So be it.
>
> Hope to see you all there?
>
> --
> 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] Starting up spiffy for dynamic content

2016-03-09 Thread Kristian Lein-Mathisen
Hi Norman!

We've been using the vhost-map a lot in our systems too. I've put together
(so far an unofficial) egg that turns spiffy's current-request and
current-response into function arguments and return values respectively.
Maybe that could be useful for some code-samples, if not useful as a
dependency.

https://github.com/Adellica/reser


K.

On Wed, Mar 9, 2016 at 4:01 PM, Norman Gray  wrote:

>
> Peter, hello.
>
> On 8 Mar 2016, at 20:41, Peter Bex wrote:
>
> On Tue, Mar 08, 2016 at 02:48:00PM +, Norman Gray wrote:
>>
>
> So you mean including handlers like:
>>>
>>> (define (vhost-handler cont)
>>> (let ((uri (uri-path (request-uri (current-request)
>>>   (if (string=? (cadr uri) "wibble") ;; we want to handle URIs
>>> like /wibble/...
>>>   (send-response status: 'ok
>>>  body: (format "Good: request was ~S
>>> (vhost)" uri)
>>>  headers: '((content-type text/html)))
>>>   (cont
>>> (vhost-map `((".*" . ,vhost-handler)))
>>>
>>
>> That's how it was intended, yes.  I've added something similar to the
>> wiki with a link to slightly extended (but somewhat outdated) example
>> from a demonstration.
>>
>
> The new section 'A simple dynamic web page example' is perfect, in
> combination with the pointer to the spiffy+sxml example.
>
> I marginally adjusted the linked webserver.scm to use sxml-serializer
> rather than the full-blown sxml transform egg (was that the 'outdated' you
> meant).  I've attached the result.
>
> OK: that's a (very) nice design -- I'll do that.
>>>
>>> But may I suggest that vhost-map is not, perhaps, the best name for
>>> this structure, since the intended functionality is much more
>>> general than mapping vhosts.  As I mentioned, I guessed that might
>>> be a route to the solution, but based on the name, on the fact it's
>>> documented in a section called 'Virtual hosts', and since the
>>> example in that section is about handling virtual hosts, I got the
>>> impression that the author was firmly steering me away from more
>>> open-ended cleverness.  Caolan suggested that I'm not (thankfully)
>>> alone in misinterpreting this.
>>>
>>
>> Well, it is a mapping for which handler to use for which vhost.  That
>> is also the topmost place where dispatching happens for incoming
>> requests, so it's the place where you'd add custom handlers.
>>
>> I could add some intermediate parameter like "request-handler", which
>> then defaults to some procedure that handles the request like the
>> current implementation does (try to serve a file), but it would be
>> one more level of indirection which is basically just what "continue"
>> does now.
>>
>> Would that be sensible?
>>
>
> I don't think that would be necessary and would, as you say, be a further
> level of indirection.  Yesterday afternoon, I did put together a potential
> patch for spiffy.scm which may have the same idea (attached for interest),
> but the vhost-map (once one understands what it's intended for) seems to be
> completely general.
>
> Perhaps dispatch-handler-map, or handler-map, or something like
>>> that, would signal the intent more clearly, along with an example
>>> such as the above.
>>>
>>
>> Not sure that would be much clearer.  Also, it would break compatibility.
>>
>
> Indeed: it's not obvious what the best name is, though 'handle/host'
> seemed to push the right buttons for me.
>
> One would of course export a (define vhost-map fancy-new-name) for
> compatibility.
>
> Since the car of the alist is a host pattern,
>>> then perhaps the word 'host' should be in the name, but in that case
>>> perhaps handle/host might be suitable (and if anything's being
>>> changed, then it might be nice to have a clear catch-all host
>>> pattern, such as #t, or to permit the list elements to be a
>>> continuation thunk as well as a string-thunk pair).  Thus:
>>>
>>> (handle/host
>>> `(,my-general-handler
>>>  ("foo\\.bar\\.com" . ,(lambda (continue) ...))
>>>  (#t . ,my-catch-all-handler))
>>>
>>
>> I think that would only complicate things, and cause more confusion
>> as to the format of this list.
>>
>
> I agree.
>
> It's a wiki, feel free to improve the wording in places where it's
>> unclear.
>>
>
> There's nothing I can usefully add to the change you've made, but I'll
> bear the suggestion in mind for what I expect to be lots of future
> engagement with these docs.
>
> And thanks, Andy, for the pointer to uri-match (and for the mention of
> Knodium, which I intend to investigate further).
>
>
> All the best,
>
> Norman
>
>
> --
> Norman Gray  :  https://nxg.me.uk
> SUPA School of Physics and Astronomy, University of Glasgow, UK
>
> ___
> Chicken-users mailing list
> Chicken-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/chicken-users
>
>
___
Chicken-users mailing list
Chicken-users@nongnu.org

Re: [Chicken-users] big prime number

2016-01-25 Thread Kristian Lein-Mathisen
Yes, indeed! CHICKEN 5 is exciting :) Thanks again Peter, for your ongoing
efforts in pushing this forward!

K.

On Mon, Jan 25, 2016 at 1:49 AM, Dan Leslie  wrote:

>
> Peter Bex  writes:
>
> > Now, the good news is that I also ran the program under CHICKEN 5 and
> > it took just under 17 seconds to complete.  Most likely this is because
> > the whole thing can be done completely inline, without any CPS calls,
> > which means a lot less allocation, which in turn means a lot less
> > garbage collections need to be performed.  So again many thanks to Felix
> > for pushing me to make all operators have inlineable C functions!
>
> I am very much looking forward to Chicken 5.
>
> :D
>
> -Dan
>
> ___
> 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] A question regarding "hidden" eggs

2016-01-20 Thread Kristian Lein-Mathisen
Hi Jörg,

I think I may have bumped into similar needs now and again. I suppose one
way of solving this is to clone the henrietta-cache and run this on your
local server. However, I feel that's a little overkill if you just want a
work-in-progress egg to be available with any chicken-install.

I tried to set up my /usr/local/share/chicken/setup.defaults so that
chicken-install would first try my ~/prj/eggs/ folder, and then use the
server if that doesn't work. I never managed to set it up like that,
though, and I can't recall what went wrong. Would this approach solve your
problems though, Jörg?

K.

On Mon, Jan 18, 2016 at 2:22 PM, Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Am 18.01.2016 um 14:13 schrieb Christian Kellermann:
> > * Jörg F. Wittenberger  [160116 19:35]:
> >> Hi,
> >>
> >> I feel the need to have some space to stash away temporary glue code.
> >>
> >
> > Is this about code you want to be able to chicken-install but noone
> > else should see it?
>
> Precisely.
>
> >> Ideally the current version of it is always empty and not of interest to
> >> anyone.  As documentation always lags behind, it is empty with high
> >> probability.  However development is not ideal.
> >
> > I don't understand this.
>
> I have some code to be ripped out of context and made available as eggs.
>  This code is well tested and comes with dependencies to things I would
> ideally rather replace with code from other eggs.  For transition and
> backward compatibility, I want to import some things from the "hidden"
> code.
>
> So it's all deprecated code right from the beginning.
>
> >> Not listing as in being marked as "(hidden)" in the meta file is
> >> apparently what I want.
> >
> > That does not make sense to me, if people can install it but should
> > not use it, what is it good for?
>
> Sure use it.  But not only indirect.  It should be outright clear and
> obvious that nothing implemented there is supposed to stay and be
> supported in future versions.  Nothing will be documented for re-use.  I
> don't want anybody to build anything at it an then complain when I
> eventually got around to remove something.
>
> >
> > If it is some code that your published eggs rely on, it will be public
> > in a way. Listing it in an egg index or hide it then does not make a
> > lot of a difference to me.
> >
> > But maybe I misunderstand what you really want to get done.
> >
> > Cheers,
> >
> > 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] Any decent web development framework

2015-12-28 Thread Kristian Lein-Mathisen
The spiffy  egg will let you make
what you're looking for, but it doesn't provide the web-DSL that Sinatra
has. You could make your own DSL, though, depending on what you're trying
to do. I put together a small spiffy wrapper that works like this:

https://github.com/Adellica/reser/blob/master/example.scm

It's not in the coops, so chicken-install reser won't work (you'll have to
do clone and cd reser && chicken-install)
K.

On Mon, Dec 28, 2015 at 9:11 AM, 机械唯物主义 : linjunhalida <
linjunhal...@gmail.com> wrote:

> Looks like artanis is for guile and it needs to be compiled, not for
> Chicken.
> Is there any way to install it in Chicken?
>
> 2015-12-28 0:47 GMT+08:00 Dan Leslie :
> >
> > If you are desiring a monolithic web stack of the Rails sort, then what
> > you probably are looking for is GNU Artanis:
> >
> > http://web-artanis.com/index.html
> >
> > -Dan
> >
> > 机械唯物主义 : linjunhalida  writes:
> >
> >> Hi scheme users,
> >>
> >> I'm a rails programmer, and knows scheme long time ago but don't have
> >> chance to write scheme code in production level. I want to use scheme
> >> for website development but it turns out there is no decent framework
> >> for web development in chicken.
> >>
> >> Is there any recommendations? awful is not very useful.
> >> Any library same as Rails or Sinatra?
> >>
> >> Sinatra writes like this:
> >>
> >> (get "/" (lambda (request)  "hello")
> >> (get "/from/:id" (lambda (request) (sprintf "hello ~A" (request 'id
> >> (get "/page/:id" (lambda (request)
> >>   (let ((data ($query (from pages) (where (= id (request 'id))
> >> (render "templates/page" ('data data
> >>
> >> Thanks.
> >
>
>
>
> --
>
> Coder, Gamer, Reader.
>
> ___
> 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] This may be a bug in chickens hash tables - or my bad

2015-12-17 Thread Kristian Lein-Mathisen
I may be completely misunderstanding something here, but don't you have to
use equal? and not eq? for record structures?

K.

On Wed, Dec 16, 2015 at 10:09 PM, Jörg F. Wittenberger <
joerg.wittenber...@softeyes.net> wrote:

> Ah, great to learn.
>
> a) You are right: Per SRFI-69 it is actually undefined.  Per chicken
> manual it returns the new value associated with key.
>
> As I've seen the latter (e.g. in the iup egg) actually being used, we
> might at least want to keep the behavior in chicken.
>
> b) But does not matter much.  I ran into this originally from
> hash-table-ref signaling a missing key.
>
> The attached, modified test case fails because it i) does not find the
> key object hence hash-table-fold'ing the tree to ii) find an association
> with the very key the lookup failed for before.
>
> My hypothesis (after lightly reading the srfi-69.scm source) that the
> eq?-hash procedure produces a different hash value for the lookup before
> and after the mutation.  Hence the lookup fails while walking the tree
> succeeds.
>
> /Jörg
>
> Am 16.12.2015 um 21:55 schrieb Peter Bex:
> > On Wed, Dec 16, 2015 at 09:47:31PM +0100, Jörg F. Wittenberger wrote:
> >> Hi,
> >>
> >> I always assumed that (make-hash-table eq?) would create a hash table
> >> usable with arbitrary chicken objects as keys.
> >>
> >> That is especially structures like objects created via define-record
> >> should be valid as keys.  That is: referencing the table using the very
> >> same object (comparing eq? to the key object of the insert operation)
> >> will succeed.
> >>
> >> However this fails for me.  At least after the key object was mutated
> >> between insert and reference time.
> >>
> >> See attached test case.
> >>
> >> Am I trying something illegal here?
> >>
> >> Thanks
> >>
> >> /Jörg
> >
> >> (use srfi-69)
> >>
> >> (define objtbl (make-hash-table eq?))
> >>
> >> (define (register! obj arg)
> >>   (hash-table-update! objtbl obj identity (lambda () (list obj arg
> >>
> >> (assert (eq? (register! 1 1) (register! 1 2)))
> >
> > I believe the return value of hash-table-update! is undefined.
> >
> > Cheers,
> > Peter
> >
>
>
> ___
> 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] Hello! I'm new and need some pointers please ~

2015-11-29 Thread Kristian Lein-Mathisen
Hi Federico and welcome to the CHICKEN community!

I've just got a small note on your build setup. Most CHICKEN projects use a
.setup-file and then build with chicken-install. There should be a thousand
examples of setup-files (here's
 a small
one, and here's
 a
large one). Setup-files and chicken-install do tend to clobber your project
folder with binary files as well as installing things in /usr. If you can
live with that, it's nice in that it integrates in the other CHICKEN tools
(like cross-compiling and salmonella).

Cheers!
K.

On Sun, Nov 29, 2015 at 2:55 PM, Andy Bennett 
wrote:

> Hi Federico!
>
> > Hello there! I'm Federico, a.k.a gosukiwi.
> >
> > I'm a wen developer (JS, Ruby, PHP, etc) wanting to learn
> > Scheme/Lisp/functional programming. My first lisp dialect is CHICKEN.
>
> Welcome!
>
>
> > I decided to make a simple project using Scheme so I can get the hang of
> > it. I didn't use anything "crazy" like macros, just simple constructs.
> > (Oh btw, any recommended book on Scheme which I follow along using
> CHICKEN?)
> >
> > It would be awesome if you guys could take a look and let me know what
> > you think? The source code is
> > here: https://github.com/gosukiwi/chicken-brainfuck
> > It's an interactive brainfuck interpreter.
> >
> > Also, I have one question: What's a good site for CHICKEN Scheme
> > reference? A simple document with a list of all standard R5RS/CHICKEN
> > functions would be great. Currently, using the CHICKEN website is so
> > hard to stuff, and if I Google I get a lot of Racket/MIT Scheme
> > documentation, but very little for CHICKEN.
>
> The R5RS spec itself is actually pretty accessible.
> "Learn Scheme in Fixnum Days" is also quite good.
>
> There are some DuckDuckGo shortcuts (https://duckduckgo.com/ ) !csc and
> !csw which look up the search term in the Chicken Scheme Chickadee and
> Wiki respectively. Just type the short code and then your search term in
> to the search box at http://duckduckgo.com/ .
>
> Chickadee (http://api.call-cc.org/ ) allows you to search the APIs for
> CHICKEN and its Eggs.
>
>
> > For example, for web development we have http://devdocs.io/ which is
> > awesome for searching documentation.
> >
> > Thanks for your time ~
>
> No worries! Welcome to the community.
>
>
>
>
>
> Regards,
> @ndy
>
> --
> andy...@ashurst.eu.org
> http://www.ashurst.eu.org/
> 0290 DA75 E982 7D99 A51F  E46A 387A 7695 7EBA 75FF
>
>
> ___
> 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] New SDL2 eggs; help wanted

2015-11-08 Thread Kristian Lein-Mathisen
Hi John!

This is great! I would love to play around with this.

I tried to smack something together in the days when I was playing with
CHICKEN on Android. It's probably not very useful, but I though I'd mention
it anyhow: https://github.com/Adellica/chicken-sdl2/blob/master/sdl2.scm.
It's true what the readme says: it's very alpha.

K.

On Fri, Nov 6, 2015 at 3:10 AM, John Croisant  wrote:

> On 11/4/15 3:41 PM, Kooda wrote:
>
>> On Wed, Nov 04, 2015 at 01:35:13PM -0800, Dan Leslie wrote:
>>
>>> As a potential user and implementor of similar eggs (Allegro, SOIL, ..
>>> nanovg), I would provide fairly lean bindings first, then do any
>>> simplification or hand-holding as an additional module. It will save you
>>> time in the near term and provide flexibility to the users.
>>>
>>> -Dan
>>>
>> It seems to already be the case. There is a sdl-internals module used by
>> the public sdl2 module.
>>
>> Yes, the sdl2 egg is implemented as two modules, sdl2 and sdl2-internals.
> The sdl2-internals module is not considered part of the public API, and
> does not have the same stability guarantees. But, some parts of it are safe
> to use, which I have today written a guide to document:
>
>
> https://gitlab.com/chicken-sdl2/chicken-sdl2/blob/master/docs/using-sdl2-internals.md
>
> So, if anyone really needs to drop down to a lower level, the low-level
> bindings *do* exist. But I hope most people will not need (or want) to do
> that. If there are low-level operations that people need to perform, please
> submit a feature request so I can consider providing support for it to the
> sdl2 module. That said, the purpose of this egg is only to provide
> convenient access to SDL2's features. It is not a high-level game framework
> or engine. (But it would be a good foundation for someone to build a
> high-level game framework or engine on top of.)
>
> - John Croisant
>
>
> ___
> 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] new egg: chicken-cjson

2015-09-28 Thread Kristian Lein-Mathisen
Hi guys,

and thanks so much for a great weekend! It was nice to meet everyone again
and specially nice to meet the "new" guys coming from very far away! I hope
it won't be long till next time :)

I even managed to be a little productive this time, and am releasing a new
egg:
https://github.com/Adellica/chicken-cjson

I don't know how useful it is because you need to tweak things a lot to
gain any performance over medea's, for example, but I though it was pretty
straight-forward and wouldn't hurt to put it out in the wild. Please let me
know if you find you end up using it!

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


Re: [Chicken-users] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Interesting. I can't fint that tag:

$ git fetch origin 4.10.0rc1
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From git://code.call-cc.org/chicken-core
 * tag   4.10.0rc1  - FETCH_HEAD

$ cat .git/FETCH_HEAD
671a5eb3fa2cf29f7e9d7a877e22335fb503934atag '4.10.0rc1' of
git://code.call-cc.org/chicken-core
$ git log --oneline | grep 671a | wc
  0   0   0

Maybe something funny happened on the server-side? A commit that was
tagged, then a rebase? Should I make a local tag on commit
eacc846be7cf4026eb8e8f6eaa577082d826da2e
to be 4.10.0rc1?

Thanks,
K.

On Tue, Jun 9, 2015 at 9:35 AM, Peter Bex pe...@more-magic.net wrote:

 On Tue, Jun 09, 2015 at 09:24:34AM +0200, Kristian Lein-Mathisen wrote:
  Great work Moritz and the team! Looking forward to test this on our
  systems.

 Excellent!  I'd love to hear your feedback.

  We are building from the git repo, is there a tag/branch for 4.10.0?
  prerelease perhaps?

 Yes, there's the prerelease branch, and also a 4.10.0rc1 tag.
 I had to explicitly tell git to fetch the tag, because it didn't
 on a normal fetch/pull.  Why not?  Because it's git ;)

 Cheers,
 Peter

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


Re: [Chicken-users] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Interesting! I didn't know about git fetch --tags, that worked. But yes,
it's not on a branch. We'll use this for our tests. Thanks everyone!

K.

On Tue, Jun 9, 2015 at 11:31 AM, Christian Kellermann ck...@pestilenz.org
wrote:

 * Kristian Lein-Mathisen kristianl...@gmail.com [150609 11:25]:
  Interesting. I can't fint that tag:

 How did you update? Git will only fetch tags from the server if you tell
 it to do so, for example git fetch --tags.

 The tag interestingly resides on a commit without a branch though, it
 sits on 671a5eb3fa2cf29f7e9d7a877e22335fb503934a.

 So I guess what happened is that Moritz created a tag, then moved the
 commit to some place else (which in essence is creating a new commit
 with its own hash). BUT as tags are just bookmarks to commit hashes this
 does not automatically adjust the tag.

 TL;DR the tag is worthless and needs to be reset by the author.

 As a workaround tag eacc846be7cf4026eb8e8f6eaa577082d826da2e as you
 proposed, Moritz should do that for the call-cc.org repo.

 Sorry,

 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] [Chicken-announce] CHICKEN 4.10.0 release candidate 1 available

2015-06-09 Thread Kristian Lein-Mathisen
Great work Moritz and the team! Looking forward to test this on our
systems.

We are building from the git repo, is there a tag/branch for 4.10.0?
prerelease perhaps?

K.

On Sun, Jun 7, 2015 at 5:16 PM, Moritz Heidkamp mor...@twoticketsplease.de
wrote:

 Hello everyone,

 we are happy to announce the first release candidate of the upcoming
 CHICKEN 4.10.0. It is now available at this location:

 http://code.call-cc.org/dev-snapshots/2015/06/07/chicken-4.10.0rc1.tar.gz

 The SHA 256 sum of that tarball is

 b5cc7c2d270d11f56a52da1b78950ada27d9bce2496b8ba230542d104b5477f0

 The list of changes since version 4.9.0 is available here:

 http://code.call-cc.org/dev-snapshots/2015/06/07/NEWS

 Please give it a test and report your findings to the mailing list.

 Here's a suggested test procedure:

   $ make PLATFORM=platform PREFIX=some dir install check
   $ some dir/bin/chicken-install pastiche

 If you want to build CHICKEN with a compiler other than the default one,
 just use C_COMPILER=the compiler (e.g., C_COMPILER=clang) on the make
 invocation.

 Of course, feel free to explore other supported build options (see the
 README file for more information) and actually use CHICKEN 4.10.0rc1 for
 your software.

 If you can, please let us know the following information about the
 environment you tested the RC tarball on:

 Operating system: (e.g., FreeBSD 10.1, Debian 8, Windows 7 mingw-msys)
 Hardware platform: (e.g., x86, x86-64, PPC)
 C Compiler: (e.g., GCC 4.9.2, clang 3.6)
 Installation works?: yes or no
 Tests work?: yes or no
 Installation of eggs works?: yes or no

 Thanks in advance!

 The CHICKEN Team

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


Re: [Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-21 Thread Kristian Lein-Mathisen
I see, that sounds sensible. Could you apply the no-home-path-expansion
patch and fix it upstream, so that openssl will work on 4.9.01?

K.

On Tue, May 19, 2015 at 3:23 PM, Thomas Chust ch...@web.de wrote:

 On 2015-05-19 13:35, Kristian Lein-Mathisen wrote:
  [...]
  It's been way too long! I'm running CHICKEN 4.9.0.1 and the openssl-egg
  segfaults at ssl-load-certificate-chain! and friends.
 
  I have two patches/suggestions:
  - remove home path expansion
  - use the pathname-expand egg
  [...]

 Hello,

 the only reason this functionality was included in the first place, was
 that CHICKEN's standard I/O procedures used to perform automatic home
 directory expansion, so I wanted the OpenSSL egg to behave similarly. If
 I'm not mistaken, the standard I/O procedures no longer do home
 directory expansion by default. I think it would make sense to also
 remove this functionality from the OpenSSL egg. If needed, one could
 always make use of the pathname-expand egg explicitly, which would make
 the intent clearer.

 Ciao,
 Thomas


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

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

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


Re: [Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-21 Thread Kristian Lein-Mathisen
Obs! I'm on Version 4.9.1 (rev 30bb2f2), sorry for the confusion Thomas!

Thanks for getting it in there. I wonder what might break with this
upcoming change.
K.

On Thu, May 21, 2015 at 6:01 PM, Thomas Chust ch...@web.de wrote:

 On 2015-05-21 09:18, Kristian Lein-Mathisen wrote:
  I see, that sounds sensible. Could you apply the no-home-path-expansion
  patch and fix it upstream, so that openssl will work on 4.9.01?
  [...]

 Hello,

 I just checked and apparently the home path expansion stuff is still in
 place in released versions of chicken: My installation of CHICKEN reports

   Version 4.9.0.1 (stability/4.9.0) (rev 8b3189b)

 and it has ##sys#expand-home-path and does automatic home path expansion
 for standard I/O procedures such as open-input-file :-/

 There is commit 4f91e654f04254ba1039e327460e643fefbf5e36 in CHICKEN's
 Git repository that gets rid of this cruft, but it's not included in any
 released source tarball, as far as I can tell.

 I have removed the uses of ##sys#expand-home-path from the trunk version
 of the OpenSSL egg, but I think it doesn't make sense to tag a release
 at the moment.

 Ciao,
 Thomas


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

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


[Chicken-users] openssl egg segfauls: ##sys#expand-home-path

2015-05-19 Thread Kristian Lein-Mathisen
Hi guys,

It's been way too long! I'm running CHICKEN 4.9.0.1 and the openssl-egg
segfaults at ssl-load-certificate-chain! and friends.

I have two patches/suggestions:
- remove home path expansion
- use the pathname-expand egg

I need either of these patches to make openssl not segfault on my system.
Any chance of fixing this upstream?

Thanks!
K.
From 8aeb5252f681d472816dc84e6f00f284ce8aa3c9 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen kristianl...@gmail.com
Date: Tue, 19 May 2015 13:22:22 +0200
Subject: [PATCH] bugfix: no home-path expansion

because `##sys#expand-home-path` was removed in something like
4.9.0.1. this variable is unbound and causes a segfault (OBS! no error
saying that ##sys#expand-home-path is not available)
---
 openssl.scm | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/openssl.scm b/openssl.scm
index db693fe..9e2d57a 100644
--- a/openssl.scm
+++ b/openssl.scm
@@ -42,8 +42,7 @@
##sys#current-thread
##sys#size
##sys#setslot
-   ##sys#check-string
-   ##sys#expand-home-path))
+   ##sys#check-string))
 
 (use srfi-18 tcp)
 
@@ -583,7 +582,7 @@ EOF
   (unless (eq?
 	   ((foreign-lambda
 	 int SSL_CTX_use_certificate_chain_file c-pointer c-string)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname))
+	(ssl-unwrap-context obj) pathname)
 	   1)
 (ssl-abort 'ssl-load-certificate-chain! #f pathname)))
 
@@ -602,7 +601,7 @@ EOF
 	   return(SSL_CTX_use_PrivateKey_file(
 	(SSL_CTX *)ctx, path, 
 	(asn1 ? SSL_FILETYPE_ASN1 : SSL_FILETYPE_PEM)));\n)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname)
+	(ssl-unwrap-context obj) pathname
 	rsa? asn1?)
 	   1)
 (ssl-abort 'ssl-load-private-key! #f pathname rsa? asn1?)))
@@ -626,8 +625,8 @@ EOF
 	   ((foreign-lambda
 	 int SSL_CTX_load_verify_locations c-pointer c-string c-string)
 	(ssl-unwrap-context obj)
-	(if pathname (##sys#expand-home-path pathname) #f)
-	(if dirname (##sys#expand-home-path dirname) #f))
+	(if pathname pathname #f)
+	(if dirname dirname #f))
 	   1)
 (ssl-abort 'ssl-load-verify-root-certificates! #f pathname dirname)))
 
@@ -636,8 +635,7 @@ EOF
   (##sys#check-string pathname)
   (ssl-clear-error)
   (cond
-   (((foreign-lambda c-pointer SSL_load_client_CA_file c-string)
- (##sys#expand-home-path pathname))
+   (((foreign-lambda c-pointer SSL_load_client_CA_file c-string) pathname)
 = (cut
 	(foreign-lambda
 	 void SSL_CTX_set_client_CA_list c-pointer c-pointer)
-- 
2.4.1

From 14254fa5a4e0d9d2084c309abc3cc128950f6919 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen kristianl...@gmail.com
Date: Tue, 19 May 2015 13:31:21 +0200
Subject: [PATCH] bugfix: migrates from ##sys#expand-home-path =
 pathname-expand

the ##sys#expand-home-path procedure was removed from core around
chicken 4.9.0.1, and put in a separate egg. let's use that egg (or not
expand at all?)

without this patch, ssl-load-certificate-chain! and friends will
segfault! it's trying to call an unbound procedure: ##sys#expand-home-path
---
 openssl.meta |  1 +
 openssl.scm  | 15 +++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/openssl.meta b/openssl.meta
index b27c8a2..5904c83 100644
--- a/openssl.meta
+++ b/openssl.meta
@@ -5,5 +5,6 @@
  (author Thomas Chust)
  (license BSD)
  (category net)
+ (depends pathname-expand)
  (doc-from-wiki)
  (files openssl.scm openssl.release-info openssl.meta openssl.setup))
diff --git a/openssl.scm b/openssl.scm
index db693fe..f7665d4 100644
--- a/openssl.scm
+++ b/openssl.scm
@@ -42,10 +42,9 @@
##sys#current-thread
##sys#size
##sys#setslot
-   ##sys#check-string
-   ##sys#expand-home-path))
+   ##sys#check-string))
 
-(use srfi-18 tcp)
+(use srfi-18 tcp pathname-expand)
 
 #
 #include errno.h
@@ -583,7 +582,7 @@ EOF
   (unless (eq?
 	   ((foreign-lambda
 	 int SSL_CTX_use_certificate_chain_file c-pointer c-string)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname))
+	(ssl-unwrap-context obj) (pathname-expand pathname))
 	   1)
 (ssl-abort 'ssl-load-certificate-chain! #f pathname)))
 
@@ -602,7 +601,7 @@ EOF
 	   return(SSL_CTX_use_PrivateKey_file(
 	(SSL_CTX *)ctx, path, 
 	(asn1 ? SSL_FILETYPE_ASN1 : SSL_FILETYPE_PEM)));\n)
-	(ssl-unwrap-context obj) (##sys#expand-home-path pathname)
+	(ssl-unwrap-context obj) (pathname-expand pathname)
 	rsa? asn1?)
 	   1)
 (ssl-abort 'ssl-load-private-key! #f pathname rsa? asn1?)))
@@ -626,8 +625,8 @@ EOF
 	   ((foreign-lambda
 	 int SSL_CTX_load_verify_locations c-pointer c-string c-string)
 	(ssl-unwrap-context obj)
-	(if pathname (##sys#expand-home-path pathname) #f)
-	(if dirname (##sys#expand-home-path dirname) #f))
+	(if pathname (pathname-expand pathname) #f)
+	(if dirname (pathname-expand dirname) #f))
 	   1)
 (ssl-abort 'ssl-load-verify-root-certificates! #f

Re: [Chicken-users] Homepage design proposal

2015-01-23 Thread Kristian Lein-Mathisen
Yeah, that makes sense. I guess we're stuck with a server-side solution
unless we can get Chicken running on this little emulator
http://bellard.org/jslinux/. repl.it may be of inspiration!

Thanks,
K.

On Fri, Jan 23, 2015 at 1:08 PM, Yaroslav Tsarko eriktsa...@googlemail.com
wrote:

  Kristian,

 On 23.01.2015 14:34, Kristian Lein-Mathisen wrote:

  Has anybody played with the idea of compiling CHICKEN with emscripten
 http://emscripten.org/? That way, we could have a client-side REPL to
 experiment with on the homepage.


 As far as I could understand it, one does not simply compile CHICKEN using
 emscripten because of setjmp/longjmp (according to this page:
 http://kripken.github.io/emscripten-site/docs/porting/guidelines/portability_guidelines.html)
 without special porting.

 Thanks,
 Yaroslav

 ___
 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] Happy Christmas

2014-12-29 Thread Kristian Lein-Mathisen
I'm a little late too!

I also want to wish everyone a wonderful vacation. And a happy new year
with many blessings!

K.
On Dec 29, 2014 9:15 PM, Pedro Melendez pmelen...@pevicom.com wrote:

 Is it too late to join to the Happy holidays sentiment?

 I hope you guys had (and/or are having) a great holiday season.

 Cheers,

 Pedro.

 On Mon, Dec 29, 2014 at 1:56 PM, Kevin Wortman kwort...@gmail.com wrote:

 Happy holidays from California, USA!

 Cheers,
 Kevin Wortman

 On Sat, Dec 27, 2014 at 1:06 AM, Karel Miklav ka...@lovetemple.net
 wrote:

 Happy holidays Felix, the rest of the Chicken team and everybody else on
 this list.

 Thank you for the good work!

 Karel

 ___
 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




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


Re: [Chicken-users] Why there is no nil?

2014-12-17 Thread Kristian Lein-Mathisen
Hi Bahman,

I just thought I'd add that the only thing that evaluates to false in
Scheme is #f.

K.
On Dec 17, 2014 9:42 AM, Christian Kellermann ck...@pestilenz.org wrote:

 * Bahman Movaqar bah...@bahmanm.com [141217 09:35]:
  I'm curious to know why nil is not defined in CHICKEN and one has to
  use '() instead? TIA,
 
  PS: Or am I missing something ridiculously obvious!?

 This is scheme not lisp. nil is not defined in R5RS scheme.
 And I think it is not defined in R6RS or R7RS either.

 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] crypt egg: won't compile for Android

2014-11-02 Thread Kristian Lein-Mathisen
Hi all,

Android, I believe, like OpenBSD, has no libcrypt.so but still has support
for the crypt function. The crypt.setyp has already support for removing
the -lcrypt flag during compilation and injecting android into that seems
to do the trick:

diff --git a/crypt.setup b/crypt.setup
index eeaf1d5..9dac09a 100644
--- a/crypt.setup
+++ b/crypt.setup
@@ -28,2 +28,3 @@ EOF
 (openbsd #f)
+(android #f)
 (else #t)

Could someone fix this upstream if this patch is acceptable?
Thank you!
K.
___
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users


Re: [Chicken-users] crypt egg: won't compile for Android

2014-11-02 Thread Kristian Lein-Mathisen
Perfect, thank you!

K.
On Nov 2, 2014 4:01 PM, Peter Bex peter@xs4all.nl wrote:

 On Sun, Nov 02, 2014 at 02:43:38PM +0100, Kristian Lein-Mathisen wrote:
  Hi all,
 
  Android, I believe, like OpenBSD, has no libcrypt.so but still has
 support
  for the crypt function. The crypt.setyp has already support for removing
  the -lcrypt flag during compilation and injecting android into that
 seems
  to do the trick:

 Hi Kris,

 Thanks for reporting this!  I've just released crypt 0.4.3 which
 includes the change.

 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] new egg: arrays

2014-10-28 Thread Kristian Lein-Mathisen
Hi Juergen!

Is it possible you've made the same mistake I did with my last
egg-announcement, forgetting to provide a URL for us?

K.
On Oct 28, 2014 5:03 PM, Juergen Lorenz j...@jugilo.de wrote:

 Hi all,
 I've just uploaded a new egg, arrays, which contains an implementation
 of functional arrays, which -- like vectors -- allow fast access to its
 stored items, but -- unlike vectors -- can shrink and grow as needed.
 As an application, an implementation of sets is provided.
 Please give the library a try.
 Best regards
 Juergen

 --

 Dr. Juergen Lorenz
 Flensburger Str. 12
 10557 Berlin

 ___
 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] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
Hi folks!

I have lately been working on an egg for thread-safe message passing, and
this is my first attempt:

https://github.com/Adellica/chicken-gochan

I've decided to go with the relatively well-established channel-API of
GoLang since I don't really know what I'm doing. This implementation is
based on Alex Shinn's channel.scm from Chibi Scheme.

Please add it to the coop, and please try it out!

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


Re: [Chicken-users] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
Hi,

Sorry about that! Should be fixed now. Do I need to release a new version
of gochan?

I will fix nanomsg asap.
K.

On Wed, Oct 22, 2014 at 12:40 PM, Mario Domenech Goulart 
mario.goul...@gmail.com wrote:

 Hi Kristian,

 On Wed, 22 Oct 2014 11:04:42 +0200 Kristian Lein-Mathisen 
 kristianl...@gmail.com wrote:

  I have lately been working on an egg for thread-safe message passing,
  and this is my first attempt:
 
  https://github.com/Adellica/chicken-gochan
 
  I've decided to go with the relatively well-established channel-API of
  GoLang since I don't really know what I'm doing. This implementation
  is based on Alex Shinn's channel.scm from Chibi Scheme.
 
  Please add it to the coop, and please try it out!

 Cool.  Thanks for sharing your work.

 salmonella reports a couple of issues with gochan:

 - Missing egg category
 - Missing license
 - Test failure (missing dependency on test, at least)

 BTW, have you seen http://bugs.call-cc.org/ticket/1163 ?

 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] new egg: gochan

2014-10-22 Thread Kristian Lein-Mathisen
 Just make sure the latest tag specified in .release-info points to a
 working state.


Fixed! For both nanomsg and gochan.

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


  1   2   >