[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: notangle_guile.in
User: pbernaud
Date: 05/02/28 13:29:19
Modified: . notangle_guile.in
Log:
Updated notangle_guile after applying changes suggested by Thien-Thi Nguyen.
Revision Changes Path
1.3 +25 -26 eda/geda/devel/gschem/scripts/notangle_guile.in
(In the diff below, changes in quantity of whitespace are not shown.)
Index: notangle_guile.in
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/scripts/notangle_guile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- notangle_guile.in 24 Feb 2005 22:09:32 -0000 1.2
+++ notangle_guile.in 28 Feb 2005 18:29:19 -0000 1.3
@@ -31,21 +31,21 @@
(define (read-code-chunk)
(let loop ((line (read-line (current-input-port) 'concat)))
(if (not (eof-object? line))
- (let ((res (regexp-exec end-regexp line)))
;; code chunk ends at line that match end-regexp (^@\ ?)
- (if (regexp-match? res)
+ (if (regexp-exec end-regexp line)
;; reached end of chunk
'()
;; end not yet reached, continues the analyze
(append (list line)
- (loop (read-line (current-input-port) 'concat))))))))
+ (loop (read-line (current-input-port) 'concat)))))))
;; identifies code chunk and adds them to the association table
(let loop ((line ""))
(if (not (eof-object? line))
- (let ((m (regexp-exec def-regexp line)))
- (if (regexp-match? m)
- (add-code-chunk (match:substring m 1) (read-code-chunk)))
+ (begin
+ (and=> (regexp-exec def-regexp line)
+ (lambda (m)
+ (add-code-chunk (match:substring m 1) (read-code-chunk))))
(loop (read-line))))))
(define (tangle-step2)
@@ -65,17 +65,17 @@
(if (not first) (display offset) (set! first #f))
;; search for one (or more) chunk reference in the current line
(let loop ((l line))
- (let ((m (regexp-exec ref-regexp l)))
- (if (regexp-match? m)
+ (cond ((regexp-exec ref-regexp l)
;; found a reference in the line, process it
- (begin
+ => (lambda (m)
(display (match:prefix m))
(output-code-chunk (match:substring m 1)
(string-append offset
(make-string
(match:start m)
#\space)))
- (loop (match:suffix m)))
+ (loop (match:suffix m))))
+ (else
;; no reference found, output the full line
(display l)))))
code)
@@ -161,8 +161,7 @@
(if (string? noweb-filename)
;; work on a file
(with-input-from-file noweb-filename
- (lambda ()
- (tangle-noweb)))
+ tangle-noweb)
;; no file specified, work on current input port
(tangle-noweb)))