The shasht Reference Manual

This is the shasht Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 06:52:33 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 shasht

JSON reading and writing for the Kzinti.

Author

Tarn W. Burton

Home Page

https://yitzchak.github.io/shasht/

Bug Tracker

https://github.com/yitzchak/shasht/issues

License

MIT

Version

0.1

Dependencies
  • trivial-do (system).
  • closer-mop (system).
Source

shasht.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 shasht/src

Source

shasht.asd.

Parent Component

shasht (system).

Child Components

4 Files

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


4.1 Lisp


4.1.1 shasht/shasht.asd

Source

shasht.asd.

Parent Component

shasht (system).

ASDF Systems

shasht.


4.1.2 shasht/src/packages.lisp

Source

shasht.asd.

Parent Component

src (module).

Packages

shasht.


4.1.3 shasht/src/utils.lisp

Dependency

packages.lisp (file).

Source

shasht.asd.

Parent Component

src (module).

Public Interface

make-object (function).

Internals

4.1.4 shasht/src/config.lisp

Dependency

utils.lisp (file).

Source

shasht.asd.

Parent Component

src (module).

Public Interface
Internals

*read-hash-table-test* (special variable).


4.1.5 shasht/src/read.lisp

Dependency

config.lisp (file).

Source

shasht.asd.

Parent Component

src (module).

Public Interface
Internals

4.1.6 shasht/src/write.lisp

Dependency

read.lisp (file).

Source

shasht.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 shasht

Source

packages.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

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


6.1 Public Interface


6.1.1 Special variables

Special Variable: *read-default-array-format*

The default format to use when reading an array. Current supported formats are :vector or :list.

Package

shasht.

Source

config.lisp.

Special Variable: *read-default-false-value*

The default value to return when reading a false token.

Package

shasht.

Source

config.lisp.

Special Variable: *read-default-null-value*

The default value to return when reading a null token.

Package

shasht.

Source

config.lisp.

Special Variable: *read-default-object-format*

The default format to use when reading an object. Current supported formats are :hash-table, :alist or :plist.

Package

shasht.

Source

config.lisp.

Special Variable: *read-default-true-value*

The default value to return when reading a true token.

Package

shasht.

Source

config.lisp.

Special Variable: *read-length*

The maximum number of values in an array or an object.

Package

shasht.

Source

config.lisp.

Special Variable: *read-level*

The maximum number of levels to allow during reading.

Package

shasht.

Source

config.lisp.

Special Variable: *symbol-name-function*
Package

shasht.

Source

config.lisp.

Special Variable: *write-alist-as-object*

If true then assocation lists will be written as an object.

Package

shasht.

Source

config.lisp.

Special Variable: *write-array-tags*

Indicators in the CAR of a list that indicate that the CDR or the list should be written as an array.

Package

shasht.

Source

config.lisp.

Special Variable: *write-ascii-encoding*

If true then any non ASCII values will be encoded using Unicode escape sequences.

Package

shasht.

Source

config.lisp.

Special Variable: *write-empty-array-values*

Values that will be written as an empty array.

Package

shasht.

Source

config.lisp.

Special Variable: *write-empty-object-values*

Values that will be written as an empty object.

Package

shasht.

Source

config.lisp.

Special Variable: *write-false-values*

Values that will be written as a false token.

Package

shasht.

Source

config.lisp.

Special Variable: *write-indent-string*

The string to use when indenting objects and arrays.

Package

shasht.

Source

config.lisp.

Special Variable: *write-null-values*

Values that will be written as a null token.

Package

shasht.

Source

config.lisp.

Special Variable: *write-object-alist-tags*

Indicators in the CAR of a list that indicate that the CDR of the list is an alist and should be written as object.

Package

shasht.

Source

config.lisp.

Special Variable: *write-object-plist-tags*

Indicators in the CAR of a list that indicate that the CDR of the list is an plist and should be written as object.

Package

shasht.

Source

config.lisp.

Special Variable: *write-plist-as-object*

If true then property lists will be written as an object.

Package

shasht.

Source

config.lisp.

Special Variable: *write-true-values*

Values that will be written as a true token.

Package

shasht.

Source

config.lisp.


6.1.2 Macros

Macro: with-json-array (output-stream &body body)

Enable JSON array writing for body. Array open/close and commas will be automatically handled when calls to print-json-value are made.

Package

shasht.

Source

write.lisp.

Macro: with-json-key ((key output-stream) &body body)
Package

shasht.

Source

write.lisp.

Macro: with-json-object (output-stream &body body)

