downlevel

The downlevel command (currently available in Eagle only), is used to evaluate a script in the variable context that existed just prior to the previous uplevel command.

Example #1:

    proc deepdown {} {
      lappend a 1
      uplevel 1 {
        lappend a 2
        downlevel {
          lappend a 3
          uplevel #0 {
            lappend a 4
            downlevel {
              lappend a 5
            }
          }
        }
      }
      return $a
    }

    deepdown; # returns 1 3 5

Example #2:

    proc deepdown2 {} {
      lappend a [info level]; # 1
      uplevel 1 {
        lappend a [info level]; # 0
        downlevel {
          lappend a [info level]; # 1
          uplevel #0 {
            lappend a [info level]; # 0
            downlevel {
              lappend a [info level]; # 1
            }
          }
        }
      }
      return $a
    }

    deepdown2; # returns 1 1 1