guile-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

api-diff


From: Thien-Thi Nguyen
Subject: api-diff
Date: Fri, 15 Feb 2002 14:14:10 -0800

#!/bin/sh
# -*- scheme -*-
exec guile -s $0 "$@"
!#
;;; api-diff --- diff guile-api.alist files

;; Copyright (C) 2002 Thien-Thi Nguyen
;; This program is part of ttn-do, released under GNU GPL v2 with ABSOLUTELY
;; NO WARRANTY.  See http://www.gnu.org/copyleft/gpl.txt for details.

(define (read-alist-file file)
  (with-input-from-file file
    (lambda () (read))))

(define A (read-alist-file (list-ref (command-line) 1)))
(define B (read-alist-file (list-ref (command-line) 2)))

(define A-scheme (assq-ref A 'scheme))
(define A-C      (assq-ref A 'C))

(define B-scheme (assq-ref B 'scheme))
(define B-C      (assq-ref B 'C))

(use-modules (ice-9 common-list))

(define (diff x y) (set-difference (map car x) (map car y)))

(define OLD-scheme (diff A-scheme B-scheme))
(define NEW-scheme (diff B-scheme A-scheme))

(define OLD-C      (diff A-C B-C))
(define NEW-C      (diff B-C A-C))

(use-modules (ttn echo))

(define (display-list head ls)
  (echo "::" head "--" (length ls))
  (for-each echo ls)
  (echo))

(display-list "OLD (deleted) scheme" OLD-scheme)
(display-list "NEW scheme"           NEW-scheme)
(display-list "OLD (deleted) C"      OLD-C)
(display-list "NEW C"                NEW-C)

;;; api-diff ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]