summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-07-11 11:14:37 +0000
committerpaltherr <paltherr@epfl.ch>2003-07-11 11:14:37 +0000
commitf01c39c755a7dd43d795e22378198d5b93e0f27f (patch)
tree20b6d0004a617f47952d33d6622d22bfa994efe5 /bin
parent0ef074e5fb929c784f901163b8c4c464572a5314 (diff)
downloadscala-f01c39c755a7dd43d795e22378198d5b93e0f27f.tar.gz
scala-f01c39c755a7dd43d795e22378198d5b93e0f27f.tar.bz2
scala-f01c39c755a7dd43d795e22378198d5b93e0f27f.zip
- Removed expand-template and expand-template.scm
Diffstat (limited to 'bin')
-rwxr-xr-xbin/expand-template16
-rwxr-xr-xbin/expand-template.scm50
2 files changed, 0 insertions, 66 deletions
diff --git a/bin/expand-template b/bin/expand-template
deleted file mode 100755
index 177f73fd61..0000000000
--- a/bin/expand-template
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-# $Id$
-
-SOURCE="$0";
-while [ -h "$SOURCE" ]; do
- LOOKUP="`ls -ld "$SOURCE"`";
- TARGET="`expr "$LOOKUP" : '.*-> \(.*\)$'`";
- if expr "${TARGET:-.}/" : '/.*/$' > /dev/null; then
- SOURCE="${TARGET:-.}";
- else
- SOURCE="`dirname "$SOURCE"`/${TARGET:-.}";
- fi;
-done;
-
-scsh -e main -s "$SOURCE.scm" "$@"
diff --git a/bin/expand-template.scm b/bin/expand-template.scm
deleted file mode 100755
index 96147abf85..0000000000
--- a/bin/expand-template.scm
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/home/linuxsoft/bin/scsh \
--e main -s
-!#
-
-;; $Id$
-
-(define expand
- (let ((variable-rx (rx "[#" (submatch (+ (| alphanum ("-")))) "#]")))
- (lambda (env in-port out-port)
- (awk (read-line in-port 'concat) (line) ()
- (#t (regexp-substitute/global out-port
- variable-rx
- line
- 'pre
- (lambda (match)
- (let* ((var (string->symbol
- (match:substring match 1)))
- (expansion (assoc var env)))
- (if expansion
- (cdr expansion)
- (error "Unknown variable in template"
- var))))
- 'post))))))
-
-(define (display-usage-and-exit prog)
- (format #t "Usage: ~a <rule-file> <template-file> <target-file>~%" prog)
- (format #t "where <rule-file> is a Scheme file containing expansion rules,~%")
- (format #t " <template-file> is the template file, and~%")
- (format #t " <target-file> is the file to generate.~%")
- (exit 1))
-
-(define initial-environment
- '((do-not-edit . "DO NOT EDIT. Automatically generated file!")))
-
-(define (main cmd-line)
- (let ((prog (car cmd-line))
- (args (cdr cmd-line)))
- (if (= (length args) 3)
- (let ((rule (first args))
- (tmpl (second args))
- (file (third args)))
- (load rule)
- (call-with-input-file tmpl
- (lambda (in-port)
- (call-with-output-file file
- (lambda (out-port)
- (expand (append initial-environment (make-env file))
- in-port
- out-port))))))
- (display-usage-and-exit prog))))