The DSP library#

The DSP module#

<dylan-server-page> Open Primary Class#
Superclasses:

<expiring-mixin>, <resource>

Init-Keywords:
  • source

<page-link> Open Class#
Superclasses:

<object>

Init-Keywords:
  • label

  • page-number

<paginator> Open Class#
Superclasses:

<sequence>

Init-Keywords:
  • current-page-number

  • page-size

  • sequence

<taglib> Class#
Superclasses:

<object>

Init-Keywords:
  • name

  • prefix

add-field-error Generic function#
Signature:

add-field-error (field-name message #rest format-arguments) => (#rest results)

Parameters:
  • field-name – An instance of <object>.

  • message – An instance of <object>.

  • format-arguments (#rest) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

add-page-error Generic function#
Signature:

add-page-error (format-string #rest format-arguments) => (#rest results)

Parameters:
  • format-string – An instance of <object>.

  • format-arguments (#rest) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

add-page-note Generic function#
Signature:

add-page-note (format-string #rest format-arguments) => (#rest results)

Parameters:
  • format-string – An instance of <object>.

  • format-arguments (#rest) – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

current-page-number Generic function#
Signature:

current-page-number (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

current-page-number-setter Generic function#
Signature:

current-page-number-setter (value object) => (#rest results)

Parameters:
  • value – An instance of <object>.

  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

current-row Function#
Signature:

current-row () => (#rest results)

Values:
  • #rest results – An instance of <object>.

current-row-number Function#
Signature:

current-row-number () => (#rest results)

Values:
  • #rest results – An instance of <object>.

get-field-errors Generic function#
Signature:

get-field-errors (field-name) => (#rest results)

Parameters:
  • field-name – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

get-named-method Generic function#
Signature:

get-named-method (taglib name) => (#rest results)

Parameters:
  • taglib – An instance of <object>.

  • name – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

get-tag-call-attribute Function#
Signature:

get-tag-call-attribute (attr #key as test) => (attribute-value)

Parameters:
  • attr – An instance of <object>.

  • as (#key) – An instance of <type>.

  • test (#key) – An instance of <object>.

Values:
  • attribute-value – An instance of <object>.

loop-index Generic function#
Signature:

loop-index () => (#rest results)

Values:
  • #rest results – An instance of <object>.

loop-value Generic function#
Signature:

loop-value () => (#rest results)

Values:
  • #rest results – An instance of <object>.

map-tag-call-attributes Function#
Signature:

map-tag-call-attributes (f #key exclude) => (#rest results)

Parameters:
  • f – An instance of <function>.

  • exclude (#key) – An instance of <sequence>.

Values:
  • #rest results – An instance of <object>.

named-method-definer Macro#
next-page-number Generic function#
Signature:

next-page-number (paginator) => (#rest results)

Parameters:
  • paginator – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

page-count Open Generic function#
Signature:

page-count (paginator) => (count)

Parameters:
  • paginator – An instance of <paginator>.

Values:
  • count – An instance of <integer>.

page-has-errors? Generic function#
Signature:

page-has-errors? () => (#rest results)

Values:
  • #rest results – An instance of <object>.

Signature:

page-link-label (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

Signature:

page-link-page-number (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

Signature:

page-links (paginator #key ellipsis prev next center-span min-pages) => (page-links)

Parameters:
  • paginator – An instance of <paginator>.

  • ellipsis (#key) – An instance of false-or(<string>).

  • prev (#key) – An instance of false-or(<string>).

  • next (#key) – An instance of false-or(<string>).

  • center-span (#key) – An instance of false-or(<integer>).

  • min-pages (#key) – An instance of false-or(<integer>).

Values:
  • page-links – An instance of <sequence>.

page-size Generic function#
Signature:

page-size (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

page-source Generic function#
Signature:

page-source (page) => (#rest results)

Parameters:
  • page – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

page-template Generic function#
Signature:

page-template (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

page-template-setter Generic function#
Signature:

page-template-setter (value object) => (#rest results)

Parameters:
  • value – An instance of <object>.

  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

paginator-sequence Generic function#
Signature:

paginator-sequence (object) => (#rest results)

Parameters:
  • object – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

previous-page-number Generic function#
Signature:

previous-page-number (paginator) => (#rest results)

Parameters:
  • paginator – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

process-template Generic function#
Signature:

process-template (page) => (#rest results)

Parameters:
  • page – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

register-tag Generic function#
Signature:

register-tag (tag taglib) => (#rest results)

Parameters:
  • tag – An instance of <object>.

  • taglib – An instance of <object>.

Values:
  • #rest results – An instance of <object>.

show-tag-call-attributes Function#
Signature:

show-tag-call-attributes (stream #key exclude) => (#rest results)

Parameters:
  • stream – An instance of <object>.

  • exclude (#key) – An instance of <sequence>.

Values:
  • #rest results – An instance of <object>.

tag-definer Macro#

Defines a new tag in the given tag library.

Signature:

define [modifiers] tag tag-name [in taglib-name] (method-parameters) (tag-call-parameters) body end

Parameters:
  • modifiers – The only valid modifier is body, which must be used if the tag allows nested body elements. If body is not specified then the tag call must end in /> or an error will be signalled when the DSP template is parsed. If body is specified, method-parameters must have a third parameter (see below).

  • tag-name – The name of the tag, as it will appear in the .dsp file.

  • taglib-name – The name of the taglib the tag should be added to.

  • method-parameters – Each tag definition creates a method that will be called when the tag is invoked. This is the parameter list for that method. The basic form of the parameter list is (page[, process-body]). page is an instance of <dylan-server-page>. process-body is an instance of <function>. The process-body argument should be specified if and only if the body modifier is supplied.

  • tag-call-parameterstag-call-parameters allows you to receive named keyword arguments from a tag call. For example, if your tag call looks like <xx:foo arg1="one" arg2="2"> then tag-call-parameters might look like (arg1, arg2) in which case body code may refer to arg1 and arg2. If the tag call doesn’t specify a given tag-call-parameter then #f will be used. If a tag-call-parameter has a type specifier, then the passed argument will be parsed into the appropriate type before it is passed. See the parse-tag-arg generic function. Note that this means specifying a type of which #f is not a member effectively makes the tag-call-parameter required. For example, (arg1, arg2 :: <integer>) specifies that arg1 is optional (it will be a <string> if supplied) and arg2 is required and must be parsable to an <integer>.

  • body – The body of the tag definition. method-parameter and tag-call-parameters are bound within the body.

Discussion:

Defines a new tag named tag-name in the taglib-name tag library. For simple DSP tags with no body elements, the body code normally just does output to the output stream of the current response, generating dynamic output in place of the literal tag call in the source file. Tags that have body elements may additionally want to setup state for nested tags to use. This may be done, for example, through the use of dynamically bound thread variables or storing information in the session or page context.

When the DSP engine invokes the tag to generate dynamic content it passes arguments that match method-parameters. tag-call-parameters receive arguments specified in the tag call, in the DSP source file, after they have been parsed to the specified types.

Example:

A simple tag in the “demo” taglib that displays “Hello, world!” in the page. It is invoked with <demo:hello/>:

define tag hello in demo
    (page :: <dylan-server-page>)
    ()
  format(output-stream(current-response()), "Hello, world!");
end;

A tag that allows body elements, and processes the body elements three times. It is invoked with <demo:three-times>...whatever...</demo:three-times>:

define body tag three-times in demo
    (page :: <dylan-server-page>,
     do-body :: <function>)
    ()
  for (i from 1 to 3)
    do-body();
  end;
end;
taglib-definer Macro#

Defines a new tag library.

Signature:

define taglib taglib-name () end

Parameters:
  • taglib-name – The name of the tag library.

validate-form-field Generic function#
Signature:

validate-form-field (field-name validator) => (#rest results)

Parameters:
  • field-name – An instance of <object>.

  • validator – An instance of <object>.

Values:
  • #rest results – An instance of <object>.