The myway Reference Manual

Table of Contents

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

The myway Reference Manual

This is the myway Reference Manual, version 0.1.0, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:19:07 2018 GMT+0.


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

1 Introduction

My Way

My Way is a Sinatra-compatible URL routing library. This was originally written as Clack.Util.Route, a part of Clack.

Usage

(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

(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.

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

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

Installation

(ql:quickload :myway)

Author

Copyright

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

License

Licensed under the LLGPL License.


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

2 Systems

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


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

2.1 myway

Author

Eitaro Fukamachi

License

LLGPL

Description

Sinatra-compatible routing library.

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
Source

myway.asd (file)

Component

src (module)


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

3 Modules

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


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

3.1 myway/src

Parent

myway (system)

Location

src/

Components

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

4 Files

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


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

4.1 Lisp


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

4.1.1 myway.asd

Location

myway.asd

Systems

myway (system)

Packages

myway-asd


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

4.1.2 myway/src/myway.lisp

Dependencies
Parent

src (module)

Location

src/myway.lisp

Packages

myway

Exported Definitions

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

4.1.3 myway/src/rule.lisp

Parent

src (module)

Location

src/rule.lisp

Packages

myway.rule

Exported Definitions
Internal Definitions

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

4.1.4 myway/src/route.lisp

Dependency

rule.lisp (file)

Parent

src (module)

Location

src/route.lisp

Packages

myway.route

Exported Definitions

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

4.1.5 myway/src/mapper.lisp

Dependencies
Parent

src (module)

Location

src/mapper.lisp

Packages

myway.mapper

Exported Definitions
Internal Definitions

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

4.1.6 myway/src/util.lisp

Parent

src (module)

Location

src/util.lisp

Packages

myway.util

Exported Definitions

make-collector (function)


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

5 Packages

Packages are listed by definition order.


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

5.1 myway-asd

Source

myway.asd

Use List

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

5.2 myway

Source

myway.lisp (file)

Use List

common-lisp

Exported Definitions

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

5.3 myway.rule

Source

rule.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5.4 myway.route

Source

route.lisp (file)

Use List

common-lisp

Exported Definitions

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

5.5 myway.mapper

Source

mapper.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5.6 myway.util

Source

util.lisp (file)

Use List

common-lisp

Exported Definitions

make-collector (function)


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

6 Definitions

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


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

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *env*
Package

myway

Source

myway.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Functions

Function: add-route MAPPER ROUTE
Package

myway.mapper

Source

mapper.lisp (file)

Function: connect MAPPER URL FN &key METHOD REGEXP NAME
Package

myway

Source

myway.lisp (file)

Function: dispatch MAPPER URL-STRING &key METHOD ALLOW-HEAD
Package

myway.mapper

Source

mapper.lisp (file)

Function: equal-rule RULE1 RULE2
Package

myway.rule

Source

rule.lisp (file)

Function: find-route MAPPER URL &rest ARGS &key METHOD REGEXP NAME ROUTE-CLASS &allow-other-keys
Package

myway

Source

myway.lisp (file)

Function: make-collector ()
Package

myway.util

Source

util.lisp (file)

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

myway.mapper

Source

mapper.lisp (file)

Function: make-rule URL &key METHOD REGEXP
Package

myway.rule

Source

rule.lisp (file)

Function: mapper-routes MAPPER
Package

myway.mapper

Source

mapper.lisp (file)

Function: match-rule RULE METHOD URL-STRING &key ALLOW-HEAD
Package

myway.rule

Source

rule.lisp (file)

Function: member-route MAPPER ROUTE
Package

myway.mapper

Source

mapper.lisp (file)

Function: next-route ()
Package

myway.mapper

Source

mapper.lisp (file)

Function: to-app MAPPER
Package

myway

Source

myway.lisp (file)

Function: url-for ROUTE PARAMS
Package

myway.route

Source

route.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Generic functions

Generic Function: equal-route ROUTE1 ROUTE2
Package

myway.route

Source

route.lisp (file)

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 (file)

Methods
Method: match-route (ROUTE route) METHOD URL-STRING &key ALLOW-HEAD
Generic Function: route-handler OBJECT
Generic Function: (setf route-handler) NEW-VALUE OBJECT
Package

myway.route

Methods
Method: route-handler (ROUTE route)

automatically generated reader method

Source

route.lisp (file)

Method: (setf route-handler) NEW-VALUE (ROUTE route)

automatically generated writer method

Source

route.lisp (file)

Generic Function: route-name OBJECT
Generic Function: (setf route-name) NEW-VALUE OBJECT
Package

myway.route

Methods
Method: route-name (ROUTE route)

automatically generated reader method

Source

route.lisp (file)

Method: (setf route-name) NEW-VALUE (ROUTE route)

automatically generated writer method

Source

route.lisp (file)

Generic Function: route-rule OBJECT
Generic Function: (setf route-rule) NEW-VALUE OBJECT
Package

myway.route

Methods
Method: route-rule (ROUTE route)

automatically generated reader method

Source

route.lisp (file)

Method: (setf route-rule) NEW-VALUE (ROUTE route)

automatically generated writer method

Source

route.lisp (file)

Generic Function: rule-url-for RULE PARAMS
Package

myway.rule

Source

rule.lisp (file)

Methods
Method: rule-url-for (RULE rule) PARAMS
Method: rule-url-for (RULE regex-rule) PARAMS

Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Structures

Structure: mapper ()
Package

myway.mapper

Source

mapper.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: %routes
Initform

(myway.util:make-collector)

Readers

mapper-%routes (function)

Writers

(setf mapper-%routes) (function)

Structure: regex-rule ()
Package

myway.rule

Source

rule.lisp (file)

Direct superclasses

rule (structure)

Direct methods

rule-url-for (method)

Structure: rule ()
Package

myway.rule

Source

rule.lisp (file)

Direct superclasses

structure-object (structure)

Direct subclasses

regex-rule (structure)

Direct methods

rule-url-for (method)

Direct slots
Slot: methods
Type

map-set:map-set

Initform

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

Readers

rule-methods (function)

Writers

(setf rule-methods) (function)

Slot: url
Readers

rule-url (function)

Writers

(setf rule-url) (function)

Slot: regex
Readers

rule-regex (function)

Writers

(setf rule-regex) (function)

Slot: format-string
Readers

rule-format-string (function)

Writers

(setf rule-format-string) (function)

Slot: param-keys
Readers

rule-param-keys (function)

Writers

(setf rule-param-keys) (function)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.5 Classes

Class: route ()
Package

myway.route

Source

route.lisp (file)

Direct superclasses

standard-object (class)

Direct methods
Direct slots
Slot: name
Initargs

:name

Readers

route-name (generic function)

Writers

(setf route-name) (generic function)

Slot: rule
Readers

route-rule (generic function)

Writers

(setf route-rule) (generic function)

Slot: handler
Initargs

:handler

Readers

route-handler (generic function)

Writers

(setf route-handler) (generic function)


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

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Special variables

Special Variable: *default-rule-methods*
Package

myway.rule

Source

rule.lisp (file)

Special Variable: *next-route-function*
Package

myway.mapper

Source

mapper.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: %make-regex-rule &key (METHODS METHODS) (URL URL) (REGEX REGEX) (FORMAT-STRING FORMAT-STRING) (PARAM-KEYS PARAM-KEYS)
Package

myway.rule

Source

rule.lisp (file)

Function: %make-rule &key (METHODS METHODS) (URL URL) (REGEX REGEX) (FORMAT-STRING FORMAT-STRING) (PARAM-KEYS PARAM-KEYS)
Package

myway.rule

Source

rule.lisp (file)

Function: compile-rule RULE
Package

myway.rule

Source

rule.lisp (file)

Function: copy-mapper INSTANCE
Package

myway.mapper

Source

mapper.lisp (file)

Function: copy-regex-rule INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: copy-rule INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: escape-special-char CHAR
Package

myway.rule

Source

rule.lisp (file)

Function: list-to-map-set ELEMENTS
Package

myway.rule

Source

rule.lisp (file)

Function: mapper-%routes INSTANCE
Function: (setf mapper-%routes) VALUE INSTANCE
Package

myway.mapper

Source

mapper.lisp (file)

Function: mapper-p OBJECT
Package

myway.mapper

Source

mapper.lisp (file)

Function: match-method-p RULE METHOD &key ALLOW-HEAD
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-format-string INSTANCE
Function: (setf regex-rule-format-string) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-methods INSTANCE
Function: (setf regex-rule-methods) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-p OBJECT
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-param-keys INSTANCE
Function: (setf regex-rule-param-keys) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-regex INSTANCE
Function: (setf regex-rule-regex) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: regex-rule-url INSTANCE
Function: (setf regex-rule-url) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: rule-format-string INSTANCE
Function: (setf rule-format-string) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: rule-methods INSTANCE
Function: (setf rule-methods) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: rule-p OBJECT
Package

myway.rule

Source

rule.lisp (file)

Function: rule-param-keys INSTANCE
Function: (setf rule-param-keys) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: rule-regex INSTANCE
Function: (setf rule-regex) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)

Function: rule-url INSTANCE
Function: (setf rule-url) VALUE INSTANCE
Package

myway.rule

Source

rule.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, myway.asd: The myway<dot>asd file
File, Lisp, myway/src/mapper.lisp: The myway/src/mapper<dot>lisp file
File, Lisp, myway/src/myway.lisp: The myway/src/myway<dot>lisp file
File, Lisp, myway/src/route.lisp: The myway/src/route<dot>lisp file
File, Lisp, myway/src/rule.lisp: The myway/src/rule<dot>lisp file
File, Lisp, myway/src/util.lisp: The myway/src/util<dot>lisp file

L
Lisp File, myway.asd: The myway<dot>asd file
Lisp File, myway/src/mapper.lisp: The myway/src/mapper<dot>lisp file
Lisp File, myway/src/myway.lisp: The myway/src/myway<dot>lisp file
Lisp File, myway/src/route.lisp: The myway/src/route<dot>lisp file
Lisp File, myway/src/rule.lisp: The myway/src/rule<dot>lisp file
Lisp File, myway/src/util.lisp: The myway/src/util<dot>lisp file

M
Module, myway/src: The myway/src module
myway.asd: The myway<dot>asd file
myway/src: The myway/src module
myway/src/mapper.lisp: The myway/src/mapper<dot>lisp file
myway/src/myway.lisp: The myway/src/myway<dot>lisp file
myway/src/route.lisp: The myway/src/route<dot>lisp file
myway/src/rule.lisp: The myway/src/rule<dot>lisp file
myway/src/util.lisp: The myway/src/util<dot>lisp file

Jump to:   F   L   M  

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

A.2 Functions

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

%
%make-regex-rule: Internal functions
%make-rule: Internal functions

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

A
add-route: Exported functions

C
compile-rule: Internal functions
connect: Exported functions
copy-mapper: Internal functions
copy-regex-rule: Internal functions
copy-rule: Internal functions

D
dispatch: Exported functions

E
equal-route: Exported generic functions
equal-route: Exported generic functions
equal-rule: Exported functions
escape-special-char: Internal functions

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

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

L
list-to-map-set: Internal functions

M
make-collector: Exported functions
make-mapper: Exported functions
make-rule: Exported functions
mapper-%routes: Internal functions
mapper-p: Internal functions
mapper-routes: Exported functions
match-method-p: Internal functions
match-route: Exported generic functions
match-route: Exported generic functions
match-rule: Exported functions
member-route: Exported functions
Method, (setf route-handler): Exported generic functions
Method, (setf route-name): Exported generic functions
Method, (setf route-rule): Exported generic functions
Method, equal-route: Exported generic functions
Method, match-route: Exported generic functions
Method, route-handler: Exported generic functions
Method, route-name: Exported generic functions
Method, route-rule: Exported generic functions
Method, rule-url-for: Exported generic functions
Method, rule-url-for: Exported generic functions

N
next-route: Exported functions

R
regex-rule-format-string: Internal functions
regex-rule-methods: Internal functions
regex-rule-p: Internal functions
regex-rule-param-keys: Internal functions
regex-rule-regex: Internal functions
regex-rule-url: Internal functions
route-handler: Exported generic functions
route-handler: Exported generic functions
route-name: Exported generic functions
route-name: Exported generic functions
route-rule: Exported generic functions
route-rule: Exported generic functions
rule-format-string: Internal functions
rule-methods: Internal functions
rule-p: Internal functions
rule-param-keys: Internal functions
rule-regex: Internal functions
rule-url: Internal functions
rule-url-for: Exported generic functions
rule-url-for: Exported generic functions
rule-url-for: Exported generic functions

T
to-app: Exported functions

U
url-for: Exported functions

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

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

A.3 Variables

Jump to:   %   *  
F   H   M   N   P   R   S   U  
Index Entry  Section

%
%routes: Exported structures

*
*default-rule-methods*: Internal special variables
*env*: Exported special variables
*next-route-function*: Internal special variables

F
format-string: Exported structures

H
handler: Exported classes

M
methods: Exported structures

N
name: Exported classes

P
param-keys: Exported structures

R
regex: Exported structures
rule: Exported classes

S
Slot, %routes: Exported structures
Slot, format-string: Exported structures
Slot, handler: Exported classes
Slot, methods: Exported structures
Slot, name: Exported classes
Slot, param-keys: Exported structures
Slot, regex: Exported structures
Slot, rule: Exported classes
Slot, url: Exported structures
Special Variable, *default-rule-methods*: Internal special variables
Special Variable, *env*: Exported special variables
Special Variable, *next-route-function*: Internal special variables

U
url: Exported structures

Jump to:   %   *  
F   H   M   N   P   R   S   U  

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

A.4 Data types

Jump to:   C   M   P   R   S  
Index Entry  Section

C
Class, route: Exported classes

M
mapper: Exported structures
myway: The myway system
myway: The myway package
myway-asd: The myway-asd package
myway.mapper: The myway<dot>mapper package
myway.route: The myway<dot>route package
myway.rule: The myway<dot>rule package
myway.util: The myway<dot>util package

P
Package, myway: The myway package
Package, myway-asd: The myway-asd package
Package, myway.mapper: The myway<dot>mapper package
Package, myway.route: The myway<dot>route package
Package, myway.rule: The myway<dot>rule package
Package, myway.util: The myway<dot>util package

R
regex-rule: Exported structures
route: Exported classes
rule: Exported structures

S
Structure, mapper: Exported structures
Structure, regex-rule: Exported structures
Structure, rule: Exported structures
System, myway: The myway system

Jump to:   C   M   P   R   S