File: uevent.man

package info (click to toggle)
tcllib 1.10-dfsg-3
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 17,708 kB
  • ctags: 6,122
  • sloc: tcl: 106,354; ansic: 9,205; sh: 8,707; xml: 1,766; yacc: 753; makefile: 115; perl: 84; f90: 84; python: 33; ruby: 13; php: 11
file content (120 lines) | stat: -rw-r--r-- 3,896 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
[manpage_begin uevent n 0.1.2]
[copyright {2007 Andreas Kupries <andreas_kupries@users.sourceforge.net>}]
[moddesc   {User events}]
[titledesc {User events}]
[require Tcl 8.4]
[require uevent [opt 0.1.2]]
[require logger]
[keywords event bind unbind {generate event}]
[description]

This package provides a general facility for the handling of user
events. Allows the binding of arbitrary commands to arbitrary events
on arbitrary tags, removal of bindings, and event generation.

[para]

The main difference to the event system built into the Tcl/Tk core is
that the latter can generate only virtual events, and only for
widgets. It is not possible to use the builtin facilities to bind to
events on arbitrary (pseudo-)objects, nor is it able to generate
events for such.

[para]

Here we can, by assuming that each object in question is represented
by its own tag. Which is possible as we allow arbitrary tags.

[para]

More differences:

[list_begin enumerated]
[enum]

The package uses only a two-level hierarchy, tags and events, to
handle everything, whereas the Tcl/Tk system uses three levels, i.e.
objects, tags, and events, with a n:m relationship between objects and
tags.

[enum]
This package triggers all bound commands for a tag/event combination,
and they are independent of each other. A bound command cannot force
the event processing core to abort the processing of command coming
after it.

[list_end]

[section API]

The package exports three commands, as specified below:

[list_begin definitions]

[call [cmd ::uevent::bind] [arg tag] [arg event] [arg command]]

Using this command registers the [arg command] prefix to be triggered
when the [arg event] occurs for the [arg tag]. The result of the
command is an opaque token representing the binding. Note that if the
same combination of <[arg tag],[arg event],[arg command]> is used
multiple times the same token is returned by every call.

[para]

The signature of the [arg command] prefix is

[list_begin definitions]
[call [cmd command] [arg tag] [arg event] [arg details]]
[list_end]
[para]

where [arg details] contains the argument(s) of the event. Its
contents are event specific and have to be agreed upon between actual
event generator and consumer. This package simply transfers the
information and does not perform any processing beyond that.


[call [cmd ::uevent::unbind] [arg token]]

This command releases the event binding represented by the
[arg token]. The token has to be the result of a call to
[cmd ::uevent::bind]. The result of the command is the empty string.


[call [cmd ::uevent::generate] [arg tag] [arg event] [opt [arg details]]]

This command generates an [arg event] for the [arg tag], triggering
all commands bound to that combination. The [arg details] argument is
simply passed unchanged to all event handlers. It is the
responsibility of the code generating and consuming the event to have
an agreement about the format and contents of the information carried
therein. The result of the command is the empty string.

[para]

Note that all bound commands are triggered, independently of each
other. The event handlers cannot assume a specific order. They are
also [emph not] called synchronously with the invokation of this
command, but simply put into the event queue for processing when the
system returns to the event loop.

[para]

Generating an event for an unknown tag, or for a
<[arg tag],[arg event]> combination which has no commands bound to it
is allowed, such calls will be ignored.

[list_end]

[section {BUGS, IDEAS, FEEDBACK}]

This document, and the package it describes, will undoubtedly contain
bugs and other problems.

Please report such in the category [emph uevent] of the
[uri {http://sourceforge.net/tracker/?group_id=12883} {Tcllib SF Trackers}].

Please also report any ideas for enhancements you may have for either
package and/or documentation.

[manpage_end]