This is the vivid-diff Reference Manual, version 2.1.4, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 07:04:30 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
vivid-diff
Colored object diff viewer.
SATO Shinichi
(GIT git@github.com:hyotang666/vivid-diff)
MIT
2.1.4
vivid-colors
(system).
cl-colors2
(system).
closer-mop
(system).
matrix-case
(system).
vivid-diff.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
vivid-diff/vivid-diff.lisp
vivid-diff
(system).
diff
(structure).
diff-comparable
(structure).
diff-comparable-origin
(reader).
(setf diff-comparable-origin)
(writer).
diff-object
(reader).
(setf diff-object)
(writer).
diff-print
(function).
markup
(function).
markup-nothing
(function).
mismatch-sexp
(generic function).
nothing
(structure).
print-object
(method).
*env*
(special variable).
copy-diff
(function).
copy-diff-comparable
(function).
copy-hash-table-diff
(function).
copy-nothing
(function).
copy-object-diff
(function).
copy-pathname-diff
(function).
copy-string-diff
(function).
diff-comparable-object
(function).
(setf diff-comparable-object)
(function).
diff-comparable-p
(function).
diff-p
(function).
hash-table-diff
(structure).
hash-table-diff-object
(function).
(setf hash-table-diff-object)
(function).
hash-table-diff-p
(function).
make-diff-comparable
(function).
markup-hash-table
(function).
markup-object
(function).
markup-pathname
(function).
markup-string
(function).
nothing-object
(function).
(setf nothing-object)
(function).
nothing-p
(function).
object-diff
(structure).
object-diff-object
(function).
(setf object-diff-object)
(function).
object-diff-origin
(function).
(setf object-diff-origin)
(function).
object-diff-p
(function).
pathname-diff
(structure).
pathname-diff-object
(function).
(setf pathname-diff-object)
(function).
pathname-diff-origin
(function).
(setf pathname-diff-origin)
(function).
pathname-diff-p
(function).
similar-vector-type-p
(function).
slots<=obj
(function).
string-diff
(structure).
string-diff-object
(function).
(setf string-diff-object)
(function).
string-diff-origin
(function).
(setf string-diff-origin)
(function).
string-diff-p
(function).
vprint-diff
(function).
vprint-hash-table-diff
(function).
vprint-nothing
(function).
vprint-object-diff
(function).
vprint-pathname-diff
(function).
vprint-string-diff
(function).
Packages are listed by definition order.
vivid-diff
common-lisp
.
diff
(structure).
diff-comparable
(structure).
diff-comparable-origin
(reader).
(setf diff-comparable-origin)
(writer).
diff-object
(reader).
(setf diff-object)
(writer).
diff-print
(function).
markup
(function).
markup-nothing
(function).
mismatch-sexp
(generic function).
nothing
(structure).
*env*
(special variable).
copy-diff
(function).
copy-diff-comparable
(function).
copy-hash-table-diff
(function).
copy-nothing
(function).
copy-object-diff
(function).
copy-pathname-diff
(function).
copy-string-diff
(function).
diff-comparable-object
(function).
(setf diff-comparable-object)
(function).
diff-comparable-p
(function).
diff-p
(function).
hash-table-diff
(structure).
hash-table-diff-object
(function).
(setf hash-table-diff-object)
(function).
hash-table-diff-p
(function).
make-diff-comparable
(function).
markup-hash-table
(function).
markup-object
(function).
markup-pathname
(function).
markup-string
(function).
nothing-object
(function).
(setf nothing-object)
(function).
nothing-p
(function).
object-diff
(structure).
object-diff-object
(function).
(setf object-diff-object)
(function).
object-diff-origin
(function).
(setf object-diff-origin)
(function).
object-diff-p
(function).
pathname-diff
(structure).
pathname-diff-object
(function).
(setf pathname-diff-object)
(function).
pathname-diff-origin
(function).
(setf pathname-diff-origin)
(function).
pathname-diff-p
(function).
similar-vector-type-p
(function).
slots<=obj
(function).
string-diff
(structure).
string-diff-object
(function).
(setf string-diff-object)
(function).
string-diff-origin
(function).
(setf string-diff-origin)
(function).
string-diff-p
(function).
vprint-diff
(function).
vprint-hash-table-diff
(function).
vprint-nothing
(function).
vprint-object-diff
(function).
vprint-pathname-diff
(function).
vprint-string-diff
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
# DIFF-COMPARABLE-ORIGIN
## Description:
### syntax (DIFF-COMPARABLE-ORIGIN sb-kernel:instance)
=> result
### setf
(SETF (DIFF-COMPARABLE-ORIGIN SB-KERNEL:INSTANCE) SB-KERNEL::VALUE)
=> new-value
## Arguments and Values:
instance := DIFF-COMPARABLE
result := T
## Affected By:
none
## Side-Effects:
none
## Notes:
## Exceptional-Situations:
# DIFF-OBJECT
## Description:
Accessor for DIFF.
### syntax (DIFF-OBJECT sb-kernel:instance)
=> result
### setf
(SETF (DIFF-OBJECT SB-KERNEL:INSTANCE) SB-KERNEL::VALUE)
=> new-value
## Arguments and Values:
instance := DIFF, otherwise implementation dependent condition.
“‘lisp
#?(diff-object "not diff object")
:signals condition
“‘
result := T
## Affected By:
none
## Side-Effects:
none
## Notes:
## Exceptional-Situations:
# MARKUP
## Description:
Markup OBJECT as DIFF.
### syntax (MARKUP object)
=> result
## Arguments and Values:
object := T
result := DIFF.
## Affected By:
none
## Side-Effects:
none
## Notes:
When *PRINT-READABLY* and *PRINT-ESCAPSE* is NIL and VIVID-COLORS:*PRINT-VIVID* is T,
and VIVID-COLORS:*VPRINT-DISPATCH* bound by :vivid-diff dispatch-table,
Colored notation is printed.
“‘lisp
#?(let ((vivid-colors:*print-vivid* t)
(vivid-colors:*vprint-dispatch* (vivid-colors:find-vprint-dispatch :vivid-diff)))
(write (markup 0) :readably nil :escape nil))
:outputs #.(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "0"))
“‘
## Exceptional-Situations:
# MISMATCH-SEXP
## Description:
If S-Expression is mismatch, DIFF object is returned,
otherwise actual is returned.
### syntax (MISMATCH-SEXP actual expected)
=> result
## Argument Precedence Order:
actual expected
## Method signature:
* MISMATCH-SEXP (ACTUAL HASH-TABLE) (EXPECTED HASH-TABLE))
* MISMATCH-SEXP (ACTUAL STANDARD-OBJECT) (EXPECTED STANDARD-OBJECT))
* MISMATCH-SEXP (ACTUAL STRUCTURE-OBJECT) (EXPECTED STRUCTURE-OBJECT))
* MISMATCH-SEXP (ACTUAL ARRAY) (EXPECTED ARRAY))
* MISMATCH-SEXP (ACTUAL VECTOR) (EXPECTED VECTOR))
* MISMATCH-SEXP (ACTUAL BIT-VECTOR) (EXPECTED BIT-VECTOR))
* MISMATCH-SEXP (ACTUAL NUMBER) (EXPECTED NUMBER))
* MISMATCH-SEXP (ACTUAL PATHNAME) (EXPECTED PATHNAME))
* MISMATCH-SEXP (ACTUAL STRING) (EXPECTED STRING))
* MISMATCH-SEXP (ACTUAL LIST) (EXPECTED LIST))
* MISMATCH-SEXP (ACTUAL SYMBOL) (EXPECTED SYMBOL))
* MISMATCH-SEXP :AROUND (ACTUAL T) (EXPECTED T))
* MISMATCH-SEXP (ACTUAL T) (EXPECTED T))
## Arguments and Values:
actual := T
expected := T
result := (or T DIFF)
## Affected By:
none
## Side-Effects:
none
## Notes:
As the name explains, MISMATCH-SEXP is for S-Expression.
i.e. macro expansion form especially uninterned symbol.
“‘lisp
#?(mismatch-sexp ’#:a ’#:b)
:satisfies (lambda (x)
(& (symbolp x)
(null (symbol-package x))
(equal "A" (symbol-name x))))
“‘
“‘lisp
#?(let ((expanded-form1 (macroexpand-1 #0=’(case 0)))
(expanded-form2 (macroexpand-1 #0#)))
(values (tree-equal expanded-form1 expanded-form2)
(tree-equal expanded-form1 (mismatch-sexp expanded-form1 expanded-form2))))
:values (nil t)
“‘
## Exceptional-Situations:
#### Numbers
“‘lisp
#?(mismatch-sexp 0 0)
=> 0
“‘
“‘lisp
#?(mismatch-sexp 0 1)
:be-the diff
“‘
“‘lisp
#?(diff-print (mismatch-sexp 0 1))
:outputs #.(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "0"))
“‘
#### Characters
“‘lisp
#?(mismatch-sexp #\a #\b)
:be-the diff
“‘
“‘lisp
#?(diff-print (mismatch-sexp #\a #\b))
:outputs #.(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red (prin1-to-string #\a)))
“‘
#### Symbols
“‘lisp
#?(mismatch-sexp t t)
=> T
“‘
“‘lisp
#?(mismatch-sexp t nil)
:be-the diff
“‘
“‘lisp
#?(diff-print (mismatch-sexp t nil))
:outputs #.(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "T"))
“‘
“‘lisp
#?(mismatch-sexp :key nil)
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":KEY")))))
“‘
“‘lisp
#?(mismatch-sexp :key ’#:uninterned)
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":KEY")))))
“‘
#### List
“‘lisp
#?(mismatch-sexp ’(:a) ’(:a))
=> (:A)
, :test
“‘
“‘lisp
#?(mismatch-sexp ’(:a) ’(:b))
:satisfies (lambda (diff)
(& (typep diff ’(cons diff null))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "(~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red (prin1-to-string ’:a)))))))
“‘
Dot list.
“‘lisp
#?(mismatch-sexp ’(a) ’(a . b))
:satisfies (lambda (diff)
(& (typep diff ’(cons (eql a) diff))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "(A . ~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "NIL"))))))
“‘
Lesser
“‘lisp
#?(mismatch-sexp ’(a) ’(a b))
:satisfies (lambda (diff)
(& (typep diff ’(cons (eql a) diff))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "(A . ~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "NIL"))))))
“‘
Greater
“‘lisp
#?(mismatch-sexp ’(a b) ’(a))
:satisfies (lambda (diff)
(& (typep diff ’(cons (eql a) diff))
(let ((output (with-output-to-string (out) (diff-print diff out))))
(& (equal "(A . (B))" (ppcre:regex-replace-all "\\x1B[^m]+m" output ""))
(let ((red-escape-sequence
(search (let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:make-color-string cl-colors2:+red+))
output)))
(& (< red-escape-sequence
(search cl-ansi-text:+reset-color-string+ output))))))))
“‘
#### String
“‘lisp
#?(mismatch-sexp "a" "a")
=> "a"
, :test
“‘
“‘lisp
#?(mismatch-sexp "a" "b")
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "\"~A\""
(cl-ansi-text:red "a" :style :background)))))
“‘
Lesser
“‘lisp
#?(mismatch-sexp "a" "ab")
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "\"a~A\""
(cl-ansi-text:red ":NULL" :effect :blink)))))
“‘
Greater
“‘lisp
#?(mismatch-sexp "ab" "a")
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "\"a~A\""
(cl-ansi-text:red "b" :style :background)))))
“‘
#### Pathname
“‘lisp
#?(mismatch-sexp #P"hoge" #P"hoge")
=> #P"hoge"
, :test
“‘
“‘lisp
#?(mismatch-sexp #P"hoge" #P"fuga")
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#P\"~A\""
(cl-ansi-text:red "hoge" :style :background)))))
“‘
#### Bit-vector
“‘lisp
#?(mismatch-sexp #*1101 #*1101)
=> #*1101
, :test
“‘
“‘lisp
#?(mismatch-sexp #*1101 #*1111)
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "#*1101")))))
“‘
#### Vector
“‘lisp
#?(mismatch-sexp #() #())
=> #()
, :test
“‘
type mismatch.
“‘lisp
#?(mismatch-sexp "a" #(#\a))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "\"a\"")))))
“‘
element mismatch.
“‘lisp
#?(mismatch-sexp #(hoge) #(#\a))
:satisfies (lambda (diff)
(& (typep diff ’(vector t *))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#(~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "HOGE"))))))
“‘
Lesser
“‘lisp
#?(mismatch-sexp #(a) #(a b))
:satisfies (lambda (diff)
(& (typep diff ’(vector t *))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#(A ~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":NULL" :effect :blink))))))
“‘
Greater
“‘lisp
#?(mismatch-sexp #(a b) #(a))
:satisfies (lambda (diff)
(& (typep diff ’(vector t *))
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#(A ~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "B"))))))
“‘
#### Array
“‘lisp
#?(mismatch-sexp #0A() #0A())
=> #0A()
, :test
“‘
dimension mismatch
“‘lisp
#?(mismatch-sexp #0A() #1A())
:satisfies (lambda (diff)
(& (typep diff ’diff)
(let ((output (with-output-to-string (out) (diff-print diff out))))
(& (uiop:string-prefix-p (let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:make-color-string cl-colors2:+red+))
output)
(uiop:string-suffix-p output cl-ansi-text:+reset-color-string+)
(equal "(:DIFFERENT-DIMENSIONS :EXPECTED (0) :ACTUAL NIL #0ANIL)"
(ppcre:regex-replace-all "\\x1B[^m]+m" output ""))))))
“‘
Lesser
“‘lisp
#?(mismatch-sexp #2A((a b)) #2A((a b) (c d)))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(let ((output (with-output-to-string (out) (diff-print diff out))))
(& (uiop:string-prefix-p (let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:make-color-string cl-colors2:+red+))
output)
(uiop:string-suffix-p output cl-ansi-text:+reset-color-string+)
(equal "(:DIFFERENT-DIMENSIONS :EXPECTED (2 2) :ACTUAL (1 2) #2A((A B)))"
(ppcre:regex-replace-all "\\x1B[^m]+m" output ""))))))
“‘
“‘lisp
#?(mismatch-sexp #2A((a b)) #2A((a c)))
:satisfies (lambda (diff)
(& (typep diff ’array)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#2A((A ~A))"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "B"))))))
“‘
#### Strucuture
“‘lisp
#?(mismatch-sexp cl-colors2:+red+ cl-colors2:+red+)
=> #.cl-colors2:+red+
, :test
“‘
“‘lisp
#?(mismatch-sexp cl-colors2:+red+ cl-colors2:+blue+)
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#S(CL-COLORS2:RGB :RED ~A :GREEN 0 :BLUE ~A)"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "1"))
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red "0"))))))
“‘
#### Standard-object
“‘lisp
#?(defclass c () ((slot :initarg :slot)))
:be-the standard-class
“‘
“‘lisp
#?(mismatch-sexp (make-instance ’c :slot :a) (make-instance ’c :slot :a))
:satisfies (lambda (result)
(& (typep result ’c)
(equal :a (slot-value result ’slot))))
“‘
Not bound.
“‘lisp
#?(mismatch-sexp (make-instance ’c) (make-instance ’c :slot :a))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<C :SLOT ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":UNBOUND" :effect :blink))))))
“‘
Should be unbound.
“‘lisp
#?(mismatch-sexp (make-instance ’c :slot :a) (make-instance ’c))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<C :SLOT ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":A"))))))
“‘
Mismatch value.
“‘lisp
#?(mismatch-sexp (make-instance ’c :slot :a) (make-instance ’c :slot :b))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<C :SLOT ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":A"))))))
“‘
#### Hash-table
“‘lisp
#?(mismatch-sexp (make-hash-table) (make-hash-table))
:equivalents (make-hash-table)
, :test
“‘
Lesser
“‘lisp
#?(mismatch-sexp (make-hash-table) (alexandria:plist-hash-table ’(:a :b)))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<HASH-TABLE :A ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":MISSING" :effect :blink))))))
“‘
Greater
“‘lisp
#?(mismatch-sexp (alexandria:plist-hash-table ’(:a :b)) (make-hash-table))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<HASH-TABLE :A ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":B"))))))
“‘
Mismatch value.
“‘lisp
#?(mismatch-sexp (alexandria:plist-hash-table ’(:a :b)) (alexandria:plist-hash-table ’(:a "b")))
:satisfies (lambda (diff)
(& (typep diff ’diff)
(equal (with-output-to-string (out) (diff-print diff out))
(format nil "#<HASH-TABLE :A ~A>"
(let ((cl-ansi-text:*color-mode* :8bit))
(cl-ansi-text:red ":B"))))))
“‘
hash-table
) (expected hash-table
)) ¶standard-object
) (expected standard-object
)) ¶structure-object
) (expected structure-object
)) ¶array
) (expected array
)) ¶vector
) (expected vector
)) ¶bit-vector
) (expected bit-vector
)) ¶number
) (expected number
)) ¶pathname
) (expected pathname
)) ¶string
) (expected string
)) ¶list
) (expected list
)) ¶symbol
) (expected symbol
)) ¶# DIFF
## Description:
Abstract structure for every DIFF object.
## Class Precedence List: (case in SBCL)
diff structure-object slot-object t
## Effective Slots:
OBJECT [Type] T
## Notes:
structure-object
.
# DIFF-COMPARABLE
## Description:
Abstract diff structure for comparables.
## Class Precedence List: (case in SBCL) diff-comparable diff structure-object slot-object t
## Effective Slots:
ORIGIN [Type] T
OBJECT [Type] T
## Notes:
Jump to: | (
C D F G H M N O P S V |
---|
Jump to: | (
C D F G H M N O P S V |
---|
Jump to: | *
O S |
---|
Jump to: | *
O S |
---|
Jump to: | D F H N O P S V |
---|
Jump to: | D F H N O P S V |
---|