source: project/grovel @ 2430

Last change on this file since 2430 was 2430, checked in by felix winkelmann, 14 years ago

added scsh-regexp

  • Property svn:executable set to *
File size: 1.0 KB
Line 
1#!/bin/sh
2#| ;;; grovel -*- Hen -*-
3exec csi -s $0 "$@"
4|#
5
6
7(use utils regex-case posix)
8
9
10(define *ignored* '("comet" "chicken"()))
11(define *top* #f)
12
13(define (grovel f)
14  (cond ((directory? f)
15         (unless (member f *ignored*)
16           (unless *top*
17             (print #\newline (list (pathname-file f)) #\newline)
18             (fprintf (current-error-port) "~a ...~%" f) )
19           (parameterize ((current-directory f))
20             (fluid-let ((*top* (or *top* f)))
21               (match (glob "*.meta")
22                 ((meta)
23                  (let* ((meta (car (read-file meta)))
24                         (files (assq 'files meta)) )
25                    (for-each grovel (if (pair? files) (cdr files) (cdr (assq 'file meta))))))
26                 (_ (for-each grovel (glob "trunk"))) ) ) ) ) )
27        ((member (pathname-extension f) '("scm" "ss"))
28         (print ";; " (pathname-strip-directory f))
29         (with-input-from-file f
30           (lambda ()
31             (for-each-line
32              (lambda (line)
33                (regex-case line
34                  ("\\(define[ \t]+\\(*([^() \t]+).*" (_ name)
35                   (unless (char=? #\# (string-ref name 0))
36                     (print name) ) ) ) ) ) ) ) ) ) )
37
38(for-each grovel (command-line-arguments))
Note: See TracBrowser for help on using the repository browser.