reader_treeser.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*- */
00002 /*  -- $Id: reader_treeser.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---*/
00003 /* */
00004 /*  PAGE plugin - reader - TREESER ~ Serialized TREE*/
00005 /* */
00006 
00007 /*  ### ### ### ######### ######### #########*/
00008 /*  Imported API*/
00009 
00010 /*  -----------------+--*/
00011 /*  page_read        | Access to the input stream.*/
00012 /*  page_read_done   |*/
00013 /*  page_eof         |*/
00014 /*  -----------------+--*/
00015 /*  page_info        | Reporting to the user.*/
00016 /*  page_warning     |*/
00017 /*  page_error       |*/
00018 /*  -----------------+--*/
00019 /*  page_log_error   | Reporting of internals.*/
00020 /*  page_log_warning |*/
00021 /*  page_log_info    |*/
00022 /*  -----------------+--*/
00023 
00024 /*  ### ### ### ######### ######### #########*/
00025 /*  Exported API*/
00026 
00027 /*  -----------------+--*/
00028 /*  page_rfeature    | Query for special plugin features page might wish to use.*/
00029 /*  page_rtime       | Activate collection of timing statistics.*/
00030 /*  page_rgettime    | Return the collected timing statistics.*/
00031 /*  page_rlabel      | User readable label for the plugin.*/
00032 /*  page_rhelp       | Doctools help text for plugin.*/
00033 /*  page_roptions    | Options understood by plugin.*/
00034 /*  page_rconfigure  | Option (re)configuration.*/
00035 /*  page_rdata       | External access to processed input stream.*/
00036 /*  page_rrun        | Process input stream per plugin configuration and hardwiring.*/
00037 /*  -----------------+--*/
00038 
00039 /*  ### ### ### ######### ######### #########*/
00040 /*  Requisites*/
00041 
00042 package require struct::tree ; /*  Data structure.*/
00043 
00044 global usec
00045 global timed
00046     timed =  0
00047 
00048 /*  ### ### ### ######### ######### #########*/
00049 /*  Implementation of exported API*/
00050 
00051 ret  page_rlabel () {
00052     return {Serialized Tree}
00053 }
00054 
00055 ret  page_rfeature (type key) {
00056     return [string eq $key timeable]
00057 }
00058 
00059 ret  page_rtime () {
00060     global timed
00061     set    timed 1
00062     return
00063 }
00064 
00065 ret  page_rgettime () {
00066     global  usec
00067     return $usec
00068 }
00069 
00070 ret  page_rhelp () {
00071     return {}
00072 }
00073 
00074 ret  page_roptions () {
00075     return {}
00076 }
00077 
00078 ret  page_rconfigure (type option , type value) {
00079     return -code error "Cannot set value of unknown option \"$option\""
00080 }
00081 
00082 /*  proc page_rdata {} {}*/
00083 /*  Created in 'Initialize'*/
00084 
00085 ret  page_rrun () {
00086     global timed usec
00087     page_log_info "reader/treeser/run/parse"
00088 
00089     if {$timed} {
00090     set usec [lindex [time {
00091         set data [page_read]
00092     }] 0] ; #{}
00093     } else {
00094     set data [page_read]
00095     }
00096     page_read_done
00097 
00098     # Reading and passing it on is trivial.
00099     # Here however we validate the we truly got
00100     # a sensible serialization.
00101 
00102     struct::tree ::tree
00103     ::tree deserialize $data
00104     ::tree destroy
00105 
00106     page_log_info "reader/treeser/run/ok"
00107     return $data
00108 }
00109 
00110 /*  ### ### ### ######### ######### #########*/
00111 /*  Internal helper code.*/
00112 
00113 /*  ### ### ### ######### ######### #########*/
00114 /*  Initialization*/
00115 
00116 package provide page::reader::treeser 0.1
00117 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1