writer_ser.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*- */
00002 /*  -- $Id: writer_ser.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---*/
00003 /* */
00004 /*  PAGE plugin - writer - SER ~ Serialized PEG Container*/
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 package require page::gen::peg::ser
00040 package require struct::tree         ; /*  Data structure.*/
00041 
00042 global usec
00043 global timed
00044     timed =  0
00045 
00046 /*  ### ### ### ######### ######### #########*/
00047 /*  Implementation of exported API*/
00048 
00049 ret  page_wlabel () {
00050     return {Serialized PEG Container}
00051 }
00052 
00053 ret  page_wfeature (type key) {
00054     return [string eq $key timeable]
00055 }
00056 
00057 ret  page_wtime () {
00058     global timed
00059     set    timed 1
00060     return
00061 }
00062 
00063 ret  page_wgettime () {
00064     global  usec
00065     return $usec
00066 }
00067 ret  page_whelp () {
00068     return {}
00069 }
00070 
00071 ret  page_woptions () {
00072     return {}
00073 }
00074 
00075 ret  page_wconfigure (type option , type value) {
00076     return -code error "Cannot set value of unknown option \"$option\""
00077 }
00078 
00079 ret  page_wrun (type chan , type data) {
00080     global timed usec
00081     page_log_info "writer/ser/run/"
00082 
00083     if {$timed} {
00084     set usec [lindex [time {
00085         ::struct::tree      ::tree deserialize $data
00086         page::gen::peg::ser ::tree             $chan
00087     }] 0] ; #{}
00088     } else {
00089     ::struct::tree      ::tree deserialize $data
00090     page::gen::peg::ser ::tree             $chan
00091     }
00092     page_log_info "writer/ser/run/ok"
00093 
00094     ::tree destroy
00095     return
00096 }
00097 
00098 /*  ### ### ### ######### ######### #########*/
00099 /*  Internal helper code.*/
00100 
00101 /*  ### ### ### ######### ######### #########*/
00102 /*  Initialization*/
00103 
00104 package provide page::writer::ser 0.1
00105 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1