home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / vbgrammar.tcl < prev    next >
Text File  |  1997-05-07  |  54KB  |  1,963 lines

  1. #---------------------------------------------------------------------------
  2. #
  3. # Copyright (c) 1997 by Cayenne Software, Inc.
  4. #
  5. # This software is furnished under a license and may be used only in
  6. # accordance with the terms of such license and with the inclusion of
  7. # the above copyright notice. This software or any other copies thereof
  8. # may not be provided or otherwise made available to any other person.
  9. # No title to and ownership of the software is hereby transferred.
  10. #
  11. # The information in this software is subject to change without notice
  12. # and should not be construed as a commitment by Cayenne Software, Inc.
  13. #
  14. #---------------------------------------------------------------------------
  15. #
  16. #       File            : vbgrammar.tcl
  17. #       Author          : 
  18. #       Original date   : May 1997
  19. #       Description     : Classes for code generation
  20. #
  21. #---------------------------------------------------------------------------
  22.  
  23. #---------------------------------------------------------------------------
  24. #      File:           @(#)vbcookie.tcl    /main/hindenburg/5
  25. #---------------------------------------------------------------------------
  26.  
  27. # Start user added include file section
  28. # End user added include file section
  29.  
  30.  
  31. Class VBCookie : {Object} {
  32.     constructor
  33.     method destructor
  34. }
  35.  
  36. global VBCookie::inherAttribs
  37. set VBCookie::inherAttribs "' Inheritance attributes"
  38.  
  39. global VBCookie::events
  40. set VBCookie::events "' Events"
  41.  
  42. global VBCookie::implement0
  43. set VBCookie::implement0 "' Implement this function!"
  44.  
  45. global VBCookie::implement1
  46. set VBCookie::implement1 "'"
  47.  
  48. global VBCookie::startUserSection
  49. set VBCookie::startUserSection "' Start user section"
  50.  
  51. global VBCookie::endUserSection
  52. set VBCookie::endUserSection "' End user section"
  53.  
  54. global VBCookie::assocAttribs
  55. set VBCookie::assocAttribs "' Association attributes"
  56.  
  57. global VBCookie::userDefControl
  58. set VBCookie::userDefControl "' User defined control"
  59.  
  60. global VBCookie::userDefAttribs
  61. set VBCookie::userDefAttribs "' User defined attributes"
  62.  
  63. global VBCookie::userDefMethods
  64. set VBCookie::userDefMethods "' User defined methods"
  65.  
  66. global VBCookie::userDefEnums
  67. set VBCookie::userDefEnums "' User defined Enums"
  68.  
  69. global VBCookie::accessMethods
  70. set VBCookie::accessMethods "' Access methods"
  71.  
  72. global VBCookie::assocMethods
  73. set VBCookie::assocMethods "' Association methods"
  74.  
  75. global VBCookie::classFeatureAttribs
  76. set VBCookie::classFeatureAttribs "' Class feature attributes"
  77.  
  78. global VBCookie::classFeatureMethods
  79. set VBCookie::classFeatureMethods "' Class feature methods"
  80.  
  81. global VBCookie::regenMarker
  82. set VBCookie::regenMarker "' Do not delete this line -- regeneration marker"
  83.  
  84. global VBCookie::userAttribDefault
  85. set VBCookie::userAttribDefault "' Has default value "
  86.  
  87.  
  88. constructor VBCookie {class this} {
  89.     set this [Object::constructor $class $this $name]
  90.     # Start constructor user section
  91.     # End constructor user section
  92.     return $this
  93. }
  94.  
  95. method VBCookie::destructor {this} {
  96.     # Start destructor user section
  97.     # End destructor user section
  98. }
  99.  
  100. # Do not delete this line -- regeneration end marker
  101.  
  102. #---------------------------------------------------------------------------
  103. #      File:           @(#)vbargument.tcl    /main/hindenburg/2
  104. #---------------------------------------------------------------------------
  105.  
  106. # Start user added include file section
  107. # End user added include file section
  108.  
  109.  
  110. Class VBArgument : {GCObject} {
  111.     constructor
  112.     method destructor
  113.     method generate
  114.     attribute optional
  115.     attribute passedBy
  116.     attribute name
  117.     attribute type
  118. }
  119.  
  120. constructor VBArgument {class this type} {
  121.     set this [GCObject::constructor $class $this]
  122.     $this optional 0
  123.     $this type $type
  124.     # Start constructor user section
  125.         $this passedBy ""
  126.     # End constructor user section
  127.     return $this
  128. }
  129.  
  130. method VBArgument::destructor {this} {
  131.     # Start destructor user section
  132.     # End destructor user section
  133. }
  134.  
  135. method VBArgument::generate {this whole} {
  136.         if {[$this optional]} {$whole append "Optional "}
  137.         if {[$this passedBy] != ""} {
  138.               $whole append [$this passedBy]
  139.               $whole append " "
  140.         }
  141.         $whole append [$this name]
  142.         $whole append " "
  143.         [$this type] generate $whole
  144. }
  145.  
  146. # Do not delete this line -- regeneration end marker
  147.  
  148. #---------------------------------------------------------------------------
  149. #      File:           @(#)vbcomment.tcl    /main/hindenburg/1
  150. #---------------------------------------------------------------------------
  151.  
  152. # Start user added include file section
  153. # End user added include file section
  154.  
  155.  
  156. Class VBComment : {GCObject} {
  157.     constructor
  158.     method destructor
  159.     method generate
  160.     attribute comment
  161. }
  162.  
  163. constructor VBComment {class this} {
  164.     set this [GCObject::constructor $class $this]
  165.     # Start constructor user section
  166.     # End constructor user section
  167.     return $this
  168. }
  169.  
  170. method VBComment::destructor {this} {
  171.     # Start destructor user section
  172.     # End destructor user section
  173. }
  174.  
  175. method VBComment::generate {this section} {
  176.         if { [string length [$this comment]] > 0 } {
  177.                 set restComment [$this comment]
  178.                 set newlinePos [string first "\n" $restComment ]
  179.                 while {$newlinePos != -1} {
  180.                         set thisline [string range $restComment 0 [expr $newlinePos - 1]]
  181.                         set restComment \
  182.                                 [string range $restComment [expr $newlinePos + 1] end]
  183.                         set newlinePos [string first "\n" $restComment ]
  184.                         $section append "' $thisline\n"
  185.                 }
  186.                 $section append "' $restComment\n"
  187.         }
  188. }
  189.  
  190. # Do not delete this line -- regeneration end marker
  191.  
  192. #---------------------------------------------------------------------------
  193. #      File:           @(#)vbenumcons.tcl    /main/hindenburg/3
  194. #---------------------------------------------------------------------------
  195.  
  196. # Start user added include file section
  197. # End user added include file section
  198.  
  199.  
  200. Class VBEnumConstant : {GCObject} {
  201.     constructor
  202.     method destructor
  203.     method generate
  204.     method module
  205.     attribute refName
  206.     attribute name
  207.     attribute hasValue
  208.     attribute value
  209.     attribute comment
  210.     attribute _module
  211. }
  212.  
  213. constructor VBEnumConstant {class this module} {
  214.     set this [GCObject::constructor $class $this]
  215.     $this hasValue 0
  216.     $this _module $module
  217.     [$module _constSet] append $this
  218.     # Start constructor user section
  219.     $this comment ""      
  220.     # End constructor user section
  221.     return $this
  222. }
  223.  
  224. method VBEnumConstant::destructor {this} {
  225.     # Start destructor user section
  226.     # End destructor user section
  227. }
  228.  
  229. method VBEnumConstant::generate {this section} {
  230.         if {![$this hasValue]} {
  231.               $this value [[$this module] unique] 
  232.               $this hasValue 1
  233.         }
  234.         
  235.         if {[$this comment] != ""} {
  236.                [$this comment] generate $section
  237.         }
  238.         if {[$this refName] != ""} {
  239.               $section append [$this refName]
  240.               $section append "_"
  241.         }
  242.         $section append [$this name]
  243.         $section append " = "
  244.         $section append [$this value]
  245.         $section append "\n"
  246. }
  247.  
  248. # Do not delete this line -- regeneration end marker
  249.  
  250. method VBEnumConstant::module {this args} {
  251.     if {$args == ""} {
  252.         return [$this _module]
  253.     }
  254.     set ref [$this _module]
  255.     if {$ref != ""} {
  256.         [$ref _constSet] removeValue $this
  257.     }
  258.     set obj [lindex $args 0]
  259.     if {$obj != ""} {
  260.         [$obj _constSet] append $this
  261.     }
  262.     $this _module $obj
  263. }
  264.  
  265. #---------------------------------------------------------------------------
  266. #      File:           @(#)vbfeature.tcl    /main/hindenburg/3
  267. #---------------------------------------------------------------------------
  268.  
  269. # Start user added include file section
  270. # End user added include file section
  271.  
  272.  
  273. Class VBFeature : {GCObject} {
  274.     constructor
  275.     method destructor
  276.     attribute name
  277.     attribute refName
  278.     attribute access
  279.     attribute comment
  280. }
  281.  
  282. constructor VBFeature {class this} {
  283.     set this [GCObject::constructor $class $this]
  284.     # Start constructor user section
  285.     $this comment ""      
  286.     $this refName ""      
  287.     # End constructor user section
  288.     return $this
  289. }
  290.  
  291. method VBFeature::destructor {this} {
  292.     # Start destructor user section
  293.     # End destructor user section
  294. }
  295.  
  296. # Do not delete this line -- regeneration end marker
  297.  
  298. #---------------------------------------------------------------------------
  299. #      File:           @(#)vbproject.tcl    /main/hindenburg/6
  300. #---------------------------------------------------------------------------
  301.  
  302. # Start user added include file section
  303. # End user added include file section
  304.  
  305.  
  306. Class VBProject : {GCObject} {
  307.     constructor
  308.     method destructor
  309.     method generate
  310.     method getClassmodule
  311.     method setClassmodule
  312.     method removeClassmodule
  313.     method getForm
  314.     method setForm
  315.     method removeForm
  316.     method getModule
  317.     method setModule
  318.     method removeModule
  319.     attribute name
  320.     attribute mdiform
  321.     attribute classmodule
  322.     attribute form
  323.     attribute module
  324. }
  325.  
  326. constructor VBProject {class this} {
  327.     set this [GCObject::constructor $class $this]
  328.     $this classmodule [Dictionary new]
  329.     $this form [Dictionary new]
  330.     $this module [Dictionary new]
  331.     # Start constructor user section
  332.     # End constructor user section
  333.     return $this
  334. }
  335.  
  336. method VBProject::destructor {this} {
  337.     # Start destructor user section
  338.     # End destructor user section
  339. }
  340.  
  341. method VBProject::generate {this typeToClassDict} {
  342.         $typeToClassDict foreach ooplclass fileDict {
  343.               switch [$ooplclass baseClass] {
  344.                    "Form"    {    
  345.                         if {[[$this form] exists [$ooplclass getName]]} {
  346.                            set formfile [TextSection new]
  347.                            [[$this form] set [$ooplclass getName]] generate $formfile  
  348.                            $fileDict set "frm" $formfile
  349.                            
  350.                            if {[[[$this form] set [$ooplclass getName]] hasExtraModule]} {
  351.                                 set modulefile [TextSection new]
  352.                                 [[$this form] set [$ooplclass getName]] generateExtraModule $modulefile  
  353.                                 $fileDict set "bas" $modulefile
  354.                            }
  355.                         }
  356.                    }
  357.                    "Class"   {    
  358.                         if {[[$this classmodule] exists [$ooplclass getName]]} {
  359.                            set classfile [TextSection new]
  360.                            [[$this classmodule] set [$ooplclass getName]] generate $classfile 
  361.                            $fileDict set "cls" $classfile
  362.  
  363.                            if {[[[$this classmodule] set [$ooplclass getName]] hasExtraModule]} {
  364.                                 set modulefile [TextSection new]
  365.                                 [[$this classmodule] set [$ooplclass getName]] generateExtraModule $modulefile  
  366.                                 $fileDict set "bas" $modulefile
  367.                            }
  368.                         }
  369.                    }
  370.                    "MDIForm" {
  371.                         if {[$this mdiform] != ""} {
  372.                            set mdiformfile [TextSection new]
  373.                            [$this mdiform] generate $mdiformfile  
  374.                            $fileDict set "frm" $mdiformfile
  375.  
  376.                            if {[[$this mdiform] hasExtraModule]} {
  377.                                 set modulefile [TextSection new]
  378.                                 [$this mdiform] generateExtraModule $modulefile  
  379.                                 $fileDict set "bas" $modulefile
  380.                            }
  381.                         }
  382.                    } 
  383.                    "Enum"    { 
  384.                         if {[[$this module] exists [$ooplclass getName]]} {
  385.                             set modulefile [TextSection new]
  386.                             [[$this module] set [$ooplclass getName]] generate $modulefile  
  387.                             $fileDict set "bas" $modulefile
  388.                         }
  389.                    }
  390.              }
  391.        }
  392. }
  393.  
  394. # Do not delete this line -- regeneration end marker
  395.  
  396. method VBProject::getClassmodule {this name} {
  397.     return [[$this classmodule] set $name]
  398. }
  399.  
  400. method VBProject::setClassmodule {this name newClassmodule} {
  401.     [$this classmodule] set $name $newClassmodule
  402. }
  403.  
  404. method VBProject::removeClassmodule {this name} {
  405.     [$this classmodule] unset $name
  406. }
  407.  
  408. method VBProject::getForm {this name} {
  409.     return [[$this form] set $name]
  410. }
  411.  
  412. method VBProject::setForm {this name newForm} {
  413.     [$this form] set $name $newForm
  414. }
  415.  
  416. method VBProject::removeForm {this name} {
  417.     [$this form] unset $name
  418. }
  419.  
  420. method VBProject::getModule {this name} {
  421.     return [[$this module] set $name]
  422. }
  423.  
  424. method VBProject::setModule {this name newModule} {
  425.     [$this module] set $name $newModule
  426. }
  427.  
  428. method VBProject::removeModule {this name} {
  429.     [$this module] unset $name
  430. }
  431.  
  432. #---------------------------------------------------------------------------
  433. #      File:           @(#)vbtype.tcl    /main/hindenburg/1
  434. #---------------------------------------------------------------------------
  435.  
  436. # Start user added include file section
  437. # End user added include file section
  438.  
  439.  
  440. Class VBType : {GCObject} {
  441.     constructor
  442.     method destructor
  443.     method generate
  444.     attribute name
  445. }
  446.  
  447. constructor VBType {class this} {
  448.     set this [GCObject::constructor $class $this]
  449.     # Start constructor user section
  450.     # End constructor user section
  451.     return $this
  452. }
  453.  
  454. method VBType::destructor {this} {
  455.     # Start destructor user section
  456.     # End destructor user section
  457. }
  458.  
  459. method VBType::generate {this whole} {
  460.         $whole append "As "
  461.         $whole append [$this name] 
  462. }
  463.  
  464. # Do not delete this line -- regeneration end marker
  465.  
  466. #---------------------------------------------------------------------------
  467. #      File:           @(#)vbobject.tcl    /main/hindenburg/1
  468. #---------------------------------------------------------------------------
  469.  
  470. # Start user added include file section
  471. # End user added include file section
  472.  
  473.  
  474. Class VBObject : {GCObject} {
  475.     constructor
  476.     method destructor
  477. }
  478.  
  479. constructor VBObject {class this} {
  480.     set this [GCObject::constructor $class $this]
  481.     # Start constructor user section
  482.     # End constructor user section
  483.     return $this
  484. }
  485.  
  486. method VBObject::destructor {this} {
  487.     # Start destructor user section
  488.     # End destructor user section
  489. }
  490.  
  491. # Do not delete this line -- regeneration end marker
  492.  
  493. #---------------------------------------------------------------------------
  494. #      File:           @(#)vbprocedur.tcl    /main/hindenburg/7
  495. #---------------------------------------------------------------------------
  496.  
  497. # Start user added include file section
  498. # End user added include file section
  499.  
  500.  
  501. Class VBProcedure : {VBFeature} {
  502.     constructor
  503.     method destructor
  504.     method generateGenCode
  505.     method generateUserCode
  506.     method generateBegin
  507.     method generateBeginArguments
  508.     method generateBeginSub
  509.     method generateMiddle
  510.     method generateEnd
  511.     method generate
  512.     method addArg
  513.     method removeArg
  514.     attribute procType
  515.     attribute hasUserSection
  516.     attribute userCodeFirst
  517.     attribute usercode
  518.     attribute gencode
  519.     attribute argSet
  520. }
  521.  
  522. constructor VBProcedure {class this} {
  523.     set this [VBFeature::constructor $class $this]
  524.     $this procType "None"
  525.     $this hasUserSection 1
  526.     $this userCodeFirst 0
  527.     $this argSet [List new]
  528.     # Start constructor user section
  529.     $this usercode ""
  530.     $this gencode  ""
  531.     # End constructor user section
  532.     return $this
  533. }
  534.  
  535. method VBProcedure::destructor {this} {
  536.     # Start destructor user section
  537.     # End destructor user section
  538.     $this VBFeature::destructor
  539. }
  540.  
  541. method VBProcedure::generateGenCode {this whole} {
  542.       $whole indent +
  543.       if {[$this gencode] != ""} {
  544.             $whole appendSect [$this gencode] 
  545.       } elseif {![$this hasUserSection] && [$this usercode] == ""} {
  546.             $whole append "${VBCookie::implement0}\n"  
  547.             $whole append "${VBCookie::implement1}\n"  
  548.       }
  549.       $whole indent -
  550. }
  551.  
  552. method VBProcedure::generateUserCode {this whole} {
  553.         if {[$this hasUserSection]} {
  554.               $whole indent +
  555.               $whole append "${VBCookie::startUserSection}\n"  
  556.               $whole indent -
  557.         }
  558.  
  559.         if {[$this usercode] != ""} {
  560.               $whole appendSect [$this usercode]
  561.         }
  562.  
  563.         if {[$this hasUserSection]} {
  564.               $whole indent +
  565.               $whole append "${VBCookie::endUserSection}\n"  
  566.               $whole indent -
  567.         }
  568. }
  569.  
  570. method VBProcedure::generateBegin {this whole} {
  571.         if {[$this comment] != ""} {
  572.               [$this comment] generate $whole
  573.         }
  574.         $whole append [$this access]
  575.         $whole append " "
  576.         $whole append [$this procType]
  577.         $whole append " "
  578.         if {[$this refName] != ""} {
  579.               $whole append [$this refName]
  580.               $whole append "_"
  581.         }
  582.         $whole append [$this name]
  583.         $this generateBeginArguments $whole
  584. }
  585.  
  586. method VBProcedure::generateBeginArguments {this whole} {
  587.         $whole append "("
  588.         set first 1
  589.         [$this argSet] foreach arg {
  590.                 if {$first} {
  591.                         set first 0
  592.                 } else {
  593.                         $whole append ", "
  594.                 }
  595.                 $arg generate $whole
  596.         }
  597.         $whole append ")"
  598. }
  599.  
  600. method VBProcedure::generateBeginSub {this whole} {
  601.         $whole append "\n"
  602. }
  603.  
  604. method VBProcedure::generateMiddle {this whole} {
  605.         if {[$this userCodeFirst]} {
  606.            $this generateUserCode $whole
  607.            $this generateGenCode $whole
  608.         } else {
  609.            $this generateGenCode $whole
  610.            $this generateUserCode $whole
  611.         }
  612. }
  613.  
  614. method VBProcedure::generateEnd {this whole} {
  615.         $whole append "End "
  616.         $whole append [$this procType]
  617.         $whole append "\n\n"
  618. }
  619.  
  620. method VBProcedure::generate {this whole} {
  621.         if {[$this access] != "None"} {
  622.             $this generateBegin $whole
  623.             $this generateBeginSub $whole
  624.             $this generateMiddle $whole
  625.             $this generateEnd $whole
  626.         }
  627. }
  628.  
  629. # Do not delete this line -- regeneration end marker
  630.  
  631. method VBProcedure::addArg {this newArg} {
  632.     [$this argSet] append $newArg
  633.  
  634. }
  635.  
  636. method VBProcedure::removeArg {this oldArg} {
  637.     [$this argSet] removeValue $oldArg
  638. }
  639.  
  640. #---------------------------------------------------------------------------
  641. #      File:           @(#)vbproperty.tcl    /main/hindenburg/1
  642. #---------------------------------------------------------------------------
  643.  
  644. # Start user added include file section
  645. # End user added include file section
  646.  
  647.  
  648. Class VBProperty : {VBProcedure} {
  649.     constructor
  650.     method destructor
  651.     method generateEnd
  652.     attribute procType
  653.     attribute hasUserSection
  654. }
  655.  
  656. constructor VBProperty {class this} {
  657.     set this [VBProcedure::constructor $class $this]
  658.     $this procType "Property None"
  659.     $this hasUserSection 0
  660.     # Start constructor user section
  661.     # End constructor user section
  662.     return $this
  663. }
  664.  
  665. method VBProperty::destructor {this} {
  666.     # Start destructor user section
  667.     # End destructor user section
  668.     $this VBProcedure::destructor
  669. }
  670.  
  671. method VBProperty::generateEnd {this whole} {
  672.         $whole append "End Property"
  673.         $whole append "\n\n"
  674. }
  675.  
  676. # Do not delete this line -- regeneration end marker
  677.  
  678. #---------------------------------------------------------------------------
  679. #      File:           @(#)vbsetprope.tcl    /main/hindenburg/1
  680. #---------------------------------------------------------------------------
  681.  
  682. # Start user added include file section
  683. # End user added include file section
  684.  
  685.  
  686. Class VBSetProperty : {VBProperty} {
  687.     constructor
  688.     method destructor
  689.     attribute procType
  690. }
  691.  
  692. constructor VBSetProperty {class this} {
  693.     set this [VBProperty::constructor $class $this]
  694.     $this procType "Property Set"
  695.     # Start constructor user section
  696.     # End constructor user section
  697.     return $this
  698. }
  699.  
  700. method VBSetProperty::destructor {this} {
  701.     # Start destructor user section
  702.     # End destructor user section
  703.     $this VBProperty::destructor
  704. }
  705.  
  706. # Do not delete this line -- regeneration end marker
  707.  
  708. #---------------------------------------------------------------------------
  709. #      File:           @(#)vbgetprope.tcl    /main/hindenburg/1
  710. #---------------------------------------------------------------------------
  711.  
  712. # Start user added include file section
  713. # End user added include file section
  714.  
  715.  
  716. Class VBGetProperty : {VBProperty} {
  717.     constructor
  718.     method destructor
  719.     method generateBeginSub
  720.     attribute procType
  721.     attribute returnvalue
  722. }
  723.  
  724. constructor VBGetProperty {class this returnvalue} {
  725.     set this [VBProperty::constructor $class $this]
  726.     $this procType "Property Get"
  727.     $this returnvalue $returnvalue
  728.     # Start constructor user section
  729.     # End constructor user section
  730.     return $this
  731. }
  732.  
  733. method VBGetProperty::destructor {this} {
  734.     # Start destructor user section
  735.     # End destructor user section
  736.     $this VBProperty::destructor
  737. }
  738.  
  739. method VBGetProperty::generateBeginSub {this whole} {
  740.          $whole append " "
  741.          [$this returnvalue] generate $whole
  742.          $whole append "\n"
  743. }
  744.  
  745. # Do not delete this line -- regeneration end marker
  746.  
  747. #---------------------------------------------------------------------------
  748. #      File:           @(#)vbvariable.tcl    /main/hindenburg/7
  749. #---------------------------------------------------------------------------
  750.  
  751. # Start user added include file section
  752. # End user added include file section
  753.  
  754.  
  755. Class VBVariable : {VBFeature} {
  756.     constructor
  757.     method destructor
  758.     method generate
  759.     method generateProcs
  760.     method addProc
  761.     method removeProc
  762.     attribute defaultValue
  763.     attribute procSet
  764.     attribute type
  765. }
  766.  
  767. constructor VBVariable {class this type} {
  768.     set this [VBFeature::constructor $class $this]
  769.     $this type $type
  770.     $this procSet [List new]
  771.     # Start constructor user section
  772.     # End constructor user section
  773.     return $this
  774. }
  775.  
  776. method VBVariable::destructor {this} {
  777.     # Start destructor user section
  778.     # End destructor user section
  779.     $this VBFeature::destructor
  780. }
  781.  
  782. method VBVariable::generate {this whole} {
  783.         if {[$this comment] != ""} {
  784.               [$this comment] generate $whole
  785.         }
  786.         $whole append [$this access]
  787.         $whole append " "
  788.         if {[$this refName] != ""} {
  789.               $whole append [$this refName]
  790.               $whole append "_"
  791.         }
  792.         $whole append [$this name]
  793.         $whole append " "
  794.         [$this type] generate $whole
  795.     if {[$this defaultValue] != ""} {
  796.         $whole append "\n${VBCookie::userAttribDefault}"
  797.         $whole append [$this defaultValue]
  798.     }
  799.         $whole append "\n\n" 
  800. }
  801.  
  802. method VBVariable::generateProcs {this whole} {
  803.         [$this procSet] foreach proc {
  804.                 $proc refName [$this refName]
  805.                 $proc generate $whole
  806.         }
  807. }
  808.  
  809. # Do not delete this line -- regeneration end marker
  810.  
  811. method VBVariable::addProc {this newProc} {
  812.     [$this procSet] append $newProc
  813.  
  814. }
  815.  
  816. method VBVariable::removeProc {this oldProc} {
  817.     [$this procSet] removeValue $oldProc
  818. }
  819.  
  820. #---------------------------------------------------------------------------
  821. #      File:           @(#)vbfunction.tcl    /main/hindenburg/1
  822. #---------------------------------------------------------------------------
  823.  
  824. # Start user added include file section
  825. # End user added include file section
  826.  
  827.  
  828. Class VBFunction : {VBProcedure} {
  829.     constructor
  830.     method destructor
  831.     method generateBeginSub
  832.     attribute procType
  833.     attribute returnvalue
  834. }
  835.  
  836. constructor VBFunction {class this returnvalue} {
  837.     set this [VBProcedure::constructor $class $this]
  838.     $this procType "Function"
  839.     $this returnvalue $returnvalue
  840.     # Start constructor user section
  841.     # End constructor user section
  842.     return $this
  843. }
  844.  
  845. method VBFunction::destructor {this} {
  846.     # Start destructor user section
  847.     # End destructor user section
  848.     $this VBProcedure::destructor
  849. }
  850.  
  851. method VBFunction::generateBeginSub {this whole} {
  852.       $whole append " "
  853.       [$this returnvalue] generate $whole
  854.       $whole append "\n"
  855. }
  856.  
  857. # Do not delete this line -- regeneration end marker
  858.  
  859. #---------------------------------------------------------------------------
  860. #      File:           @(#)vbsub.tcl    /main/hindenburg/1
  861. #---------------------------------------------------------------------------
  862.  
  863. # Start user added include file section
  864. # End user added include file section
  865.  
  866.  
  867. Class VBSub : {VBProcedure} {
  868.     constructor
  869.     method destructor
  870.     attribute procType
  871. }
  872.  
  873. constructor VBSub {class this} {
  874.     set this [VBProcedure::constructor $class $this]
  875.     $this procType "Sub"
  876.     # Start constructor user section
  877.     # End constructor user section
  878.     return $this
  879. }
  880.  
  881. method VBSub::destructor {this} {
  882.     # Start destructor user section
  883.     # End destructor user section
  884.     $this VBProcedure::destructor
  885. }
  886.  
  887. # Do not delete this line -- regeneration end marker
  888.  
  889. #---------------------------------------------------------------------------
  890. #      File:           @(#)vbevent.tcl    /main/hindenburg/2
  891. #---------------------------------------------------------------------------
  892.  
  893. # Start user added include file section
  894. # End user added include file section
  895.  
  896.  
  897. Class VBEvent : {VBSub} {
  898.     constructor
  899.     method destructor
  900.     method generateBeginArguments
  901.     attribute access
  902.     attribute hasIndex
  903. }
  904.  
  905. constructor VBEvent {class this} {
  906.     set this [VBSub::constructor $class $this]
  907.     $this access "Private"
  908.     $this hasIndex 0
  909.     # Start constructor user section
  910.     # End constructor user section
  911.     return $this
  912. }
  913.  
  914. method VBEvent::destructor {this} {
  915.     # Start destructor user section
  916.     # End destructor user section
  917.     $this VBSub::destructor
  918. }
  919.  
  920. method VBEvent::generateBeginArguments {this whole} {
  921.         $whole append "("
  922.  
  923.         if {[$this hasIndex]} {
  924.               $whole append "Index As Integer"
  925.               set first 0
  926.         } else {
  927.               set first 1
  928.         }
  929.  
  930.         [$this argSet] foreach arg {
  931.                 if {$first} {
  932.                         set first 0
  933.                 } else {
  934.                         $whole append ", "
  935.                 }
  936.                 $arg generate $whole
  937.         }
  938.         $whole append ")"
  939. }
  940.  
  941. # Do not delete this line -- regeneration end marker
  942.  
  943. #---------------------------------------------------------------------------
  944. #      File:           @(#)vbunit.tcl    /main/hindenburg/17
  945. #---------------------------------------------------------------------------
  946.  
  947. # Start user added include file section
  948. # End user added include file section
  949.  
  950.  
  951. Class VBUnit : {VBObject} {
  952.     constructor
  953.     method destructor
  954.     method generateAssocAttribs
  955.     method generateUserDefAttribs
  956.     method generateInherAttribs
  957.     method generateUserDefMethods
  958.     method generateAccessMethods
  959.     method generateAssocMethods
  960.     method generateEvents
  961.     method generateBegin
  962.     method generateEnd
  963.     method generate
  964.     method hasExtraModule
  965.     method generateExtraModule
  966.     method addGlobvar
  967.     method removeGlobvar
  968.     method addAssocvar
  969.     method removeAssocvar
  970.     method addUservar
  971.     method removeUservar
  972.     method addInhervar
  973.     method removeInhervar
  974.     method addUserSproc
  975.     method removeUserSproc
  976.     method addGlobSproc
  977.     method removeGlobSproc
  978.     method getUserproc
  979.     method setUserproc
  980.     method removeUserproc
  981.     method getGlobproc
  982.     method setGlobproc
  983.     method removeGlobproc
  984.     attribute name
  985.     attribute type
  986.     attribute globvarSet
  987.     attribute attribs
  988.     attribute assocvarSet
  989.     attribute uservarSet
  990.     attribute inhervarSet
  991.     attribute userSprocSet
  992.     attribute globSprocSet
  993.     attribute constructor
  994.     attribute terminate
  995.     attribute userproc
  996.     attribute globproc
  997. }
  998.  
  999. constructor VBUnit {class this} {
  1000.     set this [VBObject::constructor $class $this]
  1001.     $this type "None"
  1002.     $this globvarSet [List new]
  1003.     $this assocvarSet [List new]
  1004.     $this uservarSet [List new]
  1005.     $this inhervarSet [List new]
  1006.     $this userSprocSet [List new]
  1007.     $this globSprocSet [List new]
  1008.     $this userproc [Dictionary new]
  1009.     $this globproc [Dictionary new]
  1010.     # Start constructor user section
  1011.     # End constructor user section
  1012.     return $this
  1013. }
  1014.  
  1015. method VBUnit::destructor {this} {
  1016.     # Start destructor user section
  1017.     # End destructor user section
  1018.     $this VBObject::destructor
  1019. }
  1020.  
  1021. method VBUnit::generateAssocAttribs {this section} {
  1022.         $section append "\n${VBCookie::assocAttribs}\n\n"
  1023.  
  1024.         [$this assocvarSet] foreach assocvar {
  1025.                 $assocvar generate $section
  1026.         }
  1027. }
  1028.  
  1029. method VBUnit::generateUserDefAttribs {this section} {
  1030.         $section append "\n${VBCookie::userDefAttribs}\n\n"
  1031.  
  1032.         [$this uservarSet] foreach uservar {
  1033.                 $uservar generate $section
  1034.         }
  1035. }
  1036.  
  1037. method VBUnit::generateInherAttribs {this section} {
  1038. }
  1039.  
  1040. method VBUnit::generateUserDefMethods {this section} {
  1041.         $section append "\n${VBCookie::userDefMethods}\n\n"
  1042.  
  1043.         if {[$this constructor] != ""} {
  1044.                 [$this constructor] refName  [$this name]
  1045.                 [$this constructor] generate $section
  1046.         }
  1047.  
  1048.         if {[$this terminate] != ""} {
  1049.                 [$this terminate] refName  [$this type]
  1050.                 [$this terminate] generate $section
  1051.         }
  1052.  
  1053.         [$this userSprocSet] foreach userproc {
  1054.                 $userproc generate $section
  1055.         }
  1056. }
  1057.  
  1058. method VBUnit::generateAccessMethods {this section} {
  1059.         $section append "\n${VBCookie::accessMethods}\n\n"
  1060.  
  1061.         [$this uservarSet] foreach uservar {
  1062.                 $uservar generateProcs $section
  1063.         }
  1064.  
  1065.         [$this globvarSet] foreach globvar {
  1066.                 $globvar generateProcs $section
  1067.         }
  1068. }
  1069.  
  1070. method VBUnit::generateAssocMethods {this section} {
  1071.         $section append "\n${VBCookie::assocMethods}\n\n"
  1072.  
  1073.         [$this assocvarSet] foreach assocvar {
  1074.                 $assocvar generateProcs $section
  1075.         }
  1076. }
  1077.  
  1078. method VBUnit::generateEvents {this section} {
  1079. }
  1080.  
  1081. method VBUnit::generateBegin {this section} {
  1082.         $section append "NONE\n"
  1083. }
  1084.  
  1085. method VBUnit::generateEnd {this section} {
  1086.         $this generateInherAttribs $section
  1087.     $this generateAssocAttribs $section
  1088.     $this generateUserDefAttribs $section
  1089.     $this generateUserDefMethods $section
  1090.     $this generateEvents $section
  1091.         $section append "${VBCookie::regenMarker}\n"
  1092.     $this generateAccessMethods $section
  1093.     $this generateAssocMethods $section
  1094. }
  1095.  
  1096. method VBUnit::generate {this section} {
  1097.         $this generateBegin $section
  1098.         $this generateEnd   $section
  1099. }
  1100.  
  1101. method VBUnit::hasExtraModule {this} {
  1102.         if {[[$this globvarSet] empty]} {
  1103.            if {[[$this globproc] size] == 0} {
  1104.               return 0
  1105.            }
  1106.         }
  1107.         return 1 
  1108. }
  1109.  
  1110. method VBUnit::generateExtraModule {this section} {
  1111.         $section append "Attribute VB_Name = \""
  1112.         $section append [$this name]
  1113.         $section append "Extras\"\n"
  1114.         $section append "Option Explicit\n"
  1115.  
  1116.         $section append "\n${VBCookie::classFeatureAttribs}\n\n"
  1117.         [$this globvarSet] foreach globalvar {
  1118.                 $globalvar refName [$this name]
  1119.                 $globalvar access "Public"
  1120.                 $globalvar generate $section
  1121.         }
  1122.  
  1123.         $section append "\n\n${VBCookie::classFeatureMethods}\n\n"
  1124.         [$this globSprocSet] foreach globalproc {
  1125.                 $globalproc refName [$this name]
  1126.                 $globalproc access "Public"
  1127.                 $globalproc generate $section
  1128.         }
  1129.         $section append "${VBCookie::regenMarker}\n"
  1130. }
  1131.  
  1132. # Do not delete this line -- regeneration end marker
  1133.  
  1134. method VBUnit::addGlobvar {this newGlobvar} {
  1135.     [$this globvarSet] append $newGlobvar
  1136.  
  1137. }
  1138.  
  1139. method VBUnit::removeGlobvar {this oldGlobvar} {
  1140.     [$this globvarSet] removeValue $oldGlobvar
  1141. }
  1142.  
  1143. method VBUnit::addAssocvar {this newAssocvar} {
  1144.     [$this assocvarSet] append $newAssocvar
  1145.  
  1146. }
  1147.  
  1148. method VBUnit::removeAssocvar {this oldAssocvar} {
  1149.     [$this assocvarSet] removeValue $oldAssocvar
  1150. }
  1151.  
  1152. method VBUnit::addUservar {this newUservar} {
  1153.     [$this uservarSet] append $newUservar
  1154.  
  1155. }
  1156.  
  1157. method VBUnit::removeUservar {this oldUservar} {
  1158.     [$this uservarSet] removeValue $oldUservar
  1159. }
  1160.  
  1161. method VBUnit::addInhervar {this newInhervar} {
  1162.     [$this inhervarSet] append $newInhervar
  1163.  
  1164. }
  1165.  
  1166. method VBUnit::removeInhervar {this oldInhervar} {
  1167.     [$this inhervarSet] removeValue $oldInhervar
  1168. }
  1169.  
  1170. method VBUnit::addUserSproc {this newUserSproc} {
  1171.     [$this userSprocSet] append $newUserSproc
  1172.  
  1173. }
  1174.  
  1175. method VBUnit::removeUserSproc {this oldUserSproc} {
  1176.     [$this userSprocSet] removeValue $oldUserSproc
  1177. }
  1178.  
  1179. method VBUnit::addGlobSproc {this newGlobSproc} {
  1180.     [$this globSprocSet] append $newGlobSproc
  1181.  
  1182. }
  1183.  
  1184. method VBUnit::removeGlobSproc {this oldGlobSproc} {
  1185.     [$this globSprocSet] removeValue $oldGlobSproc
  1186. }
  1187.  
  1188. method VBUnit::getUserproc {this name} {
  1189.     return [[$this userproc] set $name]
  1190. }
  1191.  
  1192. method VBUnit::setUserproc {this name newUserproc} {
  1193.     [$this userproc] set $name $newUserproc
  1194. }
  1195.  
  1196. method VBUnit::removeUserproc {this name} {
  1197.     [$this userproc] unset $name
  1198. }
  1199.  
  1200. method VBUnit::getGlobproc {this name} {
  1201.     return [[$this globproc] set $name]
  1202. }
  1203.  
  1204. method VBUnit::setGlobproc {this name newGlobproc} {
  1205.     [$this globproc] set $name $newGlobproc
  1206. }
  1207.  
  1208. method VBUnit::removeGlobproc {this name} {
  1209.     [$this globproc] unset $name
  1210. }
  1211.  
  1212. #---------------------------------------------------------------------------
  1213. #      File:           @(#)vbclassmod.tcl    /main/hindenburg/6
  1214. #---------------------------------------------------------------------------
  1215.  
  1216. # Start user added include file section
  1217. # End user added include file section
  1218.  
  1219.  
  1220. Class VBClassModule : {VBUnit} {
  1221.     constructor
  1222.     method destructor
  1223.     method generateInherAttribs
  1224.     method generateBegin
  1225.     attribute type
  1226. }
  1227.  
  1228. constructor VBClassModule {class this} {
  1229.     set this [VBUnit::constructor $class $this]
  1230.     $this type "Class"
  1231.     # Start constructor user section
  1232.     # End constructor user section
  1233.     return $this
  1234. }
  1235.  
  1236. method VBClassModule::destructor {this} {
  1237.     # Start destructor user section
  1238.     # End destructor user section
  1239.     $this VBUnit::destructor
  1240. }
  1241.  
  1242. method VBClassModule::generateInherAttribs {this section} {
  1243.         $section append "\n${VBCookie::inherAttribs}\n\n"
  1244.  
  1245.         [$this inhervarSet] foreach inhervar {
  1246.                 $inhervar generate $section
  1247.         }
  1248. }
  1249.  
  1250. method VBClassModule::generateBegin {this section} {
  1251.         $section append "VERSION 1.0 CLASS\n"
  1252.         $section append "BEGIN\n"
  1253.         $section append "  MultiUse = -1  'True\n"
  1254.         $section append "END\n"
  1255.         if {[$this attribs] == ""} {
  1256.                $section append "Attribute VB_Name = \""
  1257.                $section append [$this name]
  1258.                $section append "\"\n"
  1259.         } else {
  1260.                $section appendSect [$this attribs] 
  1261.         }
  1262.         $section append "${VBCookie::regenMarker}\n"
  1263.         $section append "Option Explicit\n\n"
  1264. }
  1265.  
  1266. # Do not delete this line -- regeneration end marker
  1267.  
  1268. #---------------------------------------------------------------------------
  1269. #      File:           @(#)vbcontaine.tcl    /main/hindenburg/9
  1270. #---------------------------------------------------------------------------
  1271.  
  1272. # Start user added include file section
  1273. # End user added include file section
  1274.  
  1275.  
  1276. Class VBContainer : {VBObject} {
  1277.     constructor
  1278.     method destructor
  1279.     method generateIndex
  1280.     method generateMiddle
  1281.     method generate
  1282.     method generateRemarks
  1283.     method generateEvents
  1284.     method addSevent
  1285.     method removeSevent
  1286.     method getEvent
  1287.     method setEvent
  1288.     method removeEvent
  1289.     attribute name
  1290.     attribute ofClass
  1291.     attribute guiType
  1292.     attribute guiLib
  1293.     attribute hasIndex
  1294.     attribute indexInSpecs
  1295.     attribute index
  1296.     attribute specs
  1297.     attribute SeventSet
  1298.     attribute event
  1299. }
  1300.  
  1301. constructor VBContainer {class this} {
  1302.     set this [VBObject::constructor $class $this]
  1303.     $this guiLib "VB"
  1304.     $this hasIndex 0
  1305.     $this indexInSpecs 0
  1306.     $this SeventSet [List new]
  1307.     $this event [Dictionary new]
  1308.     # Start constructor user section
  1309.     $this specs ""     
  1310.     # End constructor user section
  1311.     return $this
  1312. }
  1313.  
  1314. method VBContainer::destructor {this} {
  1315.     # Start destructor user section
  1316.     # End destructor user section
  1317.     $this VBObject::destructor
  1318. }
  1319.  
  1320. method VBContainer::generateIndex {this section} {
  1321.         if {[$this hasIndex] && ![$this indexInSpecs]} {
  1322.               $section append "Index           =   "
  1323.               $section append [$this index]
  1324.               $section append "\n"                  
  1325.         }
  1326. }
  1327.  
  1328. method VBContainer::generateMiddle {this section} {
  1329.         $section append "NONE\n"
  1330. }
  1331.  
  1332. method VBContainer::generate {this section} {
  1333.         $section append "Begin "
  1334.         $section append [$this guiLib]
  1335.         $section append "."           
  1336.         $section append [$this guiType]
  1337.         $section append " "           
  1338.         $section append [$this name]
  1339.         $section append "\n"           
  1340.  
  1341.         if {[$this specs] != ""} {
  1342.               $section pushIndent 1
  1343.               $section appendSect [$this specs] 
  1344.               $section popIndent
  1345.         }
  1346.         $section indent +
  1347.         $this generateIndex $section
  1348.         $section indent -
  1349.  
  1350.         $section indent +
  1351.         $this generateMiddle $section 
  1352.         $section indent -
  1353.  
  1354.         $section append "End\n"      
  1355. }
  1356.  
  1357. method VBContainer::generateRemarks {this section} {
  1358.     $section append "${VBCookie::userDefControl} [$this name] of [$this ofClass]\n"
  1359. }
  1360.  
  1361. method VBContainer::generateEvents {this section} {
  1362.         [$this SeventSet] foreach eventval {
  1363.                 $eventval refName [$this name]
  1364.                 $eventval hasIndex [$this hasIndex]
  1365.                 $eventval generate $section
  1366.         }
  1367. }
  1368.  
  1369. # Do not delete this line -- regeneration end marker
  1370.  
  1371. method VBContainer::addSevent {this newSevent} {
  1372.     [$this SeventSet] append $newSevent
  1373.  
  1374. }
  1375.  
  1376. method VBContainer::removeSevent {this oldSevent} {
  1377.     [$this SeventSet] removeValue $oldSevent
  1378. }
  1379.  
  1380. method VBContainer::getEvent {this name} {
  1381.     return [[$this event] set $name]
  1382. }
  1383.  
  1384. method VBContainer::setEvent {this name newEvent} {
  1385.     [$this event] set $name $newEvent
  1386. }
  1387.  
  1388. method VBContainer::removeEvent {this name} {
  1389.     [$this event] unset $name
  1390. }
  1391.  
  1392. #---------------------------------------------------------------------------
  1393. #      File:           @(#)vbcontrol.tcl    /main/hindenburg/3
  1394. #---------------------------------------------------------------------------
  1395.  
  1396. # Start user added include file section
  1397. # End user added include file section
  1398.  
  1399.  
  1400. Class VBControl : {VBContainer} {
  1401.     constructor
  1402.     method destructor
  1403.     method getContainers
  1404.     method addContain
  1405.     method generateMiddle
  1406.     method addSubcontrol
  1407.     method removeSubcontrol
  1408.     attribute subcontrolSet
  1409. }
  1410.  
  1411. constructor VBControl {class this} {
  1412.     set this [VBContainer::constructor $class $this]
  1413.     $this subcontrolSet [List new]
  1414.     # Start constructor user section
  1415.     # End constructor user section
  1416.     return $this
  1417. }
  1418.  
  1419. method VBControl::destructor {this} {
  1420.     # Start destructor user section
  1421.     # End destructor user section
  1422.     $this VBContainer::destructor
  1423. }
  1424.  
  1425. method VBControl::getContainers {this frm} {
  1426.         $frm addContainer $this
  1427.         [$this subcontrolSet] foreach subcontrol {
  1428.                 $subcontrol getContainers $frm
  1429.         }
  1430. }
  1431.  
  1432. method VBControl::addContain {this cl} {
  1433.     $this addSubcontrol $cl         
  1434. }
  1435.  
  1436. method VBControl::generateMiddle {this section} {
  1437.         [$this subcontrolSet] foreach subcontrol {
  1438.                 $subcontrol generate $section
  1439.         }
  1440. }
  1441.  
  1442. # Do not delete this line -- regeneration end marker
  1443.  
  1444. method VBControl::addSubcontrol {this newSubcontrol} {
  1445.     [$this subcontrolSet] append $newSubcontrol
  1446.  
  1447. }
  1448.  
  1449. method VBControl::removeSubcontrol {this oldSubcontrol} {
  1450.     [$this subcontrolSet] removeValue $oldSubcontrol
  1451. }
  1452.  
  1453. #---------------------------------------------------------------------------
  1454. #      File:           @(#)vbform.tcl    /main/hindenburg/16
  1455. #---------------------------------------------------------------------------
  1456.  
  1457. # Start user added include file section
  1458. # End user added include file section
  1459.  
  1460.  
  1461. Class VBForm : {VBUnit} {
  1462.     constructor
  1463.     method destructor
  1464.     method addContain
  1465.     method checkSynonyms
  1466.     method removeDuplicates
  1467.     method setIndices
  1468.     method configur
  1469.     method generateControls
  1470.     method generateControlRemarks
  1471.     method generateMenus
  1472.     method generateBegin
  1473.     method generateEvents
  1474.     method addContainer
  1475.     method removeContainer
  1476.     method addControl
  1477.     method removeControl
  1478.     method addMenu
  1479.     method removeMenu
  1480.     method addSortedmenu
  1481.     method removeSortedmenu
  1482.     method addSevent
  1483.     method removeSevent
  1484.     method getEvent
  1485.     method setEvent
  1486.     method removeEvent
  1487.     attribute type
  1488.     attribute objects
  1489.     attribute specs
  1490.     attribute containerSet
  1491.     attribute controlSet
  1492.     attribute menuSet
  1493.     attribute sortedmenuSet
  1494.     attribute SeventSet
  1495.     attribute event
  1496. }
  1497.  
  1498. constructor VBForm {class this} {
  1499.     set this [VBUnit::constructor $class $this]
  1500.     $this type "Form"
  1501.     $this containerSet [List new]
  1502.     $this controlSet [List new]
  1503.     $this menuSet [List new]
  1504.     $this sortedmenuSet [List new]
  1505.     $this SeventSet [List new]
  1506.     $this event [Dictionary new]
  1507.     # Start constructor user section
  1508.         $this specs ""
  1509.     # End constructor user section
  1510.     return $this
  1511. }
  1512.  
  1513. method VBForm::destructor {this} {
  1514.     # Start destructor user section
  1515.     # End destructor user section
  1516.     $this VBUnit::destructor
  1517. }
  1518.  
  1519. method VBForm::addContain {this cl} {
  1520.         if {[$cl guiType] == "Menu"} {
  1521.             $this addMenu $cl
  1522.         } else {
  1523.             $this addControl $cl
  1524.         }
  1525. }
  1526.  
  1527. method VBForm::checkSynonyms {this} {
  1528.         set SynonymsDict [Dictionary new]
  1529.  
  1530.         [$this containerSet] foreach container {
  1531.              if {[$SynonymsDict exists [$container name]]} {
  1532.                   set group [$SynonymsDict set [$container name]]
  1533.                   $group foreach other {
  1534.                       $this removeDuplicates $container $other
  1535.                   }
  1536.              } else {
  1537.                   set group [List new]
  1538.                   $SynonymsDict set [$container name] $group
  1539.              }
  1540.              $group append $container
  1541.         }
  1542.  
  1543.         [$this containerSet] foreach container {
  1544.              if {[[$SynonymsDict set [$container name]] length] > 1} {
  1545.                   $container hasIndex 1          
  1546.              }
  1547.         }
  1548. }
  1549.  
  1550. method VBForm::removeDuplicates {this first second} {
  1551.     [$first event] foreach evntname evnt {
  1552.              if {[[$second event] exists $evntname]} {
  1553.           $second removeSevent [$second getEvent $evntname]
  1554.                   $second removeEvent $evntname
  1555.              }
  1556.         }
  1557. }
  1558.  
  1559. method VBForm::setIndices {this} {
  1560.         set indexContainerDict [Dictionary new]
  1561.  
  1562.         [$this containerSet] foreach container {
  1563.              if {![$indexContainerDict exists [$container name]]} {
  1564.                    $indexContainerDict set [$container name] [Dictionary new]
  1565.              }
  1566.              if {[$container hasIndex] && [$container index] != ""} {
  1567.                 [$indexContainerDict set [$container name]] set [$container index] [$container index] 
  1568.              }
  1569.         }
  1570.  
  1571.         [$this containerSet] foreach container {
  1572.              if {[$container hasIndex] && [$container index] == ""} {
  1573.                 set indx  0
  1574.                 set found 0
  1575.                 while {!$found} {
  1576.                      if {![[$indexContainerDict set [$container name]] exists $indx]} {
  1577.                            set found 1                                                 
  1578.                      } else {
  1579.                            incr indx
  1580.                      }
  1581.                 }
  1582.                 [$indexContainerDict set [$container name]] set $indx $indx 
  1583.                 $container index $indx 
  1584.              }
  1585.         }
  1586. }
  1587.  
  1588. method VBForm::configur {this} {
  1589.         if {[[$this containerSet] empty]} {
  1590.                [$this sortedmenuSet] foreach sortedmenu {
  1591.                       $sortedmenu getContainers $this
  1592.                }
  1593.                [$this menuSet] foreach menu {
  1594.                       $menu getContainers $this
  1595.                }
  1596.                [$this controlSet] foreach control {
  1597.                        $control getContainers $this
  1598.                }
  1599.         }
  1600.         $this checkSynonyms
  1601. }
  1602.  
  1603. method VBForm::generateControls {this section} {
  1604.         [$this controlSet] foreach control {
  1605.                 $control generate $section
  1606.         }
  1607. }
  1608.  
  1609. method VBForm::generateControlRemarks {this section} {
  1610.         [$this containerSet] foreach control {
  1611.                 $control generateRemarks $section
  1612.         }
  1613. }
  1614.  
  1615. method VBForm::generateMenus {this section} {
  1616.         [$this sortedmenuSet] foreach sortedmenu {
  1617.                $sortedmenu generate $section
  1618.         }
  1619.         [$this menuSet] foreach menu {
  1620.                $menu generate $section
  1621.         }
  1622. }
  1623.  
  1624. method VBForm::generateBegin {this section} {
  1625.         $section append "VERSION 5.00\n"
  1626.         if {[$this objects] != ""} {
  1627.                $section appendSect [$this objects] 
  1628.         }
  1629.         $section append "Begin VB."
  1630.         $section append [$this type]
  1631.         $section append " "
  1632.         $section append [$this name]
  1633.         $section append "\n"
  1634.  
  1635.         if {[$this specs] != ""} {
  1636.                $section appendSect [$this specs] 
  1637.         }
  1638.  
  1639.         $this configur
  1640.         $this setIndices
  1641.  
  1642.         $section indent +
  1643.         $this generateControls $section
  1644.         $this generateMenus $section
  1645.         $section indent -
  1646.  
  1647.         $section append "End\n"
  1648.  
  1649.         if {[$this attribs] != ""} {
  1650.                $section appendSect [$this attribs] 
  1651.         } else {
  1652.                $section append "Attribute VB_Name = \""
  1653.                $section append [$this name]
  1654.                $section append "\"\n"
  1655.         }
  1656.         $section append "${VBCookie::regenMarker}\n"
  1657.         $this generateControlRemarks $section
  1658.         $section append "Option Explicit\n\n"
  1659. }
  1660.  
  1661. method VBForm::generateEvents {this section} {
  1662.         $section append "\n${VBCookie::events}\n\n"
  1663.  
  1664.         [$this SeventSet] foreach eventval {
  1665.                 $eventval refName [$this type]
  1666.                 $eventval generate $section
  1667.         }
  1668.         [$this containerSet] foreach container {
  1669.                 $container generateEvents $section
  1670.         }
  1671. }
  1672.  
  1673. # Do not delete this line -- regeneration end marker
  1674.  
  1675. method VBForm::addContainer {this newContainer} {
  1676.     [$this containerSet] append $newContainer
  1677.  
  1678. }
  1679.  
  1680. method VBForm::removeContainer {this oldContainer} {
  1681.     [$this containerSet] removeValue $oldContainer
  1682. }
  1683.  
  1684. method VBForm::addControl {this newControl} {
  1685.     [$this controlSet] append $newControl
  1686.  
  1687. }
  1688.  
  1689. method VBForm::removeControl {this oldControl} {
  1690.     [$this controlSet] removeValue $oldControl
  1691. }
  1692.  
  1693. method VBForm::addMenu {this newMenu} {
  1694.     [$this menuSet] append $newMenu
  1695.  
  1696. }
  1697.  
  1698. method VBForm::removeMenu {this oldMenu} {
  1699.     [$this menuSet] removeValue $oldMenu
  1700. }
  1701.  
  1702. method VBForm::addSortedmenu {this newSortedmenu} {
  1703.     [$this sortedmenuSet] append $newSortedmenu
  1704.  
  1705. }
  1706.  
  1707. method VBForm::removeSortedmenu {this oldSortedmenu} {
  1708.     [$this sortedmenuSet] removeValue $oldSortedmenu
  1709. }
  1710.  
  1711. method VBForm::addSevent {this newSevent} {
  1712.     [$this SeventSet] append $newSevent
  1713.  
  1714. }
  1715.  
  1716. method VBForm::removeSevent {this oldSevent} {
  1717.     [$this SeventSet] removeValue $oldSevent
  1718. }
  1719.  
  1720. method VBForm::getEvent {this name} {
  1721.     return [[$this event] set $name]
  1722. }
  1723.  
  1724. method VBForm::setEvent {this name newEvent} {
  1725.     [$this event] set $name $newEvent
  1726. }
  1727.  
  1728. method VBForm::removeEvent {this name} {
  1729.     [$this event] unset $name
  1730. }
  1731.  
  1732. #---------------------------------------------------------------------------
  1733. #      File:           @(#)vbmdiform.tcl    /main/hindenburg/2
  1734. #---------------------------------------------------------------------------
  1735.  
  1736. # Start user added include file section
  1737. # End user added include file section
  1738.  
  1739.  
  1740. Class VBMDIForm : {VBForm} {
  1741.     constructor
  1742.     method destructor
  1743.     attribute type
  1744. }
  1745.  
  1746. constructor VBMDIForm {class this} {
  1747.     set this [VBForm::constructor $class $this]
  1748.     $this type "MDIForm"
  1749.     # Start constructor user section
  1750.     # End constructor user section
  1751.     return $this
  1752. }
  1753.  
  1754. method VBMDIForm::destructor {this} {
  1755.     # Start destructor user section
  1756.     # End destructor user section
  1757.     $this VBForm::destructor
  1758. }
  1759.  
  1760. # Do not delete this line -- regeneration end marker
  1761.  
  1762. #---------------------------------------------------------------------------
  1763. #      File:           @(#)vbenummodu.tcl    /main/hindenburg/5
  1764. #---------------------------------------------------------------------------
  1765.  
  1766. # Start user added include file section
  1767. # End user added include file section
  1768.  
  1769.  
  1770. Class VBEnumModule : {VBObject} {
  1771.     constructor
  1772.     method destructor
  1773.     method generate
  1774.     method unique
  1775.     method constSet
  1776.     method addConst
  1777.     method removeConst
  1778.     attribute name
  1779.     attribute comment
  1780.     attribute _constSet
  1781. }
  1782.  
  1783. constructor VBEnumModule {class this} {
  1784.     set this [VBObject::constructor $class $this]
  1785.     $this _constSet [List new]
  1786.     # Start constructor user section
  1787.     # End constructor user section
  1788.     return $this
  1789. }
  1790.  
  1791. method VBEnumModule::destructor {this} {
  1792.     # Start destructor user section
  1793.     # End destructor user section
  1794.     $this VBObject::destructor
  1795. }
  1796.  
  1797. method VBEnumModule::generate {this section} {
  1798.         if {[$this comment] != ""} {
  1799.               [$this comment] generate $section
  1800.         }
  1801.  
  1802.         $section append "Attribute VB_Name = \""
  1803.         $section append "[$this name]Extras"
  1804.         $section append "\"\n"
  1805.         $section append "Option Explicit\n\n"
  1806.         $section append "${VBCookie::userDefEnums}\n\n"
  1807.         $section append "Enum [$this name]\n"
  1808.         $section indent +
  1809.         [$this constSet] foreach const {
  1810.                 $const generate $section
  1811.         }  
  1812.         $section indent -
  1813.         $section append "End Enum\n"
  1814. }
  1815.  
  1816. method VBEnumModule::unique {this} {
  1817.        set value 0
  1818.        set found 0
  1819.  
  1820.        while {!$found} {
  1821.            incr value
  1822.            set found 1
  1823.            [$this constSet] foreach const {
  1824.                    if {[$const hasValue]} {
  1825.                         if {[$const value] == $value} {
  1826.                              set found 0
  1827.                              break
  1828.                         }
  1829.                    } 
  1830.            }
  1831.        }
  1832.        return $value
  1833. }
  1834.  
  1835. # Do not delete this line -- regeneration end marker
  1836.  
  1837. method VBEnumModule::constSet {this} {
  1838.     return [$this _constSet]
  1839. }
  1840.  
  1841. method VBEnumModule::addConst {this newConst} {
  1842.     [$this _constSet] append $newConst
  1843.     $newConst _module $this
  1844. }
  1845.  
  1846. method VBEnumModule::removeConst {this oldConst} {
  1847.     $oldConst _module ""
  1848.     [$this _constSet] removeValue $oldConst
  1849. }
  1850.  
  1851. #---------------------------------------------------------------------------
  1852. #      File:           @(#)vbletprope.tcl    /main/hindenburg/1
  1853. #---------------------------------------------------------------------------
  1854.  
  1855. # Start user added include file section
  1856. # End user added include file section
  1857.  
  1858.  
  1859. Class VBLetProperty : {VBProperty} {
  1860.     constructor
  1861.     method destructor
  1862.     attribute procType
  1863. }
  1864.  
  1865. constructor VBLetProperty {class this} {
  1866.     set this [VBProperty::constructor $class $this]
  1867.     $this procType "Property Let"
  1868.     # Start constructor user section
  1869.     # End constructor user section
  1870.     return $this
  1871. }
  1872.  
  1873. method VBLetProperty::destructor {this} {
  1874.     # Start destructor user section
  1875.     # End destructor user section
  1876.     $this VBProperty::destructor
  1877. }
  1878.  
  1879. # Do not delete this line -- regeneration end marker
  1880.  
  1881. #---------------------------------------------------------------------------
  1882. #      File:           @(#)vbmenu.tcl    /main/hindenburg/2
  1883. #---------------------------------------------------------------------------
  1884.  
  1885. # Start user added include file section
  1886. # End user added include file section
  1887.  
  1888.  
  1889. Class VBMenu : {VBContainer} {
  1890.     constructor
  1891.     method destructor
  1892.     method getContainers
  1893.     method addContain
  1894.     method generateMiddle
  1895.     method addSubmenu
  1896.     method removeSubmenu
  1897.     method addSortedsubmenu
  1898.     method removeSortedsubmenu
  1899.     attribute guiType
  1900.     attribute submenuSet
  1901.     attribute sortedsubmenuSet
  1902. }
  1903.  
  1904. constructor VBMenu {class this} {
  1905.     set this [VBContainer::constructor $class $this]
  1906.     $this guiType "Menu"
  1907.     $this submenuSet [List new]
  1908.     $this sortedsubmenuSet [List new]
  1909.     # Start constructor user section
  1910.     # End constructor user section
  1911.     return $this
  1912. }
  1913.  
  1914. method VBMenu::destructor {this} {
  1915.     # Start destructor user section
  1916.     # End destructor user section
  1917.     $this VBContainer::destructor
  1918. }
  1919.  
  1920. method VBMenu::getContainers {this frm} {
  1921.         $frm addContainer $this
  1922.         [$this sortedsubmenuSet] foreach sortedsubmenu {
  1923.                $sortedsubmenu getContainers $frm
  1924.         }
  1925.         [$this submenuSet] foreach submenu {
  1926.                $submenu getContainers $frm
  1927.         }
  1928. }
  1929.  
  1930. method VBMenu::addContain {this cl} {
  1931.         $this addSubmenu $cl
  1932. }
  1933.  
  1934. method VBMenu::generateMiddle {this section} {
  1935.         [$this sortedsubmenuSet] foreach sortedsubmenu {
  1936.                $sortedsubmenu generate $section
  1937.         }
  1938.         [$this submenuSet] foreach submenu {
  1939.                $submenu generate $section
  1940.         }
  1941. }
  1942.  
  1943. # Do not delete this line -- regeneration end marker
  1944.  
  1945. method VBMenu::addSubmenu {this newSubmenu} {
  1946.     [$this submenuSet] append $newSubmenu
  1947.  
  1948. }
  1949.  
  1950. method VBMenu::removeSubmenu {this oldSubmenu} {
  1951.     [$this submenuSet] removeValue $oldSubmenu
  1952. }
  1953.  
  1954. method VBMenu::addSortedsubmenu {this newSortedsubmenu} {
  1955.     [$this sortedsubmenuSet] append $newSortedsubmenu
  1956.  
  1957. }
  1958.  
  1959. method VBMenu::removeSortedsubmenu {this oldSortedsubmenu} {
  1960.     [$this sortedsubmenuSet] removeValue $oldSortedsubmenu
  1961. }
  1962.  
  1963.