writer_mecpu.tcl

Go to the documentation of this file.
00001 /*  -*- tcl -*- */
00002 /*  -- $Id: writer_mecpu.tcl,v 1.2 2007/03/21 23:15:53 andreas_kupries Exp $ ---*/
00003 /* */
00004 /*  PAGE plugin - writer - ME cpu ~ Match Engine CPU*/
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::mecpu
00040 
00041 global usec
00042 global timed
00043     timed =  0
00044 
00045 /*  ### ### ### ######### ######### #########*/
00046 /*  Implementation of exported API*/
00047 
00048 ret  page_wlabel () {
00049     return {ME cpu Assembler}
00050 }
00051 
00052 ret  page_wfeature (type key) {
00053     return [string eq $key timeable]
00054 }
00055 
00056 ret  page_wtime () {
00057     global timed
00058     set    timed 1
00059     return
00060 }
00061 
00062 ret  page_wgettime () {
00063     global  usec
00064     return $usec
00065 }
00066 
00067 ret  page_whelp () {
00068     return {}
00069 }
00070 
00071 ret  page_woptions () {
00072     return {--package --copyright --template --cmarker}
00073 }
00074 
00075 ret  page_wconfigure (type option , type value) {
00076     switch -exact -- $option {
00077     --package {
00078         page::gen::peg::mecpu::package $value
00079     }
00080     --copyright {
00081         page::gen::peg::mecpu::copyright $value
00082     }
00083     --template {
00084         page::gen::peg::mecpu::template $value
00085     }
00086     --cmarker {
00087         page::gen::peg::mecpu::cmarker $value
00088     }
00089     default {
00090         return -code error "Cannot set value of unknown option \"$option\""
00091     }
00092     }
00093 }
00094 
00095 ret  page_wrun (type chan , type data) {
00096     global timed usec
00097     page_log_info "writer/me-cpu/run/"
00098 
00099     if {$timed} {
00100     set usec [lindex [time {
00101         page::gen::peg::mecpu $data $chan
00102     }] 0] ; #{}
00103     } else {
00104     page::gen::peg::mecpu $data $chan
00105     }
00106     page_log_info "writer/me-cpu/run/ok"
00107     return
00108 }
00109 
00110 /*  ### ### ### ######### ######### #########*/
00111 /*  Internal helper code.*/
00112 
00113 /*  ### ### ### ######### ######### #########*/
00114 /*  Initialization*/
00115 
00116 package provide page::writer::mecpu 0.1.1
00117 

Generated on 21 Sep 2010 for Gui by  doxygen 1.6.1