Index: openacs-4/packages/acs-tcl/tcl/adp-parser-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/adp-parser-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-tcl/tcl/adp-parser-procs.tcl 10 Jan 2007 21:22:11 -0000 1.2 +++ openacs-4/packages/acs-tcl/tcl/adp-parser-procs.tcl 27 Oct 2014 16:40:05 -0000 1.3 @@ -97,7 +97,7 @@ Evaluates __code in a separate stack frame. } { - eval $__code + {*}$__code } ad_proc -public doc_adp_abort {} { @@ -140,9 +140,9 @@ # We use procs so that the Tcl code can be byte-code-compiled for extra performance # benefit. - if { [catch { set info [__doc_adp_cache_info,$file_name] }] || \ - [lindex $info 0] != $mtime || \ - [lindex $info 1] != $size } { + if { [catch { set info [__doc_adp_cache_info,$file_name] }] + || [lindex $info 0] != $mtime + || [lindex $info 1] != $size } { set reparse_p 1 } else { ns_log "Error" "CACHE HIT for $file_name" @@ -228,7 +228,7 @@ } # Append to the text buffer any text before the "<". - append text_buffer [string range $adp $index [expr { $lt_index - 1 }]] + append text_buffer [string range $adp $index $lt_index-1] set index $lt_index if { [info exists tag] } { @@ -244,29 +244,32 @@ if { [string index $adp $index] eq "/" } { set end_tag_p 1 incr index - } elseif { ![info exists literal_tag] && [string index $adp $index] == "%" } { + } elseif { ![info exists literal_tag] + && [string index $adp $index] eq "%" + } { doc_adp_flush_text_buffer incr index - if { [string index $adp $index] == "=" } { + if { [string index $adp $index] eq "=" } { incr index set puts_p 1 } else { set puts_p 0 } set tcl_code_begin $index - while { $index < [string length $adp] && \ - ([string index $adp $index] != "%" || [string index $adp [expr { $index + 1 }]] != ">") } { + while { $index < [string length $adp] + && ([string index $adp $index] ne "%" || [string index $adp $index+1] ne ">") + } { incr index } if { $index >= [string length $adp] } { return -code error "Unbalanced Tcl evaluation block" } - set tcl_code [string range $adp $tcl_code_begin [expr { $index - 1 }]] + set tcl_code [string range $adp $tcl_code_begin $index-1] if { $puts_p } { - doc_adp_append_code "doc_adp_puts \[subst [doc_adp_quote_tcl_string $tcl_code]]" + doc_adp_append_code "doc_adp_puts \[subst [doc_adp_quote_tcl_string $tcl_code]\]" } else { doc_adp_append_code $tcl_code } @@ -275,7 +278,7 @@ incr index 2 continue - } elseif { ![info exists literal_tag] && [string index $adp $index] == "$" } { + } elseif { ![info exists literal_tag] && [string index $adp $index] eq "$" } { incr index set tag "var" set end_tag_p 0 @@ -286,15 +289,17 @@ if { ![info exists tag] } { # Find the next non-word character. set tag_begin $index - while { [string index $adp $index] eq "-" || \ - [string is wordchar -strict [string index $adp $index]] } { + while { [string index $adp $index] eq "-" + || [string is wordchar -strict [string index $adp $index]] + } { incr index } - set tag [string range $adp $tag_begin [expr { $index - 1 }]] + set tag [string range $adp $tag_begin $index-1] } - if { (![info exists literal_tag] || ($end_tag_p && $tag eq $literal_tag)) && \ - [nsv_exists doc_adptags $tag] } { + if { (![info exists literal_tag] || ($end_tag_p && $tag eq $literal_tag)) + && [nsv_exists doc_adptags $tag] + } { doc_adp_flush_text_buffer if { [info exists literal_tag] } { @@ -313,27 +318,28 @@ } # If it's a >, we're done. - if { [string index $adp $index] == ">" } { + if { [string index $adp $index] eq ">" } { # Done with attribute list. incr index break } # Not a > - must be an attribute name. set attr_name_begin $index - while { $index < $adp_length && \ - [string index $adp $index] != ">" && \ - [string index $adp $index] != "=" && \ - ![string is space -strict [string index $adp $index]] } { + while { $index < $adp_length + && [string index $adp $index] ne ">" + && [string index $adp $index] ne "=" + && ![string is space -strict [string index $adp $index]] + } { incr index } - if { $attr_name_begin == $index } { + if { $attr_name_begin eq $index } { return -code error "Weird attribute format to tag \"$tag\"" } - set attr_name [string range $adp $attr_name_begin [expr { $index - 1 }]] + set attr_name [string range $adp $attr_name_begin $index-1] - if { [string index $adp $index] == "=" } { + if { [string index $adp $index] eq "=" } { incr index while { [string is space -strict [string index $adp $index]] } { incr index @@ -348,15 +354,16 @@ incr index } else { set value_begin $index - while { $index < $adp_length && \ - [string index $adp $index] != ">" && \ - [string index $adp $index] != "=" && \ - ![string is space -strict [string index $adp $index]] } { + while { $index < $adp_length + && [string index $adp $index] ne ">" + && [string index $adp $index] ne "=" + && ![string is space -strict [string index $adp $index]] + } { incr index } set value_end $index } - ns_set put $attributes $attr_name [string range $adp $value_begin [expr { $value_end - 1 }]] + ns_set put $attributes $attr_name [string range $adp $value_begin $value_end-1] } else { ns_set put $attributes $attr_name $attr_name } @@ -369,7 +376,7 @@ if { $tag ne [lindex $balanced_tag_stack end] } { return -code error "Expected end tag to be , not " } - set balanced_tag_stack [lrange $balanced_tag_stack 0 [expr { [llength $balanced_tag_stack] - 2 }]] + set balanced_tag_stack [lrange $balanced_tag_stack 0 [llength $balanced_tag_stack]-2] doc_adp_append_code "\}" } else { doc_adp_append_code "set __doc_attributes \[ns_set create\]" @@ -389,7 +396,7 @@ } } } else { - append text_buffer [string range $adp $lt_index [expr { $index - 1 }]] + append text_buffer [string range $adp $lt_index $index-1] } }