1# -*- tcl -*- 2# -- $Id: writer_identity.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ --- 3# 4# PAGE plugin - writer - Generic dump 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 {Raw data unchanged} 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} 64proc page_whelp {} { 65 return {} 66} 67 68proc page_woptions {} { 69 return {} 70} 71 72proc page_wconfigure {option value} { 73 return -code error "Cannot set value of unknown option \"$option\"" 74} 75 76proc page_wrun {chan data} { 77 global timed usec 78 page_log_info "writer/identity/run/" 79 80 if {$timed} { 81 set usec [lindex [time { 82 puts $chan $data 83 }] 0] ; #{} 84 } else { 85 puts $chan $data 86 } 87 88 page_log_info "writer/identity/run/ok" 89 return 90} 91 92# ### ### ### ######### ######### ######### 93## Internal helper code. 94 95# ### ### ### ######### ######### ######### 96## Initialization 97 98package provide page::writer::identity 0.1 99