1# -*- tcl -*-
2# -- $Id: transform_realizable.tcl,v 1.1 2005/09/28 04:51:22 andreas_kupries Exp $ ---
3#
4# PAGE plugin - transform - realizable ~ Realizability Analysis
5#
6
7# ### ### ### ######### ######### #########
8## Imported API
9
10# -----------------+--
11# page_tdata       | Access to processed input stream.
12# -----------------+--
13# page_info        | Reporting to the user.
14# page_warning     |
15# page_error       |
16# -----------------+--
17# page_log_error   | Reporting of internals.
18# page_log_warning |
19# page_log_info    |
20# -----------------+--
21
22# ### ### ### ######### ######### #########
23## Exported API
24
25# -----------------+--
26# page_tfeature    | Query for special plugin features page might wish to use.
27# page_ttime       | Activate collection of timing statistics.
28# page_tgettime    | Return the collected timing statistics.
29# page_tlabel      | User readable label for the plugin.
30# page_thelp       | Doctools help text for plugin.
31# page_toptions    | Options understood by plugin.
32# page_tconfigure  | Option (re)configuration.
33# page_trun        | Transform input data per plugin configuration and hardwiring.
34# -----------------+--
35
36# ### ### ### ######### ######### #########
37## Requisites
38
39package require page::analysis::peg::realizable
40package require struct::tree         ; # Data structure.
41
42global usec
43global timed
44set    timed 0
45
46# ### ### ### ######### ######### #########
47## Implementation of exported API
48
49proc page_tlabel {} {
50    return Realizability
51}
52
53proc page_tfeature {key} {
54    return [string eq $key timeable]
55}
56
57proc page_ttime {} {
58    global timed
59    set    timed 1
60    return
61}
62
63proc page_tgettime {} {
64    global  usec
65    return $usec
66}
67
68proc page_thelp {} {
69    return {}
70}
71
72proc page_toptions {} {
73    return {}
74}
75
76proc page_tconfigure {option value} {
77    return -code error "Cannot set value of unknown option \"$option\""
78}
79
80proc page_trun {data} {
81    global timed usec
82    page_log_info "transform/realizable/run/"
83
84    if {$timed} {
85	set usec [lindex [time {
86	    ::struct::tree           ::tree deserialize $data
87	    ::page::analysis::peg::realizable::remove! ::tree
88	}] 0] ; #{}
89    } else {
90	::struct::tree           ::tree deserialize $data
91	::page::analysis::peg::realizable::remove! ::tree
92    }
93    set data [::tree serialize]
94    ::tree destroy
95
96    page_log_info "transform/realizable/run/ok"
97    return $data
98}
99
100# ### ### ### ######### ######### #########
101## Internal helper code.
102
103# ### ### ### ######### ######### #########
104## Initialization
105
106package provide page::transform::realizable 0.1
107