1# -*- tcl -*-
2# -- $Id: writer_null.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
3#
4# PAGE plugin - writer - NULL ~ /dev/null the output
5#
6
7# ### ### ### ######### ######### #########
8## Imported API
9
10# -----------------+--
11# page_wdata       | Access to processed input stream.
12# -----------------+--
13# page_info        | Reporting to the user.
14# page_warning     |
15# page_error       |
16# -----------------+--
17# page_log_error   | Reporting of internals.
18# page_log_warning |
19# page_log_info    |
20# -----------------+--
21
22# ### ### ### ######### ######### #########
23## Exported API
24
25# -----------------+--
26# page_wfeature    | Query for special plugin features page might wish to use.
27# page_wtime       | Activate collection of timing statistics.
28# page_wgettime    | Return the collected timing statistics.
29# page_wlabel      | User readable label for the plugin.
30# page_whelp       | Doctools help text for plugin.
31# page_woptions    | Options understood by plugin.
32# page_wconfigure  | Option (re)configuration.
33# page_wrun        | Generate output from data per plugin configuration and hardwiring.
34# -----------------+--
35
36# ### ### ### ######### ######### #########
37## Requisites
38
39global usec
40global timed
41set    timed 0
42
43# ### ### ### ######### ######### #########
44## Implementation of exported API
45
46proc page_wlabel {} {
47    return /dev/null
48}
49
50proc page_wfeature {key} {
51    return [string eq $key timeable]
52}
53
54proc page_wtime {} {
55    global timed
56    set    timed 1
57    return
58}
59
60proc page_wgettime {} {
61    global  usec
62    return $usec
63}
64
65proc page_whelp {} {
66    return {}
67}
68
69proc page_woptions {} {
70    return {}
71}
72
73proc page_wconfigure {option value} {
74    return -code error "Cannot set value of unknown option \"$option\""
75}
76
77proc page_wrun {chan data} {
78    global timed usec
79    if {$timed} {
80	set usec [lindex [time {
81	    page_log_info "writer/null/run/"
82	    page_log_info "writer/null/run/ok"
83	}] 0] ; #{}
84    } else {
85	page_log_info "writer/null/run/"
86	page_log_info "writer/null/run/ok"
87    }
88    return
89}
90
91# ### ### ### ######### ######### #########
92## Internal helper code.
93
94# ### ### ### ######### ######### #########
95## Initialization
96
97package provide page::writer::null 0.1
98