Use _SOURCES and nodist_ _SOURCES rather than a _LIBADD.
Consider re-compiling Scheme code if -const.bin changes.
Punt trying to override etag's commandline. Use the tags rule to
append .cdecls and use tags-fix.sh to re-order the files.
Use EXEEXT. Provide mostlyclean-local. Use standard copyright
notice. Remove trailing whitespace.
## 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
-##
+##
## This file is part of MIT/GNU Scheme.
-##
+##
## MIT/GNU Scheme is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## your option) any later version.
-##
+##
## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with MIT/GNU Scheme; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@
AM_CFLAGS = @MIT_CFLAGS@
-blowfish_shim_la_LIBADD = blowfish-adapter.lo
blowfish_shim_la_LDFLAGS = -module -avoid-version -shared
+blowfish_shim_la_SOURCES = blowfish-adapter.c blowfish-shim.h
+nodist_blowfish_shim_la_SOURCES = blowfish-shim.c
-noinst_PROGRAMS = blowfish-const
-blowfish_const_SOURCES = blowfish-const.c blowfish-shim.h
+noinst_PROGRAMS = blowfish-const$(EXEEXT)
+blowfish_const_SOURCES = blowfish-shim.h
+nodist_blowfish_const_SOURCES = blowfish-const.c
blowfish-shim.c: stamp-shim
blowfish-const.c: stamp-shim
blowfish-const.bin: blowfish-const.scm
echo '(sf "blowfish-const")' | $(MIT_SCHEME_EXE) --batch-mode
-blowfish-const.scm: blowfish-const
+blowfish-const.scm: blowfish-const$(EXEEXT)
./blowfish-const
@MIT_SCHEME_DEPS@
-stamp-scheme: stamp-shim $(sources) blowfish.pkg
+stamp-scheme: stamp-shim $(sources) blowfish-const.bin blowfish.pkg
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
+MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) blowfish-const$(EXEEXT)
+
+mostlyclean-local:
+ -rm -rf .libs
+
CLEANFILES = blowfish-const* blowfish-shim.c
CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
CLEANFILES += stamp-shim stamp-scheme
CLEANFILES += test
tags: tags-am
- ./tags-fix.sh blowfish
-
-all_sources = $(sources) blowfish-adapter.c
-ETAGS_ARGS = $(all_sources) -r '/^([^iI].*/' $(cdecls)
-TAGS_DEPENDENCIES = $(all_sources) $(cdecls)
+ $(ETAGS) -a $(sources) -r '/^([^iI].*/' $(cdecls)
+ ./tags-fix.sh
-EXTRA_DIST += $(all_sources) $(cdecls) compile.sh compile.scm blowfish.pkg
+EXTRA_DIST += $(sources) $(cdecls) compile.sh compile.scm blowfish.pkg
EXTRA_DIST += blowfish-test.scm blowfish-check.scm blowfish-check.sh
EXTRA_DIST += make.scm optiondb.scm tags-fix.sh debian
#!/bin/sh
# -*-Scheme-*-
#
-# Chop the generated $1-shim.c and $1-const.c files out of TAGS.
+# Changes to TAGS:
+# + Punt any generated *-shim.c and *-const.c files.
+# + Re-order the files: .scm first, .[hc] next, whatnot, and .cdecls last.
+# Someday:
+# + Index the .cdecls?
set -e
: ${MIT_SCHEME_EXE=mit-scheme}
${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF
-(let ((name (car (command-line-arguments))))
- (let ((shim.c-prefix (string-append name "-shim.c,"))
- (const.c-prefix (string-append name "-const.c,")))
-
- (define (rewriter in out)
- (let loop ((skipping? #f))
- (let ((line (read-line in)))
- (cond ((eof-object? line)
- unspecific)
- ((string=? line "\f")
- (let ((next (read-line in)))
- (cond ((eof-object? next) (error "Bogus TAGS format:" next))
- ((or (string-prefix? shim.c-prefix next)
- (string-prefix? const.c-prefix next))
- (loop #t))
- (else
- (write-string line out)
- (newline out)
- (write-string next out)
- (newline out)
- (loop #f)))))
- (skipping?
- (loop skipping?))
- (else
- (write-string line out)
- (newline out)
- (loop skipping?))))))
-
- (parameterize ((param:suppress-loading-message? #t))
- (load-option 'FFI))
- ((access rewrite-file (->environment '(ffi build)))
- (merge-pathnames "TAGS")
- rewriter)))
+(let ()
+
+ (define-integrable (make-section filename bytecount lines)
+ (cons (cons filename bytecount) lines))
+ (define-integrable section.filename caar)
+ (define-integrable section.bytecount cdar)
+ (define-integrable section.lines cdr)
+
+ (define headline-pattern
+ (compile-regsexp '(seq (line-start)
+ (group filename (+ (char-not-in #\,)))
+ #\,
+ (group bytecount (+ (char-in numeric)))
+ (line-end))))
+
+ (define (write-section section out)
+ (write-string "\f\n" out)
+ (write-string (string (section.filename section)
+ #\, (section.bytecount section)
+ "\n")
+ out)
+ (for-each (lambda (line) (write-string line out) (newline out))
+ (section.lines section)))
+
+ (define (write-sections sections out)
+ (for-each (lambda (section) (write-section section out))
+ (sort sections
+ (lambda (a b)
+ (string<? (section.filename a)
+ (section.filename b))))))
+
+ (define (read-section in)
+ (let loop ((lines '()))
+ (let ((line (read-line in)))
+ (if (or (eof-object? line)
+ (string=? line "\f"))
+ (reverse! lines)
+ (loop (cons line lines))))))
+
+ (define (rewriter in out)
+ (let ((line (read-line in)))
+ (cond ((eof-object? line)
+ (error "TAGS file is empty"))
+ ((not (string=? line "\f"))
+ (error "TAGS file does not start with a formfeed:" line))))
+ (let loop ((scms '()) (chs '()) (cdecls '()) (rest '()))
+ (let ((line (read-line in)))
+ (if (eof-object? line)
+ (begin
+ (write-sections scms out)
+ (write-sections chs out)
+ (write-sections rest out)
+ (write-sections cdecls out))
+ (let ((match (regsexp-match-string headline-pattern line)))
+ (if (not match)
+ (error "TAGS file contains a bogus headline:" line))
+ (let ((filename (cdr (assq 'filename (cddr match))))
+ (section (make-section (cdr (assq 'filename (cddr match)))
+ (cdr (assq 'bytecount (cddr match)))
+ (read-section in))))
+ (cond ((or (string-suffix? "-shim.c" filename)
+ (string-suffix? "-const.c" filename))
+ (loop scms chs cdecls rest))
+ ((string-suffix? ".scm" filename)
+ (loop (cons section scms) chs cdecls rest))
+ ((or (string-suffix? ".c" filename)
+ (string-suffix? ".h" filename))
+ (loop scms (cons section chs) cdecls rest))
+ ((string-suffix? ".cdecl" filename)
+ (loop scms chs (cons section cdecls) rest))
+ (else
+ (loop scms chs cdecls (cons section rest))))))))))
+
+ (parameterize ((param:suppress-loading-message? #t))
+ (load-option 'FFI))
+ ((access rewrite-file (->environment '(ffi build)))
+ (merge-pathnames "TAGS")
+ rewriter)))
EOF
## Technology
##
## This file is part of MIT/GNU Scheme.
-##
+##
## MIT/GNU Scheme is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## your option) any later version.
-##
+##
## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with MIT/GNU Scheme; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
scmdocdir = $(datarootdir)/doc/@MIT_SCHEME_PROJECT@
#scminfodir = $(scmdocdir)/info
-scmlib_sub_DATA = $(sources)
-scmlib_sub_DATA += $(binaries)
+scmlib_sub_DATA = $(sources) $(binaries)
scmlib_sub_DATA += loadef.scm edwin.bld
-scmlib_sub_DATA += make.scm edwin.pkg edwin-@MIT_SCHEME_OS_SUFFIX@.pkd
+scmlib_sub_DATA += make.scm edwin.pkg @MIT_SCHEME_PKD@
scmlib_sub_DATA += TUTORIAL
#scminfo_DATA = edwin.info
#info_TEXINFOS = edwin.texi
-#AM_MAKEINFOHTMLFLAGS = --no-split
+#AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=style.css
#AM_UPDATE_INFO_DIR = no
include $(srcdir)/source-dependencies.am
edwin.bld: stamp-scheme
-edwin-@MIT_SCHEME_OS_SUFFIX@.pkd: stamp-scheme
+@MIT_SCHEME_PKD@: stamp-scheme
stamp-scheme: $(sources) edwin.ldr edwin.pkg
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
CLEANFILES = *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd *.bld
CLEANFILES += stamp-scheme
-ETAGS_ARGS = $(sources) edwin.ldr
-TAGS_DEPENDENCIES = $(sources) edwin.ldr
+TAGS_FILES = $(sources) edwin.ldr
-EXTRA_DIST += $(sources) TUTORIAL
-EXTRA_DIST += sources.sh compile.sh decls.scm edwin.ldr
+EXTRA_DIST += $(sources) edwin.ldr TUTORIAL
+EXTRA_DIST += sources.scm sources.sh compile.sh decls.scm
EXTRA_DIST += edwin.sf edwin.cbf edwin.pkg debian
install-data-hook:
| ${MIT_SCHEME_TOOLCHAIN_EXE} --batch-mode`
fi
+MIT_SCHEME_PKD="edwin-${MIT_SCHEME_OS_SUFFIX}.pkd"
+
AC_SUBST([MIT_SCHEME_PROJECT])
AC_SUBST([MIT_SCHEME_TOOLCHAIN_EXE])
AC_SUBST([MIT_SCHEME_LIBDIR])
-AC_SUBST([MIT_SCHEME_OS_SUFFIX])
+AC_SUBST([MIT_SCHEME_PKD])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
## 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
-##
+##
## This file is part of MIT/GNU Scheme.
-##
+##
## MIT/GNU Scheme is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## your option) any later version.
-##
+##
## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with MIT/GNU Scheme; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@
AM_CFLAGS = @MIT_CFLAGS@
-gdbm_shim_la_LIBADD = gdbm-adapter.lo
gdbm_shim_la_LDFLAGS = -module -avoid-version -shared
+gdbm_shim_la_SOURCES = gdbm-adapter.c gdbm-shim.h
+nodist_gdbm_shim_la_SOURCES = gdbm-shim.c
-noinst_PROGRAMS = gdbm-const
-gdbm_const_SOURCES = gdbm-const.c gdbm-shim.h
+noinst_PROGRAMS = gdbm-const$(EXEEXT)
+gdbm_const_SOURCES = gdbm-shim.h
+nodist_gdbm_const_SOURCES = gdbm-const.c
gdbm-shim.c: stamp-shim
gdbm-const.c: stamp-shim
gdbm-const.bin: gdbm-const.scm
echo '(sf "gdbm-const")' | $(MIT_SCHEME_EXE) --batch-mode
-gdbm-const.scm: gdbm-const
+gdbm-const.scm: gdbm-const$(EXEEXT)
./gdbm-const
@MIT_SCHEME_DEPS@
-stamp-scheme: stamp-shim $(sources) gdbm.pkg
+stamp-scheme: stamp-shim $(sources) gdbm-const.bin gdbm.pkg
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
+MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) gdbm-const$(EXEEXT)
+
+mostlyclean-local:
+ -rm -rf .libs
+
CLEANFILES = gdbm-const* gdbm-shim.c
CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
CLEANFILES += stamp-shim stamp-scheme
CLEANFILES += gdbm-check.db
tags: tags-am
- ./tags-fix.sh gdbm
-
-all_sources = $(sources) gdbm-adapter.c
-ETAGS_ARGS = $(all_sources) -r '/^([^iI].*/' $(cdecls)
-TAGS_DEPENDENCIES = $(all_sources) $(cdecls)
+ $(ETAGS) -a $(sources) -r '/^([^iI].*/' $(cdecls)
+ ./tags-fix.sh
-EXTRA_DIST += $(all_sources) $(cdecls) compile.sh compile.scm gdbm.pkg
+EXTRA_DIST += $(sources) $(cdecls) compile.sh compile.scm gdbm.pkg
EXTRA_DIST += gdbm-check.scm gdbm-check.sh
EXTRA_DIST += make.scm optiondb.scm tags-fix.sh debian
#!/bin/sh
# -*-Scheme-*-
#
-# Chop the generated $1-shim.c and $1-const.c files out of TAGS.
+# Changes to TAGS:
+# + Punt any generated *-shim.c and *-const.c files.
+# + Re-order the files: .scm first, .[hc] next, whatnot, and .cdecls last.
+# Someday:
+# + Index the .cdecls?
set -e
: ${MIT_SCHEME_EXE=mit-scheme}
${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF
-(let ((name (car (command-line-arguments))))
- (let ((shim.c-prefix (string-append name "-shim.c,"))
- (const.c-prefix (string-append name "-const.c,")))
-
- (define (rewriter in out)
- (let loop ((skipping? #f))
- (let ((line (read-line in)))
- (cond ((eof-object? line)
- unspecific)
- ((string=? line "\f")
- (let ((next (read-line in)))
- (cond ((eof-object? next) (error "Bogus TAGS format:" next))
- ((or (string-prefix? shim.c-prefix next)
- (string-prefix? const.c-prefix next))
- (loop #t))
- (else
- (write-string line out)
- (newline out)
- (write-string next out)
- (newline out)
- (loop #f)))))
- (skipping?
- (loop skipping?))
- (else
- (write-string line out)
- (newline out)
- (loop skipping?))))))
-
- (parameterize ((param:suppress-loading-message? #t))
- (load-option 'FFI))
- ((access rewrite-file (->environment '(ffi build)))
- (merge-pathnames "TAGS")
- rewriter)))
+(let ()
+
+ (define-integrable (make-section filename bytecount lines)
+ (cons (cons filename bytecount) lines))
+ (define-integrable section.filename caar)
+ (define-integrable section.bytecount cdar)
+ (define-integrable section.lines cdr)
+
+ (define headline-pattern
+ (compile-regsexp '(seq (line-start)
+ (group filename (+ (char-not-in #\,)))
+ #\,
+ (group bytecount (+ (char-in numeric)))
+ (line-end))))
+
+ (define (write-section section out)
+ (write-string "\f\n" out)
+ (write-string (string (section.filename section)
+ #\, (section.bytecount section)
+ "\n")
+ out)
+ (for-each (lambda (line) (write-string line out) (newline out))
+ (section.lines section)))
+
+ (define (write-sections sections out)
+ (for-each (lambda (section) (write-section section out))
+ (sort sections
+ (lambda (a b)
+ (string<? (section.filename a)
+ (section.filename b))))))
+
+ (define (read-section in)
+ (let loop ((lines '()))
+ (let ((line (read-line in)))
+ (if (or (eof-object? line)
+ (string=? line "\f"))
+ (reverse! lines)
+ (loop (cons line lines))))))
+
+ (define (rewriter in out)
+ (let ((line (read-line in)))
+ (cond ((eof-object? line)
+ (error "TAGS file is empty"))
+ ((not (string=? line "\f"))
+ (error "TAGS file does not start with a formfeed:" line))))
+ (let loop ((scms '()) (chs '()) (cdecls '()) (rest '()))
+ (let ((line (read-line in)))
+ (if (eof-object? line)
+ (begin
+ (write-sections scms out)
+ (write-sections chs out)
+ (write-sections rest out)
+ (write-sections cdecls out))
+ (let ((match (regsexp-match-string headline-pattern line)))
+ (if (not match)
+ (error "TAGS file contains a bogus headline:" line))
+ (let ((filename (cdr (assq 'filename (cddr match))))
+ (section (make-section (cdr (assq 'filename (cddr match)))
+ (cdr (assq 'bytecount (cddr match)))
+ (read-section in))))
+ (cond ((or (string-suffix? "-shim.c" filename)
+ (string-suffix? "-const.c" filename))
+ (loop scms chs cdecls rest))
+ ((string-suffix? ".scm" filename)
+ (loop (cons section scms) chs cdecls rest))
+ ((or (string-suffix? ".c" filename)
+ (string-suffix? ".h" filename))
+ (loop scms (cons section chs) cdecls rest))
+ ((string-suffix? ".cdecl" filename)
+ (loop scms chs (cons section cdecls) rest))
+ (else
+ (loop scms chs cdecls (cons section rest))))))))))
+
+ (parameterize ((param:suppress-loading-message? #t))
+ (load-option 'FFI))
+ ((access rewrite-file (->environment '(ffi build)))
+ (merge-pathnames "TAGS")
+ rewriter)))
EOF
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
##
-## This file is part of the IMail option for MIT/GNU Scheme.
+## This file is part of MIT/GNU Scheme.
##
-## IMail is free software; you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
+## MIT/GNU Scheme is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
##
-## IMail is distributed in the hope that it will be useful, but
+## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with IMail; if not, write to the Free Software Foundation,
-## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+## along with MIT/GNU Scheme; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+## USA.
EXTRA_DIST = autogen.sh
binaries += imap-response.bci imap-response.com
binaries += imap-syntax.bci imap-syntax.com
-scmlib_sub_DATA = $(sources)
-scmlib_sub_DATA += $(binaries)
-scmlib_sub_DATA += make.scm imail.pkg imail-@MIT_SCHEME_OS_SUFFIX@.pkd
+scmlib_sub_DATA = $(sources) $(binaries)
+scmlib_sub_DATA += make.scm imail.pkg @MIT_SCHEME_PKD@
scminfo_DATA = imail.info
info_TEXINFOS = imail.texi
#TESTS = imail-check.sh
-ETAGS_ARGS = $(sources)
-TAGS_DEPENDENCIES = $(sources)
+TAGS_FILES = $(sources)
-EXTRA_DIST += $(sources) compile.sh make.scm compile.scm imail.pkg debian
+EXTRA_DIST += $(sources) compile.sh compile.scm imail.pkg
+EXTRA_DIST += make.scm debian
install-data-hook:
( echo '(add-plugin "imail" "@MIT_SCHEME_PROJECT@"'; \
| ${MIT_SCHEME_TOOLCHAIN_EXE} --batch-mode`
fi
+MIT_SCHEME_PKD="imail-${MIT_SCHEME_OS_SUFFIX}.pkd"
+
AC_SUBST([MIT_SCHEME_PROJECT])
AC_SUBST([MIT_SCHEME_TOOLCHAIN_EXE])
AC_SUBST([MIT_SCHEME_LIBDIR])
-AC_SUBST([MIT_SCHEME_OS_SUFFIX])
+AC_SUBST([MIT_SCHEME_PKD])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
## 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
-##
+##
## This file is part of MIT/GNU Scheme.
-##
+##
## MIT/GNU Scheme is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## your option) any later version.
-##
+##
## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with MIT/GNU Scheme; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
scmlib_sub_DATA += make.scm mcrypt.pkg @MIT_SCHEME_PKD@
#scminfo_DATA = mcrypt.info
-#AM_MAKEINFOHTMLFLAGS = --no-split
+#info_TEXINFOS = mcrypt.texi
+#AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=style.css
+#AM_UPDATE_INFO_DIR = no
AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@
AM_CFLAGS = @MIT_CFLAGS@
-mcrypt_shim_la_LIBADD = mcrypt-adapter.lo
mcrypt_shim_la_LDFLAGS = -module -avoid-version -shared
+mcrypt_shim_la_SOURCES = mcrypt-adapter.c mcrypt-shim.h
+nodist_mcrypt_shim_la_SOURCES = mcrypt-shim.c
-noinst_PROGRAMS = mcrypt-const
-mcrypt_const_SOURCES = mcrypt-const.c mcrypt-shim.h
+noinst_PROGRAMS = mcrypt-const$(EXEEXT)
+mcrypt_const_SOURCES = mcrypt-shim.h
+nodist_mcrypt_const_SOURCES = mcrypt-const.c
mcrypt-shim.c: stamp-shim
mcrypt-const.c: stamp-shim
mcrypt-const.bin: mcrypt-const.scm
echo '(sf "mcrypt-const")' | $(MIT_SCHEME_EXE) --batch-mode
-mcrypt-const.scm: mcrypt-const
+mcrypt-const.scm: mcrypt-const$(EXEEXT)
./mcrypt-const
@MIT_SCHEME_DEPS@
-stamp-scheme: stamp-shim $(sources) mcrypt.pkg
+stamp-scheme: stamp-shim $(sources) mcrypt-const.bin mcrypt.pkg
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
+MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) mcrypt-const$(EXEEXT)
+
+mostlyclean-local:
+ -rm -rf .libs
+
CLEANFILES = mcrypt-const* mcrypt-shim.c
CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
CLEANFILES += stamp-shim stamp-scheme
CLEANFILES += encrypted decrypted
tags: tags-am
- ./tags-fix.sh mcrypt
-
-all_sources = $(sources) mcrypt-adapter.c
-ETAGS_ARGS = $(all_sources) -r '/^([^iI].*/' $(cdecls)
-TAGS_DEPENDENCIES = $(all_sources) $(cdecls)
+ $(ETAGS) -a $(sources) -r '/^([^iI].*/' $(cdecls)
+ ./tags-fix.sh
-EXTRA_DIST += $(all_sources) $(cdecls) compile.sh compile.scm mcrypt.pkg
+EXTRA_DIST += $(sources) $(cdecls) compile.sh compile.scm mcrypt.pkg
EXTRA_DIST += mcrypt-check.scm mcrypt-check.sh
EXTRA_DIST += make.scm optiondb.scm tags-fix.sh debian
#!/bin/sh
# -*-Scheme-*-
#
-# Chop the generated $1-shim.c and $1-const.c files out of TAGS.
+# Changes to TAGS:
+# + Punt any generated *-shim.c and *-const.c files.
+# + Re-order the files: .scm first, .[hc] next, whatnot, and .cdecls last.
+# Someday:
+# + Index the .cdecls?
set -e
: ${MIT_SCHEME_EXE=mit-scheme}
${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF
-(let ((name (car (command-line-arguments))))
- (let ((shim.c-prefix (string-append name "-shim.c,"))
- (const.c-prefix (string-append name "-const.c,")))
-
- (define (rewriter in out)
- (let loop ((skipping? #f))
- (let ((line (read-line in)))
- (cond ((eof-object? line)
- unspecific)
- ((string=? line "\f")
- (let ((next (read-line in)))
- (cond ((eof-object? next) (error "Bogus TAGS format:" next))
- ((or (string-prefix? shim.c-prefix next)
- (string-prefix? const.c-prefix next))
- (loop #t))
- (else
- (write-string line out)
- (newline out)
- (write-string next out)
- (newline out)
- (loop #f)))))
- (skipping?
- (loop skipping?))
- (else
- (write-string line out)
- (newline out)
- (loop skipping?))))))
-
- (parameterize ((param:suppress-loading-message? #t))
- (load-option 'FFI))
- ((access rewrite-file (->environment '(ffi build)))
- (merge-pathnames "TAGS")
- rewriter)))
+(let ()
+
+ (define-integrable (make-section filename bytecount lines)
+ (cons (cons filename bytecount) lines))
+ (define-integrable section.filename caar)
+ (define-integrable section.bytecount cdar)
+ (define-integrable section.lines cdr)
+
+ (define headline-pattern
+ (compile-regsexp '(seq (line-start)
+ (group filename (+ (char-not-in #\,)))
+ #\,
+ (group bytecount (+ (char-in numeric)))
+ (line-end))))
+
+ (define (write-section section out)
+ (write-string "\f\n" out)
+ (write-string (string (section.filename section)
+ #\, (section.bytecount section)
+ "\n")
+ out)
+ (for-each (lambda (line) (write-string line out) (newline out))
+ (section.lines section)))
+
+ (define (write-sections sections out)
+ (for-each (lambda (section) (write-section section out))
+ (sort sections
+ (lambda (a b)
+ (string<? (section.filename a)
+ (section.filename b))))))
+
+ (define (read-section in)
+ (let loop ((lines '()))
+ (let ((line (read-line in)))
+ (if (or (eof-object? line)
+ (string=? line "\f"))
+ (reverse! lines)
+ (loop (cons line lines))))))
+
+ (define (rewriter in out)
+ (let ((line (read-line in)))
+ (cond ((eof-object? line)
+ (error "TAGS file is empty"))
+ ((not (string=? line "\f"))
+ (error "TAGS file does not start with a formfeed:" line))))
+ (let loop ((scms '()) (chs '()) (cdecls '()) (rest '()))
+ (let ((line (read-line in)))
+ (if (eof-object? line)
+ (begin
+ (write-sections scms out)
+ (write-sections chs out)
+ (write-sections rest out)
+ (write-sections cdecls out))
+ (let ((match (regsexp-match-string headline-pattern line)))
+ (if (not match)
+ (error "TAGS file contains a bogus headline:" line))
+ (let ((filename (cdr (assq 'filename (cddr match))))
+ (section (make-section (cdr (assq 'filename (cddr match)))
+ (cdr (assq 'bytecount (cddr match)))
+ (read-section in))))
+ (cond ((or (string-suffix? "-shim.c" filename)
+ (string-suffix? "-const.c" filename))
+ (loop scms chs cdecls rest))
+ ((string-suffix? ".scm" filename)
+ (loop (cons section scms) chs cdecls rest))
+ ((or (string-suffix? ".c" filename)
+ (string-suffix? ".h" filename))
+ (loop scms (cons section chs) cdecls rest))
+ ((string-suffix? ".cdecl" filename)
+ (loop scms chs (cons section cdecls) rest))
+ (else
+ (loop scms chs cdecls (cons section rest))))))))))
+
+ (parameterize ((param:suppress-loading-message? #t))
+ (load-option 'FFI))
+ ((access rewrite-file (->environment '(ffi build)))
+ (merge-pathnames "TAGS")
+ rewriter)))
EOF
## 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
-##
+##
## This file is part of MIT/GNU Scheme.
-##
+##
## MIT/GNU Scheme is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or (at
## your option) any later version.
-##
+##
## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
-##
+##
## You should have received a copy of the GNU General Public License
## along with MIT/GNU Scheme; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
scmlibdir = @MIT_SCHEME_LIBDIR@
scmlib_subdir = $(scmlibdir)pgsql
scmdocdir = $(datarootdir)/doc/@MIT_SCHEME_PROJECT@
+#scminfodir = $(scmdocdir)/info
scmlib_LTLIBRARIES = pgsql-shim.la
scmlib_DATA = pgsql-types.bin pgsql-const.bin
scmlib_sub_DATA = $(sources) $(binaries)
scmlib_sub_DATA += make.scm pgsql.pkg @MIT_SCHEME_PKD@
-#info_TEXINFOS = mit-scheme-pgsql.texi
-#AM_MAKEINFOHTMLFLAGS = --no-split
+#scminfo_DATA = pgsql.info
+#info_TEXINFOS = pgsql.texi
+#AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=style.css
+#AM_UPDATE_INFO_DIR = no
AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@
AM_CFLAGS = @MIT_CFLAGS@ `pkg-config --cflags libpq`
-LIBS = `pkg-config --libs libpq`
+AM_LIBS = `pkg-config --libs libpq`
pgsql_shim_la_LDFLAGS = -module -avoid-version -shared
+pgsql_shim_la_SOURCES = pgsql-shim.h
+nodist_pgsql_shim_la_SOURCES = pgsql-shim.c
-noinst_PROGRAMS = pgsql-const
-pgsql_const_SOURCES = pgsql-const.c pgsql-shim.h
+noinst_PROGRAMS = pgsql-const$(EXEEXT)
+pgsql_const_SOURCES = pgsql-shim.h
+nodist_pgsql_const_SOURCES = pgsql-const.c
pgsql-shim.c: stamp-shim
pgsql-const.c: stamp-shim
pgsql-const.bin: pgsql-const.scm
echo '(sf "pgsql-const")' | $(MIT_SCHEME_EXE) --batch-mode
-pgsql-const.scm: pgsql-const
+pgsql-const.scm: pgsql-const$(EXEEXT)
./pgsql-const
@MIT_SCHEME_DEPS@
-stamp-scheme: stamp-shim $(sources) pgsql.pkg
+stamp-scheme: stamp-shim $(sources) pgsql-const.bin pgsql.pkg
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
+MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) pgsql-const$(EXEEXT)
+
+mostlyclean-local:
+ -rm -rf .libs
+
CLEANFILES = pgsql-const* pgsql-shim.c
CLEANFILES += *.bin *.ext *.com *.bci *.moc *.fni *.crf *.fre *.pkd
CLEANFILES += stamp-shim stamp-scheme
CLEANFILES += pgsql-check.db
tags: tags-am
- ./tags-fix.sh pgsql
-
-all_sources = $(sources)
-ETAGS_ARGS = $(all_sources) -r '/^([^iI].*/' $(cdecls)
-TAGS_DEPENDENCIES = $(all_sources) $(cdecls)
+ $(ETAGS) -a $(sources) -r '/^([^iI].*/' $(cdecls)
+ ./tags-fix.sh
-EXTRA_DIST += $(all_sources) $(cdecls) compile.sh compile.scm pgsql.pkg
+EXTRA_DIST += $(sources) $(cdecls) compile.sh compile.scm pgsql.pkg
EXTRA_DIST += pgsql-check.scm pgsql-check.sh
EXTRA_DIST += make.scm optiondb.scm tags-fix.sh debian
#!/bin/sh
# -*-Scheme-*-
#
-# Chop the generated $1-shim.c and $1-const.c files out of TAGS.
+# Changes to TAGS:
+# + Punt any generated *-shim.c and *-const.c files.
+# + Re-order the files: .scm first, .[hc] next, whatnot, and .cdecls last.
+# Someday:
+# + Index the .cdecls?
set -e
: ${MIT_SCHEME_EXE=mit-scheme}
${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF
-(let ((name (car (command-line-arguments))))
- (let ((shim.c-prefix (string-append name "-shim.c,"))
- (const.c-prefix (string-append name "-const.c,")))
-
- (define (rewriter in out)
- (let loop ((skipping? #f))
- (let ((line (read-line in)))
- (cond ((eof-object? line)
- unspecific)
- ((string=? line "\f")
- (let ((next (read-line in)))
- (cond ((eof-object? next) (error "Bogus TAGS format:" next))
- ((or (string-prefix? shim.c-prefix next)
- (string-prefix? const.c-prefix next))
- (loop #t))
- (else
- (write-string line out)
- (newline out)
- (write-string next out)
- (newline out)
- (loop #f)))))
- (skipping?
- (loop skipping?))
- (else
- (write-string line out)
- (newline out)
- (loop skipping?))))))
-
- (parameterize ((param:suppress-loading-message? #t))
- (load-option 'FFI))
- ((access rewrite-file (->environment '(ffi build)))
- (merge-pathnames "TAGS")
- rewriter)))
+(let ()
+
+ (define-integrable (make-section filename bytecount lines)
+ (cons (cons filename bytecount) lines))
+ (define-integrable section.filename caar)
+ (define-integrable section.bytecount cdar)
+ (define-integrable section.lines cdr)
+
+ (define headline-pattern
+ (compile-regsexp '(seq (line-start)
+ (group filename (+ (char-not-in #\,)))
+ #\,
+ (group bytecount (+ (char-in numeric)))
+ (line-end))))
+
+ (define (write-section section out)
+ (write-string "\f\n" out)
+ (write-string (string (section.filename section)
+ #\, (section.bytecount section)
+ "\n")
+ out)
+ (for-each (lambda (line) (write-string line out) (newline out))
+ (section.lines section)))
+
+ (define (write-sections sections out)
+ (for-each (lambda (section) (write-section section out))
+ (sort sections
+ (lambda (a b)
+ (string<? (section.filename a)
+ (section.filename b))))))
+
+ (define (read-section in)
+ (let loop ((lines '()))
+ (let ((line (read-line in)))
+ (if (or (eof-object? line)
+ (string=? line "\f"))
+ (reverse! lines)
+ (loop (cons line lines))))))
+
+ (define (rewriter in out)
+ (let ((line (read-line in)))
+ (cond ((eof-object? line)
+ (error "TAGS file is empty"))
+ ((not (string=? line "\f"))
+ (error "TAGS file does not start with a formfeed:" line))))
+ (let loop ((scms '()) (chs '()) (cdecls '()) (rest '()))
+ (let ((line (read-line in)))
+ (if (eof-object? line)
+ (begin
+ (write-sections scms out)
+ (write-sections chs out)
+ (write-sections rest out)
+ (write-sections cdecls out))
+ (let ((match (regsexp-match-string headline-pattern line)))
+ (if (not match)
+ (error "TAGS file contains a bogus headline:" line))
+ (let ((filename (cdr (assq 'filename (cddr match))))
+ (section (make-section (cdr (assq 'filename (cddr match)))
+ (cdr (assq 'bytecount (cddr match)))
+ (read-section in))))
+ (cond ((or (string-suffix? "-shim.c" filename)
+ (string-suffix? "-const.c" filename))
+ (loop scms chs cdecls rest))
+ ((string-suffix? ".scm" filename)
+ (loop (cons section scms) chs cdecls rest))
+ ((or (string-suffix? ".c" filename)
+ (string-suffix? ".h" filename))
+ (loop scms (cons section chs) cdecls rest))
+ ((string-suffix? ".cdecl" filename)
+ (loop scms chs (cons section cdecls) rest))
+ (else
+ (loop scms chs cdecls (cons section rest))))))))))
+
+ (parameterize ((param:suppress-loading-message? #t))
+ (load-option 'FFI))
+ ((access rewrite-file (->environment '(ffi build)))
+ (merge-pathnames "TAGS")
+ rewriter)))
EOF
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
##
-## This file is part of an X11-screen plugin for MIT/GNU Scheme.
+## This file is part of MIT/GNU Scheme.
##
-## This plugin is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published
-## by the Free Software Foundation; either version 2 of the License,
-## or (at your option) any later version.
+## MIT/GNU Scheme is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
##
-## This plugin is distributed in the hope that it will be useful, but
+## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with this plugin; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-## 02110-1301, USA.
+## along with MIT/GNU Scheme; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+## USA.
EXTRA_DIST = autogen.sh
scmlib_sub_DATA += make.scm x11-screen.pkg @MIT_SCHEME_PKD@
#scminfo_DATA = x11-screen.info
-#AM_MAKEINFOHTMLFLAGS = --no-split
+#info_TEXINFOS = x11-screen.texi
+#AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=style.css
+#AM_UPDATE_INFO_DIR = no
@MIT_SCHEME_DEPS@
stamp-scheme: $(sources) x11-screen.pkg
TESTS = x11-screen-check.sh
-ETAGS_ARGS = $(sources)
-TAGS_DEPENDENCIES = $(sources)
+TAGS_FILES = $(sources)
-EXTRA_DIST += $(sources) compile.sh x11-screen.pkg
-EXTRA_DIST += x11-screen-check.sh x11-screen-test.scm
-EXTRA_DIST += make.scm optiondb.scm compile.scm debian
+EXTRA_DIST += $(sources) compile.sh compile.scm x11-screen.pkg
+EXTRA_DIST += x11-screen-test.scm x11-screen-check.sh
+EXTRA_DIST += make.scm optiondb.scm debian
install-data-hook:
( echo '(add-plugin "x11-screen" "@MIT_SCHEME_PROJECT@"'; \
## 2015, 2016, 2017, 2018, 2019 Massachusetts Institute of
## Technology
##
-## This file is part of an x11 plugin for MIT/GNU Scheme.
+## This file is part of MIT/GNU Scheme.
##
-## This plugin is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published
-## by the Free Software Foundation; either version 2 of the License,
-## or (at your option) any later version.
+## MIT/GNU Scheme is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or (at
+## your option) any later version.
##
-## This plugin is distributed in the hope that it will be useful, but
+## MIT/GNU Scheme is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
-## along with this plugin; if not, write to the Free Software
-## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-## 02110-1301, USA.
+## along with MIT/GNU Scheme; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301,
+## USA.
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = autogen.sh
scmlib_sub_DATA += make.scm x11.pkg @MIT_SCHEME_PKD@
#scminfo_DATA = x11.info
-#AM_MAKEINFOHTMLFLAGS = --no-split
+#info_TEXINFOS = x11.texi
+#AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=style.css
+#AM_UPDATE_INFO_DIR = no
AM_CPPFLAGS = -I@MIT_SCHEME_INCLUDEDIR@
AM_CFLAGS = @MIT_CFLAGS@
x11_shim_la_LIBADD = @MIT_LIBS@
-c_sources = x11base.c x11color.c x11graph.c x11term.c x11-shim.h x11.h
-x11_shim_la_SOURCES = $(c_sources) x11-shim.c
x11_shim_la_LDFLAGS = -module -avoid-version -shared
+x11_shim_la_SOURCES = x11base.c x11color.c x11graph.c x11term.c x11-shim.h x11.h
+nodist_x11_shim_la_SOURCES = x11-shim.c
-noinst_PROGRAMS = x11-const
-x11_const_SOURCES = x11-const.c x11-shim.h x11.h
+noinst_PROGRAMS = x11-const$(EXEEXT)
+x11_const_SOURCES = x11-shim.h x11.h
+nodist_x11_const_SOURCES = x11-const.c
x11-shim.c: stamp-shim
x11-const.c: stamp-shim
x11-types.bin: stamp-shim
-stamp-shim: $(c_sources) $(cdecls)
+stamp-shim: x11-shim.h x11.h $(cdecls)
echo '(generate-shim "x11" "#include \"x11-shim.h\"")' \
| $(MIT_SCHEME_EXE) --batch-mode
echo "done" > $@
MIT_SCHEME_EXE=$(MIT_SCHEME_EXE) ./compile.sh
echo "done" > $@
-MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) x11-const
+MOSTLYCLEANFILES = $(scmlib_LTLIBRARIES) x11-const$(EXEEXT)
mostlyclean-local:
-rm -rf .libs
TESTS = x11-check.sh
tags: tags-am
- ./tags-fix.sh x11
-
-ETAGS_ARGS = $(sources) $(c_sources) -r '/^([^iI].*/' $(cdecls)
-TAGS_DEPENDENCIES = $(sources) $(c_sources) $(cdecls)
+ $(ETAGS) -a $(sources) -r '/^([^iI].*/' $(cdecls)
+ ./tags-fix.sh
EXTRA_DIST += $(sources) $(cdecls) compile.sh compile.scm x11.pkg
-EXTRA_DIST += x11-check.sh x11-test.scm
+EXTRA_DIST += x11-test.scm x11-check.sh
EXTRA_DIST += make.scm optiondb.scm tags-fix.sh debian
install-data-hook:
#!/bin/sh
# -*-Scheme-*-
#
-# Chop the generated $1-shim.c and $1-const.c files out of TAGS.
+# Changes to TAGS:
+# + Punt any generated *-shim.c and *-const.c files.
+# + Re-order the files: .scm first, .[hc] next, whatnot, and .cdecls last.
+# Someday:
+# + Index the .cdecls?
set -e
: ${MIT_SCHEME_EXE=mit-scheme}
${MIT_SCHEME_EXE} --batch-mode -- ${1+"$@"} <<\EOF
-(let ((name (car (command-line-arguments))))
- (let ((shim.c-prefix (string-append name "-shim.c,"))
- (const.c-prefix (string-append name "-const.c,")))
-
- (define (rewriter in out)
- (let loop ((skipping? #f))
- (let ((line (read-line in)))
- (cond ((eof-object? line)
- unspecific)
- ((string=? line "\f")
- (let ((next (read-line in)))
- (cond ((eof-object? next) (error "Bogus TAGS format:" next))
- ((or (string-prefix? shim.c-prefix next)
- (string-prefix? const.c-prefix next))
- (loop #t))
- (else
- (write-string line out)
- (newline out)
- (write-string next out)
- (newline out)
- (loop #f)))))
- (skipping?
- (loop skipping?))
- (else
- (write-string line out)
- (newline out)
- (loop skipping?))))))
-
- (parameterize ((param:suppress-loading-message? #t))
- (load-option 'FFI))
- ((access rewrite-file (->environment '(ffi build)))
- (merge-pathnames "TAGS")
- rewriter)))
+(let ()
+
+ (define-integrable (make-section filename bytecount lines)
+ (cons (cons filename bytecount) lines))
+ (define-integrable section.filename caar)
+ (define-integrable section.bytecount cdar)
+ (define-integrable section.lines cdr)
+
+ (define headline-pattern
+ (compile-regsexp '(seq (line-start)
+ (group filename (+ (char-not-in #\,)))
+ #\,
+ (group bytecount (+ (char-in numeric)))
+ (line-end))))
+
+ (define (write-section section out)
+ (write-string "\f\n" out)
+ (write-string (string (section.filename section)
+ #\, (section.bytecount section)
+ "\n")
+ out)
+ (for-each (lambda (line) (write-string line out) (newline out))
+ (section.lines section)))
+
+ (define (write-sections sections out)
+ (for-each (lambda (section) (write-section section out))
+ (sort sections
+ (lambda (a b)
+ (string<? (section.filename a)
+ (section.filename b))))))
+
+ (define (read-section in)
+ (let loop ((lines '()))
+ (let ((line (read-line in)))
+ (if (or (eof-object? line)
+ (string=? line "\f"))
+ (reverse! lines)
+ (loop (cons line lines))))))
+
+ (define (rewriter in out)
+ (let ((line (read-line in)))
+ (cond ((eof-object? line)
+ (error "TAGS file is empty"))
+ ((not (string=? line "\f"))
+ (error "TAGS file does not start with a formfeed:" line))))
+ (let loop ((scms '()) (chs '()) (cdecls '()) (rest '()))
+ (let ((line (read-line in)))
+ (if (eof-object? line)
+ (begin
+ (write-sections scms out)
+ (write-sections chs out)
+ (write-sections rest out)
+ (write-sections cdecls out))
+ (let ((match (regsexp-match-string headline-pattern line)))
+ (if (not match)
+ (error "TAGS file contains a bogus headline:" line))
+ (let ((filename (cdr (assq 'filename (cddr match))))
+ (section (make-section (cdr (assq 'filename (cddr match)))
+ (cdr (assq 'bytecount (cddr match)))
+ (read-section in))))
+ (cond ((or (string-suffix? "-shim.c" filename)
+ (string-suffix? "-const.c" filename))
+ (loop scms chs cdecls rest))
+ ((string-suffix? ".scm" filename)
+ (loop (cons section scms) chs cdecls rest))
+ ((or (string-suffix? ".c" filename)
+ (string-suffix? ".h" filename))
+ (loop scms (cons section chs) cdecls rest))
+ ((string-suffix? ".cdecl" filename)
+ (loop scms chs (cons section cdecls) rest))
+ (else
+ (loop scms chs cdecls (cons section rest))))))))))
+
+ (parameterize ((param:suppress-loading-message? #t))
+ (load-option 'FFI))
+ ((access rewrite-file (->environment '(ffi build)))
+ (merge-pathnames "TAGS")
+ rewriter)))
EOF