[ FYI, Nikolay, I'm cc'ing the AOLserver list on this reply, in case others want to comment on this as well. ]
On 2003.08.15, Nikolay Skachkov <[EMAIL PROTECTED]> wrote: > The problem is that there is nothing much of intelegent to be done with > -sameframe as such. The sameframe means that all the vatiables known at > the ns_include position are implicitly passed inside include. This lets > (or did let in vesrion 2.3 rather) write ns_include without parameters > and they are without parameters. > > The _std_ns_include wrapper you propose would be a proc with what > parameters? And with what parameters should I call it? - Apprently I > have to call _std_ns_include with <list of variables to be passed into > include> > > If I knew those list for each include, however, there will be already no > problem. But there are no lists in the current code. Drop this in your tcllib directory and call it something like ns_adp_include_compat.tcl: ----8<-snip-here-8<---- # # From AOLserver 2.x docs at http://aolserver.am.net/docs/2.3/tapi-c12.htm: # # ns_adp_include [-sameframe | -newframe] filename ?arg1? ?arg2? ?...? # proc ns_adp_include args { if ![llength $args] { error "wrong # args: should be \"ns_adp_include_compat ?switch? filename ?arg1? ?arg2? ?...?\"" } set switch -newframe set filename [lindex $args 0] set args [lrange $args 1 end] if [llength $args] { if [regexp {^-(same|new)frame} $filename] { set switch $filename set filename [lindex $args 0] set args [lrange $args 1 end] } } switch -exact -- $switch { -newframe { _ns_adp_include $filename $args } -sameframe { # rest of $args gets thrown away, and you can't ns_adp_bind_args # and ns_adp_argc and ns_adp_argc won't work either. set fd [open [ns_adp_dir]/$filename r] set script [read $fd] close $fd regsub -all [format (%s%s.) < %] $script "\\1 uplevel {" script regsub -all [format (%s%s) % >] $script "} \\1" script ns_adp_puts [ns_adp_eval $script] } } } ----8<-snip-here-8<---- WARNING WARNING WARNING WARNING -- This is absolutely ugly foul hackery and I'll probably go to that extra-special place in programmer Hell for people who allow code like this to enter into the world ... but, if you're determined to squish square pegs into round holes, let me be the first to give you a bigger hammer. ;-) > > "Huge rewrite" -- how many files/lines of code are we talking here? > > about 630 files, about 370 ns_includes That's tiny. I'd bet you a case of coca cola and a good meal that with a bit of shell kung-fu and a few Tcl and Perl scripts, all your existing code can be programmatically converted in an hour or two, with the rest of the day spent running your regression tests. -- Dossy -- Dossy Shiobara mail: [EMAIL PROTECTED] Panoptic Computer Network web: http://www.panoptic.com/ "He realized the fastest way to change is to laugh at your own folly -- then you can let go and quickly move on." (p. 70) -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