Enable JSON object writing for body. Object open/close and commas will be automatically handled when calls to print-json-key-value are made.

Package

shasht.

Source

write.lisp.


6.1.3 Ordinary functions

Function: make-object (&rest args)

Create a hash table based on args (in plist format) and a test of equal.

Package

shasht.

Source

utils.lisp.

Function: print-json-delimiter (output-stream)
Package

shasht.

Source

write.lisp.

Function: read-json (&optional input-stream-or-string eof-error-p eof-value single-value-p)

Read a JSON value. Reading is influenced by the dynamic variables *read-default-true-value*, *read-default-false-value*, *read-default-null-value*, *read-default-array-format*, *read-default-object-format*, *read-hash-table-test* and common-lisp:*read-default-float-format* which each determine the default values and formats used. The following arguments also control the behavior of the read.

* input-stream-or-string - a stream, a string or t. If t is passed then *standard-input* is used.
* eof-error-p - if true signal eof with error, otherwise return eof-value.
* eof-value - value used if eof-error-p is nil.
* single-value-p - Check for trailing junk after read is complete.

Package

shasht.

Source

read.lisp.

Function: read-json* (&key stream eof-error eof-value single-value true-value false-value null-value array-format object-format float-format length level hash-table-test)

Read a JSON value.

* stream - a stream, a string or t. If t is passed then *standard-input* is used.
* eof-error - if true signal eof with error, otherwise return eof-value.
* eof-value - value used if eof-error-p is nil.
* single-value - Check for trailing junk after read is complete.
* true-value - The value to return when reading a true token.
* false-value - The value to return when reading a false token.
* null-value - The value to return when reading a null token.
* array-format - The format to use when reading an array. Current supported formats are :vector or :list.
* object-format - The format to use when reading an object. Current supported formats are :hash-table, :alist or :plist.
* float-format - The format of floating point values.
* hash-table-test - Value for the make-hash-table :test designator

Package

shasht.

Source

read.lisp.

Function: write-json (value &optional output-stream)

Write a JSON value. Writing is influenced by the dynamic variables *write-ascii-encoding*, *write-true-values*, *write-false-values*, *write-null-values*, *write-alist-as-object*, *write-plist-as-object*, *write-indent-string* and common-lisp:*print-pretty*.

The following arguments also control the behavior of the write.

* value - The value to be written.
* output-stream - a stream or nil to return a string or t to use *standard-output*.

Package

shasht.

Source

write.lisp.

Function: write-json* (value &key stream ascii-encoding true-values false-values empty-array-values empty-object-values array-tags object-alist-tags object-plist-tags alist-as-object plist-as-object pretty indent-string)

Write a JSON value.

The following arguments also control the behavior of the write.

* value - The value to be written.
* stream - a stream or nil to return a string or t to use *standard-output*.
* ascii-encoding - If true then any non ASCII values will be encoded
using Unicode escape sequences.
* true-values - Values that will be written as a true token.
* false-values - Values that will be written as a false token.
* null-values - Values that will be written as a null token.
* empty-array-values - Values that will be written as an empty array.
* empty-object-values - Values that will be written as an empty object.
* array-tags - A list of values whose appearance in the CAR of a list indicates the CDR of the list should be written as an array.
* object-alist-tags - A list of values whose appearance in the CAR of
a list indicates the CDR of the list is an alist and should be written as an object.
* object-plist - A list of values whose appearance in the CAR of
a list indicates the CDR of the list is a plist and should be written as an object.
* alist-as-object - If true then assocation lists will be written as an object. * plist-as-object - If true then property lists will be written as an object. * pretty - Use indentation in printing.
* indent-string - The string to use when indenting objects and arrays.

Package

shasht.

Source

write.lisp.

Function: write-json-string (value output-stream)

Write value as a JSON string to stream specified by output-stream.

Package

shasht.

Source

write.lisp.


6.1.4 Generic functions

Generic Function: print-json-key-value (object key value output-stream)

Print a JSON key value. Must be used inside of with-json-object.

Package

shasht.

Source

write.lisp.

Methods
Method: print-json-key-value (object key value output-stream)
Generic Function: print-json-value (value output-stream)

Print a JSON value to output-stream. Used by write-json to dispatch based on type.

Package

shasht.

Source

write.lisp.

