"))
969 | (line port "
")
970 | (if (string=? side "left")
971 | (line port "")
972 | (line port ""))
973 | (line port text)
974 | (line port "
")
975 | (line port "
")))
976 |
977 |
978 | ;; progress bar :-)
979 | (define diff-progress
980 | (new-progress 10000))
981 |
982 | (define cleanup
983 | (lambda ()
984 | (set! *node-size-hash* (make-hasheq))
985 | (set! *diff-hash* (make-hasheq))))
986 |
987 |
988 | ;; main command
989 | (define diff
990 | (lambda (file1 file2 parse)
991 | (cleanup)
992 | (letv ([s1 (read-file file1)]
993 | [s2 (read-file file2)]
994 | [node1 (parse s1)]
995 | [node2 (parse s2)]
996 | [_ (diff-progress "\nDone parsing")]
997 | [(changes cost) (diff-node node1 node2 0 #f)]
998 | [_ (diff-progress "\nDone diffing")]
999 | [changes (closure changes)]
1000 | [_ (diff-progress "\nDone moving")]
1001 | [_ (set! *diff-hash* (make-hasheq))]
1002 | [ctags1 (change-tags changes 'left)]
1003 | [ctags2 (change-tags changes 'right)]
1004 | [tagged1 (apply-tags s1 ctags1)]
1005 | [tagged2 (apply-tags s2 ctags2)])
1006 | (let* ([frame-file (string-append (base-name file1) "-"
1007 | (base-name file2) ".html")]
1008 | [port (open-output-file frame-file
1009 | #:mode 'text
1010 | #:exists 'replace)])
1011 | (html-header port)
1012 | (write-html port tagged1 "left")
1013 | (write-html port tagged2 "right")
1014 | (html-footer port)
1015 | (close-output-port port)
1016 | (cleanup)))))
1017 |
1018 |
1019 | ; (current-directory "d:/prog/schdiff")
1020 | ; (diff "t2.ss" "diff.ss")
1021 |
1022 | ; (diff "search.ss" "diff.ss")
1023 | ; (diff "mk.scm" "mk-c.scm")
1024 |
1025 | ; (current-directory "d:/home/.emacs.d")
1026 | ; (diff "paredit20.el" "paredit22.el")
1027 |
1028 |
--------------------------------------------------------------------------------
/nav-div.js:
--------------------------------------------------------------------------------
1 | // yDiff - a language-aware tool for comparing programs
2 | // Copyright (C) 2011 Yin Wang (yinwang0@gmail.com)
3 |
4 |
5 | // This program is free software: you can redistribute it and/or modify
6 | // it under the terms of the GNU General Public License as published by
7 | // the Free Software Foundation, either version 3 of the License, or
8 | // (at your option) any later version.
9 |
10 | // This program is distributed in the hope that it will be useful,
11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | // GNU General Public License for more details.
14 |
15 | // You should have received a copy of the GNU General Public License
16 | // along with this program. If not, see