Re: [PATCH 1/1] Allow "-cached" flag with chicken-install for local egg file

2021-03-13 Thread kooda
Sounds good to me! Applied.  :)



Re: [PATCH] * types.db: Fix set-parameterized-read-syntax! , set-sharp-read-syntax! types

2021-03-13 Thread kooda
megane  wrote:
> here's a small patch for #1733.

Applied :)



Re: [PATCH] better error message with unknown component-dependency

2021-03-03 Thread kooda
felix.winkelm...@bevuta.com wrote:
> Reported by wasamasa.
> 

Resurecting this bug report.

As reference, here is an example egg file that shows the error (from wasamasa):

((synopsis "Broken")
 (components (program test (component-dependencies test-files))
 (data test-files (files "test.txt"

Unknown component dependenciy errors are already handled in filter-deps, the 
problem here is trying to generate build commands for data files.

The original proposed patch displays an error message even though the egg file 
is valid, it’s just a no-op to have a data component as a dependency, because 
the data is always there.
I think having this kind of error message (“unknown dependency: test-files” for 
the above example) would be very confusing.

Here is a different patch for this issue: it just adds the three missing cases 
for static data components, mapping them to an empty build command list.
For good measure there’s also a fallback case that prints an error message 
indicating that there is a bug in chicken-install if we someday add a new 
component type and forget to add its build commands.

From 648331dda85ec4de1ef3ee2c07d5dead0c22c61f Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Wed, 3 Mar 2021 11:49:57 +0100
Subject: [PATCH] =?UTF-8?q?chicken-install:=20don=E2=80=99t=20try=20to=20g?=
 =?UTF-8?q?enerate=20build=20commands=20for=20data=20components?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 egg-compile.scm | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index be05f6a6..a4c4bf0c 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -526,9 +526,14 @@
(if (memq 'static link)
(list (apply compile-static-object data))
'())
-  (else
-(let ((data (assq id genfiles)))
-  (list (apply compile-generated-file data))
+  ((assq id genfiles) =>
+   (lambda (data)
+ (list (apply compile-generated-file data
+  ((or (assq id data)
+   (assq id cinc)
+   (assq id scminc))
+   '()) ;; nothing to build for data components
+  (else (error "Error in chicken-install, don't know how to 
build component" id
   order)
 ;; installation commands
 (append
-- 
2.30.0



Re: [PATCH] Only force finalizers at program cleanup when live finalizer count is non-zero

2020-07-28 Thread kooda
felix.winkelm...@bevuta.com wrote:
> Here is an amended patch - before checking live the finalizer count, any
> finalizers already pending are executed.
> 
> 
> felix

Applied, thanks. :)



Re: [PATCH] Update irregex to 0.9.8 for issue in irregex-replace/all with positive lookbehind

2020-07-28 Thread kooda
Peter Bex  wrote:
> Hi all,
> 
> Here's a patch to bring our core copy of irregex up to date with the
> upstream change Alex pushed yesterday to fix the issue reported on
> chicken-users by Kay Rhodes.
> 
> Cheers,
> Peter

Applied, thanks. :)



Re: [PATCH] use -rpath option

2020-03-24 Thread kooda
felix.winkelm...@bevuta.com wrote:
> This patch replaces the use of the "-R" linker option by "-rpath", which 
> appears to be
> more portable (accepted by tcc, for example). According to the GNU ld manual, 
> -R is
> actually a compatibility alias for -rpath, so the latter seems to be more 
> canonical.
> The manual page for Solaris' ld lists only -R, so on that platform we still 
> use it.

Pushed, thank you!

I also took the liberty to push the remaining change needed to make
CHICKEN build with TCC.


Re: [PATCH] Implement platform autodetection when possible

2020-03-24 Thread kooda
Evan Hanson  wrote:
> Hi there,
> 
> Here's a signed-off version of the latest patch, including removing the
> handling of iOS as John suggested. I've also fixed the capitalisation of
> the Haiku platform name, added a bit more info to the NEWS entry, and
> moved it into the correct section.

Hey, I finally pushed this!

I added a check so that it works on non-gnu Linux systems (such as Alpine 
Linux).

Thanks a lot for this!


Re: [patch] csi needs flonum arithmetic

2020-02-03 Thread kooda
felix.winkelm...@bevuta.com wrote:
> This patch removes the "fixnum-arithmetic" declaration from csi.scm,
> since "report" (,r) crashes due to flonums in the symbol-table statistics
> vector.

Applied.



Re: [PATCH] compile c-object components properly in dynamic mode

2019-12-18 Thread kooda
felix.winkelm...@bevuta.com wrote:
> This patch addresses #1659, as reported by Thomas Chust.

Applied



Re: [PATCH] Fix too small memory allocations

2019-11-28 Thread kooda
Evan Hanson  wrote:
> Hi Jani,
> 
> Thank you! It took a while to track down a gcc that was new enough, but
> I've attached a signed-off version.
> 
> This one also includes the extra info from Peter and megane's commit
> messages, as well as the variable from megane's that gives a name to the
> `min-words-per-bignum' value in c-platform.scm.
> 

I added the srfi-4 rewrites mentionned previously and pushed this. Thanks
a lot everyone!



Re: [Chicken-hackers] [PATCH] Fix #1633 by detecting nonexistent field names (typos) in constructor a

2019-10-11 Thread kooda
Peter Bex  wrote:
> Here's a relatively straightforward patch for #1633; we simply walk the
> constructor's arguments and check that there's a matching field
> definition for it.  If not, bail out with syntax-error.

Cool! Pushed!

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


Re: [Chicken-hackers] Allowing unspecified key arguments in functions

2019-07-26 Thread kooda
Amir Teymuri  wrote:
> I had a question about the objectives and reasons of allowing
> un-specified key arguments in functions as soon as i want to have some
> key arguments.

Any DSSSL style arguments (#!rest, #!optional and #!key) always are
optional arguments to the procedure.

You can think of them as working this way:

(lambda (foo #!key bar qux) your-code)
=>
(lambda (foo . rest)
  (let ((bar (get-keyword-arg #:bar rest))
(qux (get-keyword-arg #:qux rest)))
your-code))

If you want to have a more strict handling of them, you might want to
write your own superset of “lambda” and/or “define”, that check
what you need.

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


Re: [Chicken-hackers] [PATCH] Fix C_u_i_s32vector_ref

2019-07-25 Thread kooda
megane  wrote:
> Hi,
> 
> Here's a small typo fix.
> 

Thanks! Applied! Sorry for the wait.

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


[Chicken-hackers] MacOS salmonella machine woes

2019-07-11 Thread kooda
Hey! 

A few months ago, I insalled salmonella on an old macbook a friend gave
me. It was working great, until very recently. During the heatwave, the
power supply died. Does anyone around here have a spare one? 

From what I’ve seen, there are multiple different types of those, the
one I need looks like this:

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


Re: [Chicken-hackers] [PATCH] Sync "compile_r" behaviour in Windows and Unix test scripts

2019-07-10 Thread kooda
Evan Hanson  wrote:
> Hi there,
> 
> Here's a fix for an issue I found while testing megane's inlining patch.
> 
> It just makes the Windows tests match the Unix ones. Currently,
> %compile_r% always generates a file called a.out, which isn't correct,
> or at least isn't what we want for the new inlining test.
> 
> Cheers,

Applied!

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


Re: [Chicken-hackers] [PATCH] Always regenerate import libraries in setup-mode

2019-05-29 Thread kooda
felix.winkelm...@bevuta.com wrote:
> > On 2019-05-07  7:45, Evan Hanson wrote:
> > > On 2019-05-06 13:04, ko...@upyum.com wrote:
> > > > I don't think that patch is right. If you emit import libraries from the
> > > > static builds, you will not be able to import modules from the evaluator
> > > > when the modules are statically linked, because the module registration
> > > > code is taken out.
> > > 
> > > Oh, of course, you're right. I suppose the bug is really that the build
> > > script tries to compile these files, then, and not that they aren't
> > > emitted?
> > 
> > No, that's not right either. It's a combination of the two: if they're
> > not emitted, there's no file to install and separate compilation is
> > impossible, but if they *are* emitted then they're removed from the
> > compiled artifacts and ipmort-in-eval fails (as you point out).
> > 
> > I wonder... For static-only extensions, do we perhaps need to add a call
> > to csc with "-analyze-only" just to produce the import libraries? And in
> > the meantime, should we "undocument" the static option for "linkage"
> > with something like the attached?
> 
> I dunno, this somehow defeats the purpose of the linkage property.
> I think it is better to change the behaviour to do the right thing instead
> of defining an switch that has just a single option.

Should we fix this for 5.1?

In any case we should probably open a ticket to keep track of that issue.

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


[Chicken-hackers] ♥PATCH♥ Update types.db to reflect keyword changes

2019-05-25 Thread kooda
When messing around with the latest changes in core, I found a couple of type 
warnings.

From 1cfa85be5cba3e45e3bea4508fa68f0918629097 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Sat, 25 May 2019 15:24:53 +0200
Subject: [PATCH] Update types.db to reflect keyword changes

---
 types.db | 61 +---
 1 file changed, 32 insertions(+), 29 deletions(-)

diff --git a/types.db b/types.db
index 2e34d99d..01f76ec6 100644
--- a/types.db
+++ b/types.db
@@ -63,13 +63,13 @@
 (scheme#eq? (#(procedure #:pure #:foldable) scheme#eq? (* *) boolean))
 
 (scheme#eqv? (#(procedure #:pure #:foldable) scheme#eqv? (* *) boolean)
-(((or immediate symbol) *) (scheme#eq? #(1) #(2)))
-((* (or immediate symbol)) (scheme#eq? #(1) #(2)))
+(((or immediate symbol keyword) *) (scheme#eq? #(1) #(2)))
+((* (or immediate symbol keyword)) (scheme#eq? #(1) #(2)))
 ((* *) (##core#inline "C_i_eqvp" #(1) #(2
 
 (scheme#equal? (#(procedure #:pure #:foldable) scheme#equal? (* *) boolean)
-  (((or immediate symbol) *) (scheme#eq? #(1) #(2)))
-  ((* (or immediate symbol)) (scheme#eq? #(1) #(2)))
+  (((or immediate symbol keyword) *) (scheme#eq? #(1) #(2)))
+  ((* (or immediate symbol keyword)) (scheme#eq? #(1) #(2)))
   ((number number) (##core#inline "C_i_eqvp" #(1) #(2
 
 (scheme#pair? (#(procedure #:pure #:predicate pair) scheme#pair? (*) boolean))
@@ -190,15 +190,15 @@
 (scheme#memv (forall (a b) (#(procedure #:clean #:foldable) scheme#memv (a 
(list-of b))
(or false (pair a (list-of b)
 ((* null) (let ((#(tmp) #(1))) '#f))
-(((or symbol procedure immediate) list)
+(((or symbol keyword procedure immediate) list)
  (##core#inline "C_u_i_memq" #(1) #(2
 
 (scheme#member (forall (a b) (#(procedure #:clean #:foldable) scheme#member (a 
(list-of b))
  (or false (pair a (list-of b)
   ((* null) (let ((#(tmp) #(1))) '#f))
-  (((or symbol procedure immediate) list)
+  (((or symbol keyword procedure immediate) list)
(##core#inline "C_u_i_memq" #(1) #(2)))
-  ((* (list-of (or symbol procedure immediate)))
+  ((* (list-of (or symbol keyword procedure immediate)))
(##core#inline "C_u_i_memq" #(1) #(2
 
 (scheme#assq (forall (a b c) (#(procedure #:clean #:foldable) scheme#assq
@@ -211,18 +211,18 @@
  (a (list-of (pair b c)))
  (or false (pair a c
 ((* null) (let ((#(tmp) #(1))) '#f))
-(((or symbol immediate procedure) (list-of pair))
+(((or symbol keyword immediate procedure) (list-of pair))
  (##core#inline "C_u_i_assq" #(1) #(2)))
-((* (list-of (pair (or symbol procedure immediate) *)))
+((* (list-of (pair (or symbol keyword procedure immediate) *)))
  (##core#inline "C_u_i_assq" #(1) #(2
 
 (scheme#assoc (forall (a b c) (#(procedure #:clean #:foldable) scheme#assoc
   (a (list-of (pair b c)))
   (or false (pair a c
  ((* null) (let ((#(tmp) #(1))) '#f))
- (((or symbol procedure immediate) (list-of pair))
+ (((or symbol keyword procedure immediate) (list-of pair))
   (##core#inline "C_u_i_assq" #(1) #(2)))
- ((* (list-of (pair (or symbol procedure immediate) *)))
+ ((* (list-of (pair (or symbol keyword procedure immediate) *)))
   (##core#inline "C_u_i_assq" #(1) #(2
 
 (scheme#symbol? (#(procedure #:pure #:predicate symbol) scheme#symbol? (*) 
boolean))
@@ -731,8 +731,8 @@
  (procedure scheme#call-with-output-file
(string (procedure (output-port) . *) #!rest) . *))
 
-(scheme#open-input-file (#(procedure #:clean #:enforce) scheme#open-input-file 
(string #!rest symbol) input-port))
-(scheme#open-output-file (#(procedure #:clean #:enforce) 
scheme#open-output-file (string #!rest symbol) output-port))
+(scheme#open-input-file (#(procedure #:clean #:enforce) scheme#open-input-file 
(string #!rest keyword) input-port))
+(scheme#open-output-file (#(procedure #:clean #:enforce) 
scheme#open-output-file (string #!rest keyword) output-port))
 (scheme#close-input-port (#(procedure #:enforce) scheme#close-input-port 
(input-port) undefined))
 (scheme#close-output-port (#(procedure #:enforce) scheme#close-output-port 
(output-port) undefined))
 
@@ -757,11 +757,11 @@
 (scheme#newline (#(procedure #:enforce) scheme#newline (#!optional 
output-port) undefined))
 
 (scheme#with-input-from-file
- (#(procedure #:enforce) scheme#with-input-from-file (string (procedure () . 
*) #!rest symbol) . *)

Re: [Chicken-hackers] [PATCH] Fix breakage for dependencies of foreigners and bind egg (and a few mor

2019-05-25 Thread kooda
Applied!

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


Re: [Chicken-hackers] [PATCH] Improve hygiene of FFI macros

2019-05-06 Thread kooda
Peter Bex  wrote:
> Attached is an updated version of my initial patch but without that one
> patch hunk that broke canonicalize-expression.

This looks good, I’ve applied it.

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


Re: [Chicken-hackers] [PATCH] Always regenerate import libraries in setup-mode

2019-05-06 Thread kooda
Evan Hanson  wrote:
> Here's a new version that uses a flag.

Thanks! I’ve applied this.

> There's also a supporting bugfix dealing with static-only extension
> libraries (that's the first patch).

I don’t think that patch is right. If you emit import libraries from the
static builds, you will not be able to import modules from the evaluator
when the modules are statically linked, because the module registration
code is taken out.

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


Re: [Chicken-hackers] [PATCH] Fix #1581 by allowing unqualified record names

2019-04-20 Thread kooda
felix.winkelm...@bevuta.com wrote:
> Can anybody give details about the coops problem?

From what I can remember, the main problem is not in coops itself, but
in record-variants, that uses low-level ##sys# procedures to define
records and doesn’t use the right tags (which don’t work with
define-record-printer and in turn prevent print-object methods from
working as intended).

I think with the module prefix, any egg using the low-level structure
procedures have to be updated.

If I remember correctly, at SaarCHICKEN we pretty much settled on the
solution of using the record name variable containing the correct tag,
which is the most correct and elegant solution, and should fix every
one of these problems, not just `record-instance?`

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


Re: [Chicken-hackers] [PATCH] Always regenerate import libraries in setup-mode

2019-04-11 Thread kooda
Evan Hanson  wrote:
> This patch is a very simple solution to the problem, but it's not the
> only way we could address the issue so if someone wants to propose
> something more clever please be my guest.

I would prefer this to be a separate csc option, instead of putting it
together with setup-mode.

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


Re: [Chicken-hackers] [PATCH] Fix #1581 by allowing unqualified record names

2019-04-11 Thread kooda
Peter Bex  wrote:
> Hi all,
> 
> Here's a relatively straightforward patch, which fixes #1581 as we
> discussed at SaarCHICKEN.

Please don’t apply this patch.

The conclusion we arrived to, at SaarCHICKEN, was that the user of such
procedure would be able to use the record variable holding the structure
tag. This would be a more general solution than this patch, since it
can also be used with ##sys#make-structure, ##sys#check-structure and
other procedures of this kind.

On the other hand, this will require more work from existing eggs’ authors, 
such as record-variant (that uses internal ##sys#… procedures)
or matchable (that captures, probably unhygienically, the symbol passed
by the user).

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


Re: [Chicken-hackers] [PATCH] Reset port EOF flag when seeking

2019-04-01 Thread kooda
Peter Bex  wrote:
> I think this isn't entirely correct; your code returns either
> # or whatever C_fseek returns.  The wrapping "unless"
> will thus see # if the when's condition is false.
> […]
> though I don't really like the nested (and ... (begin ...)).

Woops! Indeed!

Here’s a new patch. Do you like that style better?

>From ac00085ee814f026d39e2ee6bb9078228edfc1d5 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Mon, 1 Apr 2019 10:52:54 +0200
Subject: [PATCH] Reset port EOF flag when seeking

---
 posix-common.scm | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/posix-common.scm b/posix-common.scm
index bfd77941..73e14841 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -357,8 +357,10 @@ EOF
   (##sys#check-fixnum pos 'set-file-position!)
   (##sys#check-fixnum whence 'set-file-position!)
   (unless (cond ((port? port)
-(and (eq? (##sys#slot port 7) 'stream)
- (##core#inline "C_fseek" port pos whence) ) )
+(and-let* ((stream (eq? (##sys#slot port 7) 'stream))
+   (res (##core#inline "C_fseek" port pos whence)))
+   (##sys#setislot port 6 #f) ;; Reset EOF status
+   res))
((fixnum? port)
 (##core#inline "C_lseek" port pos whence))
(else
-- 
2.20.1

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


[Chicken-hackers] [PATCH] Reset port EOF flag when seeking

2019-03-31 Thread kooda
The subject explains it all. I think that’s the correct thing to do.

This fixes the tailf example of the inotify egg.

>From f865dfc57978ffe97501bb0edd2097179a26e365 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Sun, 31 Mar 2019 12:49:22 +0200
Subject: [PATCH] Reset port EOF flag when seeking

---
 posix-common.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/posix-common.scm b/posix-common.scm
index bfd77941..53ef3c28 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -357,8 +357,9 @@ EOF
   (##sys#check-fixnum pos 'set-file-position!)
   (##sys#check-fixnum whence 'set-file-position!)
   (unless (cond ((port? port)
-(and (eq? (##sys#slot port 7) 'stream)
- (##core#inline "C_fseek" port pos whence) ) )
+(when (eq? (##sys#slot port 7) 'stream)
+  (##sys#setislot port 6 #f) ;; Reset EOF status
+  (##core#inline "C_fseek" port pos whence) ) )
((fixnum? port)
 (##core#inline "C_lseek" port pos whence))
(else
-- 
2.20.1

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


[Chicken-hackers] …PATCH… Fix some bugs with the egg file c-object declaration

2019-03-29 Thread kooda
Hi!

When trying to use the new `c-object` and `objects` facilities to link a C
library to one of my eggs, I found a couple of bugs.

Two path construction mistakes, and one linking mistake which linked the
dynamic variant inside the static archive.

From 719bc786e4ef9e22643c69bf5ff8cc22d2bd056f Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Fri, 29 Mar 2019 14:35:40 +0100
Subject: [PATCH] Fix some bugs with the egg file c-object declaration

---
 egg-compile.scm | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index ee7ed86e..bffcf7fa 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -618,7 +618,7 @@
" " src " -o " out2)
 (when (pair? link-objects)
   (let ((lobjs (filelist srcdir
- (map (cut conc <> (object-extension platform))
+ (map (cut conc <> ".static" (object-extension 
platform))
link-objects)
  platform)))
 (print (qs* default-builder platform #t) " " out3 " : "
@@ -772,12 +772,13 @@
  (opts (if (null? options)
default-dynamic-compilation-options
options))
- (sname (or source name))
+ (sname (prefix srcdir name))
+ (ssname (and source (prefix srcdir source)))
  (out (qs* (target-file (conc sname
   (object-extension platform))
 mode)
platform))
- (src (qs* (conc sname ".c") platform)))
+ (src (qs* (or ssname (conc sname ".c")) platform)))
 (when custom
   (prepare-custom-command cmd platform))
 (print "\n" (slashify default-builder platform) " "
-- 
2.20.1

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


Re: [Chicken-hackers] [PATCH] Make imports faster

2019-03-24 Thread kooda
megane  wrote:
> Hi,
> 
> Here's a small patch that makes some things compile a lot faster.

This looks alright to me, but I don’t know that part of the compiler
very well so please check that thoroughly. :)

Here is the signed-off patch, as well as the results of profiling a very
module heavy program.

From d321b1ac43fb536e3cf6787ce58cfbe132a7d93b Mon Sep 17 00:00:00 2001
From: megane 
Date: Wed, 20 Mar 2019 15:15:25 +0200
Subject: [PATCH] Make imports faster

Importing modules with many identifiers (e.g. wrappers for GL
libraries) most of the time is spent merging the environments in
merge-se.

* modules.scm (merge-se): Use hash-tables to get O(n) instead of O(n^2) 
behaviour

Signed-off-by: Kooda 
---
 modules.scm | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/modules.scm b/modules.scm
index e018de5f..26cf55de 100644
--- a/modules.scm
+++ b/modules.scm
@@ -294,15 +294,24 @@
  (warn "indirect export of unknown binding" (car 
iexports))
  (loop2 (cdr iexports)))
 
-(define (merge-se . ses)   ; later occurrences take precedence
-  (let bwd ((ses (remove null? ses)))
-(cond ((null? ses) '())
- ((null? (cdr ses)) (car ses)) ; Do not re-cons the final list
- (else (let fwd ((se (car ses))
- (rest (bwd (cdr ses
- (cond ((null? se) rest)
-   ((assq (caar se) rest) (fwd (cdr se) rest))
-   (else (cons (car se) (fwd (cdr se) rest)
+(define (merge-se . ses*) ; later occurrences take precedence to earlier ones
+  (define (make-hash-table #!optional _test _hash (size 301)) (make-vector 
size '()))
+  (define (hash-table-exists? t k) (and (hash-table-ref t k) #t))
+  (let ((seen (make-hash-table)) (rses (reverse ses*)))
+(let loop ((ses (cdr rses)) (last-se #f) (se2 (car rses)))
+  (cond ((null? ses) se2)
+   ((or (eq? last-se (car ses)) (null? (car ses)))
+(loop (cdr ses) last-se se2))
+   ((not last-se)
+(unless (null? ses)
+  (for-each (lambda (e) (hash-table-set! seen (car e) #t)) se2))
+(loop ses se2 se2))
+   (else (let lp ((se (car ses)) (se2 se2))
+   (cond ((null? se) (loop (cdr ses) (car ses) se2))
+ ((hash-table-exists? seen (caar se))
+  (lp (cdr se) se2))
+ (else (hash-table-set! seen (caar se) #t)
+   (lp (cdr se) (cons (car se) se2))
 
 (define (##sys#compiled-module-registration mod)
   (let ((dlist (module-defined-list mod))
-- 
2.20.1

On hypergiant/examples/simple.scm
Compiled with chicken -:p simple.scm

master branch (without patch):
procedure   calls  seconds  average 
 percent

modules.scm:304: fwd   67  230.0803.434 
  80.371
modules.scm:305: fwd   76   32.4090.426 
  11.321
modules.scm:718: import-env18   22.5501.252 
   7.877
library.scm:1300: ##sys#allocate-vector 80.2400.030 
   0.083
core.scm:522: find-id   70.1600.022 
   0.055
library.scm:2673: ##sys#intern-symbol   80.1200.014 
   0.041
eval.scm:1033: ##sys#dload  60.1200.020 
   0.041
eval.scm:91: find-id70.0700.010 
   0.024
library.scm:3653: g4333 40.0400.010 
   0.013
library.scm:4031: ##sys#read-char-0 30.0300.010 
   0.010
library.scm:3634: g4319 30.0300.010 
   0.010
modules.scm:773: ##sys#current-environment  30.0300.010 
   0.010
library.scm:4055: loop  30.0300.010 
   0.010
expand.scm:277: lookup  30.0300.010 
   0.010
library.scm:4017: ##sys#peek-char-0 20.0200.010 
   0.006
internal.scm:178: hash-symbol   20.0200.010 
   0.006
modules.scm:585: chicken.keyword#keyword?   20.0200.010 
   0.006
library.scm:1285: copy  20.0200.010 
   0.006
modules.scm:715: g2251  20.0200.010 
   0.006
eval.scm:1035: ##sys#dload  10.0200.020 
   0.006
scrutinizer.scm:1849: g3797 10.0200.020 
   0.006
library.scm:3997: loop  10.0100.010 
   0.0

[Chicken-hackers] New salmonella test machine for Mac OS

2019-03-23 Thread kooda
Hey folks!

A friend of mine gave me his broken macbook laptop so I installed
all the things needed to run salmonella on it, here are the first results:
https://www.upyum.com/salmonella/master/clang/macosx/x86-64/2019/

I used MacPorts to install the eggs’ dependencies. Appart for a few
bindings, pretty much everything worked out of the box, that’s great!

I still need to figure out a few things to properly host the results,
but this should be fairly stable in a few days.

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


Re: [Chicken-hackers] ⍄PATCH⍃ Fix double quoting in build scripts

2019-03-18 Thread kooda
felix.winkelm...@bevuta.com wrote:
> Attached a patch for (hopefully) fixing #1588.

Pushed.
Thanks for looking into it!

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


Re: [Chicken-hackers] [PATCH] Re: Alternative egg installation directories

2019-03-01 Thread kooda
Jim Ursetto  wrote:
> - utf8: utf8-case-map files as above. Cannot currently be worked around as
> the path is hardcoded. (There is technically a way but it is not good.)

I have a patch for that egg that I use to release Ensemble, that gets rid of
the extra files and bakes them into the binaries. Otherwise this module is
useless when static linking.

Should I update the egg with this patch?

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


Re: [Chicken-hackers] ☺Patch☺ Add linkage to component-options

2019-01-23 Thread Kooda

On 1/17/19 12:04 AM, ko...@upyum.com wrote:

Tiny patch that makes “linkage” valid in the “component-options”
specification of egg files.

It gets quite tiresome to specify each one manually when you have a lot of
components. :x


Here is an updated patch set, after some discussion with Felix on IRC.

The first one changes the default linkage of program to static when
using a static CHICKEN.

The second one adds the functionality of the original patch, but this
patch tries to honor the dynamic scope, as per Felix’ recommendation.

The third one is a fix for a bug I found when trying static-only builds,
import libraries aren’t generated by the compilation of static
extensions. It works in the default case because the compilation of the
dynamic extension does generate the import library, and always occurs
before the compilation of the static variant.
>From 49510d1939e8cd6e13f4fe127a783666f70b6bec Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Wed, 23 Jan 2019 11:35:49 +0100
Subject: [PATCH 1/3] Make the default linkage of egg programs static when in a
 static CHICKEN build

---
 egg-compile.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index c744592b..ba4ed67c 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -30,11 +30,13 @@
 (define default-dynamic-program-link-options '())
 (define default-static-extension-link-options '())
 (define default-dynamic-extension-link-options '())
-(define default-program-linkage '(dynamic))
 (define default-static-compilation-options '("-O2" "-d1"))
 (define default-dynamic-compilation-options '("-O2" "-d1"))
 (define default-import-library-compilation-options '("-O2" "-d0"))
 
+(define default-program-linkage
+  (if staticbuild '(static) '(dynamic)))
+
 (define default-extension-linkage
   (if staticbuild '(static) '(static dynamic)))
 
-- 
2.20.1

>From 83f3df3ecaa0449156b5423a4612f6ef2f153836 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Wed, 23 Jan 2019 12:34:43 +0100
Subject: [PATCH 2/3] Add 'linkage' to the component-options specification of
 eggs

---
 egg-compile.scm | 9 +
 manual/Egg specification format | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index ba4ed67c..da277179 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -190,7 +190,7 @@
   (sdeps '())
   (src #f)
   (cbuild #f)
-  (link default-extension-linkage)
+  (link (if (null? link) default-extension-linkage link))
   (tfile #f)
   (ptfile #f)
   (ifile #f)
@@ -239,7 +239,7 @@
   (sdeps '())
   (src #f)
   (cbuild #f)
-  (link default-extension-linkage)
+  (link (if (null? link) default-extension-linkage link))
   (oname #f)
   (mods #f)
   (opts opts))
@@ -325,7 +325,7 @@
   (sdeps '())
   (cbuild #f)
   (src #f)
-  (link default-program-linkage)
+  (link (if (null? link) default-program-linkage link))
   (lobjs '())
   (lopts lopts)
   (oname #f)
@@ -408,7 +408,8 @@
   (case (car info)
 ((csc-options) (set! opts (append opts (cdr info
 ((link-options) (set! lopts (append lopts (cdr info
-(else (error "invalid option specification" info
+((linkage) (set! link (append link (cdr info
+(else (error "invalid component-options specification" info
 (define (compile-cond-expand info walk)
   (let loop ((clauses (cdr info)))
 (cond ((null? clauses)
diff --git a/manual/Egg specification format b/manual/Egg specification format
index 20b1dd0f..24b45038 100644
--- a/manual/Egg specification format	
+++ b/manual/Egg specification format	
@@ -145,7 +145,7 @@ intended for cross compilation.
 [egg property] (component-options OPTIONSPEC ...)
 
 Specifies global options for all programs and extensions compiled for this egg.
-{{OPTIONSPEC}} may be {{csc-options}} or {{link-options}} specifications.
+{{OPTIONSPEC}} may be {{csc-options}}, {{link-options}} or {{linkage}} specifications.
 
  cond-expand
 
-- 
2.20.1

>From 8dbc8612b4b18bf396d217c70e4582dd78a12ab6 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Wed, 23 Jan 2019 12:35:15 +0100
Subject: [PATCH 3/3] Fix building extensions in static only mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The import libraries weren’t generated by the static build call, only by the
dynamic one, which occurs before the static one in the default (dynamic

[Chicken-hackers] ☺Patch☺ Add linkage to component-options

2019-01-16 Thread kooda
Tiny patch that makes “linkage” valid in the “component-options”
specification of egg files.

It gets quite tiresome to specify each one manually when you have a lot of
components. :x

From c9753e8584ef1001332847001be74d5e747308e3 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Wed, 16 Jan 2019 23:49:59 +0100
Subject: [PATCH] Add 'linkage' to the component-options specification of egg
 files

---
 egg-compile.scm | 5 -
 manual/Egg specification format | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/egg-compile.scm b/egg-compile.scm
index c744592b..85f6e5b7 100644
--- a/egg-compile.scm
+++ b/egg-compile.scm
@@ -406,7 +406,10 @@
   (case (car info)
 ((csc-options) (set! opts (append opts (cdr info
 ((link-options) (set! lopts (append lopts (cdr info
-(else (error "invalid option specification" info
+((linkage)
+ (set! default-program-linkage (cdr info))
+ (set! default-extension-linkage (cdr info)))
+(else (error "invalid component-options specification" info
 (define (compile-cond-expand info walk)
   (let loop ((clauses (cdr info)))
 (cond ((null? clauses)
diff --git a/manual/Egg specification format b/manual/Egg specification format
index 20b1dd0f..24b45038 100644
--- a/manual/Egg specification format   
+++ b/manual/Egg specification format   
@@ -145,7 +145,7 @@ intended for cross compilation.
 [egg property] (component-options OPTIONSPEC ...)
 
 Specifies global options for all programs and extensions compiled for this egg.
-{{OPTIONSPEC}} may be {{csc-options}} or {{link-options}} specifications.
+{{OPTIONSPEC}} may be {{csc-options}}, {{link-options}} or {{linkage}} 
specifications.
 
  cond-expand
 
-- 
2.20.1

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


Re: [Chicken-hackers] ⌦PATCH⌫ cond-expand + error for .egg files

2018-11-18 Thread kooda
felix.winkelm...@bevuta.com wrote:
> That's actually a very good idea, but complicates the implementation.
> Currently we just add a bunch of forms. With your suggested change,
> we need to rewrite the egg spec as it is interpreted. Not too difficult,
> though.

Lets go with the current method for now, the change is already useful enough. :)
I pushed the patch as is.

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


Re: [Chicken-hackers] ⌦PATCH⌫ cond-expand + error for .egg files

2018-11-18 Thread kooda
felix.winkelm...@bevuta.com wrote:
> 2 patches: first one fixes the problem that program components
> are not considered when resolving component dependencies,

Pushed, thanks :)


> second adds "cond-expand" + "error" forms to the egg specification
> format and resurrects "chicken-install"s "-feature" option.

It looks fine, but I have one question: does it make sense to keep the
cond-expand clauses in the installed egg-info file? Shouldn’t the expanded
version be installed instead, to avoid losing some information about how the
egg was compiled?

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


Re: [Chicken-hackers] conditionals in .egg files

2018-09-28 Thread kooda
felix.winkelm...@bevuta.com wrote:
> I wonder: there is no way to conditionally set options, configure egg 
> building,
> etc. I think it would be handy to have a "cond-expand" form that can be used 
> inside
> ..egg files customize the egg build/installation depending on platform.
> […]
> Opinions?

I’m in favor of this, I’ve had the same kind of need for a few eggs too,
and suggested this cond-expand-like feature on IRC a few times.

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


Re: [Chicken-hackers] [PATCH] Fix parallel build

2018-09-06 Thread kooda
Tobias Kortkamp  wrote:
> Hi,
> 
> attempting to build 5.0.0rc1 in parallel (with something like gmake
> -j4 on FreeBSD) fails

Hi! :)

Sorry but parallel build is not supported so far.

See the README:
https://code.call-cc.org/cgi-bin/gitweb.cgi?p=chicken-core.git;a=blob;f=README;h=b43503c347c6a65b6caefea93380b48abfca6e3c;hb=68eeaaef3fc4eb6c500e62160b52c06edd403165#l74

I’m surprised you only found one problem about it!

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


Re: [Chicken-hackers] [PATCH] * chicken.h: Fix C_u_fixnum_modulo by extracting the definition from

2018-08-27 Thread kooda
Peter Bex  wrote:
> Good catch, here's a signed-off copy.  I also added the extra
> compilation with -unsafe to runtests.bat.

Pushed, great work!

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


Re: [Chicken-hackers] [PATCH] Fix error in "chicken-status -cached" due to `map' with string argument

2018-08-27 Thread kooda
Evan Hanson  wrote:
> Here's a bugfix for an error I encountered running "chicken-status -cached":

Pushed, thanks!

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


Re: [Chicken-hackers] C lost -D on chicken-install

2018-08-21 Thread kooda
Peter Bex  wrote:
> While I'm all for improving things, let's keep an eye on feature creep.  We
> are only fixing critical bugs here, not adding new features: those can go
> into 5.1.

Then we can drop that issue altogether until 5.1. One can pass the desired
features with CSC_OPTIONS already.

CSC_OPTIONS="-D foo" chicken-install the-egg

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


Re: [Chicken-hackers] C lost -D on chicken-install

2018-08-21 Thread kooda
felix.winkelm...@bevuta.com wrote:
> There is no bad intent behind this - during the rewrite simply a few options
> were dropped, since they didn't look crucial. If you want it back, no problem.

I’ve been missing it a little bit, but I agree with some of what has been said 
and would like to add my 2 cents.

Should the features declared via chicken-install be passed to all dependencies
being built? I think so.
Vasilij’s example is quite nice to support this opinion, building hypergiant
will bring a lot of other eggs, and every one of them accept a “gles” feature to
build for OpenGL ES instead of OpenGL.

I ported (not published yet) some of these eggs and I’ve been missing a way to
do different things depending on whether the gles feature is defined or not.
I think we should add a cond-expand like mecanism in the egg file format as
well, if we add `chicken-install -D` back.

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


Re: [Chicken-hackers] ⛆PATCH⛆ Convert program options to strings

2018-08-19 Thread kooda
Applied, with a little tweak.

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


[Chicken-hackers] Two fixes for Windows

2018-08-14 Thread kooda
Yesterday on IRC, Kristian Lein-Mathisen reported that static linking
of eggs was broken, here is a patch that fixes that, as well as a patch
that fixes a tiny issue where chicken-install would miss some files when
copying files into the cache.

From 91944110e86b684f259fcd8f9e5e54f18f3902b7 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Tue, 14 Aug 2018 09:40:52 +0200
Subject: [PATCH 1/2] Make static linking work on Windows

---
 csc.scm  |  3 ++-
 distribution/manifest|  1 +
 tests/csc-tests.scm  |  7 +--
 tests/module-static-link.scm |  3 +++
 tests/runtests.bat   | 16 ++--
 tests/runtests.sh|  7 +++
 6 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 tests/module-static-link.scm

diff --git a/csc.scm b/csc.scm
index 2c3c4ce6..75074ee8 100644
--- a/csc.scm
+++ b/csc.scm
@@ -63,6 +63,7 @@
 
 ;;; Parameters:
 
+(define windows (eq? (software-type) 'windows))
 (define mingw (eq? (software-version) 'mingw32))
 (define osx (eq? (software-version) 'macosx))
 (define cygwin (eq? (software-version) 'cygwin))
@@ -101,7 +102,7 @@
 (define rc-compiler (quotewrap (if host-mode INSTALL_RC_COMPILER TARGET_RC_COMPILER)))
 (define linker (quotewrap (if host-mode host-cc default-cc)))
 (define c++-linker (quotewrap (if host-mode host-cxx default-cxx)))
-(define object-extension "o")
+(define object-extension (if windows "obj" "o"))
 (define library-extension "a")
 (define link-output-flag "-o ")
 (define executable-extension "")
diff --git a/distribution/manifest b/distribution/manifest
index fd108087..4a5ca459 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -159,6 +159,7 @@ tests/test-glob.scm
 tests/matchable.scm
 tests/module-tests.scm
 tests/module-static-eval-compiled.scm
+tests/module-static-link.scm
 tests/module-tests-2.scm
 tests/multiple-values.scm
 tests/test-finalizers.scm
diff --git a/tests/csc-tests.scm b/tests/csc-tests.scm
index 6eba87b7..0bb8a11a 100644
--- a/tests/csc-tests.scm
+++ b/tests/csc-tests.scm
@@ -2,6 +2,7 @@
 
 (import (chicken file)
 (chicken pathname)
+(chicken platform)
 (chicken process)
 (chicken process-context)
 (chicken string))
@@ -20,8 +21,10 @@
 (csc "null.scm" "-t")
 (assert (file-exists? "null.c"))
 
+(define obj-file (if (eq? (software-type) 'windows) "null.obj" "null.o"))
+
 (csc "null.c" "-c")
-(assert (file-exists? "null.o"))
+(assert (file-exists? obj-file))
 
-(csc "null.o")
+(csc obj-file)
 (run "null")
diff --git a/tests/module-static-link.scm b/tests/module-static-link.scm
new file mode 100644
index ..84b89bea
--- /dev/null
+++ b/tests/module-static-link.scm
@@ -0,0 +1,3 @@
+(module main ()
+(import scheme chicken.base sample-module)
+(assert (= foo 42)))
diff --git a/tests/runtests.bat b/tests/runtests.bat
index abacfeb1..e9dcdb33 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -19,6 +19,7 @@ set COMPILE_OPTIONS=-v -compiler %CHICKEN% -I%TEST_DIR%/.. -L%TEST_DIR%/.. -incl
 
 set compile=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out -types %TYPESDB% -ignore-repository
 set compile_r=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out
+set compile_raw=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS%
 set compile_s=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -s -types %TYPESDB% -ignore-repository
 set interpret=..\%PROGRAM_PREFIX%csi%PROGRAM_SUFFIX% -n -include-path %TEST_DIR%/..
 
@@ -425,6 +426,17 @@ if errorlevel 1 exit /b 1
 rem %compile% ec-tests.scm
 rem a.out# takes ages to compile
 
+echo  module tests (static link) ...
+%compile_raw% -static -unit sample-module -J -c sample-module.scm
+if errorlevel 1 exit /b 1
+copy sample-module.link %CHICKEN_INSTALL_REPOSITORY%
+copy sample-module.import.scm %CHICKEN_INSTALL_REPOSITORY%
+copy sample-module.o %CHICKEN_INSTALL_REPOSITORY%
+%compile_r% -static module-static-link.scm
+if errorlevel 1 exit /b 1
+a.out
+if errorlevel 1 exit /b 1
+
 echo  port tests ...
 %interpret% -s port-tests.scm
 if errorlevel 1 exit /b 1
@@ -613,7 +625,7 @@ a.out
 if errorlevel 1 exit /b 1
 
 echo  linking tests ...
-%compile_r% -unit reverser reverser\tags\1.0\reverser.scm -J -c -o reverser.o
+%compile_r% -unit reverser reverser\tags\1.0\reverser.scm -J -c -o reverser.obj
 %compile_r% -link reverser linking-tests.scm
 if errorlevel 1 exit /b 1
 a.out
@@ -622,7 +634,7 @@ if errorlevel 1 exit /b 1
 if errorlevel 1 exit /b 1
 a.out
 if errorlevel 1 exit /b 1
-move reverser.o %CHICKEN_INSTALL_REPOSITORY%
+move reverser.obj %CHICKEN_INSTALL_REPOSITORY%
 move reverser.import.scm %CHICKEN_INSTALL_REPOSITORY%
 %compile_r% -link reverser lin

[Chicken-hackers] [PATCH] Make (repository-path) return a list

2018-08-09 Thread kooda
As discussed on IRC, it doesn’t make much sense to have
(repository-path) return a string now that it’s a search path and thus
is not guaranteed to be a valid directory name any longer.

I tried to keep the scope of this patch as minimal as possible, it’s not
very clean but it seems to be working. I added a few tests to ensure that.

From 08f2609232185e09fd323afb6b8ceadad55c52f1 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Thu, 9 Aug 2018 20:47:14 +0200
Subject: [PATCH] Make `repository-path` from (chicken platform) return a list
 instead of a string

---
 NEWS  |  3 +++
 chicken-install.scm   |  2 +-
 chicken-status.scm| 13 ++---
 eval.scm  | 44 ++-
 library.scm   | 42 ++---
 tests/private-repository-test.scm |  2 +-
 tests/repository-path-default.scm |  9 +++
 tests/repository-path.scm | 33 +++
 tests/runtests.bat| 10 +++
 tests/runtests.sh | 11 +++-
 tests/sample-module.scm   |  3 +++
 types.db  |  1 +
 12 files changed, 128 insertions(+), 45 deletions(-)
 create mode 100644 tests/repository-path-default.scm
 create mode 100644 tests/repository-path.scm
 create mode 100644 tests/sample-module.scm

diff --git a/NEWS b/NEWS
index c6489e78..301bf947 100644
--- a/NEWS
+++ b/NEWS
@@ -102,6 +102,9 @@
   - `process`, `process*` and `process-execute` now expect lists of the form
 (("NAME" . "VALUE") ...) instead of the previous (("NAME=VALUE") ...)
 as their environment argument.
+  - `repository-path` is now a parameter containing a list of strings instead
+of a string, as the search path for libraries can now contain multiple
+directories.
 
 - Module system
   - The compiler has been modularised, for improved namespacing.  This
diff --git a/chicken-install.scm b/chicken-install.scm
index e88d23b6..14e07262 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -112,7 +112,7 @@
 
 (define (repo-path)
   (if (and cross-chicken (not host-extension))
-  (destination-repository 'target)
+  (##sys#split-path (destination-repository 'target))
   (repository-path)))
 
 (define (install-path)
diff --git a/chicken-status.scm b/chicken-status.scm
index 25c873dc..e145e32a 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -63,7 +63,7 @@
 
   (define (repo-path)
 (if (and cross-chicken (not host-extensions))
-	(destination-repository 'target)
+	(##sys#split-path (destination-repository 'target))
 	(repository-path)))
 
   (define (grep rx lst)
@@ -93,7 +93,7 @@
 (lambda (dir)
   (map pathname-file 
 (glob (make-pathname dir "*" +egg-info-extension+
-(##sys#split-path (repo-path)))
+(repo-path))
   equal?))
 
   (define (format-string str cols #!optional right (padc #\space))
@@ -112,7 +112,14 @@
 (let ((version
 	(cond ((let ((info (read-info egg dir ext)))
 		 (and info (get-egg-property info 'version
-		  ((file-exists? (make-pathname (list dir egg) +version-file+))
+		  ((and (string? dir)
+			(file-exists? (make-pathname (list dir egg) +version-file+)))
+		   => (lambda (fname)
+			(with-input-from-file fname read)))
+		  ((chicken.load#find-file +version-file+
+	   (map (lambda (d)
+		  (make-pathname d egg))
+		dir))
 		   => (lambda (fname)
 			(with-input-from-file fname read)))
 		  (else "unknown"
diff --git a/eval.scm b/eval.scm
index c34622f7..68c824bf 100644
--- a/eval.scm
+++ b/eval.scm
@@ -1212,40 +1212,15 @@
 
 (define ##sys#setup-mode #f)
 
-(define path-list-separator
-  (if ##sys#windows-platform #\; #\:))
-
-(define ##sys#split-path
-  (let ((cache '(#f)))
-(lambda (path)
-  (cond ((not path) '())
-((equal? path (car cache))
- (cdr cache))
-(else
-  (let* ((len (string-length path))
- (lst (let loop ((start 0) (pos 0))
-(cond ((fx>= pos len)
-   (if (fx= pos start)
-   '()
-   (list (substring path start pos
-  ((char=? (string-ref path pos) 
-   path-list-separator)
-   (cons (substring path start pos)
- (loop (fx+ pos 1)
-   (fx+ pos 1
-  (else 
-(loop start (fx+ pos 1)))
-(set! cache (cons path lst))
-lst))
-
 (define (file-exists? name) ; defined here to avoid file unit dependency
   (and (##sys#file-exists? name #t #f #f) name))
 
 (define (find-file 

[Chicken-hackers] [PATCH] Use the SUDO variable in chicken-uninstall, as documented

2018-08-06 Thread kooda
Speaks for itself.

From 4c988ef1c1f0c4d6f067de56091b1c67ccc808e5 Mon Sep 17 00:00:00 2001
From: Kooda 
Date: Mon, 6 Aug 2018 15:08:08 +0200
Subject: [PATCH] Use the SUDO variable in chicken-uninstall, as documented

Also use the `--` argument to the `rm` command.
---
 chicken-uninstall.scm | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/chicken-uninstall.scm b/chicken-uninstall.scm
index 9d3ba9b2..1854c685 100644
--- a/chicken-uninstall.scm
+++ b/chicken-uninstall.scm
@@ -50,6 +50,9 @@
 (define force-uninstall #f)
 (define sudo-uninstall #f)
 
+(define sudo-program (or (get-environment-variable "SUDO")
+ "sudo"))
+
 (define (repo-path)
   (destination-repository
 (if (and cross-chicken (not host-extensions))
@@ -115,7 +118,7 @@
   (cond ((not (file-exists? fname))
  (warning "file does not exist" fname))
 ((and sudo-uninstall (eq? 'unix default-platform))
- (let ((r (system (string-append "sudo rm -f -r " (qs fname)
+ (let ((r (system (string-append sudo-program " rm -f -r -- " (qs fname)
(unless (zero? r)
  (warning "deleting file failed" fname
 ((directory-exists? fname)
-- 
2.18.0

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


[Chicken-hackers] [PATCH 2/2] chicken-status: fix reporting of cached egg version

2018-07-27 Thread Kooda
---
 chicken-status.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/chicken-status.scm b/chicken-status.scm
index 565ddd4a..7a0a9b2d 100644
--- a/chicken-status.scm
+++ b/chicken-status.scm
@@ -115,8 +115,7 @@
 (let ((version
(cond ((get-egg-property (read-info egg dir ext)
 'version))
- ((file-exists? (make-pathname (list dir egg)
-   +version-file+))
+ ((file-exists? (make-pathname dir +version-file+))
   => (lambda (fname)
(with-input-from-file fname read)))
  (else "unknown"
-- 
2.18.0


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


[Chicken-hackers] [PATCH] A few tools fixes

2018-07-27 Thread Kooda
When reviewing the last chicken-status patches from evhan, I found two
little problems:

chicken-install doesn’t cleanup its temporary files in every cases and

chicken-status doesn’t find the version of eggs in the cache when
using the `-cached` option

Here are two patches that fix that. :)



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


[Chicken-hackers] [PATCH 1/2] chicken-install: cleanup temorary files

2018-07-27 Thread Kooda
---
 chicken-install.scm | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/chicken-install.scm b/chicken-install.scm
index b455f135..e500dc4a 100644
--- a/chicken-install.scm
+++ b/chicken-install.scm
@@ -462,7 +462,10 @@
(if (null? srvs) 
(if lax
(print "no connection to server or egg not found 
remotely - will use cached version")
-   (error "extension or version not found" name))
+   (begin
+ (delete-directory dest)
+ (delete-directory tmpdir)
+ (error "extension or version not found" name)))
(begin
  (d "trying server ~a ...~%" (car srvs)) 
  (receive (dir ver)
@@ -588,6 +591,7 @@
 (let-values (((dir ver) (locate-egg name version)))
   (when (or (not dir)
 (null? (directory dir)))
+(when dir (delete-directory dir))
 (error "extension or version not found" name))
   (d retrieve-only "~a located at ~a~%" egg dir)
   (set! canonical-eggs
@@ -971,7 +975,8 @@
   (lambda ()
 (for-each (lambda (x) (write x) (newline)) db)))
 (unless quiet (print "installing " +module-db+ " ..."))
-(copy-file dbfile (make-pathname (install-path) +module-db+) #t
+(copy-file dbfile (make-pathname (install-path) +module-db+) #t)
+(delete-file dbfile
 
 
 ;; purge cache for given (or all) eggs
-- 
2.18.0


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


Re: [Chicken-hackers] [PATCH 0/2] Fix chicken-status on MinGW

2018-07-27 Thread kooda
Evan Hanson  wrote:
> Here's a tiny patch that fixes chicken-status on Windows when
> `terminal-size' isn't available, and a second one that just removes an
> unnecessary dependency in that program.

Oh, good catch, applied!

I did not test chicken-status on windows before, sorry. :x

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


Re: [Chicken-hackers] Proposal: Release CHICKEN 5 RC1 on August 11th

2018-07-26 Thread kooda
Peter Bex  wrote:
> So, I propose that we impose a deadline on ourselves for the first
> release candidate, which I arbitrarily chose at August 11th to keep
> things going.  If there are no serious objections, I'll make the
> release candidate on that day.

Sounds good to me!

I can’t wait, I want to use it already! ;)

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


Re: [Chicken-hackers] ☛PATCH☚ Add component-options egg item

2018-07-26 Thread kooda
felix.winkelm...@bevuta.com wrote:
> This patch adds a "component-options" egg specification item to specify global
> csc- or link-options for all components. These options are combined with
> component-specific options.
> 
> This fixes #1484.

Applied!

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


Re: [Chicken-hackers] [PATCH] Only register REPL history hooks when csi is running interactively

2018-07-16 Thread kooda
Evan Hanson  wrote:
> Pretty simple, does what it says, fixes #1467.

Applied! Thanks! :)

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


Re: [Chicken-hackers] [PATCH] Forbid relative pathnames in CHICKEN_INSTALL_REPOSITORY

2018-07-16 Thread kooda
Evan Hanson  wrote:
> I think it's sufficient to validate this environment variable in just
> the commands that actually modify on the repository, so, chicken-install
> and chicken-uninstall.

Looks good, applied! :)

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


Re: [Chicken-hackers] ☢PATCH☢ Inject version retrieved from henrietta is added to egg-info

2018-06-22 Thread Kooda
pushed

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


Re: [Chicken-hackers] Make the test suite work when PROGRAM_PREFIX and PROGRAM_SUFFIX are defined

2018-05-27 Thread Kooda
On Thu, 24 May 2018 08:44:49 +1200 Evan Hanson 
wrote:
> I understand, but as I said, when options are provided as make flags
> (as these two values must be) then they're already exported, so these
> two statements are unnecessary.
> 
> Evan

What about the case where the variables are not given as make argument,
but defined in config.make for example?

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


Re: [Chicken-hackers] ☠PATCH☠ Rename dependency properties

2018-05-26 Thread Kooda
On Mon, 21 May 2018 11:28:06 +0200 felix.winkelm...@bevuta.com wrote:
> The attached patch addresses the ambiguous meaning of the "dependency"
> egg property, that Kristian correctly pointed out. Inter-component 
> dependencies are now specified with "(component-dependency NAME ...)",
> dependencies on source-files that are not themselves components
> are expressed with "(source-dependencies FILENAME ...)".
> 
> This patch also fixes a bug in the handling of the "scheme-include"
> component description and introduces an additional validation test
> that checks whether toplevel properties (like "dependencies") are not
> used in non-toplevel contexts.
> 
> 
> felix

pushed!

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


Re: [Chicken-hackers] [PATCH] fix for chicken.process-context.posix identifiers

2018-05-05 Thread Kooda
On Sat, 5 May 2018 12:15:05 +0200 Kooda <ko...@upyum.com> wrote:
> Hey!
> 
> I took the liberty to extend this patch a bit more, some windows stuff
> had been left out.
> 
> Also, according to the documentation, current-process-id should be in
> (chicken process-context) so I’ve put it there and changed types.db
> accordingly.
> 
> Finally, the create-session symbol is currently in (chicken
> process-context posix) but the documentation says it should be in
> (chicken process). I think it makes more sense the way it is so we
> should update the documentation. I leave the final decision to the
> commiter.

Woops, I made a silly mistake, there’s a missing closing parenthesis in
posixwin.scm.

Here is the fixed patch.
>From d84eb6c761a17e53f3fb9d30d290a4e07aede767 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <krist...@adellica.com>
Date: Thu, 3 May 2018 14:52:20 +0200
Subject: [PATCH] Fixes namespaces of chicken.process-context.posix exports

These identifiers were exporting undefined values.

Note that the lambda-info of these procedures are now incorrectly
missing the namespace prefix. Let's address in a separate commit.

Signed-off-by: Kooda <ko...@upyum.com>
---
 library.scm  |  6 +++-
 posix-common.scm |  2 --
 posix.scm|  3 +-
 posixunix.scm| 74 ++--
 posixwin.scm | 14 +
 types.db |  2 +-
 6 files changed, 55 insertions(+), 46 deletions(-)

diff --git a/library.scm b/library.scm
index d05d85c2..47648ea3 100644
--- a/library.scm
+++ b/library.scm
@@ -5930,7 +5930,8 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
program-name executable-pathname
change-directory current-directory
get-environment-variable get-environment-variables
-   set-environment-variable! unset-environment-variable!)
+   set-environment-variable! unset-environment-variable!
+   current-process-id)
 
 (import scheme)
 (import chicken.base chicken.fixnum chicken.foreign)
@@ -6050,6 +6051,9 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
  (##sys#check-list x 'command-line-arguments)
  x) ) )
 
+(define current-process-id
+  (foreign-lambda int "C_getpid"))
+
 ) ; chicken.process-context
 
 
diff --git a/posix-common.scm b/posix-common.scm
index ea8cf78d..6b22a54b 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -600,8 +600,6 @@ EOF
 
 ;;; Processes
 
-(define current-process-id (foreign-lambda int "C_getpid"))
-
 (set! chicken.process#process-sleep
   (lambda (n)
 (##sys#check-fixnum n 'process-sleep)
diff --git a/posix.scm b/posix.scm
index 6ef41dfb..ba14855d 100644
--- a/posix.scm
+++ b/posix.scm
@@ -320,7 +320,7 @@
 (module chicken.process-context.posix
   (change-directory* set-root-directory!
current-effective-group-id current-effective-user-id
-   current-group-id current-process-id current-user-id
+   current-group-id current-user-id
parent-process-id current-user-name
current-effective-user-name create-session
process-group-id user-information)
@@ -332,7 +332,6 @@
 (define current-effective-group-id)
 (define current-effective-user-id)
 (define current-group-id)
-(define current-process-id)
 (define current-user-id)
 (define parent-process-id)
 (define current-user-name)
diff --git a/posixunix.scm b/posixunix.scm
index 3fd30dbd..a4995598 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -606,7 +606,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
 
 ;;; Getting group- and user-information:
 
-(define current-user-id
+(set! chicken.process-context.posix#current-user-id
   (getter-with-setter
(foreign-lambda int "C_getuid")
(lambda (id)
@@ -615,7 +615,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
(##sys#error 'current-user-id!-setter "cannot set user ID" id) ) )
"(current-user-id)"))
 
-(define current-effective-user-id
+(set! chicken.process-context.posix#current-effective-user-id
   (getter-with-setter
(foreign-lambda int "C_geteuid")
(lambda (id)
@@ -625,7 +625,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
 	 'effective-user-id!-setter "cannot set effective user ID" id) ) )
"(current-effective-user-id)"))
 
-(define current-group-id
+(set! chicken.process-context.posix#current-group-id
   (getter-with-setter
(foreign-lambda int "C_getgid")
(lambda (id)
@@ -634,7 +634,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
   (##sys#error 'current-group-id!-setter "cannot set group ID" id) ) )
"(current-group-id)") )
 
-(define current-effective-group-id
+(set! chicken.process-context.posix#current-effective-group-id
   (getter-with-setter 
(foreign-lambda int "C_getegid")
(lambda (id)
@@ -652,27 +652,32 @@ static int set_file_mtime(char *f

[Chicken-hackers] \PATCH/ Fix a few typos and renames in types.db and add a forgotten export of srfi-4

2018-05-05 Thread Kooda
Hello!

Here are a few patches that add two useful scripts and fixes the
problems found with them.

The first script is a new test that walks the types.db file and find
symbols that don’t match their type signature. It’s very very simple for
now, it only checks the type of the symbol and doesn’t try to check
arguments or return values of procedures.

The second script compares the export list of modules against a
reference file that can be generated from the documentation pages.

The third patch contains the actual fixes of the mistakes found with
these scripts.
>From aae6097fcb28f163f2c279953499961f81361ad3 Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Sat, 5 May 2018 12:51:37 +0200
Subject: [PATCH 1/3] Add a types.db consistency check test

---
 tests/runtests.bat |  4 ++
 tests/runtests.sh  |  3 ++
 tests/types-db-consistency.scm | 72 ++
 3 files changed, 79 insertions(+)
 create mode 100644 tests/types-db-consistency.scm

diff --git a/tests/runtests.bat b/tests/runtests.bat
index 67fd2e6f..100e2f48 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -27,6 +27,10 @@ rmdir /q /s %CHICKEN_INSTALL_REPOSITORY%
 mkdir %CHICKEN_INSTALL_REPOSITORY%
 copy %TYPESDB% %CHICKEN_INSTALL_REPOSITORY%
 
+echo " types.db consistency ..."
+%interpret% -s types-db-consistency.scm %TYPESDB%
+if errorlevel 1 exit /b 1
+
 echo  version tests ...
 %compile% version-tests.scm
 if errorlevel 1 exit /b 1
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 04a8ade3..35cd9920 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -63,6 +63,9 @@ rm -fr *.exe *.so *.o *.import.* a.out ../foo.import.* test-repository
 mkdir -p test-repository
 cp $TYPESDB test-repository/types.db
 
+echo " types.db consistency ..."
+$interpret -s types-db-consistency.scm ${TYPESDB}
+
 echo " version tests ..."
 $compile version-tests.scm
 ./a.out
diff --git a/tests/types-db-consistency.scm b/tests/types-db-consistency.scm
new file mode 100644
index ..5bfb89ba
--- /dev/null
+++ b/tests/types-db-consistency.scm
@@ -0,0 +1,72 @@
+;; This test walks the types.db file and checks that symbols are what they are supposed to be.
+
+(import
+  (chicken base)
+  (chicken bitwise)
+  (chicken continuation)
+  (chicken read-syntax)
+  (chicken irregex)
+  (chicken memory)
+  (chicken process-context posix)
+  (chicken tcp)
+  srfi-4)
+
+(define ignored-symbols
+  '(;; internal procedures
+chicken.irregex#irregex-dfa
+chicken.irregex#irregex-dfa/search
+chicken.irregex#irregex-nfa
+chicken.irregex#irregex-flags
+chicken.irregex#irregex-lengths
+chicken.irregex#irregex-reset-matches!
+chicken.irregex#irregex-new-matches
+chicken.irregex#irregex-apply-match
+chicken.irregex#irregex-search/matches))
+
+(define *error-code* 0)
+
+(define (warn msg . args)
+  (apply fprintf (current-error-port)
+ msg args)
+  (set! *error-code* 1))
+
+(define (deep o)
+  (cond ((pair? o)
+ (deep (car o)))
+((vector? o)
+ (deep (vector-ref o 0)))
+(else o)))
+
+(define ((unknown sym) obj)
+  (warn "Unknown type '~a' for object: ~a~%"
+sym obj))
+
+(define (symbol->predicate sym)
+  (case sym
+((procedure forall) procedure?)
+((fixnum) fixnum?)
+((float) flonum?)
+((list-of) list?)
+((symbol) symbol?)
+((input-port) input-port?)
+((output-port) output-port?)
+(else (unknown sym
+
+(define (run-checks file checker)
+  (with-input-from-file file
+(lambda ()
+  (port-for-each checker read
+
+(define (simple-checker entry)
+  (let* ((symbol (car entry))
+ (value (##sys#slot symbol 0))
+ (type (deep (cadr entry)))
+ (pred (symbol->predicate type)))
+(unless (or (member symbol ignored-symbols)
+(pred value))
+  (warn "Mismatch for ~a '~a': ~a~%"
+type symbol value
+
+(run-checks (car (command-line-arguments))
+simple-checker)
+(exit *error-code*)
-- 
2.17.0

>From 5acaee5582dfa54b0730dae68193a00452e1b51b Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Sat, 5 May 2018 13:03:44 +0200
Subject: [PATCH 2/3] Add a little script to check the consistency between
 documentation and actual modules

---
 scripts/compare-documentation-exports.scm | 49 +++
 1 file changed, 49 insertions(+)
 create mode 100644 scripts/compare-documentation-exports.scm

diff --git a/scripts/compare-documentation-exports.scm b/scripts/compare-documentation-exports.scm
new file mode 100644
index ..0334fc81
--- /dev/null
+++ b/scripts/compare-documentation-exports.scm
@@ -0,0 +1,49 @@
+;; This script takes a filename as its first argument, which shoul

Re: [Chicken-hackers] [PATCH] fix for chicken.process-context.posix identifiers

2018-05-05 Thread Kooda
Hey!

I took the liberty to extend this patch a bit more, some windows stuff
had been left out.

Also, according to the documentation, current-process-id should be in
(chicken process-context) so I’ve put it there and changed types.db
accordingly.

Finally, the create-session symbol is currently in (chicken
process-context posix) but the documentation says it should be in
(chicken process). I think it makes more sense the way it is so we
should update the documentation. I leave the final decision to the
commiter.
>From a045d44db41054b9c25c15dedc24627627401a78 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <krist...@adellica.com>
Date: Thu, 3 May 2018 14:52:20 +0200
Subject: [PATCH] Fixes namespaces of chicken.process-context.posix exports

These identifiers were exporting undefined values.

Note that the lambda-info of these procedures are now incorrectly
missing the namespace prefix. Let's address in a separate commit.

Signed-off-by: Kooda <ko...@upyum.com>
---
 library.scm  |  6 +++-
 posix-common.scm |  2 --
 posix.scm|  3 +-
 posixunix.scm| 74 ++--
 posixwin.scm | 14 +
 types.db |  2 +-
 6 files changed, 55 insertions(+), 46 deletions(-)

diff --git a/library.scm b/library.scm
index d05d85c2..47648ea3 100644
--- a/library.scm
+++ b/library.scm
@@ -5930,7 +5930,8 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
program-name executable-pathname
change-directory current-directory
get-environment-variable get-environment-variables
-   set-environment-variable! unset-environment-variable!)
+   set-environment-variable! unset-environment-variable!
+   current-process-id)
 
 (import scheme)
 (import chicken.base chicken.fixnum chicken.foreign)
@@ -6050,6 +6051,9 @@ static C_word C_fcall C_setenv(C_word x, C_word y) {
  (##sys#check-list x 'command-line-arguments)
  x) ) )
 
+(define current-process-id
+  (foreign-lambda int "C_getpid"))
+
 ) ; chicken.process-context
 
 
diff --git a/posix-common.scm b/posix-common.scm
index ea8cf78d..6b22a54b 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -600,8 +600,6 @@ EOF
 
 ;;; Processes
 
-(define current-process-id (foreign-lambda int "C_getpid"))
-
 (set! chicken.process#process-sleep
   (lambda (n)
 (##sys#check-fixnum n 'process-sleep)
diff --git a/posix.scm b/posix.scm
index 6ef41dfb..ba14855d 100644
--- a/posix.scm
+++ b/posix.scm
@@ -320,7 +320,7 @@
 (module chicken.process-context.posix
   (change-directory* set-root-directory!
current-effective-group-id current-effective-user-id
-   current-group-id current-process-id current-user-id
+   current-group-id current-user-id
parent-process-id current-user-name
current-effective-user-name create-session
process-group-id user-information)
@@ -332,7 +332,6 @@
 (define current-effective-group-id)
 (define current-effective-user-id)
 (define current-group-id)
-(define current-process-id)
 (define current-user-id)
 (define parent-process-id)
 (define current-user-name)
diff --git a/posixunix.scm b/posixunix.scm
index 3fd30dbd..a4995598 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -606,7 +606,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
 
 ;;; Getting group- and user-information:
 
-(define current-user-id
+(set! chicken.process-context.posix#current-user-id
   (getter-with-setter
(foreign-lambda int "C_getuid")
(lambda (id)
@@ -615,7 +615,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
(##sys#error 'current-user-id!-setter "cannot set user ID" id) ) )
"(current-user-id)"))
 
-(define current-effective-user-id
+(set! chicken.process-context.posix#current-effective-user-id
   (getter-with-setter
(foreign-lambda int "C_geteuid")
(lambda (id)
@@ -625,7 +625,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
 	 'effective-user-id!-setter "cannot set effective user ID" id) ) )
"(current-effective-user-id)"))
 
-(define current-group-id
+(set! chicken.process-context.posix#current-group-id
   (getter-with-setter
(foreign-lambda int "C_getgid")
(lambda (id)
@@ -634,7 +634,7 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
   (##sys#error 'current-group-id!-setter "cannot set group ID" id) ) )
"(current-group-id)") )
 
-(define current-effective-group-id
+(set! chicken.process-context.posix#current-effective-group-id
   (getter-with-setter 
(foreign-lambda int "C_getegid")
(lambda (id)
@@ -652,27 +652,32 @@ static int set_file_mtime(char *filename, C_word atime, C_word mtime)
 (define-foreign-variable _user-dir c-string "C_user->pw_dir")
 (define-foreign-variable _user-shell c-string "C_user->pw_shell")
 
-(define (user-information user #!optional as-vector)
-  

[Chicken-hackers] Make the test suite work when PROGRAM_PREFIX and PROGRAM_SUFFIX are defined

2018-05-02 Thread Kooda
Hey!

New patch, all is in the title. This fixes ticket #1458.

It requires the patch “Always build in host mode unless
cross-compiling” posted on 26/04/2018 to work properly.
>From 12972c3292f2a32c57e5308d1ca9e7edc300c8d0 Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Wed, 2 May 2018 14:27:36 +0200
Subject: [PATCH] Make the test suite aware of the programs prefix and suffix

This fixes #1458
---
 rules.make  |  3 +++
 tests/csc-tests.scm |  4 +++-
 tests/posix-tests.scm   |  6 --
 tests/programs-path.scm |  9 +
 tests/runtests.bat  | 14 +++---
 tests/runtests.sh   | 18 +-
 6 files changed, 35 insertions(+), 19 deletions(-)
 create mode 100644 tests/programs-path.scm

diff --git a/rules.make b/rules.make
index 808f374b..dbe82be9 100644
--- a/rules.make
+++ b/rules.make
@@ -962,6 +962,9 @@ testclean:
 
 .PHONY: check 
 
+export PROGRAM_PREFIX
+export PROGRAM_SUFFIX
+
 check: $(TARGETS)
 ifndef WINDOWS_SHELL
 	cd tests; sh runtests.sh
diff --git a/tests/csc-tests.scm b/tests/csc-tests.scm
index 1fa281dc..6eba87b7 100644
--- a/tests/csc-tests.scm
+++ b/tests/csc-tests.scm
@@ -6,6 +6,8 @@
 (chicken process-context)
 (chicken string))
 
+(include "programs-path.scm")
+
 (define (realpath x)
   (normalize-pathname (make-pathname (current-directory) x)))
 
@@ -13,7 +15,7 @@
   (system* (string-intersperse (cons (realpath x) args
 
 (define (csc . args)
-  (apply run "../csc" "-v" "-I.." "-compiler" (realpath "../chicken") "-libdir" ".." args))
+  (apply run csc-path "-v" "-I.." "-compiler" (realpath chicken-path) "-libdir" ".." args))
 
 (csc "null.scm" "-t")
 (assert (file-exists? "null.c"))
diff --git a/tests/posix-tests.scm b/tests/posix-tests.scm
index e3ccbb69..807730e6 100644
--- a/tests/posix-tests.scm
+++ b/tests/posix-tests.scm
@@ -6,6 +6,8 @@
 (chicken process-context)
 (chicken memory representation))
 
+(include "programs-path.scm")
+
 (define-syntax assert-error
   (syntax-rules ()
 ((_ expr) 
@@ -39,13 +41,13 @@
 (assert-error (process-execute "false" '("123\x00456") '("foo\x00bar" "blabla") '("lalala" "qux\x00mooh")))
 
 (receive (in out pid)
-(process "../csi" '("-n" "-I" ".." "-e"
+(process csi-path '("-n" "-I" ".." "-e"
 "(write 'err (current-error-port)) (write 'ok)"))
   (assert (equal? 'ok (read in)))
   (newline (current-error-port)))
 
 (receive (in out pid err)
-(process* "../csi" '("-n" "-I" ".." "-e"
+(process* csi-path '("-n" "-I" ".." "-e"
  "(write 'err (current-error-port)) (write 'ok)"))
   (assert (equal? 'ok (read in)))
   (assert (equal? 'err (read err
diff --git a/tests/programs-path.scm b/tests/programs-path.scm
new file mode 100644
index ..5a5935df
--- /dev/null
+++ b/tests/programs-path.scm
@@ -0,0 +1,9 @@
+(define (executable-path exe)
+  (string-append "../"
+ (or (get-environment-variable "PROGRAM_PREFIX") "")
+ exe
+ (or (get-environment-variable "PROGRAM_SUFFIX") "")))
+  
+(define chicken-path (executable-path "chicken"))
+(define csc-path (executable-path "csc"))
+(define csi-path (executable-path "csi"))
diff --git a/tests/runtests.bat b/tests/runtests.bat
index 67fd2e6f..2bd8314c 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -5,8 +5,8 @@ setlocal enableextensions
 
 set TEST_DIR=%cd%
 
-set CHICKEN=..\chicken
-set CHICKEN_PROFILE=..\chicken-profile
+set CHICKEN=..\%PROGRAM_PREFIX%chicken%PROGRAM_SUFFIX%
+set CHICKEN_PROFILE=..\%PROGRAM_PREFIX%chicken-profile%PROGRAM_SUFFIX%
 set CHICKEN_INSTALL_REPOSITORY=%TEST_DIR%\test-repository
 set CHICKEN_REPOSITORY_PATH=%TEST_DIR%\..;%CHICKEN_INSTALL_REPOSITORY%
 set PATH=%TEST_DIR%\..;%PATH%
@@ -17,10 +17,10 @@ set FCBUFSIZE=500
 set TYPESDB=..\types.db
 set COMPILE_OPTIONS=-v -compiler %CHICKEN% -I%TEST_DIR%/.. -L%TEST_DIR%/.. -include-path %TEST_DIR%/.. -libdir %TEST_DIR%/..
 
-set compile=..\csc %COMPILE_OPTIONS% -o a.out -types %TYPESDB% -ignore-repository
-set compile_r=..\csc %COMPILE_OPTIONS% -o a.out
-set compile_s=..\csc %COMPILE_OPTIONS% -s -types %TYPESDB% -ignore-repository
-set interpret=..\csi -n -include-path %TEST_DIR%/..
+set compile=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out -types %TYPESDB% -ignore-repository
+set compile_r=..\%PROGRAM_PREFIX%csc%PROGRAM_SUFFIX% %COMPILE_OPTIONS% -o a.out
+set compile_s=..\%PROGRAM_PREFIX%csc%P

Re: [Chicken-hackers] )PATCH( Lookup program argument to feathers properly and show error on failure

2018-05-01 Thread Kooda
On Sun, 29 Apr 2018 23:37:00 +0200 felix.winkelm...@bevuta.com wrote:
> Hi!
> 
> This patch fixes two problems with feathers that I have noticed being
> mentioned on #chicken: the program argument is treated as a normal
> filename and looked up like anz other file, not dependent on the
> current PATH. Also, in the case the program wasn't found, the error
> message was not shown, due to the text widget being disabled.
> 
> 
> felix
> 

pushed

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


Re: [Chicken-hackers] [PATCH] Simplify eval/meta a little and drop ##sys#active-eval-environment (which is unused)

2018-05-01 Thread Kooda
On Sun, 29 Apr 2018 14:11:18 +0200 Peter Bex 
wrote:
> Hi all,
> 
> I noticed that we're practically rolling our own inline version of
> "parameterize" using dynamic-wind.  The attached patch simplifies
> this a little to make it more readable.  It also drops
> ##sys#active-eval-environment which is not really used.
> 
> Cheers,
> Peter

pushed

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


Re: [Chicken-hackers] [PATCH] add an error for -L and -I in csc

2018-05-01 Thread Kooda
On Sun, 29 Apr 2018 13:16:55 +0200 Kristian Lein-Mathisen
 wrote:
> Hi,
> 
> Hopefully the commit message explains it all. I ran into this problem
> when I had an egg file containing this:
> 
>  (components
>   (extension nanomsg
>  (source "nanomsg-module.scm")
>  (link-options "-L -lnanomsg")))
> 
> Which should look like this:
> 
>  (components
>   (extension nanomsg
>  (source "nanomsg-module.scm")
>  (link-options "-L" "-lnanomsg")))
> 
> It was not fun to debug why my egg wouldn't link against nanomsg.so,
> so I though it might be useful to add this check in csc.
> K.

Trivial enough patch, pushed!

I like how it prevents mistakes, which will surely happen when people
start porting eggs. :)

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


Re: [Chicken-hackers] [PATCH][4] Add missing extras unit dependency to files.scm

2018-05-01 Thread Kooda
On Thu, 26 Apr 2018 16:59:47 +0200 Evan Hanson 
wrote:
> Dead simple, fixes #1442.
> 
> Cheers,
> 
> Evan

This has been pushed already.

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


Re: [Chicken-hackers] patch: Always build in host mode unless cross-compiling

2018-05-01 Thread Kooda
This sounds right to me, unless when cross-compiling, the target is
always the host. That’s also the default for chicken-install already.

Attached is a signoff.
>From bc8fa77683e7116c027b81abef402a724e8fd8e9 Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <krist...@adellica.com>
Date: Thu, 26 Apr 2018 23:10:26 +0200
Subject: [PATCH] Always build in host mode unless cross-compiling

When building with a prefix or suffix, compiling with csc fails. The
include paths and library name are wrong because they use the
suffix-less C_TARGET_INCLUDE_HOME and C_TARGET_LIB_NAME variables.

Signed-off-by: Kooda <ko...@upyum.com>
---
 csc.scm | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/csc.scm b/csc.scm
index b3d562ab..27fbedb8 100644
--- a/csc.scm
+++ b/csc.scm
@@ -76,8 +76,8 @@
   (exit 64) )
 
 (define arguments (command-line-arguments))
-(define host-mode (member "-host" arguments))
 (define cross-chicken (feature? #:cross-chicken))
+(define host-mode (or (not cross-chicken) (member "-host" arguments)))
 
 (define (back-slash->forward-slash path)
   (if windows-shell
@@ -287,9 +287,9 @@
 ;;; Locate object files for linking:
 
 (define (repo-path)
-  (if (and cross-chicken (not host-mode))
-  (destination-repository 'target)
-  (repository-path)))
+  (if host-mode
+  (repository-path)
+  (destination-repository 'target)))
 
 (define (find-object-file name)
   (let ((o (make-pathname #f name object-extension)))
@@ -939,7 +939,7 @@ EOF
 	  (list (string-append link-output-flag (quotewrap target-filename))
 		(linker-options)
 		(linker-libraries) ) ) ) ) )
-(when (and osx (or (not cross-chicken) host-mode))
+(when (and osx host-mode)
   (command
(string-append
 	POSTINSTALL_PROGRAM " -change " (libchicken) ".dylib "
-- 
2.17.0

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


Re: [Chicken-hackers] [PATCH] Refactor posix so that identifiers appear to come from the "submodules"

2018-05-01 Thread Kooda
On Mon, 30 Apr 2018 20:28:07 +0200 Peter Bex 
wrote:
> Hi all,
> 
> As I mentioned in an earlier e-mail, the posix module can be
> refactored so that it set!s the identifiers declared in the
> other modules (like chicken.file.posix, chicken.time.posix etc).
> 
> The attached set of patches makes it so.  I've also removed some
> duplicate and unused definitions from the platform-specific files.
> 
> It's a bit annoying to do it this way, but it looks a lot saner and
> cleaner from the outside, given that every identifier will be prefixed
> with the "correct" module name instead of the weird "chicken.posix#".
> 
> This also helps a lot making the types.db a bit saner, since we no
> longer group all the posix stuff onto one big pile, but it's nicely
> grouped by modules that ultimately export the identifiers.
> 
> Cheers,
> Peter

Pushed!

Thanks a lot for this arduous handling work!

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


Re: [Chicken-hackers] [PATCH] Fix segfault when passing a non-integer to thread-sleep! (fixes #1459)

2018-04-30 Thread Kooda
On Mon, 30 Apr 2018 21:03:26 +0200 Peter Bex 
wrote:
> Hi all,
> 
> This was just found by Kristian, and it's pretty trivial:
> user code can call thread-sleep! with any real number as an argument,
> but the timeout code itself which calculates the number of
> microseconds to wait expects an integer.  This means we'll have to
> round the deadline and make it an exact integer before sleeping.
> 
> Cheers,
> Peter

pushed

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


Re: [Chicken-hackers] {PATCH} make egg artefacts implicitly dependent on egg file

2018-04-29 Thread Kooda
On Sun, 29 Apr 2018 13:08:49 +0200
felix.winkelm...@bevuta.com wrote:

> Attached an improved version, which should do the right thing when
> the egg file is in the "chicken" subdirectory.
> 
> (thanks to Kooda)
> 
> 
> felix
> 

pushed

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


Re: [Chicken-hackers] [PATCH] No longer install chicken.posix.import.so (fixes #1456)

2018-04-29 Thread Kooda
Pushed!

The chicken.posix module was still accessible with csi, I added
-no-module-registration to the build options and it seems to do the
trick.

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


Re: [Chicken-hackers] patch: manpages matching program names

2018-04-27 Thread Kooda
Pushed!

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


Re: [Chicken-hackers] [PATCH] Make result of empty "else" clause undefined in `cond' and `case' forms

2018-04-17 Thread Kooda
On Tue, 17 Apr 2018 12:51:45 +1200 Evan Hanson 
wrote:
> Thanks everyone, it sounds like this patch can be applied as-is.
> 

Done. :)

I think the modification for “case” wasn’t necessary, as
`(##core#begin ,@(cdr clause)) will yield (##core#begin) which is (I
think) equivalent to (##core#undefined). But I applied it anyway
because it’s more explicit.

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


[Chicken-hackers] [PATCH] Make chicken-install work when the egg file is inside a chicken/ subdirectory.

2018-01-15 Thread Kooda
---
 egg-information.scm | 5 -
 eval.scm| 1 -
 rules.make  | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/egg-information.scm b/egg-information.scm
index e60756c7..20e4334e 100644
--- a/egg-information.scm
+++ b/egg-information.scm
@@ -27,7 +27,10 @@
 ;;; load egg-info from file and perform validation
 
 (define (load-egg-info fname)
-  (with-input-from-file fname read))
+  (let ((fname* (make-pathname (make-pathname (pathname-directory fname)
+  "chicken")
+   (pathname-file fname) (pathname-extension 
fname
+(with-input-from-file (if (file-exists? fname*) fname* fname) read)))
 
 
 ;;; lookup specific toplevel properties of egg-information
diff --git a/eval.scm b/eval.scm
index 0d577c0d..cc9de233 100644
--- a/eval.scm
+++ b/eval.scm
@@ -881,7 +881,6 @@
chicken.internal)
 
 (include "mini-srfi-1.scm")
-(include "egg-information.scm")
 
 ;;; Installation locations
 
diff --git a/rules.make b/rules.make
index ef162cf8..4d77d825 100644
--- a/rules.make
+++ b/rules.make
@@ -783,7 +783,7 @@ library.c: $(SRCDIR)library.scm
-emit-import-library chicken.time
 internal.c: $(SRCDIR)internal.scm $(SRCDIR)mini-srfi-1.scm
$(bootstrap-lib) -emit-import-library chicken.internal
-eval.c: $(SRCDIR)eval.scm $(SRCDIR)common-declarations.scm 
$(SRCDIR)mini-srfi-1.scm $(SRCDIR)egg-information.scm
+eval.c: $(SRCDIR)eval.scm $(SRCDIR)common-declarations.scm 
$(SRCDIR)mini-srfi-1.scm
$(bootstrap-lib) \
-emit-import-library chicken.eval \
-emit-import-library chicken.load
-- 
2.15.1


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


Re: [Chicken-hackers] [PATCH] Move data-structures procedures into (chicken base)

2017-12-29 Thread Kooda
On Wed, 27 Dec 2017 21:26:56 +0100 Peter Bex 
wrote:
> Hi,
> 
> As we agreed on in c-l-r, this patch moves the procedures from
> data-structures into chicken.base.
> 
> Cheers,
> Peter

Just a tiny typo rasso -> rassoc in the +extended-bindings+ list.
Signed off and pushed! :)

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


Re: [Chicken-hackers] [PATCH] Fix inconsistency between core test lib and test egg, and fix number->string conversion on some edge case flonums

2017-10-25 Thread Kooda
First patch pushed.

As discussed on IRC, I think the second patch isn’t quite correct,
regarding to negative numbers, and possibly calling log2 with 0.

Here is an other attempt at it. :)
From d6a4d5f33c05a5973694df407d8ddcea94cca8de Mon Sep 17 00:00:00 2001
From: Peter Bex 
Date: Mon, 16 Oct 2017 20:35:33 +0200
Subject: [PATCH 2/2] Fix flonum to string conversion on extreme edge cases on
 64-bit archs

This bug was exposed by the previous commit which restored the tests
to work as intended, because the serialization of (expt 2.0 64)
resulted in "0.0" in compiled code, causing the exact/inexact
comparison tests between the bignum (expt 2 64) and the flonum
(expt 2.0 64.0) to fail.

This representation fails because C_fits_in_unsigned_int_p will
incorrectly return C_SCHEME_TRUE on a 64-bit architecture due to how
we perform the casting: Because UINT_MAX is 2^64-1, it will be
normalized by the floating-point representation to the nearest
floating-point value that can represent it: 2^64.
Thus, (double)2^64 <= UINT_MAX is true.  When we then cast the
double to an unsigned word, it will result in zero due to overflow.

The fix here is to simply check if the log2 of the number is less than
the number of bits in an UWORD, rather than trying a direct value
comparison.  As a bonus, this allows us to finally get rid of the
obsolete C_fits_in_unsigned_int_p() inline helper function.
---
 chicken.h | 14 --
 runtime.c |  5 +++--
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/chicken.h b/chicken.h
index 9e2af974..45571d45 100644
--- a/chicken.h
+++ b/chicken.h
@@ -2420,20 +2420,6 @@ inline static C_word C_i_bignump(C_word x)
 }
 
 
-
-/* XXX TODO OBSOLETE (but still used by C_flonum_to_string) */
-inline static C_word C_fits_in_unsigned_int_p(C_word x)
-{
-  double n, m;
-
-  if(x & C_FIXNUM_BIT) return C_SCHEME_TRUE;
-  if(C_truep(C_i_bignump(x))) return C_mk_bool(C_bignum_size(x) == 1);
-
-  n = C_flonum_magnitude(x);
-  return C_mk_bool(C_modf(n, ) == 0.0 && n >= 0 && n <= C_UWORD_MAX);
-}
-
-
 inline static double C_c_double(C_word x)
 {
   if(x & C_FIXNUM_BIT) return (double)C_unfix(x);
diff --git a/runtime.c b/runtime.c
index e1970cd6..9423993a 100644
--- a/runtime.c
+++ b/runtime.c
@@ -10432,7 +10432,7 @@ void C_ccall C_fixnum_to_string(C_word c, C_word *av)
 void C_ccall C_flonum_to_string(C_word c, C_word *av)
 {
   C_char *p;
-  double f;
+  double f, fa, m;
   C_word *a,
 /* self = av[ 0 ] */
 k = av[ 1 ],
@@ -10440,6 +10440,7 @@ void C_ccall C_flonum_to_string(C_word c, C_word *av)
 radix = ((c == 3) ? 10 : C_unfix(av[ 3 ]));
 
   f = C_flonum_magnitude(num);
+  fa = fabs(f);
 
   /* XXX TODO: Should inexacts be printable in other bases than 10?
* Perhaps output a string starting with #i?
@@ -10450,7 +10451,7 @@ void C_ccall C_flonum_to_string(C_word c, C_word *av)
 barf(C_BAD_ARGUMENT_TYPE_BAD_BASE_ERROR, "number->string", C_fix(radix));
   }
 
-  if(C_fits_in_unsigned_int_p(num) == C_SCHEME_TRUE) { /* Use fast int code */
+  if(f == 0.0 || (C_modf(f, ) == 0.0 && log2(fa) < C_WORD_SIZE)) { /* Use fast int code */
 if(f < 0) {
   p = to_n_nary((C_uword)-f, radix, 1, 1);
 } else {
-- 
2.15.0.rc1

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


Re: [Chicken-hackers] [PATCH] Fix #1367 by using some black magic

2017-10-22 Thread Kooda
Applied to both master and chicken-5, it might have been tricky to
find, but the solution sounds very logical to me, great job!

While I tested this patch I also found a bug in srfi-18 for C5. I’ve
pushed a patch for that to the chicken-5-eggs repo, should I put it
somewhere else as well?

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


Re: [Chicken-hackers] [PATCH] [5] Bugfix in chicken-install regarding proper import library name

2017-10-22 Thread Kooda
Good find, pushed.

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


[Chicken-hackers] [PATCH] Use the correct output file extension when using csc -c

2017-10-21 Thread Kooda
I found a little bug: when I tried to build some files with csc -c, the
output files had no extension instead of the expected ".o". Here’s a
patch that fixes that (C5 only).
>From 727426ed3e9df7855ce8190345b6ded70adc1e75 Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Sat, 21 Oct 2017 22:18:03 +0200
Subject: [PATCH] Use the correct output file extension when using csc -c

---
 csc.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/csc.scm b/csc.scm
index a4f8f9ac..c24ec836 100644
--- a/csc.scm
+++ b/csc.scm
@@ -558,9 +558,9 @@ EOF
 		(set! translate-options (cons "-dynamic" translate-options)) )
 		  (unless target-filename
 		(set! target-filename
-		  (if shared
-			  (pathname-replace-extension (first scheme-files) shared-library-extension)
-			  (pathname-replace-extension (first scheme-files) executable-extension) ) ) )
+		  (cond (shared (pathname-replace-extension (first scheme-files) shared-library-extension))
+			(compile-only (pathname-replace-extension (first scheme-files) object-extension))
+			(else (pathname-replace-extension (first scheme-files) executable-extension)) ) ) )
 		  (run-translation) ] )
 	   (unless translate-only 
 	 (run-compilation)
-- 
2.15.0.rc1

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


Re: [Chicken-hackers] [PATCH] [5] csc -static is overly static

2017-10-21 Thread Kooda
I’m fine with this change, pushed.

That way -static only links scheme code statically, and as you said,
it’s easy to make a fully static build.

One thing that might be missing for it to become really useful would be
to call the linker with the right link flags when one of the scheme
library is a binding, for example adding -lGL automatically when using
the opengl egg.

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


Re: [Chicken-hackers] [PATCH] Make the compiler output deterministic

2017-10-21 Thread Kooda
Here is the same set of patches, for master, in case we want that.
>From a37033ed2aeceef85b529f49c7b79c2102ae482e Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Sat, 21 Oct 2017 11:58:07 +0200
Subject: [PATCH 1/4] Sort the symbol table before outputing C code from the
 complier.

This helps make the compiler deterministic, as the output will not change
because of the random seeding of the symbol table.
---
 c-backend.scm | 73 ++-
 1 file changed, 47 insertions(+), 26 deletions(-)

diff --git a/c-backend.scm b/c-backend.scm
index 3e742c9f..847f2eac 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -56,12 +56,25 @@
   (string->c-identifier
(sprintf "C_~X_~A_" (random #x100) (current-seconds)) ) )
 
+;; Generate a sorted alist out of a symbol table
+(define (table->sorted-alist t)
+  (let ((alist '()))
+(##sys#hash-table-for-each
+  (lambda (id ll)
+	(set! alist
+	  (cons (cons id ll) alist)))
+  t)
+
+(sort! alist (lambda (p1 p2) (stringstring (car p1))
+	   (symbol->string (car p2)))
+
 
 ;;; Generate target code:
 
 (define (generate-code literals lliterals lambda-table out source-file dynamic db
dbg-info-table)
-  (let ((non-av-proc #f))
+  (let ((lambda-table* (table->sorted-alist lambda-table))
+	(non-av-proc #f))
 
   ;; Don't truncate floating-point precision!
   (flonum-print-precision (+ flonum-maximum-decimal-exponent 1))
@@ -595,10 +608,12 @@
   
 (define (prototypes)
   (gen #t)
-  (##sys#hash-table-for-each
-   (lambda (id ll)
-	 (let* ((n (lambda-literal-argument-count ll))
-		(customizable (lambda-literal-customizable ll)) 
+  (for-each
+   (lambda (p)
+	 (let* ((id (car p))
+		(ll (cdr p))
+		(n (lambda-literal-argument-count ll))
+		(customizable (lambda-literal-customizable ll))
 		(empty-closure (and customizable (zero? (lambda-literal-closure-size ll
 		(varlist (intersperse (make-variable-list (if empty-closure (sub1 n) n) "t") #\,))
 		(rest (lambda-literal-rest-argument ll))
@@ -631,7 +646,7 @@
 	   ;;(when customizable (gen " C_c_regparm"))
 	   (unless direct (gen " C_noret"))
 	   (gen #\;) ))
-   lambda-table) )
+   lambda-table*) )
   
 (define (trampolines)
   (let ([ns '()]
@@ -644,9 +659,11 @@
 	  ((>= i n))
 	(gen #t "C_word t" i "=av[" j "];")))
 
-	(##sys#hash-table-for-each
-	 (lambda (id ll)
-	   (let* ([argc (lambda-literal-argument-count ll)]
+	(for-each
+	 (lambda (p)
+	   (let* ([id (car p)]
+		  [ll (cdr p)]
+		  [argc (lambda-literal-argument-count ll)]
 		  [rest (lambda-literal-rest-argument ll)]
 		  [rest-mode (lambda-literal-rest-argument-mode ll)]
 		  [customizable (lambda-literal-customizable ll)]
@@ -661,7 +678,7 @@
 	   (let ([al (make-argument-list argc "t")])
 		 (apply gen (intersperse al #\,)) )
 	   (gen ");}") )))
-	 lambda-table)))
+	 lambda-table*)))
   
 (define (literal-frame)
   (do ([i 0 (add1 i)]
@@ -746,9 +763,11 @@
 	(else (bomb "invalid unboxed type" t
 
 (define (procedures)
-  (##sys#hash-table-for-each
-   (lambda (id ll)
-	 (let* ((n (lambda-literal-argument-count ll))
+  (for-each
+   (lambda (p)
+	 (let* ((id (car p))
+		(ll (cdr p))
+		(n (lambda-literal-argument-count ll))
 		(rname (real-name id db))
 		(demand (lambda-literal-allocated ll))
 		(max-av (apply max 0 (lambda-literal-callee-signatures ll)))
@@ -898,7 +917,7 @@
 		n)
 	ll)
 	   (gen #\}) ) )
-   lambda-table) )
+   lambda-table*) )
 
 (debugging 'p "code generation phase...")
 (set! output out)
@@ -912,7 +931,7 @@
 (when emit-debug-info
   (emit-debug-table dbg-info-table))
 (procedures)
-(emit-procedure-table lambda-table source-file)
+(emit-procedure-table lambda-table* source-file)
 (trailer) ) )
 
 
@@ -934,18 +953,20 @@
 
 ;;; Emit procedure table:
 
-(define (emit-procedure-table lambda-table sf)
+(define (emit-procedure-table lambda-table* sf)
   (gen #t #t "#ifdef C_ENABLE_PTABLES"
-   #t "static C_PTABLE_ENTRY ptable[" (add1 (##sys#hash-table-size lambda-table)) "] = {")
-  (##sys#hash-table-for-each
-   (lambda (id ll)
- (gen #t "{\"" id #\: (string->c-identifier sf) "\",(void*)")
- (if (eq? 'toplevel id)
- (if unit-name
- (gen "C_" unit-name "_toplevel},")
- (gen "C_toplevel},") )
- (gen id "},") ) )
-   lambda-table)
+   #t "static C_PTABLE_ENTRY ptable[" (add1 (length lambda-table*)) "] = {")
+  (for-each
+   (lambda (p)
+ (let ((id (car p))
+	   (ll (cdr p)))
+   (gen #t "{\"" id #\: (string->c-identifier sf) "\",(void*)")
+   (if (eq

[Chicken-hackers] [PATCH] Make the compiler output deterministic

2017-10-21 Thread Kooda
Hi!

It’s been a while since I proposed this change! Here is a set of
patches that does this in a more clean way than the last patch (which
fiddled with the random seed in the compiler, ugh…)

The four patches are independent and address different points of the
code that make the build process unstable. I hope everything is clear,
feel free to ask me if anything isn’t.

These changes will make the life far more easy for NixOS/Guix package
maintainers, and makes it far more easy to see how changes in the
compiler affect its output.

As a bonus, CHICKEN can be used in conjunction with ccache for a
much greater compilation speed! \o/



Building CHICKEN twice using ccache, with and without the deterministic build 
patch.
Clean cache for each test.

Without patch
=

326.60u 8.78s 335.58rmake PLATFORM=linux C_COMPILER=ccache gcc

cache directory /tmp/ccache
primary config  /tmp/ccache/ccache.conf
secondary config  (readonly)/etc/ccache.conf
cache hit (direct) 2
cache hit (preprocessed)   4
cache miss   224
cache hit rate  2.61 %
called for link  110
cleanups performed 0
files in cache   450
cache size  41.6 MB
max cache size   5.0 GB


With patch
==

63.73u 2.34s 66.10r  make PLATFORM=linux C_COMPILER=ccache gcc

cache directory /tmp/ccache
primary config  /tmp/ccache/ccache.conf
secondary config  (readonly)/etc/ccache.conf
cache hit (direct)   114
cache hit (preprocessed)   1
cache miss   115
cache hit rate 50.00 %
called for link  110
cleanups performed 0
files in cache   229
cache size  21.1 MB
max cache size   5.0 GB
>From 4eb5fcc3466cf8a3d34e84171c91fe5035ea83f0 Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Sat, 21 Oct 2017 11:58:07 +0200
Subject: [PATCH 1/4] Sort the symbol table before outputing C code from the
 complier.

This helps make the compiler deterministic, as the output will not change
because of the random seeding of the symbol table.
---
 c-backend.scm | 67 +++
 1 file changed, 44 insertions(+), 23 deletions(-)

diff --git a/c-backend.scm b/c-backend.scm
index c8b48335..4262cc51 100644
--- a/c-backend.scm
+++ b/c-backend.scm
@@ -72,11 +72,24 @@
 (define (uncommentify s) (string-translate* (->string s) '(("*/" . "*_/"
 (define (c-identifier s) (string->c-identifier (->string s)))
 
+;; Generate a sorted alist out of a symbol table
+(define (table->sorted-alist t)
+  (let ((alist '()))
+(hash-table-for-each
+  (lambda (id ll)
+	(set! alist
+	  (cons (cons id ll) alist)))
+  t)
+
+(sort! alist (lambda (p1 p2) (stringstring (car p1))
+	   (symbol->string (car p2)))
+
 
 ;;; Generate target code:
 
 (define (generate-code literals lliterals lambda-table out source-file user-supplied-options dynamic db dbg-info-table)
-  (let ((non-av-proc #f))
+  (let ((lambda-table* (table->sorted-alist lambda-table)) ;; sort the symbol table to make the compiler output deterministic.
+	(non-av-proc #f))
 
   ;; Don't truncate floating-point precision!
   (flonum-print-precision (+ flonum-maximum-decimal-exponent 1))
@@ -614,9 +627,11 @@
   
 (define (prototypes)
   (gen #t)
-  (hash-table-for-each
-   (lambda (id ll)
-	 (let* ((n (lambda-literal-argument-count ll))
+  (for-each
+   (lambda (p)
+	 (let* ((id (car p))
+		(ll (cdr p))
+		(n (lambda-literal-argument-count ll))
 		(customizable (lambda-literal-customizable ll))
 		(empty-closure (and customizable (zero? (lambda-literal-closure-size ll
 		(varlist (intersperse (make-variable-list (if empty-closure (sub1 n) n) "t") #\,))
@@ -649,7 +664,7 @@
 	   (gen #\))
 	   (unless direct (gen " C_noret"))
 	   (gen #\;) ))
-   lambda-table) )
+   lambda-table*) )
   
 (define (trampolines)
   (let ([ns '()]
@@ -662,9 +677,11 @@
 	  ((>= i n))
 	(gen #t "C_word t" i "=av[" j "];")))
 
-	(hash-table-for-each
-	 (lambda (id ll)
-	   (let* ([argc (lambda-literal-argument-count ll)]
+	(for-each
+	 (lambda (p)
+	   (let* ([id (car p)]
+		  [ll (cdr p)]
+		  [argc (lambda-literal-argument-count ll)]
 		  [rest (lambda-literal-rest-argument ll)]
 		  [rest-mode (lambda-literal-rest-argument-mode ll)]
 		  [customizable (lambda-literal-customizable ll)]
@@ -679,7 +696,7 @@
 	   (let ([al (make-argument-list argc "t")])
 		 (apply gen (intersperse al #\,)) )
 	   (gen ");}") )))
-	 lambda-table)))
+	 lambda-table*)))

Re: [Chicken-hackers] [C5] About `random` and its future

2017-09-19 Thread Kooda
As said on IRC, we could merge this with the packet signing proposal.
If we are going to use the NaCl API for that, we can borrow some random
data procedures as well.

For example the libsodium library has been carefully audited and
provides a nice bunch of procedures :
https://download.libsodium.org/doc/generating_random_data/

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


Re: [Chicken-hackers] [PATCH] Use name from egg file when installing types and inline files

2017-09-09 Thread Kooda
On Sat, 9 Sep 2017 16:14:44 +1200 Evan Hanson <ev...@foldling.org>
wrote:
> Please ignore this patch, Kooda has pointed out that the current
> behaviour makes more sense.
> 

Well, actually, I’m not sure what makes more sense. I think it’s
strange that types and inline files are relative paths in the install
script while every other file is an absolute path.

The other thing I find strange, is that the doc says that the
(types-file) and (inline-file) declarations “Specifies that a
"type-database" file should be generated and installed…”, but currently
they don’t produce any code to generate them.

All is left to do so is passing `-ot` and `-oi` to csc, through
(link-options) for example, and thus the .egg file writer can’t put an
absolute path for those options because there is nothing in the .egg
file specification to do so.

So indeed the current behaviour makes more sense but I still think it’s
wrong.

Also, what’s the use of the file name overwrite for these two options?
I would think the component name is always the right name.

In any case, I think we need a way to specify whether the types/inline
file should be generated or taken from a manually written file in the
egg source directory.

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


Re: [Chicken-hackers] [PATCH] [5] avoid colliding .o files when compiling extensions

2017-09-08 Thread Kooda
Applied! :3

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


[Chicken-hackers] [PATCH 1/2] Make `call/cc` continuations behave like `values` ones.

2017-09-07 Thread Kooda
This makes the relaxed cases for multiple values work when using
`call/cc` to pass multiple values to the continuation instead of `values`.

This fixes ticket #1390
---
 runtime.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/runtime.c b/runtime.c
index ba2ec26d..a415d004 100644
--- a/runtime.c
+++ b/runtime.c
@@ -7094,10 +7094,7 @@ void C_ccall C_call_cc(C_word c, C_word *av)
   if(C_immediatep(cont) || C_header_bits(cont) != C_CLOSURE_TYPE)
 barf(C_BAD_ARGUMENT_TYPE_ERROR, "call-with-current-continuation", cont);
   
-  /* Check for values-continuation: */
-  if(C_block_item(k, 0) == (C_word)values_continuation)
-wrapper = C_closure(, 2, (C_word)call_cc_values_wrapper, k);
-  else wrapper = C_closure(, 2, (C_word)call_cc_wrapper, k);
+  wrapper = C_closure(, 2, (C_word)call_cc_values_wrapper, k);
   
   av2[ 0 ] = cont;
   av2[ 1 ] = k;
-- 
2.14.1


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


[Chicken-hackers] [PATCH] Fix the inconsistent behavior between values and call/cc

2017-09-07 Thread Kooda
Hi!

Here is a patch and a test case for the #1390 ticket.

I’m not too sure about the quality and implications of this patch, please review
it thoroughly. :)


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


[Chicken-hackers] [PATCH 2/2] Add a test case for multiple values handling.

2017-09-07 Thread Kooda
---
 tests/multiple-values.scm | 17 +
 tests/runtests.bat|  8 
 tests/runtests.sh |  5 +
 3 files changed, 30 insertions(+)
 create mode 100644 tests/multiple-values.scm

diff --git a/tests/multiple-values.scm b/tests/multiple-values.scm
new file mode 100644
index ..c70b0521
--- /dev/null
+++ b/tests/multiple-values.scm
@@ -0,0 +1,17 @@
+(define-syntax assert-fail
+  (syntax-rules ()
+((_ exp)
+ (assert (handle-exceptions ex #t exp #f)
+
+(define (f x) #t)
+
+;; Relaxed cases
+(assert (f (values 1 2 3)))
+(assert (f (call/cc (lambda (k) (k 1 2 3)
+
+;; Strict cases
+(assert-fail (call-with-values (lambda () (values 1 2 3)) f))
+(assert-fail
+  (call-with-values
+(lambda () (call/cc (lambda (k) (k 1 2 3
+f))
diff --git a/tests/runtests.bat b/tests/runtests.bat
index 8ac8b144..2d25a98e 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -601,6 +601,14 @@ rem this may crash, if the PATH contains a non-matching 
libchicken.dll on Window
 set PATH=%PATH%;%CD%\tmp xxx %CD%\tmp
 del /f /q /s rev-app rev-app-2 reverser\*.import.* reverser\*.so
 
+echo  multiple return values tests ...
+%interpret% -s multiple-values.scm
+if errorlevel 1 exit /b 1
+%compile% multiple-values.scm
+if errorlevel 1 exit /b 1
+a.out
+if errorlevel 1 exit /b 1
+
 rem echo  reinstall tests
 rem currently disabled for windows
 
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 1cce11e6..752e6b74 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -463,4 +463,9 @@ PATH=`pwd`/tmp:$PATH xxx ${TEST_DIR}/tmp
 #PATH=$PATH:${TEST_DIR}/tmp xxx ${TEST_DIR}/tmp
 rm -fr reverser/*.import.* reverser/*.so
 
+echo " multiple return values tests 
..."
+$interpret -s multiple-values.scm
+$compile multiple-values.scm
+./a.out
+
 echo " done."
-- 
2.14.1


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


Re: [Chicken-hackers] [PATCH] Add chicken.sort module

2017-08-19 Thread Kooda
On Sun, 13 Aug 2017 15:02:27 +0200 Peter Bex 
wrote:
> Hi all,
> 
> Attached is a patch that splits the sorting procedures from
> data-structures into chicken.sort.

Applied.


> I noticed that we currently don't export "merge!" from
> data-structures. Should we do that for master?  It is documented as
> existing, so I suppose this is strictly speaking a bug.

data-structures is not a module in CHICKEN 4, so it’s available. At
least it is in all of my installations! :o

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


Re: [Chicken-hackers] [PATCH] Move current-read-table to chicken.read-syntax

2017-08-19 Thread Kooda
Pushed! :)

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


Re: [Chicken-hackers] Proposal / patch for fixing #1385 (swapped bit-set? argument order)

2017-08-19 Thread Kooda
Sounds like the best thing to do.

Applied. :)

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


Re: [Chicken-hackers] [PATCH] Move duplicated posix module declarations into posix.scm

2017-06-14 Thread Kooda
That was bugging me, thanks for the cleanup!

Pushed. :D

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


Re: [Chicken-hackers] [PATCH] [5] Make syntax-rules "fully" self-contained

2017-06-14 Thread Kooda
On Thu, 8 Jun 2017 21:23:17 +0200 Peter Bex 
wrote:
> On Thu, Jun 08, 2017 at 09:19:24PM +0200, Peter Bex wrote:
> > Hi all,
> > 
> > Here's a reasonably simple patch that moves the expansion-time
> > support helpers for ye olde syntax-rules into an internal module in
> > synrules.scm.  
> 
> Well, not simple enough I guess ;).  I decided at the last minute to
> rename "chicken.syntax-rules.internal" to
> "chicken.internal.syntax-rules" which is more consistent with our
> other naming conventions, but forgot to rename the reference in
> expand.scm as well.
> 
> This new version of the patch fixes that problem.
> 
> Cheers,
> Peter

Looks good! Pushed. :)

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


Re: [Chicken-hackers] [PATCH] Add unexport form for modules

2017-06-07 Thread Kooda
On Wed, 7 Jun 2017 22:07:56 +0200 Peter Bex 
wrote:
> Both these proposals make me very very uneasy, for slightly different
> but somewhat related reasons.

I strongly agree with you on these points. How CHICKEN’s module
definition works always seemed strange to me.

R7RS is probably what we should strive for, therefore I’m in favor of
doing what we can to improve compatibility with it.

Also, R7RS library forms make explicit everything about the defined
module. Which is, I think, an important property.

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


Re: [Chicken-hackers] using tcc -run app.c # tcc, the tiny C compiler

2017-06-07 Thread Kooda
On Wed, 7 Jun 2017 13:33:47 +0200 fire...@firemail.cc wrote:
> which paths and %VARS do I need to set so I can use tcc -run ...
> with all *.c stuff that chicken produces ?
> 

Sorry, TCC is not supported, it doesn’t implement alloca() which is
needed by CHICKEN.

Also, this kind of questions is better asked on the chicken-users
mailing-list.

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


Re: [Chicken-hackers] About (chicken process) and (chicken process-context)

2017-06-06 Thread Kooda
Sounds good to me, pushed!

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


Re: [Chicken-hackers] [PATCH] Make setting of the file modification time saner

2017-06-05 Thread Kooda
Both changes signed off and pushed. :)

Sorry for the delay.

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


Re: [Chicken-hackers] Experiments with heap shrinkage, -:hs

2017-05-20 Thread Kooda
On Fri, 19 May 2017 15:29:56 +0200 (CEST) Sven Hartrumpf
 wrote:
> Hi all.
> 
> I would like to experiment with heap shrinking (-:hs) for long
> running, memory/GC intensive processes.
> 
> I checked runtime.c and I read the following shrink condition:
> 
> count < percentage(percentage(heap_size, C_heap_shrinkage),
> DEFAULT_HEAP_SHRINKAGE_USED)
> 
> This would imply that heap usage must be < 12.5 % to lead to a heap
> shrink because C_heap_shrinkage (via DEFAULT_HEAP_SHRINKAGE) is 50 %
> and DEFAULT_HEAP_SHRINKAGE_USED is 25 %.
> This (< 12.5 %) is very unlikely for many applications :-)
> How about:
> 
> count < percentage(heap_size, DEFAULT_HEAP_SHRINKAGE_USED)  ?
> 
> Ciao
> Sven
> 

My 2 cents, I don’t know much about CHICKEN’s GC yet:

This sounds good to me, the current behaviour seems a little bit
strange.

Maybe we could also introduce a new runtime flag that would indicate at
which point we trigger heap shrinkage (that would replace
DEFAULT_HEAP_SHRINKAGE_USED)?

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


Re: [Chicken-hackers] [PATCH] Prevent uninitialized memory access when make-ing a srfi-4 vector

2017-03-14 Thread Kooda
Signed off and pushed.

I just changed the `int` type to `size_t` to avoid integer overflow.

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


Re: [Chicken-hackers] [PATCH] Make process procedures in the posix module accept alists for environments.

2017-03-09 Thread Kooda
On Fri, 10 Mar 2017 10:25:36 +1300
Evan Hanson <ev...@foldling.org> wrote:
> I think `call-with-exec-args` should use `check-environment-list`

I wanted to ask about that in my initial email but forgot about it
before sending. The original code didn’t do any type checking.

Here’s an updated patch that includes this proposal. :)
>From 353e83d8402c6289f5c6c2390955acf1204dd62b Mon Sep 17 00:00:00 2001
From: Kooda <ko...@upyum.com>
Date: Wed, 1 Mar 2017 12:10:00 +0100
Subject: [PATCH] Make process procedures in the posix module accept alists for
 environments.

Previously, environments were passed as a list of strings in the form "name=value",
which seemed inconsistent with the get-environment-variables which hands out an alist.

This fixes #1270
---
 manual/Unit posix | 10 +-
 posix-common.scm  | 16 +++-
 posixunix.scm |  2 +-
 posixwin.scm  |  2 +-
 types.db  |  6 +++---
 5 files changed, 25 insertions(+), 11 deletions(-)

diff --git a/manual/Unit posix b/manual/Unit posix
index 6097ab3b..93e107b6 100644
--- a/manual/Unit posix	
+++ b/manual/Unit posix	
@@ -641,15 +641,15 @@ Get or set the process group ID of the process specified by {{PID}}.
 
  process-execute
 
-(process-execute PATHNAME [ARGUMENT-LIST [ENVIRONMENT-LIST]])
+(process-execute PATHNAME [ARGUMENT-LIST [ENVIRONMENT-ALIST]])
 
 Replaces the running process with a new process image from the program
 stored at {{PATHNAME}}, using the C library function {{execvp(3)}}.
 If the optional argument {{ARGUMENT-LIST}} is given, then it should
 contain a list of strings which are passed as arguments to the subprocess.
-If the optional argument {{ENVIRONMENT-LIST}} is supplied, then the library
+If the optional argument {{ENVIRONMENT-ALIST}} is supplied, then the library
 function {{execve(2)}} is used, and the environment passed in
-{{ENVIRONMENT-LIST}} (which should be of the form {{("=" ...)}}
+{{ENVIRONMENT-ALIST}} (which should be of the form {{(("" . "") ...)}})
 is given to the invoked process. Note that {{execvp(3)}} respects the
 current setting of the {{PATH}} environment variable while {{execve(3)}} does not.
 
@@ -708,7 +708,7 @@ are suspended as well.
  process
 
 (process COMMANDLINE)
-(process COMMAND ARGUMENT-LIST [ENVIRONMENT-LIST])
+(process COMMAND ARGUMENT-LIST [ENVIRONMENT-ALIST])
 
 Creates a subprocess and returns three values: an input port from
 which data written by the sub-process can be read, an output port from
@@ -724,7 +724,7 @@ its standard error into a separate port).
 * The single parameter version passes the string {{COMMANDLINE}} to the host-system's shell that
 is invoked as a subprocess.
 * The multiple parameter version directly invokes the {{COMMAND}} as a subprocess. The {{ARGUMENT-LIST}}
-is directly passed, as is {{ENVIRONMENT-LIST}}.
+is directly passed, as is {{ENVIRONMENT-ALIST}}.
 
 Not using the shell may be preferrable for security reasons.
 
diff --git a/posix-common.scm b/posix-common.scm
index f8fe27fa..b9d68c60 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -741,6 +741,16 @@ EOF
   (and-let* ((s (pointer-vector-ref buffer-array i)))
 	(free s)
 
+;; Environments are represented as string->string association lists
+(define (check-environment-list lst loc)
+  (##sys#check-list lst loc)
+  (for-each
+(lambda (p)
+  (##sys#check-pair p loc)
+  (##sys#check-string (car p) loc)
+  (##sys#check-string (cdr p) loc))
+lst))
+
 (define call-with-exec-args
   (let ((pathname-strip-directory pathname-strip-directory)
 	(nop (lambda (x) x)))
@@ -758,6 +768,10 @@ EOF
 
 	  ;; Envlist is never converted, so we always use nop here
 	  (when envlist
-	(set! envbuf (list->c-string-buffer envlist nop loc)))
+	(check-environment-list envlist loc)
+	(set! envbuf
+	  (list->c-string-buffer
+		(map (lambda (p) (string-append (car p) "=" (cdr p))) envlist)
+		nop loc)))
 
 	  (proc (##sys#make-c-string filename loc) argbuf envbuf))
diff --git a/posixunix.scm b/posixunix.scm
index dee77c37..03340e12 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1582,7 +1582,7 @@ EOF
 (begin
   (set! args (##sys#shell-command-arguments cmd))
   (set! cmd (##sys#shell-command)) ) )
-(when env (chkstrlst env))
+(when env (check-environment-list env loc))
 (##sys#call-with-values 
 	 (lambda () (##sys#process loc cmd args env #t #t err?))
 	 k)
diff --git a/posixwin.scm b/posixwin.scm
index 7a10a707..02fc62f2 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -1262,7 +1262,7 @@ EOF
 		(set! exactf #t)
 		(set! args (##sys#shell-command-arguments cmd))
 		(set! cmd (##sys#shell-command)) ) )
-	(when env (chkstrlst env))
+	(when env (check-environment-list env loc))
 	(receive [in out pid err] (##sys#process loc cmd args env #t #t err? exactf)
 	  (if er

[Chicken-hackers] [PATCH] Make process procedures in the posix module accept alists for environments.

2017-03-01 Thread Kooda
Previously, environments were passed as a list of strings in the form 
"name=value",
which seemed inconsistent with the get-environment-variables which hands out an 
alist.

This fixes #1270
---
 manual/Unit posix | 10 +-
 posix-common.scm  | 15 ++-
 posixunix.scm |  2 +-
 posixwin.scm  |  2 +-
 types.db  |  6 +++---
 5 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/manual/Unit posix b/manual/Unit posix
index a79894e8..448b4ad7 100644
--- a/manual/Unit posix 
+++ b/manual/Unit posix 
@@ -641,15 +641,15 @@ Get or set the process group ID of the process specified 
by {{PID}}.
 
  process-execute
 
-(process-execute PATHNAME [ARGUMENT-LIST 
[ENVIRONMENT-LIST]])
+(process-execute PATHNAME [ARGUMENT-LIST 
[ENVIRONMENT-ALIST]])
 
 Replaces the running process with a new process image from the program
 stored at {{PATHNAME}}, using the C library function {{execvp(3)}}.
 If the optional argument {{ARGUMENT-LIST}} is given, then it should
 contain a list of strings which are passed as arguments to the subprocess.
-If the optional argument {{ENVIRONMENT-LIST}} is supplied, then the library
+If the optional argument {{ENVIRONMENT-ALIST}} is supplied, then the library
 function {{execve(2)}} is used, and the environment passed in
-{{ENVIRONMENT-LIST}} (which should be of the form {{("=" ...)}}
+{{ENVIRONMENT-ALIST}} (which should be of the form {{(("" . "") 
...)}})
 is given to the invoked process. Note that {{execvp(3)}} respects the
 current setting of the {{PATH}} environment variable while {{execve(3)}} does 
not.
 
@@ -708,7 +708,7 @@ are suspended as well.
  process
 
 (process COMMANDLINE)
-(process COMMAND ARGUMENT-LIST [ENVIRONMENT-LIST])
+(process COMMAND ARGUMENT-LIST [ENVIRONMENT-ALIST])
 
 Creates a subprocess and returns three values: an input port from
 which data written by the sub-process can be read, an output port from
@@ -724,7 +724,7 @@ its standard error into a separate port).
 * The single parameter version passes the string {{COMMANDLINE}} to the 
host-system's shell that
 is invoked as a subprocess.
 * The multiple parameter version directly invokes the {{COMMAND}} as a 
subprocess. The {{ARGUMENT-LIST}}
-is directly passed, as is {{ENVIRONMENT-LIST}}.
+is directly passed, as is {{ENVIRONMENT-ALIST}}.
 
 Not using the shell may be preferrable for security reasons.
 
diff --git a/posix-common.scm b/posix-common.scm
index f8fe27fa..f3d444c9 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -741,6 +741,16 @@ EOF
   (and-let* ((s (pointer-vector-ref buffer-array i)))
(free s)
 
+;; Environments are represented as string->string association lists
+(define (check-environment-list lst loc)
+  (##sys#check-list lst loc)
+  (for-each
+(lambda (p)
+  (##sys#check-pair p loc)
+  (##sys#check-string (car p) loc)
+  (##sys#check-string (cdr p) loc))
+lst))
+
 (define call-with-exec-args
   (let ((pathname-strip-directory pathname-strip-directory)
(nop (lambda (x) x)))
@@ -758,6 +768,9 @@ EOF
 
  ;; Envlist is never converted, so we always use nop here
  (when envlist
-   (set! envbuf (list->c-string-buffer envlist nop loc)))
+   (set! envbuf
+ (list->c-string-buffer
+   (map (lambda (p) (string-append (car p) "=" (cdr p))) envlist)
+   nop loc)))
 
  (proc (##sys#make-c-string filename loc) argbuf envbuf))
diff --git a/posixunix.scm b/posixunix.scm
index fa794f99..b6333525 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1580,7 +1580,7 @@ EOF
 (begin
   (set! args (##sys#shell-command-arguments cmd))
   (set! cmd (##sys#shell-command)) ) )
-(when env (chkstrlst env))
+(when env (check-environment-list env loc))
 (##sys#call-with-values 
 (lambda () (##sys#process loc cmd args env #t #t err?))
 k)
diff --git a/posixwin.scm b/posixwin.scm
index 7d3021da..343b03d1 100644
--- a/posixwin.scm
+++ b/posixwin.scm
@@ -1261,7 +1261,7 @@ EOF
(set! exactf #t)
(set! args (##sys#shell-command-arguments cmd))
(set! cmd (##sys#shell-command)) ) )
-   (when env (chkstrlst env))
+   (when env (check-environment-list env loc))
(receive [in out pid err] (##sys#process loc cmd args env #t #t 
err? exactf)
  (if err?
(values in out pid err)
diff --git a/types.db b/types.db
index edd0c42a..1da17d1c 100644
--- a/types.db
+++ b/types.db
@@ -2016,11 +2016,11 @@
 (chicken.posix#perm/ixusr fixnum)
 (chicken.posix#pipe/buf fixnum)
 (chicken.posix#port->fileno (#(procedure #:clean #:enforce) 
chicken.posix#port->fileno (port) fixnum))
-(chicken.posix#process (#(procedure #:clean #:enforce) chicken.posix#process 
(string #!optional (list-of string) (list-of string)) input-port output-port 
fixnum))
-(chicken.posix#process* 

Re: [Chicken-hackers] [PATCH] [5] Clean up chicken.h a little bit

2017-02-25 Thread Kooda
Signed off and pushed, except the first patch which will change the
behaviour with C++ compilers. It doesn’t seem very serious though…

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


Re: [Chicken-hackers] [PATCH] Ensure va_end() is always called in C_a_i_string()

2017-01-20 Thread Kooda
On Thu, 19 Jan 2017 22:16:20 +1300
Evan Hanson  wrote:

> Previously, the call to va_end() would be skipped when this procedure
> was given invalid arguments (and continued to `barf` a result).
> ---
>  runtime.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/runtime.c b/runtime.c
> index 78f2f9b6..40fd368f 100644
> --- a/runtime.c
> +++ b/runtime.c
> @@ -4863,14 +4863,16 @@ C_word C_a_i_string(C_word **a, int c, ...)
>p = (char *)C_data_pointer(s);
>va_start(v, c);
>  
> -  while(c--) {
> +  for(; c; c--) {
>  x = va_arg(v, C_word);
>  
>  if((x & C_IMMEDIATE_TYPE_BITS) == C_CHARACTER_BITS)
>*(p++) = C_character_code(x);
> -else barf(C_BAD_ARGUMENT_TYPE_ERROR, "string", x);
> +else break;
>}
>  
> +  va_end(v);
> +  if (c) barf(C_BAD_ARGUMENT_TYPE_ERROR, "string", x);
>return s;
>  }
>  

Looks fine, pushed!

I’m curious though: how did you catch this?

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


  1   2   >