Methods
Method: print-json-value ((value structure-object) output-stream)
Method: print-json-value ((value standard-object) output-stream)
Method: print-json-value ((value character) output-stream)
Method: print-json-value ((value pathname) output-stream)
Method: print-json-value ((value symbol) output-stream)
Method: print-json-value ((value array) output-stream)
Method: print-json-value ((value vector) output-stream)
Method: print-json-value ((value list) output-stream)
Method: print-json-value ((value hash-table) output-stream)
Method: print-json-value ((value string) output-stream)
Method: print-json-value ((value integer) output-stream)
Method: print-json-value ((value number) output-stream)
Method: print-json-value :before (value output-stream)
Generic Reader: shasht-invalid-char-char (condition)
Package

shasht.

Methods
Reader Method: shasht-invalid-char-char ((condition shasht-invalid-char))
Source

read.lisp.

Target Slot

char.

Generic Reader: shasht-invalid-char-expected (condition)
Package

shasht.

Methods
Reader Method: shasht-invalid-char-expected ((condition shasht-invalid-char))
Source

read.lisp.

Target Slot

expected.


6.1.5 Conditions

Condition: shasht-invalid-char
Package

shasht.

Source

read.lisp.

Direct superclasses

shasht-parse-error.

Direct methods
Direct slots
Slot: expected
Initform

(quote nil)

Initargs

:expected

Readers

shasht-invalid-char-expected.

Writers

This slot is read-only.

Slot: char
Package

common-lisp.

Initargs

:char

Readers

shasht-invalid-char-char.

Writers

This slot is read-only.

Condition: shasht-parse-error
Package

shasht.

Source

read.lisp.

Direct superclasses

parse-error.

Direct subclasses

shasht-invalid-char.

Condition: shasht-read-length-exceeded
Package

shasht.

Source

read.lisp.

Direct superclasses

parse-error.

Condition: shasht-read-level-exceeded
Package

shasht.

Source

read.lisp.

Direct superclasses

parse-error.


6.2 Internals


6.2.1 Special variables

Special Variable: *delimiter*
Package

shasht.

Source

write.lisp.

Special Variable: *next-delimiter*
Package

shasht.

Source

write.lisp.

Special Variable: *next-terminator*
Package

shasht.

Source

write.lisp.

Special Variable: *read-hash-table-test*

The :test designator for make-hash-table (used when reading objects into hash-tables).

Package

shasht.

Source

config.lisp.

Special Variable: *terminator*
Package

shasht.

Source

write.lisp.

Special Variable: *write-indent-level*
Package

shasht.

Source

write.lisp.


6.2.2 Ordinary functions

Function: alistp (alist)
Package

shasht.

Source

utils.lisp.

Function: ascii-printable-p (char-code)
Package

shasht.

Source

utils.lisp.

Function: control-char-p (ch)
Package

shasht.

Source

utils.lisp.

Function: copy-reader-state (instance)
Package

shasht.

Source

read.lisp.

Function: expect-char (input-stream value skip-whitespace error-p)
Package

shasht.

Source

read.lisp.

Function: frob-input-stream (input-stream-or-string)
Package

shasht.

Source

read.lisp.

Function: high-surrogate-p (code)
Package

shasht.

Source

utils.lisp.

Function: integer-char-p (char)
Package

shasht.

Source

utils.lisp.

Function: make-newline-string ()
Package

shasht.

Source

write.lisp.

Function: make-reader-state (&key type length value key)
Package

shasht.

Source

read.lisp.

Function: plistp (plist)
Package

shasht.

Source

utils.lisp.

Function: print-json-mop (value output-stream)
Package

shasht.

Source

write.lisp.

Function: read-encoded-char (input-stream)
Package

shasht.

Source

read.lisp.

Function: read-json-number (input-stream)
Package

shasht.

Source

read.lisp.

Function: read-json-string (input-stream skip-quote)
Package

shasht.

Source

read.lisp.

Reader: reader-state-key (instance)
Writer: (setf reader-state-key) (instance)
Package

shasht.

Source

read.lisp.

Target Slot

key.

Reader: reader-state-length (instance)
Writer: (setf reader-state-length) (instance)
Package

shasht.

Source

read.lisp.

Target Slot

length.

Function: reader-state-p (object)
Package

shasht.

Source

read.lisp.

Reader: reader-state-type (instance)
Writer: (setf reader-state-type) (instance)
Package

shasht.

Source

read.lisp.

Target Slot

type.

Reader: reader-state-value (instance)
Writer: (setf reader-state-value) (instance)
Package

shasht.

Source

read.lisp.

Target Slot

value.

Function: skip-whitespace (input-stream)
Package

shasht.

Source

read.lisp.

Function: supplementary-plane-p (char-code)
Package

shasht.

Source

utils.lisp.

Function: surrogates-to-codepoint (high-surrogate low-surrogate)
Package

shasht.

Source

utils.lisp.


