/usr/share/gauche-0.9/0.9.1/lib/text/diff.scm is in gauche 0.9.1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ;;;; diff.scm -- LCS for Scheme
;;; Created: <2002-06-21 15:36:46 foof>
;;; Time-stamp: <2003-02-15 00:09:55 foof>
;;; Author: Alex Shinn <foof@synthcode.com>
(define-module text.diff
(use util.lcs)
(export diff diff-report)
)
(select-module text.diff)
;; aux. fun to convert arg to a list
(define (source->list src reader)
(port->list reader
(cond ((port? src) src)
((string? src) (open-input-string src))
(else (error "don't know how to diff from:" src)))))
;; lcs on text. Returns edit-list (as defined in lcs-edit-list).
(define (diff a b :key (reader read-line) (equal equal?))
(lcs-edit-list (source->list a reader)
(source->list b reader)))
(define (write-line-diff line type)
(case type
((+)
(format #t "+ ~A\n" line))
((-)
(format #t "- ~A\n" line))
(else
(format #t " ~A\n" line))))
(define (diff-report a b :key (writer write-line-diff) (reader read-line) (equal equal?))
(lcs-fold (lambda (line _) (writer line '-))
(lambda (line _) (writer line '+))
(lambda (line _) (writer line #f))
#f
(source->list a reader)
(source->list b reader)
equal))
|