The myway Reference Manual

This is the myway Reference Manual, version 0.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:24:16 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

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


2.1 myway

Sinatra-compatible routing library.

Author

Eitaro Fukamachi

License

LLGPL

Long Description

# My Way

My Way is a Sinatra-compatible URL routing library. This was originally written as Clack.Util.Route, a part of [Clack](http://clacklisp.org/).

## Usage

“‘common-lisp
(use-package :myway)

(defvar *mapper* (make-mapper))

(connect *mapper* "/" "Welcome to My Way.")

(connect *mapper* "/hello/?:name?"
(lambda (params)
(format nil "Hello, ~A" (or (getf params :name)
"Guest"))))

(dispatch *mapper* "/")
;=> "Welcome to My Way."
; T

(dispatch *mapper* "/hello")
;=> "Hello, Guest"
; T

(dispatch *mapper* "/hello/Eitaro")
;=> "Hello, Eitaro"
; T

(dispatch *mapper* "/hello/Eitaro" :method :POST)
;=> NIL
; NIL
“‘

### next-route

“‘common-lisp
(connect *mapper* "/guess/:who"
(lambda (params)
(if (string= (getf params :who) "Eitaro")
"You got me!"
(next-route))))

(connect *mapper* "/guess/*"
(lambda (params)
(declare (ignore params))
"You missed!"))
“‘

### to-app

‘to-app‘ makes a Clack app from ‘mapper‘.

“‘common-lisp
(to-app *mapper*)
;=> #<CLOSURE (LAMBDA (MYWAY::ENV) :IN TO-APP) {100E24F13B}>

(clack:clackup (to-app *mapper*))
“‘

## Installation

“‘common-lisp
(ql:quickload :myway)
“‘

## Author

* Eitaro Fukamachi (e.arrows@gmail.com)

## Copyright

Copyright (c) 2014 Eitaro Fukamachi (e.arrows@gmail.com)

## License

Licensed under the LLGPL License.

Version

0.1.0

Dependencies
  • cl-ppcre (system).
  • quri (system).
  • map-set (system).
  • alexandria (system).
  • cl-utilities (system).
Source

myway.asd.

Child Component

src (module).


3 Modules

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


3.1 myway/src

Source

myway.asd.

Parent Component

myway (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 myway/myway.asd

Source

myway.asd.

Parent Component

myway (system).

ASDF Systems

myway.

Packages

myway-asd.


4.1.2 myway/src/myway.lisp

Dependencies
Source

myway.asd.

Parent Component

src (module).

Packages

myway.

Public Interface

4.1.3 myway/src/rule.lisp

Source

myway.asd.

Parent Component

src (module).

Packages

myway.rule.

Public Interface
Internals

4.1.4 myway/src/route.lisp

Dependency

rule.lisp (file).

Source

myway.asd.

Parent Component

src (module).

Packages

myway.route.

Public Interface

4.1.5 myway/src/mapper.lisp

Dependencies
Source

myway.asd.

Parent Component

src (module).

Packages

myway.mapper.

Public Interface
Internals

4.1.6 myway/src/util.lisp

Source

myway.asd.

Parent Component

src (module).

Packages

myway.util.

Public Interface

make-collector (function).


5 Packages

Packages are listed by definition order.


5.1 myway-asd

Source

myway.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 myway.rule

Source

rule.lisp.

Use List

common-lisp.

Public Interface
Internals

5.3 myway.route

Source

route.lisp.

Use List

common-lisp.

Public Interface

5.4 myway

Source

myway.lisp.

Use List

common-lisp.

Public Interface

5.5 myway.util

Source

util.lisp.

Use List

common-lisp.

Public Interface

make-collector (function).


5.6 myway.mapper

Source

mapper.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: *env*
Package

myway.

Source

myway.lisp.


6.1.2 Ordinary functions

Function: add-route (mapper route)
Package

myway.mapper.

Source

mapper.lisp.

Function: clear-routes (mapper)
Package

myway.mapper.

Source

mapper.lisp.

Function: connect (mapper url fn &key method regexp name)
Package

myway.

Source

myway.lisp.

Function: dispatch (mapper url-string &key method allow-head)
Package

myway.mapper.

Source

mapper.lisp.

Function: equal-rule (rule1 rule2)
Package

myway.rule.

Source

rule.lisp.

Function: find-route (mapper url &rest args &key method regexp name route-class &allow-other-keys)
Package

myway.

Source

myway.lisp.

Function: find-route-by-name (mapper name)
Package

myway.

Source

myway.lisp.

Function: make-collector ()
Package

myway.util.

Source

util.lisp.

Function: make-mapper (&key %routes)
Package

myway.mapper.

Source

mapper.lisp.

Function: make-rule (url &key method regexp)
Package

myway.rule.

Source

rule.lisp.

Function: mapper-routes (mapper)
Package

myway.mapper.

Source

mapper.lisp.

Function: match-rule (rule method url-string &key allow-head)
Package

myway.rule.

Source

rule.lisp.

Function: member-route (mapper route)
Package

myway.mapper.

Source

mapper.lisp.

Function: member-route-by-name (mapper name)
Package

myway.mapper.

Source

mapper.lisp.

Function: next-route ()
Package

myway.mapper.

Source

mapper.lisp.

Function: to-app (mapper)
Package

myway.

Source

myway.lisp.

Function: url-for (route params)
Package

myway.route.

Source

route.lisp.


6.1.3 Generic functions

Generic Function: equal-route (route1 route2)
Package

myway.route.

Source

route.lisp.

Methods
Method: equal-route ((route1 route) (route2 route))
Generic Function: match-route (route method url-string &key allow-head)
Package

myway.route.

Source

route.lisp.

Methods
Method: match-route ((route route) method url-string &key allow-head)
Generic Reader: route-handler (object)
Package

myway.route.

Methods
Reader Method: route-handler ((route route))

automatically generated reader method

Source

route.lisp.

Target Slot

handler.

Generic Writer: (setf route-handler) (object)
Package

myway.route.

Methods
Writer Method: (setf route-handler) ((route route))

automatically generated writer method

Source

route.lisp.

Target Slot

handler.

Generic Reader: route-name (object)
Package

myway.route.

Methods
Reader Method: route-name ((route route))

automatically generated reader method

Source

route.lisp.

Target Slot

name.

Generic Writer: (setf route-name) (object)
Package

myway.route.

Methods
Writer Method: (setf route-name) ((route route))

automatically generated writer method

Source

route.lisp.

Target Slot

name.

Generic Reader: route-rule (object)
Package

myway.route.

Methods
Reader Method: route-rule ((route route))

automatically generated reader method

Source

route.lisp.

Target Slot

rule.

Generic Writer: (setf route-rule) (object)
Package

myway.route.

Methods
Writer Method: (setf route-rule) ((route route))

automatically generated writer method

Source

route.lisp.

Target Slot

rule.

Generic Function: rule-url-for (rule params)
Package

myway.rule.

Source

rule.lisp.

Methods
Method: rule-url-for ((rule rule) params)
Method: rule-url-for ((rule regex-rule) params)

6.1.4 Standalone methods

Method: initialize-instance :after ((route route) &rest initargs &key url method regexp &allow-other-keys)
Source

route.lisp.


6.1.5 Structures

Structure: mapper
Package

myway.mapper.

Source

mapper.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: %routes
Initform

(myway.util:make-collector)

Readers

mapper-%routes.

Writers

(setf mapper-%routes).

Structure: regex-rule
Package

myway.rule.

Source

rule.lisp.

Direct superclasses

rule.

Direct methods

rule-url-for.

Structure: rule
Package

myway.rule.

Source

rule.lisp.

Direct superclasses

structure-object.

Direct subclasses

regex-rule.

Direct methods

rule-url-for.

Direct slots
Slot: methods
Type

map-set:map-set

Initform

myway.rule::*default-rule-methods*

Readers

rule-methods.

Writers

(setf rule-methods).

Slot: url
Readers

rule-url.

Writers

(setf rule-url).

Slot: regex
Readers

rule-regex.

Writers

(setf rule-regex).

Slot: format-string
Readers

rule-format-string.

Writers

(setf rule-format-string).

Slot: param-keys
Readers

rule-param-keys.

Writers

(setf rule-param-keys).


6.1.6 Classes

Class: route
Package

myway.route.

Source

route.lisp.

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

route-name.

Writers

(setf route-name).

Slot: rule
Readers

route-rule.

Writers

(setf route-rule).

Slot: handler
Initargs

:handler

Readers

route-handler.

Writers

(setf route-handler).


6.2 Internals


6.2.1 Special variables

Special Variable: *default-rule-methods*
Package

myway.rule.

Source

rule.lisp.

Special Variable: *next-route-function*
Package

myway.mapper.

Source

mapper.lisp.


6.2.2 Ordinary functions

Function: %make-regex-rule (&key methods url regex format-string param-keys)
Package

myway.rule.

Source

rule.lisp.

Function: %make-rule (&key methods url regex format-string param-keys)
Package

myway.rule.

Source

rule.lisp.

Function: compile-rule (rule)
Package

myway.rule.

Source

rule.lisp.

Function: copy-mapper (instance)
Package

myway.mapper.

Source

mapper.lisp.

Function: copy-regex-rule (instance)
Package

myway.rule.

Source

rule.lisp.

Function: copy-rule (instance)
Package

myway.rule.

Source

rule.lisp.

Function: escape-special-char (char)
Package

myway.rule.

Source

rule.lisp.

Function: list-to-map-set (elements)
Package

myway.rule.

Source

rule.lisp.

Reader: mapper-%routes (instance)
Writer: (setf mapper-%routes) (instance)
Package

myway.mapper.

Source

mapper.lisp.

Target Slot

%routes.

Function: mapper-p (object)
Package

myway.mapper.

Source

mapper.lisp.

Function: match-method-p (rule method &key allow-head)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-format-string (instance)
Package

myway.rule.

Source

rule.lisp.

Function: (setf regex-rule-format-string) (instance)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-methods (instance)
Package

myway.rule.

Source

rule.lisp.

Function: (setf regex-rule-methods) (instance)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-p (object)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-param-keys (instance)
Package

myway.rule.

Source

rule.lisp.

Function: (setf regex-rule-param-keys) (instance)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-regex (instance)
Package

myway.rule.

Source

rule.lisp.

Function: (setf regex-rule-regex) (instance)
Package

myway.rule.

Source

rule.lisp.

Function: regex-rule-url (instance)
Package

myway.rule.

Source

rule.lisp.

Function: (setf regex-rule-url) (instance)
Package

myway.rule.

Source

rule.lisp.

Reader: rule-format-string (instance)
Writer: (setf rule-format-string) (instance)
Package

myway.rule.

Source

rule.lisp.

Target Slot

format-string.

Reader: rule-methods (instance)
Writer: (setf rule-methods) (instance)
Package

myway.rule.

Source

rule.lisp.

Target Slot

methods.

Function: rule-p (object)
Package

myway.rule.

Source

rule.lisp.

Reader: rule-param-keys (instance)
Writer: (setf rule-param-keys) (instance)
Package

myway.rule.

Source

rule.lisp.

Target Slot

param-keys.

Reader: rule-regex (instance)
Writer: (setf rule-regex) (instance)
Package

myway.rule.

Source

rule.lisp.

Target Slot

regex.

Reader: rule-url (instance)
Writer: (setf rule-url) (instance)
Package

myway.rule.

Source

rule.lisp.

Target Slot

url.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   C   D   E   F   G   I   L   M   N   R   T   U  
Index Entry  Section

%
%make-regex-rule: Private ordinary functions
%make-rule: Private ordinary functions

(
(setf mapper-%routes): Private ordinary functions
(setf regex-rule-format-string): Private ordinary functions
(setf regex-rule-methods): Private ordinary functions
(setf regex-rule-param-keys): Private ordinary functions
(setf regex-rule-regex): Private ordinary functions
(setf regex-rule-url): Private ordinary functions
(setf route-handler): Public generic functions
(setf route-handler): Public generic functions
(setf route-name): Public generic functions
(setf route-name): Public generic functions
(setf route-rule): Public generic functions
(setf route-rule): Public generic functions
(setf rule-format-string): Private ordinary functions
(setf rule-methods): Private ordinary functions
(setf rule-param-keys): Private ordinary functions
(setf rule-regex): Private ordinary functions
(setf rule-url): Private ordinary functions

A
add-route: Public ordinary functions

C
clear-routes: Public ordinary functions
compile-rule: Private ordinary functions
connect: Public ordinary functions
copy-mapper: Private ordinary functions
copy-regex-rule: Private ordinary functions
copy-rule: Private ordinary functions

D
dispatch: Public ordinary functions

E
equal-route: Public generic functions
equal-route: Public generic functions
equal-rule: Public ordinary functions
escape-special-char: Private ordinary functions

F
find-route: Public ordinary functions
find-route-by-name: Public ordinary functions
Function, %make-regex-rule: Private ordinary functions
Function, %make-rule: Private ordinary functions
Function, (setf mapper-%routes): Private ordinary functions
Function, (setf regex-rule-format-string): Private ordinary functions
Function, (setf regex-rule-methods): Private ordinary functions
Function, (setf regex-rule-param-keys): Private ordinary functions
Function, (setf regex-rule-regex): Private ordinary functions
Function, (setf regex-rule-url): Private ordinary functions
Function, (setf rule-format-string): Private ordinary functions
Function, (setf rule-methods): Private ordinary functions
Function, (setf rule-param-keys): Private ordinary functions
Function, (setf rule-regex): Private ordinary functions
Function, (setf rule-url): Private ordinary functions
Function, add-route: Public ordinary functions
Function, clear-routes: Public ordinary functions
Function, compile-rule: Private ordinary functions
Function, connect: Public ordinary functions
Function, copy-mapper: Private ordinary functions
Function, copy-regex-rule: Private ordinary functions
Function, copy-rule: Private ordinary functions
Function, dispatch: Public ordinary functions
Function, equal-rule: Public ordinary functions
Function, escape-special-char: Private ordinary functions
Function, find-route: Public ordinary functions
Function, find-route-by-name: Public ordinary functions
Function, list-to-map-set: Private ordinary functions
Function, make-collector: Public ordinary functions
Function, make-mapper: Public ordinary functions
Function, make-rule: Public ordinary functions
Function, mapper-%routes: Private ordinary functions
Function, mapper-p: Private ordinary functions
Function, mapper-routes: Public ordinary functions
Function, match-method-p: Private ordinary functions
Function, match-rule: Public ordinary functions
Function, member-route: Public ordinary functions
Function, member-route-by-name: Public ordinary functions
Function, next-route: Public ordinary functions
Function, regex-rule-format-string: Private ordinary functions
Function, regex-rule-methods: Private ordinary functions
Function, regex-rule-p: Private ordinary functions
Function, regex-rule-param-keys: Private ordinary functions
Function, regex-rule-regex: Private ordinary functions
Function, regex-rule-url: Private ordinary functions
Function, rule-format-string: Private ordinary functions
Function, rule-methods: Private ordinary functions
Function, rule-p: Private ordinary functions
Function, rule-param-keys: Private ordinary functions
Function, rule-regex: Private ordinary functions
Function, rule-url: Private ordinary functions
Function, to-app: Public ordinary functions
Function, url-for: Public ordinary functions

G
Generic Function, (setf route-handler): Public generic functions
Generic Function, (setf route-name): Public generic functions
Generic Function, (setf route-rule): Public generic functions
Generic Function, equal-route: Public generic functions
Generic Function, match-route: Public generic functions
Generic Function, route-handler: Public generic functions
Generic Function, route-name: Public generic functions
Generic Function, route-rule: Public generic functions
Generic Function, rule-url-for: Public generic functions

I
initialize-instance: Public standalone methods

L
list-to-map-set: Private ordinary functions

M
make-collector: Public ordinary functions
make-mapper: Public ordinary functions
make-rule: Public ordinary functions
mapper-%routes: Private ordinary functions
mapper-p: Private ordinary functions
mapper-routes: Public ordinary functions
match-method-p: Private ordinary functions
match-route: Public generic functions
match-route: Public generic functions
match-rule: Public ordinary functions
member-route: Public ordinary functions
member-route-by-name: Public ordinary functions
Method, (setf route-handler): Public generic functions
Method, (setf route-name): Public generic functions
Method, (setf route-rule): Public generic functions
Method, equal-route: Public generic functions
Method, initialize-instance: Public standalone methods
Method, match-route: Public generic functions
Method, route-handler: Public generic functions
Method, route-name: Public generic functions
Method, route-rule: Public generic functions
Method, rule-url-for: Public generic functions
Method, rule-url-for: Public generic functions

N
next-route: Public ordinary functions

R
regex-rule-format-string: Private ordinary functions
regex-rule-methods: Private ordinary functions
regex-rule-p: Private ordinary functions
regex-rule-param-keys: Private ordinary functions
regex-rule-regex: Private ordinary functions
regex-rule-url: Private ordinary functions
route-handler: Public generic functions
route-handler: Public generic functions
route-name: Public generic functions
route-name: Public generic functions
route-rule: Public generic functions
route-rule: Public generic functions
rule-format-string: Private ordinary functions
rule-methods: Private ordinary functions
rule-p: Private ordinary functions
rule-param-keys: Private ordinary functions
rule-regex: Private ordinary functions
rule-url: Private ordinary functions
rule-url-for: Public generic functions
rule-url-for: Public generic functions
rule-url-for: Public generic functions

T
to-app: Public ordinary functions

U
url-for: Public ordinary functions


A.4 Data types

Jump to:   C   F   M   P   R   S   U  
Index Entry  Section

C
Class, route: Public classes

F
File, mapper.lisp: The myway/src/mapper․lisp file
File, myway.asd: The myway/myway․asd file
File, myway.lisp: The myway/src/myway․lisp file
File, route.lisp: The myway/src/route․lisp file
File, rule.lisp: The myway/src/rule․lisp file
File, util.lisp: The myway/src/util․lisp file

M
mapper: Public structures
mapper.lisp: The myway/src/mapper․lisp file
Module, src: The myway/src module
myway: The myway system
myway: The myway package
myway-asd: The myway-asd package
myway.asd: The myway/myway․asd file
myway.lisp: The myway/src/myway․lisp file
myway.mapper: The myway․mapper package
myway.route: The myway․route package
myway.rule: The myway․rule package
myway.util: The myway․util package

P
Package, myway: The myway package
Package, myway-asd: The myway-asd package
Package, myway.mapper: The myway․mapper package
Package, myway.route: The myway․route package
Package, myway.rule: The myway․rule package
Package, myway.util: The myway․util package

R
regex-rule: Public structures
route: Public classes
route.lisp: The myway/src/route․lisp file
rule: Public structures
rule.lisp: The myway/src/rule․lisp file

S
src: The myway/src module
Structure, mapper: Public structures
Structure, regex-rule: Public structures
Structure, rule: Public structures
System, myway: The myway system

U
util.lisp: The myway/src/util․lisp file