The vivid-colors Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The vivid-colors Reference Manual

This is the vivid-colors Reference Manual, version 7.1.6, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 06:29:33 2022 GMT+0.

Table of Contents


1 Introduction

VIVID-COLORS 2.0.0

What is this?

Colored object printer.

Alternatives and differences.

Please tell me if exists.

Usage

* (vprint '(:keyword :keyword
            :character #\A
	    :string "string"
	    :number 1/3
	    :pathname #P"foo/bar"))

image of the command result.

* (vprint '(defun vprint-structure (output structure)
             (vprint-logical-block (output nil :prefix "#S(" :suffix ")")
               (vprint (type-of structure) output t)
               (write-char #\Space output)
               (vprint-newline :linear output)
               (loop :for (slot . rest) :on (c2mop:class-slots (class-of structure))
                     :for name = (c2mop:slot-definition-name slot)
                     :do (vprint (intern (symbol-name name) :keyword) output t)
                         (write-char #\Space output)
                         (vprint (slot-value structure name) output t)
                         (when rest
                           (write-char #\Space output)
                           (vprint-newline :linear output))))))

image of the command result.

How to extend.

Ideally, I want to use a pretty-printing system for this coloring feature but it does not match for this purpose because

  1. Pretty printer counts escape sequence length too. (Indentation will be broken.)
  2. Pretty printing system does not provide ways to customizing. (especially the way to supersede the class for pretty-printing streams.)

In other words, at least I am satisfied with pretty-printing API. So vivid-colors APIs are designed almost the same with common lisp pretty printing APIs.

For detailed examples, see source code.

A tiny example to print the common lisp symbols as blue is bellow.

* (defun vprint-cl-symbol (output symbol)
    (put symbol output :color cl-colors2:+blue+))
VPRINT-CL-SYMBOL

* (handler-bind ((dispatch-key-confliction #'replace-by-new))
    (define-vprint-dispatch blue-cl-symbols
      (:merge :pretty :standard)
      (:set `(member ,@(loop :for s :being :each :external-symbols :of :cl
                             :collect s))
            'vprint-cl-symbol)))
BLUE-CL-SYMBOLS

* (in-vprint-dispatch blue-cl-symbols)
#<VPRINT-DISPATCH BLUE-CL-SYMBOLS entry 19>

* (vprint '(defun vprint-structure (output structure)
             (vprint-logical-block (output nil :prefix "#S(" :suffix ")")
               (vprint (type-of structure) output t)
               (write-char #\Space output)
               (vprint-newline :linear output)
               (loop :for (slot . rest) :on (c2mop:class-slots (class-of structure))
                     :for name = (c2mop:slot-definition-name slot)
                     :do (vprint (intern (symbol-name name) :keyword) output t)
                         (write-char #\Space output)
                         (vprint (slot-value structure name) output t)
                         (when rest
                           (write-char #\Space output)
                           (vprint-newline :linear output))))))

image of the command result.

PUT vs VPRINT.

PUT is used to control atomic representation coloring. 'Atomic representation' is roughly the representation that is not changed its representation by the variable CL:*PRINT-PRETTY* e.g. symbol, character, number, pathname or string.

For controlling the non-atomic representation coloring, you need to use VPRINT with binding the variable *COLOR*.

If you do not control coloring (i.e. using global one), use VPRINT.

From developer

Product's goal

License

MIT

Developed with

SBCL

Tested with

Installation


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 vivid-colors

Colored object printer.

Author

SATO Shinichi

Source Control

(GIT git@github.com:hyotang666/vivid-colors)

Bug Tracker

https://github.com/hyotang666/vivid-colors/issues

License

MIT

Version

7.1.6

Dependencies
  • lambda-fiddle (system).
  • millet (system).
  • closer-mop (system).
  • cl-colors2 (system).
  • vivid-colors.stream (system).
  • vivid-colors.dispatch (system).
  • vivid-colors.content (system).
Source

vivid-colors.asd.

Child Component

vivid-colors.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 vivid-colors/vivid-colors.asd

Source

vivid-colors.asd.

Parent Component

vivid-colors (system).

ASDF Systems

vivid-colors.


3.1.2 vivid-colors/vivid-colors.lisp

Source

vivid-colors.asd.

Parent Component

vivid-colors (system).

Packages

vivid-colors.

Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 vivid-colors

Source

vivid-colors.lisp.

Use List

common-lisp.

Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Previous: , Up: Definitions   [Contents][Index]

5.1 Internals


Previous: , Up: Internals   [Contents][Index]

5.1.1 Ordinary functions

Function: count-pre-body-forms (lambda-list)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: default-printer (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: non-printable-char-p (char)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-array (output array)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-backquote (output backquote)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-block (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-char (output char)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-comma (output comma)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-funcall (output form)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-function (output function)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-if (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-keyword (output keyword)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-let (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-list (output list &optional newline-kind)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-loop (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-macrocall (output form)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-pathname (output pathname)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-progn (output exp)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-quote (output quote)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-real (output real)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-reference (output ref)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-string (output string)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-structure (output structure)
Package

vivid-colors.

Source

vivid-colors.lisp.

Function: vprint-vector (output vector)
Package

vivid-colors.

Source

vivid-colors.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   F   N   V  
Index Entry  Section

C
count-pre-body-forms: Private ordinary functions

D
default-printer: Private ordinary functions

F
Function, count-pre-body-forms: Private ordinary functions
Function, default-printer: Private ordinary functions
Function, non-printable-char-p: Private ordinary functions
Function, vprint-array: Private ordinary functions
Function, vprint-backquote: Private ordinary functions
Function, vprint-block: Private ordinary functions
Function, vprint-char: Private ordinary functions
Function, vprint-comma: Private ordinary functions
Function, vprint-funcall: Private ordinary functions
Function, vprint-function: Private ordinary functions
Function, vprint-if: Private ordinary functions
Function, vprint-keyword: Private ordinary functions
Function, vprint-let: Private ordinary functions
Function, vprint-list: Private ordinary functions
Function, vprint-loop: Private ordinary functions
Function, vprint-macrocall: Private ordinary functions
Function, vprint-pathname: Private ordinary functions
Function, vprint-progn: Private ordinary functions
Function, vprint-quote: Private ordinary functions
Function, vprint-real: Private ordinary functions
Function, vprint-reference: Private ordinary functions
Function, vprint-string: Private ordinary functions
Function, vprint-structure: Private ordinary functions
Function, vprint-vector: Private ordinary functions

N
non-printable-char-p: Private ordinary functions

V
vprint-array: Private ordinary functions
vprint-backquote: Private ordinary functions
vprint-block: Private ordinary functions
vprint-char: Private ordinary functions
vprint-comma: Private ordinary functions
vprint-funcall: Private ordinary functions
vprint-function: Private ordinary functions
vprint-if: Private ordinary functions
vprint-keyword: Private ordinary functions
vprint-let: Private ordinary functions
vprint-list: Private ordinary functions
vprint-loop: Private ordinary functions
vprint-macrocall: Private ordinary functions
vprint-pathname: Private ordinary functions
vprint-progn: Private ordinary functions
vprint-quote: Private ordinary functions
vprint-real: Private ordinary functions
vprint-reference: Private ordinary functions
vprint-string: Private ordinary functions
vprint-structure: Private ordinary functions
vprint-vector: Private ordinary functions

Jump to:   C   D   F   N   V  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables