Prashant Thakre and Tushar Gupta
Total Page:16
File Type:pdf, Size:1020Kb
Porting a large scale enterprise application from 2.0 Glossary Tcl/Tk 8.4 to 8.5 - A Case Study Description of terms used in the paper: Prashant Thakre, Tushar Gupta {prashant_thakre, [incr Tcl] - is an OO system for tushar_gupta}@mentor.com Tcl, and [incr Tcl] provides a similar object model, including multiple inheritance, and public 1.0 Abstract and private classes and variables. This paper describes the challenges involved in porting a [incr Tk] - Megawidget large scale enterprise framework based upon [incr application from Tcl/Tk 8.4 to Tcl]. Tcl/Tk 8.5, and lists down all Iwidgtes - is an object-oriented issues encountered during the mega-widget set which extends migration. The migration to Tcl/Tk and is based on [incr Tcl] Tcl/Tk 8.5 required adjustments and [incr Tk]. in application code, necessitated due to changes in [mti Widgets] - Collection of interface, or as a result of mega-widget, additions and unexpected functional enhancements to Iwidgets. This behaviour. On some occasions it megawidget requires TIP #125 was required to patch the (wm toplevel) Tcl/Tk 8.5 distribution with fixes which are now expected to be included into standard Tcl/Tk 3.0 Motivation release. The application Veloce The case-study describes in GUI, is from the Mentor detail various external and Emulation Division (MED) at internal dependencies requiring Mentor Graphics Corp. The resolution and covers Veloce GUI is used for performance related emulation compiles, emulation benchmarks/issues. Also, runtime control, and project changes in various packages management and most (core and external) resulting in importantly for design debug. regressions are discussed. The Typically customers use objective of the case-study is to emulation for some of the provide other developers an in- largest and the most complex sight into typical issues faced, System-on-a-chip (SOC) and suggest solutions wherever designs, and the Veloce GUI is available. tuned to handle large design databases as well as huge waveform data. Each such set Tcl/Tk commands and rendering of generated debug data having is observed as compared to 8.4 information about design release. Performance hierarchy; waveform and design benchmark data is also connectivity is called a dataset. reported in a separate section. The application uses object Object-oriented programming The paper concludes by sharing provided by [incr Tcl] package, the findings and by providing to support multiple our recommendations on how to simultaneous dataset debug, catch issues during early stages potentially belonging to of migration. different design databases. The code base for Veloce 4.0 Changes required GUI primarily consists of Tcl/Tk and C/C++. Veloce GUI in This section describes in general uses various Tcl/Tk detail various external and packages and required custom internal dependencies requiring build of Tk (8.4) necessitated by resolution. Also, change in usage of [mti Widgets] (TIP 125: various packages (core and Converting between frame and external) resulting in toplevel windows). Over time, regressions are discussed. we have observed various Tcl/Tk related issues in 8.4 have • tk/library/button.tcl: been fixed in 8.5. Also, since 8.5 release of Tcl/Tk has Package: incorporated TIP #125 (using This is part of new subcommands wm manage standard distribution. and wm forget), has various new features and is actively Issue: maintained, migrating from 8.4 Application uses was a necessity. check buton and radio button, and global As with any migration to a variable linked to the major release (8.5 in this case), buttons are specified it's bound to throw challenges using itcl::scope. This during build, implementation caused Tcl exception at and testing stage. The paper runtime. describes the changes required to build process along with Solution: changes to code base. Changes Patch the tcl to code are result of core Tcl/Tk distribution with available changes or due to changes in fix for bug # 87409. This the packages like [incr Tk]. fix uses uplevel set Also, the paper covers areas instead of set ::to work where change in behaviour of with itcl. [info level] with level argument as -1 in order to • [list]-Quoting of the '#' verify that the caller is character: tk::dialog::file. However, this no longer returns the Package: required information in This is part of Tcl/Tk 8.5. standard distribution. Solution: Issue: Level argument Application dumps passed to [info level] the tree contents during should be -2 instead of -1. automated testing to check for new regressions if any. Starting with • [pwd] Tcl/Tk 8.5, name of tree nodes starting with ‘#’ Package: are quoted by default. This is part of standard distribution. Solution: Application could Issue: either modify the routine In Tcl/Tk 8.4 if a dumping the contents of present working directory the tree if possible or gets deleted a call to pwd update the gold files. throws exception. However, starting with Tcl/Tk 8.5 pwd returns an • [info level] empty string and no longer throws exception. Package: This is part of Solution: standard distribution. Add check for empty string on return Issue: value of pwd. Change in information returned by [info level] command. Application in question • [tk_getOpenFile] disables cd command for a user. However, various Package: tk routines like This is part of tk_chooseDirectory, standard distribution. tk_getOpenFile, and tk_getSaveFile internally Issue: call cd. Until Tcl/Tk 8.4 In Tcl/Tk 8.4 application would call multiple file and directory selection using ctrl Package: throws an exception. This is part of standard distribution. Solution: This has been fixed Issue: in Tcl/Tk 8.5. No change Application allows is required in application docking and undocking of code. child windows. This was implemented in Tcl/Tk 8.4 • [incr Tk]: 3.4 using patch for [wm toplevel]. Package: However, this TIP This package is was incorporated into included with [incr Tcl] standard distribution with distribution. new wm subcommands manage and forget. Issue: [incr Tk] supplies Solution: three base classes that A procedure reside in the itk wm_toplevel was defined namespace: to handle all calls to [wm 1. itk::Archetype toplevel]. Following is the 2. itk::Widget definition of the 3. itk::Toplevel procedure. Application uses proc wm_toplevel {win {bool {}}} { [incr Tk] 3.2 with Tcl/Tk if {[llength [info level 8.4 and “–menu” option is 0]] == 2} { defined in base class return [expr {[winfo itk::Archetype. However, manager $win] eq "wm"}] with [incr Tk] 3.4 this } else { if {$bool} { option is now defined only wm manage $win for toplevel windows i.e. } else { itk::Toplevel. wm forget $win } Solution: } } Widgets derived from itk::Archetype will • BWidget: 1.9.2 no longer have “-menu” option defined and will Package: require necessary This package is part changes i.e. use of Tcllib and is itk::Toplevel instead. available at http://tcllib.sf.net/. • [TIP 125]: wm manage and wm forget Issue: Solution: Application was Required changes to using BWidget 1.6 and application code on case many interfaces level by case basis. Above changes have occurred mentioned code had to be since 1.6. The command replaced with Widget::create does the pack $left –expand renaming of the widgets yes –fill both –side left to $path:cmd and creates –padx 5 –pady 5 pack $button_frame – the proc to redirect the dise left –padx 5 –pady 5 widget commands. pack $right –expand yes –fill both –side left Solution: –padx 5 –pady 5 Change usage of BWlabel::create to Label::create. Also, BWidget 1.9.1 release was a development snapshot from the Tile enabled version. This release has • Drag and drop some compatibility issues and users are encouraged to upgrade to 1.9.2. Package: This is part of tkdnd distribution. • Incorrect gridding/packing of elements Issue: Application uses Package: tkdnd for supporting drag This is part of and drop. Incorrect text standard distribution. was dropped in some cases. Issue: This relates to Solution: incorrect display in Tcl/Tk A close inspection 8.5 as compared to 8.4. revealed that unnecessary For example following quoting was causing an would display the middle issue i.e. “%T” instead of element correctly in 8.4 %T in the bind script. but not in 8.5 where button_frame contains • Tk crash while trying to add and remove buttons. pack $left dock/undock a window $button_frame $right – repeatedly. expand yes –fill both – side left =padx –pady 5 Package: This is part of regressions in our test standard distribution. suites. Issue: Solution: Repeated docking Preferences were and undocking of child modified in the windows would result in a application to select a Tk crash. On closer larger font to fix inspection it seemed that regression issues found this was due to change in during automated testing. the way “-menu” option was configured. Most of these child windows were 5.0 Performance derived from itk::Archetype. Also, due Moving to newer to changes to “menu” in release of Tcl/Tk 8.5 has [incr Tk] 3.4, “menu” was caused some unexpected configured after first regressions in terms of undock operation. This performance. In a resulted in abnormal particular computation termination during intensive task (happens docking process. on C/C++ side) it was observed that the Solution: performance penalty can Configure “menu” be as high as 30%. option to empty during all Application is busy with docking operations and the computation and does configure it back to not take user inputs i.e. correct menu during no change in display of undocking. the application. Solution: • Change in font size. Currently we are trying to profile the Package: application in order to This is part of narrow down the exact standard distribution.