reader_hb.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*- */
00002 /*  -- $Id: reader_hb.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---*/
00003 /* */
00004 /*  PAGE plugin - reader - HB ~ Half baked PEG Container*/
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 package require page::parse::peghb
00044 
00045 global usec
00046 global timed
00047     timed =  0
00048 
00049 /*  ### ### ### ######### ######### #########*/
00050 /*  Implementation of exported API*/
00051 
00052 ret  page_rlabel () {
00053     return {Halfbaked PEG Container}
00054 }
00055 
00056 ret  page_rfeature (type key) {
00057     return [string eq $key timeable]
00058 }
00059 
00060 ret  page_rtime () {
00061     global timed
00062     set    timed 1
00063     return
00064 }
00065 
00066 ret  page_rgettime () {
00067     global  usec
00068     return $usec
00069 }
00070 
00071 ret  page_rhelp () {
00072     return {}
00073 }
00074 
00075 ret  page_roptions () {
00076     return {}
00077 }
00078 
00079 ret  page_rconfigure (type option , type value) {
00080     return -code error "Cannot set value of unknown option \"$option\""
00081 }
00082 
00083 /*  proc page_rdata {} {}*/
00084 /*  Created in 'Initialize'*/
00085 
00086 ret  page_rrun () {
00087     global timed usec
00088     page_log_info "reader/hb/run/parse"
00089 
00090     struct::tree ::tree
00091 
00092     if {$timed} {
00093     set usec [lindex [time {
00094         page::parse::peghb [page_read] ::tree
00095     }] 0] ; #{}
00096     } else {
00097     page::parse::peghb [page_read] ::tree
00098     }
00099     page_read_done
00100 
00101     set ast [::tree serialize]
00102     ::tree destroy
00103 
00104     page_log_info "reader/hb/run/ok"
00105     return $ast
00106 }
00107 
00108 /*  ### ### ### ######### ######### #########*/
00109 /*  Internal helper code.*/
00110 
00111 /*  ### ### ### ######### ######### #########*/
00112 /*  Initialization*/
00113 
00114 package provide page::reader::hb 0.1
00115 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1