|
13 | 13 | :init-stats)) |
14 | 14 | (in-package :diff-backend) |
15 | 15 |
|
| 16 | +(defvar *comment-table-1*) |
| 17 | +(defvar *comment-table-2*) |
16 | 18 |
|
17 | 19 | (defun main () |
18 | 20 | (let ((cmd-args (uiop:command-line-arguments))) |
19 | 21 | (print cmd-args) |
20 | | - (true-differ-v01 (first cmd-args) (second cmd-args)))) |
| 22 | + (differ-v01 (first cmd-args) (second cmd-args)))) |
21 | 23 |
|
22 | 24 |
|
23 | | -(defun true-differ-v01 (file1 file2) |
| 25 | +(defun differ-v01 (file1 file2) |
24 | 26 | (init-stats) |
25 | | - (multiple-value-bind (res1 res2) |
26 | | - (compare-two-files file1 file2) |
27 | | - (with-open-file (stream1 "res1.json" :direction :output |
28 | | - :if-exists :supersede) |
29 | | - (with-open-file (stream2 "res2.json" :direction :output |
30 | | - :if-exists :supersede) |
31 | | - (with-open-file (stream3 "stats.json" :direction :output |
32 | | - :if-exists :supersede) |
33 | | - (get-json-res res1 stream1) |
34 | | - (get-json-res res2 stream2) |
35 | | - (get-stats-res stream3)))))) |
| 27 | + (multiple-value-bind (res1 res2) |
| 28 | + (compare-two-files file1 file2) |
| 29 | + (generate-json-outputs res1 res2))) |
36 | 30 |
|
37 | | -(defun differ-v01 (str1 str2) |
| 31 | +(defun str-differ-v01 (str1 str2) |
38 | 32 | (init-stats) |
39 | | - (multiple-value-bind (res1 res2) |
40 | | - (compare-two-str str1 str2) |
41 | | - (with-open-file (stream1 "res1.json" :direction :output |
42 | | - :if-exists :supersede) |
43 | | - (with-open-file (stream2 "res2.json" :direction :output |
44 | | - :if-exists :supersede) |
45 | | - (with-open-file (stream3 "stats.json" :direction :output |
| 33 | + (multiple-value-bind (res1 res2) |
| 34 | + (compare-two-str str1 str2) |
| 35 | + (generate-json-outputs res1 res2))) |
| 36 | + |
| 37 | +(defun generate-json-outputs (res1 res2) |
| 38 | + (when *comment-table-1* |
| 39 | + (with-open-file (stream "comments1.json" :direction :output |
| 40 | + :if-exists :supersede) |
| 41 | + (get-json-comments *comment-table-1* stream))) |
| 42 | + (when *comment-table-2* |
| 43 | + (with-open-file (stream "comments2.json" :direction :output |
46 | 44 | :if-exists :supersede) |
47 | | - (get-json-res res1 stream1) |
48 | | - (get-json-res res2 stream2) |
49 | | - (get-stats-res stream3)))))) |
| 45 | + (get-json-comments *comment-table-2* stream))) |
| 46 | + (with-open-file (stream "res1.json" :direction :output |
| 47 | + :if-exists :supersede) |
| 48 | + (get-json-res res1 stream)) |
| 49 | + (with-open-file (stream "res2.json" :direction :output |
| 50 | + :if-exists :supersede) |
| 51 | + (get-json-res res2 stream)) |
| 52 | + (with-open-file (stream "stats.json" :direction :output |
| 53 | + :if-exists :supersede) |
| 54 | + (get-stats-res stream))) |
50 | 55 |
|
51 | 56 | (defun simple-differ-str (str1 str2 &optional (out1 t ) (out2 t) (out3 t)) |
52 | 57 | (init-stats) |
53 | 58 | (multiple-value-bind (res1 res2) |
54 | 59 | (compare-two-str str1 str2) |
| 60 | + (when *comment-table-1* |
| 61 | + (get-json-comments *comment-table-1* t)) |
| 62 | + (when *comment-table-2* |
| 63 | + (get-json-comments *comment-table-2* t)) |
55 | 64 | (get-json-res res1 out1) |
56 | 65 | (get-json-res res2 out2) |
57 | 66 | (get-stats-res out3))) |
|
0 commit comments