Re: [Chicken-hackers] [PATCH] Strip all trailing slashes from directory pathname parts

2013-06-01 Thread Evan Hanson
Argh, here's a better version that removes some unnecessary code.

Evan
From 38107450defef9ee6d65f64edc7f304016c542a1 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Sat, 1 Jun 2013 16:18:30 +1200
Subject: [PATCH] Strip all trailing slashes from directory pathname parts

This causes decompose-pathname (and its derivatives pathname-directory,
pathname-replace-file, etc.) to strip all trailing slashes from the
directory parts of pathnames, rather than just the last one.
---
 files.scm|   26 +++---
 tests/path-tests.scm |   41 +
 2 files changed, 52 insertions(+), 15 deletions(-)

diff --git a/files.scm b/files.scm
index 7398350..815228b 100644
--- a/files.scm
+++ b/files.scm
@@ -161,11 +161,13 @@ EOF
 
 (define (chop-pds str)
   (and str
-   (let ((len (##sys#size str)))
-(if (and (fx= len 1)
- (*char-pds? (##core#inline C_subchar str (fx- len 1)) ) )
-(##sys#substring str 0 (fx- len 1))
-str) ) ) )
+   (let lp ((len (##sys#size str)))
+(cond ((and (fx len 1)
+(*char-pds? (##core#inline C_subchar str (fx- len 1
+   (lp (fx- len 1)))
+  ((fx len (##sys#size str))
+   (##sys#substring str 0 len))
+  (else str)
 
 (define make-pathname)
 (define make-absolute-pathname)
@@ -227,13 +229,7 @@ EOF
   (let* ([patt1 ^(.*[\\/])?([^\\/]+)(\\.([^\\/.]+))$]
 [patt2 ^(.*[\\/])?((\\.)?[^\\/]+)$]
 [rx1 (irregex patt1)]
-[rx2 (irregex patt2)]
-[strip-pds
- (lambda (dir)
-   (and dir
-(if (member dir '(/ \\))
-dir
-(chop-pds dir) ) ) )] )
+[rx2 (irregex patt2)])
 (lambda (pn)
   (##sys#check-string pn 'decompose-pathname)
   (if (fx= 0 (##sys#size pn))
@@ -241,16 +237,16 @@ EOF
  (let ([ms (irregex-search rx1 pn)])
(if ms
(values 
-(strip-pds (irregex-match-substring ms 1))
+(chop-pds (irregex-match-substring ms 1))
 (irregex-match-substring ms 2)
 (irregex-match-substring ms 4))
(let ([ms (irregex-search rx2 pn)])
  (if ms
  (values
-  (strip-pds (irregex-match-substring ms 1))
+  (chop-pds (irregex-match-substring ms 1))
   (irregex-match-substring ms 2) 
   #f)
- (values (strip-pds pn) #f #f) ) ) ) ) ) ) ) )
+ (values (chop-pds pn) #f #f) ) ) ) ) ) ) ) )
 
 (define pathname-directory
   (lambda (pn)
diff --git a/tests/path-tests.scm b/tests/path-tests.scm
index 6b9fc45..d08f87a 100644
--- a/tests/path-tests.scm
+++ b/tests/path-tests.scm
@@ -71,6 +71,47 @@
 (test '(#f #f (  foo bar)) (receive (decompose-directory  //foo//bar)))
 (test '(#f #f (foo bar)) (receive (decompose-directory foo//bar/)))
 
+(test '(#f #f #f) (receive (decompose-pathname )))
+(test '(/ #f #f) (receive (decompose-pathname /)))
+(test '(\\ #f #f) (receive (decompose-pathname \\)))
+(test '(/ a #f) (receive (decompose-pathname /a)))
+(test '(\\ a #f) (receive (decompose-pathname \\a)))
+(test '(/ #f #f) (receive (decompose-pathname ///)))
+(test '(\\ #f #f) (receive (decompose-pathname \\)))
+(test '(/ a #f) (receive (decompose-pathname ///a)))
+(test '(\\ a #f) (receive (decompose-pathname \\a)))
+(test '(/a b #f) (receive (decompose-pathname /a/b)))
+(test '(\\a b #f) (receive (decompose-pathname \\a\\b)))
+(test '(/a b c) (receive (decompose-pathname /a/b.c)))
+(test '(\\a b c) (receive (decompose-pathname \\a\\b.c)))
+(test '(. a #f) (receive (decompose-pathname ./a)))
+(test '(. a #f) (receive (decompose-pathname .\\a)))
+(test '(. a b) (receive (decompose-pathname ./a.b)))
+(test '(. a b) (receive (decompose-pathname .\\a.b)))
+(test '(./a b #f) (receive (decompose-pathname ./a/b)))
+(test '(.\\a b #f) (receive (decompose-pathname .\\a\\b)))
+(test '(#f a #f) (receive (decompose-pathname a)))
+(test '(#f a. #f) (receive (decompose-pathname a.)))
+(test '(#f .a #f) (receive (decompose-pathname .a)))
+(test '(a b #f) (receive (decompose-pathname a/b)))
+(test '(a b #f) (receive (decompose-pathname a\\b)))
+(test '(a b #f) (receive (decompose-pathname a///b)))
+(test '(a b #f) (receive (decompose-pathname a\\b)))
+(test '(a/b c #f) (receive (decompose-pathname a/b/c)))
+(test '(a\\b c #f) (receive (decompose-pathname a\\b\\c)))
+(test '(a/b/c #f #f) (receive (decompose-pathname a/b/c/)))
+(test '(a\\b\\c #f #f) (receive (decompose-pathname a\\b\\c\\)))
+(test '(a/b/c #f #f) (receive (decompose-pathname a/b/c///)))
+(test '(a\\b\\c #f #f) (receive (decompose-pathname a\\b\\c\\)))
+(test '(#f a b) (receive (decompose-pathname a.b)))
+(test '(a.b #f #f) (receive (decompose-pathname a.b/)))
+(test

Re: [Chicken-hackers] [Chicken-users] Spiffy subprocess cleanup

2013-05-28 Thread Evan Hanson
On 2013/05/23 09:17P, Peter Bex wrote:
 I've attached a patch that I *think* does the trick. [...] I'd love it
 if people could test this and provide feedback, because I'm pretty
 unsure whether this fix is the correct one.

Seems to work here -- at least, it solves the problem Bryan found and
doesn't cause any others AFAICS.

I did run into an unrelated issue while poking around with the patch,
after defining a new procedure `process-wait` for testing -- should
`process` use a ##sys variant of `process-wait` in its definition? I
don't quite grok what the guarantees are w.r.t. user shadowing 
internal procedures in the units, but I think there are a few cases in
posix where an internal variant could (should?) be used.

Either way, the attached patch makes this specific change to `process`
since it bit me.

Evan
From 7c835750032b5c073449dbb50dc7e7475e9587c3 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Tue, 28 May 2013 16:18:54 +1200
Subject: [PATCH] use internal process-wait procedure in ##sys#process

---
 posixunix.scm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/posixunix.scm b/posixunix.scm
index 7d8dcaf..88a88a0 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1859,7 +1859,7 @@ EOF
 (lambda ()
   (vector-set! clsvec idx #t)
   (when (and (vector-ref clsvec idxa) (vector-ref clsvec idxb))
-(receive [_ flg cod] (process-wait pid)
+(receive [_ flg cod] (##sys#process-wait pid #f)
   (unless flg
 (##sys#signal-hook #:process-error loc
   abnormal process exit pid cod)) ) ) ) )]
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] add R7RS support for exit and emergency-exit

2013-05-28 Thread Evan Hanson
This patch adds (I believe) almost-R7RS support for the `exit` and
`emergency-exit` procedures. Specifically, it allows `exit` to accept an
arbitrary object as its argument, causes `exit` to run all finalizers
and pending dynamic-wind after-thunks before exiting (by default;
defining an `exit-handler` overrides this behavior as before), and adds
the `emergency-exit` procedure which does not.

The exit status translation follows the usual Scheme falsity rules (#f
causes an exit with a status of 1, everything else exits 0), with the
exception of integers which, in the interest of backwards-compatability
(and also the need to return other exit statuses to the OS), are passed
along directly. There are probably more creative things one could do
here, but this behavior makes sense to me.

The second patch just fixes some macro un/hygiene tests that had relied
on exit's old behavior.

I think I've gotten these right, but they should obviously be looked at
carefully. If you can't trust software to stop, can you trust it at all?

Also, I believe CHICKEN's exit procedures are still not technically
R7RS-compliant even given these changes, since a user-specified
`exit-handler` or `on-exit` procedure may signal an error, contain a
non-local escape or simply refuse to exit, all of which are verboten by
the draft. I think this is probably OK, but others may feel differently.

Evan
From 370e0ff5008dc997f19ea7a01032cadfea0c1bef Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Tue, 28 May 2013 22:47:57 +1200
Subject: [PATCH 1/2] add R7RS support for exit and emergency-exit

This allows exit to accept an arbitrary object as its argument (if the object 
is an
integer, it is used as the process' exit status directly; otherwise, the exit
status follows the usual Scheme rules (#f is 1 to indicate an abnormal exit,
everything else is 0)).

It also causes exit to run all finalizers and pending dynamic-wind after-thunks
before exiting, and adds the emergency-exit procedure which does not.
---
 library.scm |   21 -
 manual/Parameters   |7 ---
 manual/Unit library |   19 +++
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/library.scm b/library.scm
index 68165d9..b12bd66 100644
--- a/library.scm
+++ b/library.scm
@@ -152,11 +152,19 @@ EOF
 
 ;;; System routines:
 
-(define (exit #!optional (code 0)) ((##sys#exit-handler) code))
+(define (exit #!optional (obj 0)) ((##sys#exit-handler) obj))
+(define (emergency-exit #!optional (obj 0)) (##sys#exit-runtime obj))
 (define (reset) ((##sys#reset-handler)))
 (define (##sys#quit-hook result) ((##sys#exit-handler) 0))
 (define (quit #!optional result) (##sys#quit-hook result))
 
+(define (##sys#exit-runtime obj)
+  (##core#inline
+   C_exit_runtime
+   (cond ((##sys#integer? obj) obj)
+((##sys#eq? obj #f) 1)
+(else 0
+
 (define (##sys#error . args)
   (if (pair? args)
   (apply ##sys#signal-hook #:error args)
@@ -3935,15 +3943,10 @@ EOF
 
 (define exit-handler
   (make-parameter
-   (lambda code
+   (lambda (obj)
  (##sys#cleanup-before-exit)
- (##core#inline
-  C_exit_runtime
-  (if (null? code)
- 0
- (let ([code (car code)])
-   (##sys#check-exact code)
-   code) ) ) ) ) )
+ (##sys#dynamic-unwind '() (length ##sys#dynamic-winds))
+ (##sys#exit-runtime obj
 
 (define implicit-exit-handler
   (make-parameter
diff --git a/manual/Parameters b/manual/Parameters
index bf0e7d7..cb90d87 100644
--- a/manual/Parameters
+++ b/manual/Parameters
@@ -81,9 +81,10 @@ read-syntax (see {{set-read-syntax!}} for more information).
 
 parameter(exit-handler)/parameter
 
-A procedure of a single optional argument. When {{exit}} is called,
-then this procedure will be invoked with the exit-code as argument. The
-default behavior is to terminate the program.
+A procedure of a single argument. When {{exit}} is called, this
+procedure is invoked with the object passed to {{exit}} as its argument.
+The default behavior is to run all pending finalizers and
+{{dynamic-wind}} thunks and terminate the program.
 
 
 === eval-handler
diff --git a/manual/Unit library b/manual/Unit library
index 1efb5bd..98dca79 100644
--- a/manual/Unit library   
+++ b/manual/Unit library   
@@ -451,12 +451,23 @@ the host-shell whether arguments are expanded ('globbed') 
or not.
 
  exit
 
-procedure(exit [CODE])/procedure
+procedure(exit [OBJECT])/procedure
 
-Exit the running process and return exit-code, which defaults to 0
-(Invokes {{exit-handler}}).
+Exit the running process and return an exit-code representing the given
+{{OBJECT}}, which defaults to 0. If {{OBJECT}} is an integer, it is used
+as the exit-code for the process. If {{OBJECT}} is {{#f}}, the exit-code
+will be 1, and 0 in all other cases (invokes {{exit-handler}}).
 
-Note that pending {{dynamic-wind}} thunks are ''not'' invoked when exiting 
your program in this way.
+ emergency-exit

Re: [Chicken-hackers] [PATCH] add R7RS support for exit and emergency-exit

2013-05-28 Thread Evan Hanson
On 2013/05/28 10:13P, John Cowan wrote:
 Evan Hanson scripsit:
 
  Also, I believe CHICKEN's exit procedures are still not technically
  R7RS-compliant even given these changes, since a user-specified
  `exit-handler` or `on-exit` procedure may signal an error, contain a
  non-local escape or simply refuse to exit, all of which are verboten by
  the draft. I think this is probably OK, but others may feel differently.
 
 The draft merely says The exit procedure must not signal an exception or
 return to its continuation.  Nothing is said about dynamic-wind handlers
 not doing so; it is the programmer's responsibility to avoid situations
 where the process cannot even die.

True, I suppose it must not return to *its* continuation, so the second
case is fine, but IIUC the other constraints can still be broken (since
`exit-handler` isn't wound).

 Note that emergency-exit should wind up calling _exit() rather than
 exit(), so that stdio buffers are not flushed.

Thanks, I'll incorporate this requirement.

Evan

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


Re: [Chicken-hackers] [PATCH] add = syntax for case clauses

2013-05-27 Thread Evan Hanson
On 2013/05/26 09:41P, Evan Hanson wrote:
 The attached patch adds support and basic tests for case clauses
 containing `=` patterns (R7RS 4.2.1).

I just noticed the two comments in this patch are inverted; please find
attached a hand-munged version with this fixed, and sorry for the noise.

Evan
From 48ebd94f3ec2d3926e156f7996924c142b870b23 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Mon, 27 May 2013 14:06:20 +1200
Subject: [PATCH] add = syntax for case clauses

---
 expand.scm   |   11 +--
 tests/r7rs-tests.scm |8 
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/expand.scm b/expand.scm
index b278ec0..d4b4d2f 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1174,6 +1174,7 @@
  (body (cddr form)) )
   (let ((tmp (r 'tmp))
(%or (r 'or))
+   (%= (r '=))
(%eqv? (r 'eqv?))
(%else (r 'else)))
`(let ((,tmp ,exp))
@@ -1185,7 +1186,10 @@
(##sys#check-syntax 'case clause '#(_ 1))
(cond ((c %else (car clause))
   (expand rclauses #t)
-  `(##core#begin ,@(cdr clause)) )
+  (if (and (fx= (length clause) 3) ; (else = expr)
+   (c %= (cadr clause)))
+  `(,(caddr clause) ,tmp)
+  `(##core#begin ,@(cdr clause
  (else?
   (##sys#notice
non-`else' clause following `else' clause in 
`case'
@@ -1196,7 +1200,10 @@
   `(##core#if (,%or ,@(##sys#map
(lambda (x) `(,%eqv? ,tmp ',x))
(car clause)))
-  (##core#begin ,@(cdr clause)) 
+  ,(if (and (fx= (length clause) 3) ; 
((...) = expr)
+(c %= (cadr clause)))
+   `(,(caddr clause) ,tmp)
+   `(##core#begin ,@(cdr clause)))
   ,(expand rclauses #f) ) ) ) ) ) ) ) ) ) 
) ) )
 
 (##sys#extend-macro-environment
diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm
index bc21294..2de53e7 100644
--- a/tests/r7rs-tests.scm
+++ b/tests/r7rs-tests.scm
@@ -57,6 +57,14 @@
 (exit 1)))
   (newline))
 
+(SECTION 4 2 1)
+
+;; case with = clause
+(test a (lambda () (case 'a ((a) = symbol-string
+(test a (lambda () (case 'a (else = symbol-string
+(test-error condition? (lambda () (case 'a ((a) =
+(test-error condition? (lambda () (case 'a (else =
+
 (SECTION 4 2 5)
 
 
-- 
1.7.10.4

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


Re: [Chicken-hackers] [PATCH] Add support for R7RS named characters and string escapes (except hex escapes)

2013-05-26 Thread Evan Hanson
On 2013/05/26 11:09P, Peter Bex wrote:
 Here are two patches for adding R7RS named character and string escapes
 sequences.

I don't believe the second patch is sufficient for adding intraline
whitespace escapes; it only handles LF-terminated lines, while R7RS
specifies that CR, CRLF and LF line endings should all be collapsed.

The attached patch supplements Peter's to handle these cases.

Evan
From f5b06523300b5b8880460d7cb3f935c300d85074 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Mon, 27 May 2013 16:18:53 +1200
Subject: [PATCH] handle CR  CRLF-terminated lines when collapsing intraline
 whitespace

---
 library.scm |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/library.scm b/library.scm
index 68165d9..d8264da 100644
--- a/library.scm
+++ b/library.scm
@@ -2521,12 +2521,19 @@ EOF
  (loop (##sys#read-char-0 port) (r-cons-codepoint 
n lst)) )))
   ((#\\ #\' #\ #\|)
(loop (##sys#read-char-0 port) (cons c lst)))
-  ((#\newline #\space #\tab)
+  ((#\newline #\return #\space #\tab)
;; Read escaped intraline ws* nl intraline ws*
(let eat-ws ((c c) (nl? #f))
  (case c
((#\space #\tab)
 (eat-ws (##sys#read-char-0 port) nl?))
+   ((#\return)
+(if nl?
+(loop c lst)
+(let ((nc (##sys#read-char-0 port)))
+  (if (eq? nc #\newline) ; collapse \r\n
+  (eat-ws (##sys#read-char-0 port) #t)
+  (eat-ws nc #t)
((#\newline)
 (if nl?
 (loop c lst)
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] verify syntax in = cond clauses

2013-05-26 Thread Evan Hanson
This patch improves cond's behavior on clauses which contain `=` but do
not match the precise definition of cond.

CHICKEN's current behavior is as follows:

#; (cond (#t =))
Error: (caddr) during expansion of (cond ...) - bad argument type: ()
...

I believe this behavior is incorrect, and should instead be, for
example:

#; (cond (#t =))
Error: unbound variable: =
...
#; (define = 1)
#; (cond (#t =))
1
#; (cond (#t = 2 3))
3

The attached patch simply verifies the length of cond clauses containing
arrows in order to handle cases such as these.

Evan
From af9630a633dd2ab74e89688d34358aae587fa36e Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Mon, 27 May 2013 14:11:02 +1200
Subject: [PATCH] verify syntax in = cond clauses

This corrects cond's behavior given clauses of the form `(test =)` or
`(test = foo bar)`.
---
 expand.scm |5 +++--
 tests/syntax-tests.scm |8 
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/expand.scm b/expand.scm
index b278ec0..933d47f 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1144,13 +1144,14 @@
 '(##core#begin))
((null? (cdr clause)) 
 `(,%or ,(car clause) ,(expand rclauses #f)))
-   ((c %= (cadr clause))
+   ((and (fx= (length clause) 3)
+ (c %= (cadr clause)))
 (let ((tmp (r 'tmp)))
   `(##core#let ((,tmp ,(car clause)))
(##core#if ,tmp
   (,(caddr clause) ,tmp)
   ,(expand rclauses #f) ) ) ) )
-   ((and (list? clause) (fx= (length clause) 4)
+   ((and (fx= (length clause) 4)
  (c %= (caddr clause)))
 (let ((tmp (r 'tmp)))
   `(##sys#call-with-values
diff --git a/tests/syntax-tests.scm b/tests/syntax-tests.scm
index 6da0277..89cfd46 100644
--- a/tests/syntax-tests.scm
+++ b/tests/syntax-tests.scm
@@ -191,6 +191,14 @@
   (cond (#t = 'ok)))
 )
 
+(t 1 (let ((= 1))
+   (cond (#f 'false)
+ (#t =
+
+(t 3 (let ((= 1))
+   (cond (#f 'false)
+ (#t = 2 3
+
 (t '(3 4)
 (let ((foo 3))
   (let-syntax ((bar (syntax-rules () ((_ x) (list foo x)
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] add = syntax for case clauses

2013-05-26 Thread Evan Hanson
The attached patch adds support and basic tests for case clauses
containing `=` patterns (R7RS 4.2.1). `condition?` is used in the R7RS
tests since `error-object?` has yet to be implemented.

Evan
From 48ebd94f3ec2d3926e156f7996924c142b870b23 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Mon, 27 May 2013 14:06:20 +1200
Subject: [PATCH] add = syntax for case clauses

---
 expand.scm   |   11 +--
 tests/r7rs-tests.scm |8 
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/expand.scm b/expand.scm
index b278ec0..d4b4d2f 100644
--- a/expand.scm
+++ b/expand.scm
@@ -1174,6 +1174,7 @@
  (body (cddr form)) )
   (let ((tmp (r 'tmp))
(%or (r 'or))
+   (%= (r '=))
(%eqv? (r 'eqv?))
(%else (r 'else)))
`(let ((,tmp ,exp))
@@ -1185,7 +1186,10 @@
(##sys#check-syntax 'case clause '#(_ 1))
(cond ((c %else (car clause))
   (expand rclauses #t)
-  `(##core#begin ,@(cdr clause)) )
+  (if (and (fx= (length clause) 3) ; ((...) = expr)
+   (c %= (cadr clause)))
+  `(,(caddr clause) ,tmp)
+  `(##core#begin ,@(cdr clause
  (else?
   (##sys#notice
non-`else' clause following `else' clause in 
`case'
@@ -1196,7 +1200,10 @@
   `(##core#if (,%or ,@(##sys#map
(lambda (x) `(,%eqv? ,tmp ',x))
(car clause)))
-  (##core#begin ,@(cdr clause)) 
+  ,(if (and (fx= (length clause) 3) ; 
(else = expr)
+(c %= (cadr clause)))
+   `(,(caddr clause) ,tmp)
+   `(##core#begin ,@(cdr clause)))
   ,(expand rclauses #f) ) ) ) ) ) ) ) ) ) 
) ) )
 
 (##sys#extend-macro-environment
diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm
index bc21294..2de53e7 100644
--- a/tests/r7rs-tests.scm
+++ b/tests/r7rs-tests.scm
@@ -57,6 +57,14 @@
 (exit 1)))
   (newline))
 
+(SECTION 4 2 1)
+
+;; case with = clause
+(test a (lambda () (case 'a ((a) = symbol-string
+(test a (lambda () (case 'a (else = symbol-string
+(test-error condition? (lambda () (case 'a ((a) =
+(test-error condition? (lambda () (case 'a (else =
+
 (SECTION 4 2 5)
 
 
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] load files from CHICKEN_INCLUDE_PATH on require

2013-05-26 Thread Evan Hanson
The documentation for `require` indicates that the current include
path, which defaults to the pathnames given in CHICKEN_INCLUDE_PATH
will be searched for files to load. However, this isn't currently the
case:

$ ls foo
bar.scm
$ CHICKEN_INCLUDE_PATH=./foo csi
...
#; (require 'bar)
Error: (require) cannot load extension: bar

This patch adjusts this behavior so that `##sys#include-pathnames` are
searched for files to load on require. I'm not sure if this is the
intended behavior, or if things are already as they should be and the
documentation is wrong, but it seems correct to me.

In any case, I believe this change only affects interpreted code since
AFAICS there's no way to add to the included pathnames in compiled code.

Evan
From 52c1b8bb0f0fd9ea79e49d2fd739c97f934b1e4b Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Sat, 25 May 2013 13:51:03 +1200
Subject: [PATCH] load files from CHICKEN_INCLUDE_PATH on require

---
 eval.scm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eval.scm b/eval.scm
index 62227cd..d59ac35 100644
--- a/eval.scm
+++ b/eval.scm
@@ -1196,7 +1196,7 @@
   (and err?
(##sys#error loc cannot load core library id
  (else
-  (let ([id2 (##sys#find-extension p #f)])
+  (let ([id2 (##sys#find-extension p #t)])
 (cond (id2
(##sys#load id2 #f #f)
(set! ##sys#loaded-extensions (cons p 
##sys#loaded-extensions)) 
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] remove redundant call to rm eggdir on uninstall

2013-05-26 Thread Evan Hanson
This trivial patch just gets rid of a duplicated line to remove the
$IEGGDIR when uninstalling.

Evan
From ee64c525b827326d5193e9e2e5242a289250b1f9 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@foldling.org
Date: Fri, 3 May 2013 16:28:27 +1200
Subject: [PATCH] remove redundant call to rm eggdir on uninstall

---
 rules.make |2 --
 1 file changed, 2 deletions(-)

diff --git a/rules.make b/rules.make
index f471a78..c0bbda1 100644
--- a/rules.make
+++ b/rules.make
@@ -435,8 +435,6 @@ uninstall:
$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS)\
$(DESTDIR)$(IBINDIR)$(SEP)$(prog)$(EXE) $(NL))
 
-   $(REMOVE_COMMAND) $(REMOVE_COMMAND_RECURSIVE_OPTIONS) 
$(DESTDIR)$(IEGGDIR)
-
$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) 
$(DESTDIR)$(ILIBDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(A)
$(REMOVE_COMMAND) $(REMOVE_COMMAND_OPTIONS) 
$(DESTDIR)$(ILIBDIR)$(SEP)lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)
 ifdef USES_SONAME
-- 
1.7.10.4

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


[Chicken-hackers] [PATCH] disallow compiling from both stdin named files

2012-10-11 Thread Evan Hanson
This patch addresses an issue I found while playing around with
228f8454d197b46b460a1b9ebfda7fa08d546c17, where an invocation of csc
combining named input files with stdin causes csc to try to compile
to -.c:

  $ csc - file2.scm  file1.scm  

  Error: invalid argument to `.c' option
  
  Error: shell command terminated with non-zero exit status 256: 
/home/efh/chickens/git/bin/chicken - -output-file -.c

It's unclear to me what the right thing to do in this case is, and
anything more involved would mean a more invasive patch, so this one
simply disallows combining the two. If there's a better approach, please
take it :)

Evan
From 76b0f3cc80805515eef8be044d3abe1f592ad66e Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@thunktastic.com
Date: Thu, 11 Oct 2012 22:34:21 -0500
Subject: [PATCH] disallow compiling from both stdin  named files

---
 csc.scm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/csc.scm b/csc.scm
index b067c4e..f25a4f0 100644
--- a/csc.scm
+++ b/csc.scm
@@ -550,6 +550,8 @@ EOF
(if shared
(pathname-replace-extension f0 
shared-library-extension)
(pathname-replace-extension f0 
executable-extension) ) ) ) ) ]
+[(and (member - scheme-files) ( (length scheme-files) 1))
+ (quit cannot compile from standard input with named files)]
 [else
  (when (and shared (not embedded))
(set! translate-options (cons -dynamic 
translate-options)) )
-- 
1.7.12.1

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


[Chicken-hackers] [PATCH] fix typo in _errno check in ##sys#custom-input-port

2012-03-22 Thread Evan Hanson
A single-character fix for `##sys#custom-input-port`, where it was
checking the value of `errno` (the procedure) rather than `_errno` (the
actual errno) after a `C_read`.

Evan
From 9522486398ac7ce89d65963ae3b1f31c5e1fe707 Mon Sep 17 00:00:00 2001
From: Evan Hanson ev...@thunktastic.com
Date: Thu, 22 Mar 2012 21:45:19 -0500
Subject: [PATCH] fix typo in _errno check in ##sys#custom-input-port

---
 posixunix.scm |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/posixunix.scm b/posixunix.scm
index 95039ca..76a0349 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -1309,7 +1309,7 @@ EOF
 (let loop ()
   (let ([cnt (##core#inline C_read fd buf bufsiz)])
 (cond ((fx= cnt -1)
-   (select errno
+   (select _errno
  ((_ewouldblock)
   (##sys#thread-block-for-i/o! 
##sys#current-thread fd #:input)
   (##sys#thread-yield!)
-- 
1.7.9.4

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


[Chicken-hackers] delete-directory types.db entry

2012-03-08 Thread Evan Hanson
`delete-directory` is missing its optional argument in types.db.

Evan

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


Re: [Chicken-hackers] Thrush operator

2012-02-14 Thread Evan Hanson
On 02/14/12 at 10:35pm, Jörg F. Wittenberger wrote:
 I rather loved to think instead of inserting the (*single*)
 value of the expression into the next expression of something
 along the lines of physical wires:

A classic, along those lines: http://dkeenan.com/Lambda/

Cheers,

Evan

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


<    3   4   5   6   7   8