6.4 readable-snip<%>

► |  | The Racket Graphical Interface Toolkit

1 | Windowing
2 | Widget Gallery
3 | Windowing Classes
4 | Windowing Functions
5 | Editors
6 | Snip and Style Classes
7 | Editor Classes
8 | Editor Functions
9 | WXME Decoding
10 | Preferences
11 | Dynamic Loading
12 | Startup Actions
13 | Init Libraries
14 | Platform Dependencies
| Index

▼ | 6 | Snip and Style Classes

6.1 | add-color<%>
6.2 | image-snip%
6.3 | mult-color<%>
6.4 | readable-snip<%>
6.5 | snip%
6.6 | snip-admin%
6.7 | snip-class%
6.8 | snip-class-list<%>
6.9 | string-snip%
6.10 | style<%>
6.11 | style-delta%
6.12 | style-list%
6.13 | tab-snip%

On this page:

read-special

Racket
top contents ← prev up next →

interface readable-snip<%> : interface?

A readable-snip<%> object is treated specially by the port generated by open-input-text-editor: When a readable-snip<%> object is encountered for the input stream, its read-special method is called to generate the read result for the snip, which is returned from the port as a “special” value in the sense of read-char-or-special.

Since read and read-syntax build on read-char-or-special, a snip can implement readable-snip<%> so that it produces a whole S-expression or some other kind of value when read is used on a stream containing the snip.

> > method
> > (send a-readable-snip read-special |  | source |  |  |  |
> > |  | line |  |  |  |
> > |  | column |  |  |  |
> > |  | position) |  | → |  | any/c
> source : any/c
> line : (or/c exact-nonnegative-integer? #f)
> column : (or/c exact-nonnegative-integer? #f)
> position : (or/c exact-nonnegative-integer? #f)

The arguments are the same as the arguments to a procedure returned by a custom input port’s read-in; see Custom Ports for details. The result is also the same as the result from a read-in-produced procedure.
top contents ← prev up next →