1# -*- tcl -*-
2# Copyright (c) 2009-2010 Andreas Kupries <andreas_kupries@sourceforge.net>
3
4# Canned configuration for the converter to Tcl/PARAM representation,
5# causing generation of a proper TclOO class.
6
7# # ## ### ##### ######## ############# #####################
8## Requirements
9
10package require Tcl 8.5              ; # Required runtime.
11
12# # ## ### ##### ######## ############# #####################
13##
14
15namespace eval ::pt::tclparam::configuration::tcloo {
16    namespace export   def
17    namespace ensemble create
18}
19
20# # ## ### ##### ######## #############
21## Public API
22
23# Check that the proposed serialization of an abstract syntax tree is
24# indeed such.
25
26proc ::pt::tclparam::configuration::tcloo::def {class pkg cmd} {
27
28    # TODO :: See if we can consolidate the API for converters,
29    # TODO :: plugins, export manager, and container in some way.
30    # TODO :: Container may make exporter manager available through
31    # TODO :: public method.
32
33    {*}$cmd -runtime-command my
34    {*}$cmd -self-command    my
35    {*}$cmd -proc-command    method
36    {*}$cmd -prelude         {}
37    {*}$cmd -namespace       {}
38    {*}$cmd -main            MAIN
39    {*}$cmd -indent          4
40    {*}$cmd -template        [string trim \
41				  [string map \
42				       [list \
43					    @@PKG@@   $pkg \
44					    @@CLASS@@ $class \
45					    \n\t \n \
46					   ] {
47	## -*- tcl -*-
48	##
49	## OO-based Tcl/PARAM implementation of the parsing
50	## expression grammar
51	##
52	##	@name@
53	##
54	## Generated from file	@file@
55	##            for user  @user@
56	##
57	# # ## ### ##### ######## ############# #####################
58	## Requirements
59
60	package require Tcl 8.5
61	package require OO
62	package require pt::rde::oo ; # OO-based implementation of the
63				      # PARAM virtual machine
64				      # underlying the Tcl/PARAM code
65				      # used below.
66
67	# # ## ### ##### ######## ############# #####################
68	##
69
70	oo::class create @@CLASS@@ {
71	    # # ## ### ##### ######## #############
72	    ## Public API
73
74	    superclass pt::rde::oo ; # TODO - Define this class.
75	                             # Or can we inherit from a snit
76	                             # class too ?
77
78	    method parse {channel} {
79		my reset $channel
80		my MAIN ; # Entrypoint for the generated code.
81		return [my complete]
82	    }
83
84	    method parset {text} {
85		my reset
86		my data $text
87		my MAIN ; # Entrypoint for the generated code.
88		return [my complete]
89	    }
90
91	    # # ## ### ###### ######## #############
92	    ## BEGIN of GENERATED CODE. DO NOT EDIT.
93
94@code@
95	    ## END of GENERATED CODE. DO NOT EDIT.
96	    # # ## ### ###### ######## #############
97	}
98
99	# # ## ### ##### ######## ############# #####################
100	## Ready
101
102	package provide @@PKG@@ 1
103	return
104    }]]
105
106    return
107}
108
109# # ## ### ##### ######## #############
110
111namespace eval ::pt::tclparam::configuration::tcloo {}
112
113# # ## ### ##### ######## ############# #####################
114## Ready
115
116package provide pt::tclparam::configuration::tcloo 1
117return
118