6.2.3 Structures

Structure: reader-state
Package

shasht.

Source

read.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: type
Package

common-lisp.

Initform

:value

Readers

reader-state-type.

Writers

(setf reader-state-type).

Slot: length
Package

common-lisp.

Initform

0

Readers

reader-state-length.

Writers

(setf reader-state-length).

Slot: value
Readers

reader-state-value.

Writers

(setf reader-state-value).

Slot: key
Readers

reader-state-key.

Writers

(setf reader-state-key).


6.2.4 Types

Type: high-surrogate ()
Package

shasht.

Source

utils.lisp.

Type: low-surrogate ()
Package

shasht.

Source

utils.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   E   F   G   H   I   M   P   R   S   W  
Index Entry  Section

(
(setf reader-state-key): Private ordinary functions
(setf reader-state-length): Private ordinary functions
(setf reader-state-type): Private ordinary functions
(setf reader-state-value): Private ordinary functions

A
alistp: Private ordinary functions
ascii-printable-p: Private ordinary functions

C
control-char-p: Private ordinary functions
copy-reader-state: Private ordinary functions

E
expect-char: Private ordinary functions

F
frob-input-stream: Private ordinary functions
Function, (setf reader-state-key): Private ordinary functions
Function, (setf reader-state-length): Private ordinary functions
Function, (setf reader-state-type): Private ordinary functions
Function, (setf reader-state-value): Private ordinary functions
Function, alistp: Private ordinary functions
Function, ascii-printable-p: Private ordinary functions
Function, control-char-p: Private ordinary functions
Function, copy-reader-state: Private ordinary functions
Function, expect-char: Private ordinary functions
Function, frob-input-stream: Private ordinary functions
Function, high-surrogate-p: Private ordinary functions
Function, integer-char-p: Private ordinary functions
Function, make-newline-string: Private ordinary functions
Function, make-object: Public ordinary functions
Function, make-reader-state: Private ordinary functions
Function, plistp: Private ordinary functions
Function, print-json-delimiter: Public ordinary functions
Function, print-json-mop: Private ordinary functions
Function, read-encoded-char: Private ordinary functions
Function, read-json: Public ordinary functions
Function, read-json*: Public ordinary functions
Function, read-json-number: Private ordinary functions
Function, read-json-string: Private ordinary functions
Function, reader-state-key: Private ordinary functions
Function, reader-state-length: Private ordinary functions
Function, reader-state-p: Private ordinary functions
Function, reader-state-type: Private ordinary functions
Function, reader-state-value: Private ordinary functions
Function, skip-whitespace: Private ordinary functions
Function, supplementary-plane-p: Private ordinary functions
Function, surrogates-to-codepoint: Private ordinary functions
Function, write-json: Public ordinary functions
Function, write-json*: Public ordinary functions
Function, write-json-string: Public ordinary functions

G
Generic Function, print-json-key-value: Public generic functions
Generic Function, print-json-value: Public generic functions
Generic Function, shasht-invalid-char-char: Public generic functions
Generic Function, shasht-invalid-char-expected: Public generic functions

H
high-surrogate-p: Private ordinary functions

I
integer-char-p: Private ordinary functions

M
Macro, with-json-array: Public macros
Macro, with-json-key: Public macros
Macro, with-json-object: Public macros
make-newline-string: Private ordinary functions
make-object: Public ordinary functions
make-reader-state: Private ordinary functions
Method, print-json-key-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, print-json-value: Public generic functions
Method, shasht-invalid-char-char: Public generic functions
Method, shasht-invalid-char-expected: Public generic functions

P
plistp: Private ordinary functions
print-json-delimiter: Public ordinary functions
print-json-key-value: Public generic functions
print-json-key-value: Public generic functions
print-json-mop: Private ordinary functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions
print-json-value: Public generic functions

R
read-encoded-char: Private ordinary functions
read-json: Public ordinary functions
read-json*: Public ordinary functions
read-json-number: Private ordinary functions
read-json-string: Private ordinary functions
reader-state-key: Private ordinary functions
reader-state-length: Private ordinary functions
reader-state-p: Private ordinary functions
reader-state-type: Private ordinary functions
reader-state-value: Private ordinary functions

S
shasht-invalid-char-char: Public generic functions
shasht-invalid-char-char: Public generic functions
shasht-invalid-char-expected: Public generic functions
shasht-invalid-char-expected: Public generic functions
skip-whitespace: Private ordinary functions
supplementary-plane-p: Private ordinary functions
surrogates-to-codepoint: Private ordinary functions

W
with-json-array: Public macros
with-json-key: Public macros
with-json-object: Public macros
write-json: Public ordinary functions
write-json*: Public ordinary functions
write-json-string: Public ordinary functions


A.3 Variables

Jump to:   *  
C   E   K   L   S   T   V  
Index Entry  Section

*
*delimiter*: Private special variables
*next-delimiter*: Private special variables
*next-terminator*: Private special variables
*read-default-array-format*: Public special variables
*read-default-false-value*: Public special variables
*read-default-null-value*: Public special variables
*read-default-object-format*: Public special variables
*read-default-true-value*: Public special variables
*read-hash-table-test*: Private special variables
*read-length*: Public special variables
*read-level*: Public special variables
*symbol-name-function*: Public special variables
*terminator*: Private special variables
*write-alist-as-object*: Public special variables
*write-array-tags*: Public special variables
*write-ascii-encoding*: Public special variables
*write-empty-array-values*: Public special variables
*write-empty-object-values*: Public special variables
*write-false-values*: Public special variables
*write-indent-level*: Private special variables
*write-indent-string*: Public special variables
*write-null-values*: Public special variables
*write-object-alist-tags*: Public special variables
*write-object-plist-tags*: Public special variables
*write-plist-as-object*: Public special variables
*write-true-values*: Public special variables

C
char: Public conditions

E
expected: Public conditions

K
key: Private structures

L
length: Private structures

S
Slot, char: Public conditions
Slot, expected: Public conditions
Slot, key: Private structures
Slot, length: Private structures
Slot, type: Private structures
Slot, value: Private structures
Special Variable, *delimiter*: Private special variables
Special Variable, *next-delimiter*: Private special variables
Special Variable, *next-terminator*: Private special variables
Special Variable, *read-default-array-format*: Public special variables
Special Variable, *read-default-false-value*: Public special variables
Special Variable, *read-default-null-value*: Public special variables
Special Variable, *read-default-object-format*: Public special variables
Special Variable, *read-default-true-value*: Public special variables
Special Variable, *read-hash-table-test*: Private special variables
Special Variable, *read-length*: Public special variables
Special Variable, *read-level*: Public special variables
Special Variable, *symbol-name-function*: Public special variables
Special Variable, *terminator*: Private special variables
Special Variable, *write-alist-as-object*: Public special variables
Special Variable, *write-array-tags*: Public special variables
Special Variable, *write-ascii-encoding*: Public special variables
Special Variable, *write-empty-array-values*: Public special variables
Special Variable, *write-empty-object-values*: Public special variables
Special Variable, *write-false-values*: Public special variables
Special Variable, *write-indent-level*: Private special variables
Special Variable, *write-indent-string*: Public special variables
Special Variable, *write-null-values*: Public special variables
Special Variable, *write-object-alist-tags*: Public special variables
Special Variable, *write-object-plist-tags*: Public special variables
Special Variable, *write-plist-as-object*: Public special variables
Special Variable, *write-true-values*: Public special variables

T
type: Private structures

V
value: Private structures


A.4 Data types

Jump to:   C   F   H   L   M   P   R   S   T   U   W  
Index Entry  Section

C
Condition, shasht-invalid-char: Public conditions
Condition, shasht-parse-error: Public conditions
Condition, shasht-read-length-exceeded: Public conditions
Condition, shasht-read-level-exceeded: Public conditions
config.lisp: The shasht/src/config․lisp file

F
File, config.lisp: The shasht/src/config․lisp file
File, packages.lisp: The shasht/src/packages․lisp file
File, read.lisp: The shasht/src/read․lisp file
File, shasht.asd: The shasht/shasht․asd file
File, utils.lisp: The shasht/src/utils․lisp file
File, write.lisp: The shasht/src/write․lisp file

H
high-surrogate: Private types

L
low-surrogate: Private types

M
Module, src: The shasht/src module

P
Package, shasht: The shasht package
packages.lisp: The shasht/src/packages․lisp file

R
read.lisp: The shasht/src/read․lisp file
reader-state: Private structures

S
shasht: The shasht system
shasht: The shasht package
shasht-invalid-char: Public conditions
shasht-parse-error: Public conditions
shasht-read-length-exceeded: Public conditions
shasht-read-level-exceeded: Public conditions
shasht.asd: The shasht/shasht․asd file
src: The shasht/src module
Structure, reader-state: Private structures
System, shasht: The shasht system

T
Type, high-surrogate: Private types
Type, low-surrogate: Private types

U
utils.lisp: The shasht/src/utils․lisp file

W
write.lisp: The shasht/src/write․lisp file