You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

114 lines
1.8 KiB

  1. # some dummy proc's to get things going for test purposes
  2. proc ip {} {
  3. return 10.0.0.55
  4. }
  5. proc start_chunked {a} {
  6. global httpdata
  7. global httpmime
  8. set httpmime $a
  9. set httpdata ""
  10. }
  11. proc write_chunked {a} {
  12. global httpdata
  13. append httpdata $a
  14. }
  15. proc end_chunked {} {
  16. }
  17. #proc formfetch {a} {
  18. # global httppostdata
  19. #catch {
  20. # echo "$a=$httppostdata($a)"
  21. #return $httppostdata($a)
  22. #}
  23. #
  24. #return ""
  25. #}
  26. proc tohex {a} {
  27. set r ""
  28. while 1 {
  29. set rem [expr $a%16]
  30. set a [expr $a/16]
  31. set r [string index "0123456789abcdef" $rem]$r
  32. if ($a==0) then break
  33. }
  34. return $r
  35. }
  36. # encode text
  37. proc encode {a} {
  38. return [string map {\n <br/> { } {&nbsp;} \t {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} > &gt; < &lt; / &#47;} $a]
  39. }
  40. #stubs that can be overriden to save between sessions
  41. proc load_var {a} {
  42. global glob_var
  43. catch {
  44. return $glob_var($a)
  45. }
  46. return ""
  47. }
  48. #stubs that can be overriden to save between sessions
  49. proc save_var {a b} {
  50. catch {
  51. set glob_var($a) $b
  52. return ""
  53. } err
  54. set glob_var($a) ""
  55. return ""
  56. }
  57. proc to_textarea {a} {
  58. return [string map {& &#38; > &gt; < &lt; / &#47;} $a]
  59. }
  60. proc from_textarea {a} {
  61. return [string map {&gt; > &lt; < &#38; & &#47; /} $a]
  62. }
  63. proc lunion {a b} {
  64. foreach e $a {
  65. set x($e) {}
  66. }
  67. foreach e $b {
  68. if {![info exists x($e)]} {
  69. lappend a $e
  70. }
  71. }
  72. return $a
  73. }
  74. # encode text
  75. proc encode {a} {
  76. return [string map {\n <br/> { } {&nbsp;} \t {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} > &gt; < &lt; / &#47;} $a]
  77. }
  78. # catch any exceptions, capture output and return it
  79. proc capture_catch {a} {
  80. catch {
  81. return [eval {capture $a}]
  82. } result
  83. return $result
  84. }
  85. proc zy1000_flash {} {
  86. set t [lindex 0 [ocd_flash_banks]]
  87. return $t(base)
  88. }