Changeset a566515 in tol


Ignore:
Timestamp:
Feb 15, 2012, 2:53:26 PM (15 years ago)
Author:
Jorge Pérez <josp.jorge@…>
Branches:
1941-docker-image-to-test, devel, master
Children:
0d88c15
Parents:
699b7d8
Message:

fixes #1433, cuando el conjunto es estructurado se incluye la definición de la estructura en el panel info

git-svn-id: ​https://www.tol-project.org/svn/tolp/trunk@4142 be4846ae-f051-483a-831f-b64e7d08527f

Location:
tolbase/lib/toltk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tolbase/lib/toltk/markuphelper.tcl

    r699b7d8 ra566515  
    11namespace eval ::MarkupHelper {
    2   variable markup
     2  variable markup {}
     3  variable backup {}
     4  variable indent 0
    35
    46  proc Init { } {
    57    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
    654  }
    755
    … …  
    52100    variable markup
    53101
     102    if { $markup eq "" } {
     103      Indent
     104    }
    54105    array set opts { -tags {} -br 0 }
    55106    array set opts $args
    … …  
    102153  }
    103154
     155  proc CR { } {
     156    variable markup
     157
     158    append markup "\n"
     159  }
     160
    104161  proc BR { { br 1 } } {
    105162    variable markup
     163    variable indent
    106164
    107165    if { $br } {
    108       append markup " <br>"
     166      if { $indent } {
     167        append markup "\n"
     168        Indent
     169      } else {
     170        append markup " <br>\n"
     171      }
    109172    }
    110173  }
    … …  
    125188    }
    126189    append markup "#---\n"
     190  }
     191
     192  proc AppendHT { htBuffer } {
     193    variable markup
     194
     195    append markup $htBuffer
    127196  }
    128197
    … …  
    131200    array set opts $args
    132201
     202    set extraHTInfo {}
    133203    foreach {classOf insInfo insCont} {{} {} {}} break
    134204    if { $grammar eq "NameBlock" } {
    … …  
    144214        set insCont [Tol_InstanceContent $objAddr]
    145215      }
     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      }
    146272    }
    147273    Text "Grammar: " -tags b
    … …  
    173299          [ Preprocess [ string trimright $desc ] ]
    174300    }
    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
    191302    return [ GetText ]
    192303  }
  • tolbase/lib/toltk/tolbase.tcl

    r699b7d8 ra566515  
    557557    default {
    558558      foreach {icon grammar name content path desc objRef} $args {}
    559 
    560559      if { $grammar eq "Anything" } {
    561560        if { [ regexp {/+\sClass\s} $content ] } {
  • tolbase/lib/toltk/tolinspe.tcl

    r699b7d8 ra566515  
    20122012  set addr [ ::tol::info address $objReference ]
    20132013  return [ Tol_ClassOf $addr ]
     2014}
     2015
     2016proc 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
     2027proc Tol_StructOfFromReference { objReference } {
     2028  set addr [ ::tol::info address $objReference ]
     2029  return [ Tol_StructOf $addr ]
    20142030}
    20152031
Note: See TracChangeset for help on using the changeset viewer.