This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/6809

-- gerrit

commit f816152de01cf6be698507ea1508fce1cfd7d4ea
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Wed Jan 12 17:59:12 2022 +0100

    doc: use the new jimtcl syntax for 'expr'
    
    With jimtcl 0.81 the syntax of the TCL command 'expr' requires the
    multiple arguments to be within curly brackets.
    
    Update the examples in the documentation to follow the new syntax.
    While there, split one example to avoid it to exceed the line size
    during pdf document generation.
    
    Change-Id: I91cca419f8273415ccb0c2ce369fc6ac476e34e5
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/doc/manual/primer/tcl.txt b/doc/manual/primer/tcl.txt
index 868a75ba0..eba2f552d 100644
--- a/doc/manual/primer/tcl.txt
+++ b/doc/manual/primer/tcl.txt
@@ -174,7 +174,7 @@ them. It is similar to this bash statement.
        EXPORT vn=`date`
 
 LINE 2 & 3
-       set $vn [expr (1024 * $x)]
+       set $vn [expr {1024 * $x}]
        global $vn
 
 In line 1, we dynamically created a variable name.  Here, we are
diff --git a/doc/openocd.texi b/doc/openocd.texi
index 4d5a844af..cee54ebf7 100644
--- a/doc/openocd.texi
+++ b/doc/openocd.texi
@@ -2009,9 +2009,9 @@ proc setc15 @{regs value@} @{
 
     echo [format "set p15 0x%04x, 0x%08x" $regs $value]
 
-    arm mcr 15 [expr ($regs>>12)&0x7] \
-        [expr ($regs>>0)&0xf] [expr ($regs>>4)&0xf] \
-        [expr ($regs>>8)&0x7] $value
+    arm mcr 15 [expr @{($regs >> 12) & 0x7@}] \
+        [expr @{($regs >> 0) & 0xf@}] [expr @{($regs >> 4) & 0xf@}] \
+        [expr @{($regs >> 8) & 0x7@}] $value
 @}
 @end example
 
@@ -3157,7 +3157,9 @@ the target's supply voltage.
 The result can be converted to Volts (ignoring the most significant bytes, 
always zero)
 @example
 > set a [st-link cmd 8 0xf7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
-> echo [expr 2*1.2*([lindex $a 4]+256*[lindex $a 5])/([lindex $a 
0]+256*[lindex $a 1])]
+> set n [expr @{[lindex $a 4] + 256 * [lindex $a 5]@}]
+> set d [expr @{[lindex $a 0] + 256 * [lindex $a 1]@}]
+> echo [expr @{2 * 1.2 * $n / $d@}]
 3.24891518738
 @end example
 @end deffn
@@ -4523,13 +4525,13 @@ where the mask bit is 1. The following example sets 
HPROT3 (cacheable)
 and leaves the rest of the pattern intact. It configures memory access through
 DCache on Cortex-M7.
 @example
-set CSW_HPROT3_CACHEABLE [expr 1 << 27]
+set CSW_HPROT3_CACHEABLE [expr @{1 << 27@}]
 samv.dap apcsw $CSW_HPROT3_CACHEABLE $CSW_HPROT3_CACHEABLE
 @end example
 
 Another example clears SPROT bit and leaves the rest of pattern intact:
 @example
-set CSW_SPROT [expr 1 << 30]
+set CSW_SPROT [expr @{1 << 30@}]
 samv.dap apcsw 0 $CSW_SPROT
 @end example
 
@@ -8620,7 +8622,7 @@ In addition the following arguments may be specified:
 proc load_image_bin @{fname foffset address length @} @{
     # Load data from fname filename at foffset offset to
     # target at address. Load at most length bytes.
-    load_image $fname [expr $address - $foffset] bin \
+    load_image $fname [expr @{$address - $foffset@}] bin \
                $address $length
 @}
 @end example
@@ -10402,7 +10404,7 @@ trivial challenge-response protocol could be 
implemented as follows in a
 configuration file, immediately following @command{init}:
 @example
 set challenge [riscv authdata_read]
-riscv authdata_write [expr $challenge + 1]
+riscv authdata_write [expr @{$challenge + 1@}]
 @end example
 
 @deffn {Command} {riscv authdata_read}
@@ -12111,7 +12113,7 @@ it reads a file and executes as a script.
 @example
     set x 6
     set y 7
-    puts [format "The answer: %d" [expr $x * $y]]
+    puts [format "The answer: %d" [expr @{$x * $y@}]]
 @end example
 @enumerate
 @item The SET command creates 2 variables, X and Y.
@@ -12182,13 +12184,13 @@ proc myproc @{ @} @{
 @b{Dynamic variable creation}
 @example
 # Dynamically create a bunch of variables.
-for @{ set x 0 @} @{ $x < 32 @} @{ set x [expr $x + 1]@} @{
+for @{ set x 0 @} @{ $x < 32 @} @{ set x [expr @{$x + 1@}]@} @{
     # Create var name
     set vn [format "BIT%d" $x]
     # Make it a global
     global $vn
     # Set it.
-    set $vn [expr (1 << $x)]
+    set $vn [expr @{1 << $x@}]
 @}
 @end example
 @b{Dynamic proc/command creation}

-- 

Reply via email to