00001 /* -*- tcl -*- */ 00002 /* -- $Id: writer_identity.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---*/ 00003 /* */ 00004 /* PAGE plugin - writer - Generic dump*/ 00005 /* */ 00006 00007 /* ### ### ### ######### ######### #########*/ 00008 /* Imported API*/ 00009 00010 /* -----------------+--*/ 00011 /* page_wdata | Access to processed input stream.*/ 00012 /* -----------------+--*/ 00013 /* page_info | Reporting to the user.*/ 00014 /* page_warning |*/ 00015 /* page_error |*/ 00016 /* -----------------+--*/ 00017 /* page_log_error | Reporting of internals.*/ 00018 /* page_log_warning |*/ 00019 /* page_log_info |*/ 00020 /* -----------------+--*/ 00021 00022 /* ### ### ### ######### ######### #########*/ 00023 /* Exported API*/ 00024 00025 /* -----------------+--*/ 00026 /* page_wfeature | Query for special plugin features page might wish to use.*/ 00027 /* page_wtime | Activate collection of timing statistics.*/ 00028 /* page_wgettime | Return the collected timing statistics.*/ 00029 /* page_wlabel | User readable label for the plugin.*/ 00030 /* page_whelp | Doctools help text for plugin.*/ 00031 /* page_woptions | Options understood by plugin.*/ 00032 /* page_wconfigure | Option (re)configuration.*/ 00033 /* page_wrun | Generate output from data per plugin configuration and hardwiring.*/ 00034 /* -----------------+--*/ 00035 00036 /* ### ### ### ######### ######### #########*/ 00037 /* Requisites*/ 00038 00039 global usec 00040 global timed 00041 timed = 0 00042 00043 /* ### ### ### ######### ######### #########*/ 00044 /* Implementation of exported API*/ 00045 00046 ret page_wlabel () { 00047 return {Raw data unchanged} 00048 } 00049 00050 ret page_wfeature (type key) { 00051 return [string eq $key timeable] 00052 } 00053 00054 ret page_wtime () { 00055 global timed 00056 set timed 1 00057 return 00058 } 00059 00060 ret page_wgettime () { 00061 global usec 00062 return $usec 00063 } 00064 ret page_whelp () { 00065 return {} 00066 } 00067 00068 ret page_woptions () { 00069 return {} 00070 } 00071 00072 ret page_wconfigure (type option , type value) { 00073 return -code error "Cannot set value of unknown option \"$option\"" 00074 } 00075 00076 ret page_wrun (type chan , type data) { 00077 global timed usec 00078 page_log_info "writer/identity/run/" 00079 00080 if {$timed} { 00081 set usec [lindex [time { 00082 puts $chan $data 00083 }] 0] ; #{} 00084 } else { 00085 puts $chan $data 00086 } 00087 00088 page_log_info "writer/identity/run/ok" 00089 return 00090 } 00091 00092 /* ### ### ### ######### ######### #########*/ 00093 /* Internal helper code.*/ 00094 00095 /* ### ### ### ######### ######### #########*/ 00096 /* Initialization*/ 00097 00098 package provide page::writer::identity 0.1 00099