Index: modules/pt/pkgIndex.tcl ================================================================== --- modules/pt/pkgIndex.tcl +++ modules/pt/pkgIndex.tcl @@ -51,11 +51,14 @@ package ifneeded pt::peg::from::peg 1.0.3 [list source [file join $dir pt_peg_from_peg.tcl]] # PARAM runtime. package ifneeded pt::rde 1.1 [list source [file join $dir pt_rdengine.tcl]] package ifneeded pt::rde::oo 1.1 [list source [file join $dir pt_rdengine_oo.tcl]] -package ifneeded pt::rde::nx 1.1 [list source [file join $dir pt_rdengine_nx.tcl]] + +# Note: The last two numbers are the rde::nx version itself. The +# preceding version information is the rde::oo version it is based on. +package ifneeded pt::rde::nx 1.1.1.0 [list source [file join $dir pt_rdengine_nx.tcl]] # PEG grammar specification, as CONTAINER package ifneeded pt::peg::container::peg 1 [list source [file join $dir pt_peg_container_peg.tcl]] @@ -62,9 +65,9 @@ # */PARAM support (canned configurations). package ifneeded pt::cparam::configuration::critcl 1.0.2 [list source [file join $dir pt_cparam_config_critcl.tcl]] package ifneeded pt::cparam::configuration::tea 0.1 [list source [file join $dir pt_cparam_config_tea.tcl]] package ifneeded pt::tclparam::configuration::snit 1.0.2 [list source [file join $dir pt_tclparam_config_snit.tcl]] package ifneeded pt::tclparam::configuration::tcloo 1.0.4 [list source [file join $dir pt_tclparam_config_tcloo.tcl]] -package ifneeded pt::tclparam::configuration::nx 1.0.0 [list source [file join $dir pt_tclparam_config_nx.tcl]] +package ifneeded pt::tclparam::configuration::nx 1.0.1 [list source [file join $dir pt_tclparam_config_nx.tcl]] # Parser generator core. package ifneeded pt::pgen 1.0.3 [list source [file join $dir pt_pgen.tcl]] Index: modules/pt/pt_rdengine_nx.tcl ================================================================== --- modules/pt/pt_rdengine_nx.tcl +++ modules/pt/pt_rdengine_nx.tcl @@ -1,8 +1,8 @@ # -*- tcl -*- # -# Copyright (c) 2016 by Stefan Sobernig +# Copyright (c) 2016-2017 by Stefan Sobernig # # ## ### ##### ######## ############# ##################### ## Package description ## ... @@ -27,28 +27,35 @@ :alias instvar ::nsf::methods::object::instvar namespace eval [namespace qualifier [self]] { namespace import ::nsf::my } + set vars [info class variables ${:prototype}] + if {[llength $vars]} { + set vars [concat :instvar $vars] + } + ## clone constructor lassign [info class constructor ${:prototype}] ctorParams ctorBody - :method init $ctorParams [:injectVars $ctorBody] + + set ctorBody [string map [list @body@ $ctorBody @vars@ $vars] { + :require namespace; apply [list {} { + namespace import ::nsf::my + @vars@ + @body@ + } [self]] + }] + + :method init $ctorParams $ctorBody + ## clone all methods foreach m [info class methods ${:prototype} -private] { lassign [info class definition ${:prototype} $m] params body - :method $m $params [:injectVars $body] - } - } - :method injectVars {body} { - if {![info exists :vars]} { - set :vars [info class variables ${:prototype}] - } - if {[llength ${:vars}]} { - append tmp [list :instvar {*}${:vars}] "\n" $body; - return $tmp - } else { - return $body; + :method $m $params [string map [list @body@ $body @vars@ $vars] { + @vars@ + @body@ + }] } } } ## @@ -60,6 +67,6 @@ ClassFactory create nx -prototype ::pt::rde::oo } -package provide pt::rde::nx [package req pt::rde::oo] +package provide pt::rde::nx [package req pt::rde::oo].1.0 Index: modules/pt/pt_tclparam_config_nx.man ================================================================== --- modules/pt/pt_tclparam_config_nx.man +++ modules/pt/pt_tclparam_config_nx.man @@ -1,6 +1,6 @@ -[vset VERSION 1.0.0] +[vset VERSION 1.0.1] [comment {-*- text -*- doctools manpage}] [manpage_begin pt::tclparam::configuration::nx n [vset VERSION]] [include include/module.inc] [titledesc {Tcl/PARAM, Canned configuration, NX}] [require pt::tclparam::configuration::nx [opt [vset VERSION]]] Index: modules/pt/pt_tclparam_config_nx.tcl ================================================================== --- modules/pt/pt_tclparam_config_nx.tcl +++ modules/pt/pt_tclparam_config_nx.tcl @@ -94,11 +94,11 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide @@PKG@@ @@VERSION@@ - # return + return }]] return } @@ -107,7 +107,7 @@ namespace eval ::pt::tclparam::configuration::nx {} # # ## ### ##### ######## ############# ##################### ## Ready -package provide pt::tclparam::configuration::nx 1.0.0 +package provide pt::tclparam::configuration::nx 1.0.1 return Index: modules/pt/tests/data/ok/peg_tclparam-nx/0_basic_arithmetic ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/0_basic_arithmetic +++ modules/pt/tests/data/ok/peg_tclparam-nx/0_basic_arithmetic @@ -342,6 +342,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/10_notahead ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/10_notahead +++ modules/pt/tests/data/ok/peg_tclparam-nx/10_notahead @@ -96,6 +96,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/11_epsilon ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/11_epsilon +++ modules/pt/tests/data/ok/peg_tclparam-nx/11_epsilon @@ -69,6 +69,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/1_functions ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/1_functions +++ modules/pt/tests/data/ok/peg_tclparam-nx/1_functions @@ -114,6 +114,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/27_ticket_4a4e443ce9 ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/27_ticket_4a4e443ce9 +++ modules/pt/tests/data/ok/peg_tclparam-nx/27_ticket_4a4e443ce9 @@ -239,6 +239,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/2_fun_arithmetic ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/2_fun_arithmetic +++ modules/pt/tests/data/ok/peg_tclparam-nx/2_fun_arithmetic @@ -391,6 +391,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/3_peg_itself ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/3_peg_itself +++ modules/pt/tests/data/ok/peg_tclparam-nx/3_peg_itself @@ -2408,6 +2408,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/4_choice ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/4_choice +++ modules/pt/tests/data/ok/peg_tclparam-nx/4_choice @@ -56,6 +56,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/5_sequence ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/5_sequence +++ modules/pt/tests/data/ok/peg_tclparam-nx/5_sequence @@ -56,6 +56,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/6_optional ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/6_optional +++ modules/pt/tests/data/ok/peg_tclparam-nx/6_optional @@ -66,6 +66,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/7_kleene ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/7_kleene +++ modules/pt/tests/data/ok/peg_tclparam-nx/7_kleene @@ -68,6 +68,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/8_pkleene ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/8_pkleene +++ modules/pt/tests/data/ok/peg_tclparam-nx/8_pkleene @@ -71,6 +71,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return Index: modules/pt/tests/data/ok/peg_tclparam-nx/9_ahead ================================================================== --- modules/pt/tests/data/ok/peg_tclparam-nx/9_ahead +++ modules/pt/tests/data/ok/peg_tclparam-nx/9_ahead @@ -96,6 +96,6 @@ # # ## ### ##### ######## ############# ##################### ## Ready package provide NX_PACKAGE 1 -# return +return