Changeset a566515 in tol
- Timestamp:
- Feb 15, 2012, 2:53:26 PM (15 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 0d88c15
- Parents:
- 699b7d8
- Location:
- tolbase/lib/toltk
- Files:
-
- 3 edited
-
markuphelper.tcl (modified) (7 diffs)
-
tolbase.tcl (modified) (1 diff)
-
tolinspe.tcl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tolbase/lib/toltk/markuphelper.tcl
r699b7d8 ra566515 1 1 namespace eval ::MarkupHelper { 2 variable markup 2 variable markup {} 3 variable backup {} 4 variable indent 0 3 5 4 6 proc Init { } { 5 7 variable markup {} 8 variable restore {} 9 variable indent 0 10 } 11 12 proc SetIndent { n } { 13 variable indent 14 15 if { $n >= 0 && n <= 9 } { 16 set indent n 17 } 18 return $indent 19 } 20 21 proc IncrIndent { d } { 22 variable indent 23 24 set n [ incr indent $d ] 25 if { $indent < 0 } { 26 set indent 0 27 } elseif { $indent > 9 } { 28 set indent 9 29 } 30 return $indent 31 } 32 33 proc Indent { } { 34 variable indent 35 variable markup 36 37 append markup [ string repeat ":" $indent ] 38 } 39 40 proc Backup { } { 41 variable markup 42 variable backup $markup 43 44 return $backup 45 } 46 47 proc Restore { } { 48 variable markup 49 variable backup 50 51 set old $markup 52 set markup $backup 53 return $old 6 54 } 7 55 … … 52 100 variable markup 53 101 102 if { $markup eq "" } { 103 Indent 104 } 54 105 array set opts { -tags {} -br 0 } 55 106 array set opts $args … … 102 153 } 103 154 155 proc CR { } { 156 variable markup 157 158 append markup "\n" 159 } 160 104 161 proc BR { { br 1 } } { 105 162 variable markup 163 variable indent 106 164 107 165 if { $br } { 108 append markup " <br>" 166 if { $indent } { 167 append markup "\n" 168 Indent 169 } else { 170 append markup " <br>\n" 171 } 109 172 } 110 173 } … … 125 188 } 126 189 append markup "#---\n" 190 } 191 192 proc AppendHT { htBuffer } { 193 variable markup 194 195 append markup $htBuffer 127 196 } 128 197 … … 131 200 array set opts $args 132 201 202 set extraHTInfo {} 133 203 foreach {classOf insInfo insCont} {{} {} {}} break 134 204 if { $grammar eq "NameBlock" } { … … 144 214 set insCont [Tol_InstanceContent $objAddr] 145 215 } 216 if { $insInfo ne "" } { 217 Backup 218 Init 219 Header2 [ mc "Instance's Info" ] 220 foreach line [ split $insInfo \n ] { 221 set s [ string index $line 0 ] 222 set e [ string index $line end ] 223 if { $s eq "\[" && $e eq "\]" } { 224 Text "[ string range $line 1 end-1 ]:" \ 225 -tags {b} -br 1 226 } elseif { $s eq "{" && $e eq "}" } { 227 Text "[ string range $line 1 end-1 ]: " -tags {b} 228 } else { 229 Text \ 230 [ Preprocess [ string trimright $line ] ] -br 1 231 } 232 } 233 set extraHTInfo [ Restore ] 234 } 235 } elseif { $grammar eq "Set" } { 236 if { [ info exists opts(-objref) ] } { 237 set objRef $opts(-objref) 238 set classOf [Tol_StructOfFromReference $objRef] 239 } elseif { [ info exists opts(-objaddr) ] } { 240 set objAddr $opts(-objaddr) 241 set classOf [Tol_StructOf $objAddr] 242 } 243 if { $classOf ne "" } { 244 Backup 245 Init 246 BR 247 Text [ mc "Definition:" ] -tags b 248 CR 249 IncrIndent 1 250 BR 251 Text "Struct" -tags b 252 Text " $classOf {" 253 IncrIndent 1 254 BR 255 set fields [ tol::info struct $classOf ] 256 set ll0 [ llength $fields ] 257 set ll1 [ expr { $ll0 -1 } ] 258 for { set fi 0 } { $fi < $ll0 } { incr fi } { 259 foreach {n t} [ lindex $fields $fi ] break 260 Text "$t" -tags b 261 Text " ${n};" 262 if { $fi == $ll1 } { 263 IncrIndent -1 264 } 265 BR 266 } 267 Text "}" 268 IncrIndent -1 269 BR 270 set extraHTInfo [ Restore ] 271 } 146 272 } 147 273 Text "Grammar: " -tags b … … 173 299 [ Preprocess [ string trimright $desc ] ] 174 300 } 175 if { $insInfo ne "" } { 176 Header2 "Instance's Info" 177 foreach line [ split $insInfo \n ] { 178 set s [ string index $line 0 ] 179 set e [ string index $line end ] 180 if { $s eq "\[" && $e eq "\]" } { 181 Text "[ string range $line 1 end-1 ]:" \ 182 -tags {b} -br 1 183 } elseif { $s eq "{" && $e eq "}" } { 184 Text "[ string range $line 1 end-1 ]: " -tags {b} 185 } else { 186 Text \ 187 [ Preprocess [ string trimright $line ] ] -br 1 188 } 189 } 190 } 301 AppendHT $extraHTInfo 191 302 return [ GetText ] 192 303 } -
tolbase/lib/toltk/tolbase.tcl
r699b7d8 ra566515 557 557 default { 558 558 foreach {icon grammar name content path desc objRef} $args {} 559 560 559 if { $grammar eq "Anything" } { 561 560 if { [ regexp {/+\sClass\s} $content ] } { -
tolbase/lib/toltk/tolinspe.tcl
r699b7d8 ra566515 2012 2012 set addr [ ::tol::info address $objReference ] 2013 2013 return [ Tol_ClassOf $addr ] 2014 } 2015 2016 proc Tol_StructOf { obj_addr } { 2017 set tolcode [ string map [ list %A $obj_addr ] { 2018 Text { 2019 Anything obj = GetObjectFromAddress( "%A" ); 2020 // WriteLn( "Tol_StructOf " << Grammar( obj ) ); 2021 Text If( Grammar( obj ) == "Set", StructName( obj ), "" ) 2022 } 2023 } ] 2024 return [ lindex [ toltcl::eval $tolcode ] 0 ] 2025 } 2026 2027 proc Tol_StructOfFromReference { objReference } { 2028 set addr [ ::tol::info address $objReference ] 2029 return [ Tol_StructOf $addr ] 2014 2030 } 2015 2031
Note: See TracChangeset
for help on using the changeset viewer.
