home *** CD-ROM | disk | FTP | other *** search
/ PC World 1997 November / PCWorld_1997-11_cd.bin / software / programy / komix / DATA.Z / delphioopl.tcl < prev    next >
Text File  |  1997-05-02  |  92KB  |  3,554 lines

  1. #--------------------------------------------------------------------------
  2. #
  3. #      (c)     Cayenne Software Inc.    1997
  4. #
  5. #      File:           %W%
  6. #      Author:         <generated>
  7. #
  8. #--------------------------------------------------------------------------
  9.  
  10. #      File:           @(#)dpgclass.tcl    /main/hindenburg/16
  11.  
  12.  
  13. Class DPGClass : {Object} {
  14.     constructor
  15.     method destructor
  16.     method baseType
  17.     method isGUIComponent
  18.     method isDerivable
  19.     method getUnitName
  20.     method getFormVarName
  21.     method getFormTypeName
  22.     method generateComponent
  23.     method generateType
  24.     method generateTObjectType
  25.     method generate
  26.     attribute bseType
  27.     attribute doneComponent
  28.     attribute target
  29. }
  30.  
  31. constructor DPGClass {class this name} {
  32.     set this [Object::constructor $class $this $name]
  33.     $this doneComponent 0
  34.     # Start constructor user section
  35.     # End constructor user section
  36.     return $this
  37. }
  38.  
  39. method DPGClass::destructor {this} {
  40.     # Start destructor user section
  41.     # End destructor user section
  42. }
  43.  
  44. method DPGClass::baseType {this} {
  45.     if {[$this bseType] == ""} {
  46.         set super $this
  47.  
  48.         if {[$super getName] != "TForm" && [$super getName] != "TComponent"} {
  49.             while {[llength [$super genNodeSet]] > 0} {
  50.                 if {[$super getName] == "TForm" || [$super getName] == "TComponent"} {
  51.                     break;
  52.                 }
  53.                 set super [[lindex [$super genNodeSet] 0] superClass]
  54.             }
  55.         }
  56.  
  57.         switch [$super getName] {
  58.             "TForm"        {
  59.                 $this bseType [$super getName]
  60.             }
  61.             "TComponent"    {
  62.                 $this bseType [$super getName]
  63.             }
  64.             default            {
  65.                 $this bseType "Class"
  66.             }
  67.         }
  68.     }
  69.  
  70.     return [$this bseType]
  71. }
  72.  
  73. method DPGClass::isGUIComponent {this} {
  74.     if {[$this baseType] == "TForm" || [$this baseType] == "TComponent"} {
  75.         return 1
  76.     } else {
  77.         return 0
  78.     }
  79. }
  80.  
  81. method DPGClass::isDerivable {this} {
  82.     if {[$this baseType] == "TComponent"} {
  83.         return 0
  84.     } else {
  85.         return 1
  86.     }
  87. }
  88.  
  89. method DPGClass::getUnitName {this} {
  90.     return "[$this getName]Unit"
  91. }
  92.  
  93. method DPGClass::getFormVarName {this} {
  94.     return [$this getName]
  95. }
  96.  
  97. method DPGClass::getFormTypeName {this} {
  98. #    if {[$this getPropertyValue "is_vcl"] != 1} {
  99. # }
  100.     if {[$this getName] != "TForm"} {
  101.         return "T[$this getName]"
  102.     } else {
  103.         return [$this getName]
  104.     }
  105. }
  106.  
  107. method DPGClass::generateComponent {this role class control} {
  108.     if {[$this doneComponent] == 1} {
  109.         m4_fatal $E_CONTLOOP [$class name]
  110.         return
  111.     }
  112.  
  113.     # Create new component
  114.     #
  115.     set ctrlType [[[lindex [$this genNodeSet] 0] superClass] generateType]
  116.     set newcontrol [DPControl new $ctrlType]
  117.     $newcontrol name $role
  118.     set props [TextSection new]
  119.     $newcontrol properties $props
  120.  
  121.     # Add new component to child list of parent
  122.     $control addChild $newcontrol
  123.  
  124.     # Add new component to form
  125.     [$class form] setControl [$newcontrol name] $newcontrol
  126.     
  127.     # Generate child components
  128.     $this doneComponent 1
  129.     foreach assoc [$this genAssocAttrSet] {
  130.         if {[$assoc hasGUIComponent]} {
  131.             $assoc generateComponent $class $newcontrol
  132.         }
  133.     }
  134.     $this doneComponent 0
  135.  
  136.     # Generate events
  137.     foreach operation [$this operationSet] {
  138.         if {[$operation getPropertyValue "is_event"] == 1} {
  139.  
  140.             set controlevent [DPControlEvent new [$operation generateEvent $class $newcontrol]]
  141.             $controlevent name [$operation getName] 
  142.             $newcontrol addEvent $controlevent
  143.         } else {
  144.             if {[$this baseType] != "TForm"} {
  145.                 m4_error $E_CANTCONTMETH [$this getName]
  146.             }
  147.         }
  148.     }
  149. }
  150.  
  151. method DPGClass::generateType {this} {
  152.     set type [DPType new]
  153.     $type includeType "user"
  154.     $type includeName [$this getUnitName]
  155.     if {[$this baseType] == "TForm"} {
  156.         $type name [$this getFormTypeName]
  157.     } else {
  158.         $type name "[$this getName]"
  159.     }
  160.  
  161.     set libunit [$this getPropertyValue "libunit"]
  162.     if {$libunit != "None" && $libunit != ""} {
  163.         $type includeType "system"
  164.         if {$libunit == "Other"} {
  165.             $type includeName [$this getPropertyValue "userlib"]
  166.         } else {
  167.             $type includeName $libunit
  168.         }
  169.     }
  170.     return $type
  171. }
  172.  
  173. method DPGClass::generateTObjectType {this} {
  174.     set type [DPType new]
  175.     $type includeType "system"
  176.     $type includeName "System"
  177.     $type name "TObject"
  178.     return $type
  179. }
  180.  
  181. method DPGClass::generate {this tgt} {
  182.  
  183.     # Hook unit to project
  184.     
  185.     switch [$this baseType] {
  186.         "TForm" {
  187.             # Create form class
  188.             set formtype [$this generateType]
  189.             set form [DPForm new $formtype]
  190.             $form name "[$this getName]"
  191.             set props [TextSection new]
  192.             $form properties $props
  193.             set unit [DPFormClass new $form]
  194.             $this target $unit
  195.             $unit name [$formtype name]
  196.  
  197.             #Create global form variable
  198.             set formvar [DPVariable new $formtype]
  199.             $formvar name "[$this getFormVarName]"
  200.             $unit addGlobvar $formvar
  201.  
  202.             # Hook form to project
  203.             $tgt setForm [$formvar name] $form
  204.  
  205.             # Generate events
  206.             foreach operation [$this operationSet] {
  207.                 if {[$operation getPropertyValue "is_event"] == 1} {
  208.                     set controlevent [DPControlEvent new [$operation generateEvent $unit $form]]
  209.                     $controlevent name [$operation getName] 
  210.                     $form addEvent $controlevent
  211.                 }
  212.             }
  213.  
  214.             # Generate components
  215.             foreach assoc [$this genAssocAttrSet] {
  216.                 if {[$assoc hasGUIComponent]} {
  217.                     $assoc generateComponent $unit $form
  218.                 }
  219.             }
  220.         }
  221.         "Class" {
  222.             set unit [DPClass new]
  223.             $this target $unit
  224.             set type [$this generateType]
  225.             $unit name "[$type name]"
  226.         }
  227.         default {
  228.             return
  229.         }
  230.     }
  231.     $tgt setUnit [$this getName] $unit
  232.  
  233.     # Set unit attributes
  234.     
  235.     $unit unitName "[$this getUnitName]"
  236.     
  237.     # comment
  238.  
  239.     set comment [DPComment new]
  240.     $unit comment $comment
  241.     $comment comment [$this getPropertyValue "freeText"]
  242.  
  243.     # Generate superclass
  244.  
  245.     foreach genNode [$this genNodeSet] {
  246.         $genNode generate $unit
  247.     }
  248.  
  249.     # Generate attributes
  250.  
  251.     foreach feature [$this dataAttrSet] {
  252.         $feature generate $unit
  253.     }
  254.  
  255.     # Generate methods
  256.  
  257.     foreach feature [$this operationSet] {
  258.         $feature generate $unit
  259.     }
  260.  
  261.     # Generate constructor
  262.  
  263.     if {[$this constructor] != ""} {
  264.         [$this constructor] generate $unit
  265.     }
  266.  
  267.     # Generate destructor
  268.  
  269.     set dtor [DPDestructor new]
  270.     $dtor isOverride 1
  271.     $dtor name "Destroy"
  272.     $dtor access "Published"
  273.     $dtor userCodeFirst 1
  274.     $dtor gencode [TextSection new]
  275.     $dtor gentypes [TextSection new]
  276.     $unit destructr $dtor
  277.  
  278.     # Generate associations
  279.  
  280.     foreach assoc [$this genAssocAttrSet] {
  281.         if {[$this baseType] == "Class"} {
  282.             if {[$assoc hasGUIComponent]} {
  283.                 m4_error $E_CANTCONTGUI [$this getName] [[[$assoc ooplType] ooplClass] getName]
  284.                 return
  285.             } 
  286.         }
  287.         $assoc generate $unit
  288.     }
  289.  
  290.     # Old destructor is last thing to call in a destructor
  291.     [$dtor gencode] append "\ninherited Destroy;\n"
  292. }
  293.  
  294. # Do not delete this line -- regeneration end marker
  295.  
  296. Class DPGClassD : {DPGClass OPClass} {
  297. }
  298.  
  299. selfPromoter OPClass {this} {
  300.     DPGClassD promote $this
  301. }
  302.  
  303. #      File:           @(#)dpgfeature.tcl    /main/hindenburg/3
  304.  
  305.  
  306. Class DPGFeature : {Object} {
  307.     constructor
  308.     method destructor
  309.     method generate
  310. }
  311.  
  312. constructor DPGFeature {class this name} {
  313.     set this [Object::constructor $class $this $name]
  314.     # Start constructor user section
  315.     # End constructor user section
  316.     return $this
  317. }
  318.  
  319. method DPGFeature::destructor {this} {
  320.     # Start destructor user section
  321.     # End destructor user section
  322. }
  323.  
  324. method DPGFeature::generate {this} {
  325.     # !! Implement this function !!
  326. }
  327.  
  328. # Do not delete this line -- regeneration end marker
  329.  
  330. Class DPGFeatureD : {DPGFeature OPFeature} {
  331. }
  332.  
  333. selfPromoter OPFeature {this} {
  334.     DPGFeatureD promote $this
  335. }
  336.  
  337. #      File:           @(#)dpginhgrou.tcl    /main/hindenburg/5
  338.  
  339.  
  340. Class DPGInhGroup : {Object OPInhGroup} {
  341.     constructor
  342.     method destructor
  343.     method generateSuperType
  344.     method generate
  345. }
  346.  
  347. constructor DPGInhGroup {class this name} {
  348.     set this [Object::constructor $class $this $name]
  349.     # Start constructor user section
  350.     # End constructor user section
  351.     return $this
  352. }
  353.  
  354. method DPGInhGroup::destructor {this} {
  355.     # Start destructor user section
  356.     # End destructor user section
  357. }
  358.  
  359. method DPGInhGroup::generateSuperType {this} {
  360.     if {![[$this superClass] isDerivable]} {
  361.         m4_error $E_ILLSUPER [[$this superClass] getName]
  362.     }
  363.     set type [[$this superClass] generateType]
  364.     return $type
  365. }
  366.  
  367. method DPGInhGroup::generate {this class} {
  368.  
  369.     if {[$class superclass] != ""} {
  370.         m4_warning $W_MULTINH [$class name] [[$class superclass] name] [$this getSuperClassName]
  371.         return
  372.     }
  373.     if {[$this isOverlapping]} {
  374.         m4_warning $W_OVERLAPINH [$class name] [$this getSuperClassName]
  375.     }
  376.     $class superclass [$this generateSuperType]
  377. }
  378.  
  379. # Do not delete this line -- regeneration end marker
  380.  
  381. selfPromoter OPInhGroup {this} {
  382.     DPGInhGroup promote $this
  383. }
  384.  
  385. #      File:           @(#)dpginitial.tcl    /main/hindenburg/1
  386.  
  387.  
  388. Class DPGInitializer : {Object} {
  389.     constructor
  390.     method destructor
  391.     method generate
  392. }
  393.  
  394. constructor DPGInitializer {class this name} {
  395.     set this [Object::constructor $class $this $name]
  396.     # Start constructor user section
  397.     # End constructor user section
  398.     return $this
  399. }
  400.  
  401. method DPGInitializer::destructor {this} {
  402.     # Start destructor user section
  403.     # End destructor user section
  404. }
  405.  
  406. method DPGInitializer::generate {this ctor} {
  407.     # !! Implement this function !!
  408. }
  409.  
  410. # Do not delete this line -- regeneration end marker
  411.  
  412. Class DPGInitializerD : {DPGInitializer OPInitializer} {
  413. }
  414.  
  415. selfPromoter OPInitializer {this} {
  416.     DPGInitializerD promote $this
  417. }
  418.  
  419. #      File:           @(#)dpgparamet.tcl    /main/hindenburg/1
  420.  
  421.  
  422. Class DPGParameter : {Object} {
  423.     constructor
  424.     method destructor
  425. }
  426.  
  427. constructor DPGParameter {class this name} {
  428.     set this [Object::constructor $class $this $name]
  429.     # Start constructor user section
  430.     # End constructor user section
  431.     return $this
  432. }
  433.  
  434. method DPGParameter::destructor {this} {
  435.     # Start destructor user section
  436.     # End destructor user section
  437. }
  438.  
  439. # Do not delete this line -- regeneration end marker
  440.  
  441. Class DPGParameterD : {DPGParameter OPParameter} {
  442. }
  443.  
  444. selfPromoter OPParameter {this} {
  445.     DPGParameterD promote $this
  446. }
  447.  
  448. #      File:           @(#)dpgtype.tcl    /main/hindenburg/4
  449.  
  450.  
  451. Class DPGType : {Object Object} {
  452.     constructor
  453.     method destructor
  454.     method generate
  455. }
  456.  
  457. constructor DPGType {class this name name} {
  458.     set this [Object::constructor $class $this $name]
  459.     set this [Object::constructor $class $this $name]
  460.     # Start constructor user section
  461.     # End constructor user section
  462.     return $this
  463. }
  464.  
  465. method DPGType::destructor {this} {
  466.     # Start destructor user section
  467.     # End destructor user section
  468. }
  469.  
  470. method DPGType::generate {this} {
  471.  
  472.     if {[$this ooplClass] != ""} {
  473.         set type [[$this ooplClass] generateType]
  474.     } else {
  475.         set type [DPType new]
  476.         $type includeType "user"
  477.         $type includeName ""
  478.         $type name ""
  479.     }
  480.     return $type
  481. }
  482.  
  483. # Do not delete this line -- regeneration end marker
  484.  
  485. Class DPGTypeD : {DPGType OPType} {
  486. }
  487.  
  488. selfPromoter OPType {this} {
  489.     DPGTypeD promote $this
  490. }
  491.  
  492. #      File:           @(#)dpgassocge.tcl    /main/hindenburg/8
  493.  
  494.  
  495. Class DPGAssocGen : {GCObject} {
  496.     constructor
  497.     method destructor
  498.     method propRead
  499.     method propWrite
  500.     method hasGet
  501.     method assocattr
  502.     attribute varname
  503.     attribute varref
  504.     attribute varset
  505.     attribute vardict
  506.     attribute varqual
  507.     attribute opvarname
  508.     attribute opvarref
  509.     attribute opvarset
  510.     attribute opvardict
  511.     attribute addWarning
  512.     attribute setWarning
  513.     attribute getWarning
  514.     attribute removeWarning
  515.     attribute dtorWarning
  516.     attribute _assocattr
  517. }
  518.  
  519. constructor DPGAssocGen {class this assocattr} {
  520.     set this [GCObject::constructor $class $this]
  521.     $this addWarning 0
  522.     $this setWarning 0
  523.     $this getWarning 0
  524.     $this removeWarning 0
  525.     $this dtorWarning 0
  526.     $this _assocattr $assocattr
  527.     $assocattr _generator $this
  528.     # Start constructor user section
  529.  
  530.  
  531.     # Check for mtory-mtory
  532.     #
  533.     set assoc [$this assocattr]
  534.     set oppos [[$this assocattr] opposite]
  535.     if {$oppos != ""} {
  536.         if {[$assoc isMandatory] && [$assoc getMultiplicity] == "one" && ![$assoc isQualified]} {
  537.             if {[$oppos isMandatory] && [$oppos getMultiplicity] == "one" && ![$oppos isQualified]} {
  538.                 m4_error $E_MTORYMTORY [[[[$this assocattr] opposite] ooplClass] getName] [[[$this assocattr] ooplClass] getName]
  539.             }
  540.         }
  541.     }
  542.  
  543.     $this varname [[$this assocattr] getName]
  544.     $this varref "[$this varname]Ref"
  545.     $this varset "[$this varname]Set"
  546.     $this vardict "[$this varname]Dict"
  547.     if {[[$this assocattr] get_obj_type] == "qual_assoc_attrib" || [[$this assocattr] get_obj_type] == "qual_link_attrib"} {
  548.         $this varqual [[[$this assocattr] qualifier] getName]
  549.     }
  550.     if {[[$this assocattr] opposite] != ""} {
  551.         $this opvarname [[[$this assocattr] opposite] getName]
  552.         $this opvarref "[$this opvarname]Ref"
  553.         $this opvarset "[$this opvarname]Set"
  554.         $this opvardict "[$this opvarname]Dict"
  555.     }
  556.     # End constructor user section
  557.     return $this
  558. }
  559.  
  560. method DPGAssocGen::destructor {this} {
  561.     # Start destructor user section
  562.     # End destructor user section
  563. }
  564.  
  565. method DPGAssocGen::propRead {this} {
  566.     set accessList [split [[$this assocattr] getPropertyValue assoc_access] -]
  567.     set accessStr [lindex $accessList 0]
  568.     if {$accessStr == ""} {
  569.         set accessStr "Published"
  570.     }
  571.     return $accessStr
  572. }
  573.  
  574. method DPGAssocGen::propWrite {this} {
  575.     set accessList [split [[$this assocattr] getPropertyValue assoc_access] -]
  576.     set accessStr [lindex $accessList 1]
  577.     if {$accessStr == ""} {
  578.         set accessStr "Published"
  579.     }
  580.     return $accessStr
  581. }
  582.  
  583. method DPGAssocGen::hasGet {this self} {
  584.     set rd [$this propRead]
  585.     if {$self} {
  586.         if {$rd == "None"} {
  587.             return 0
  588.         } 
  589.     } else {
  590.         if {$rd == "None" || $rd == "Private" || $rd == "Protected"} {
  591.             return 0
  592.         } 
  593.     }
  594.     return 1
  595. }
  596.  
  597. # Do not delete this line -- regeneration end marker
  598.  
  599. method DPGAssocGen::assocattr {this args} {
  600.     if {$args == ""} {
  601.         return [$this _assocattr]
  602.     }
  603.     set ref [$this _assocattr]
  604.     if {$ref != ""} {
  605.         $ref _generator ""
  606.     }
  607.     set obj [lindex $args 0]
  608.     if {$obj != ""} {
  609.         $obj _generator $this
  610.     }
  611.     $this _assocattr $obj
  612. }
  613.  
  614.  
  615. #      File:           @(#)dpgclassen.tcl    /main/hindenburg/5
  616.  
  617.  
  618. Class DPGClassEnum : {DPGClass} {
  619.     constructor
  620.     method destructor
  621.     method isDerivable
  622.     method generate
  623. }
  624.  
  625. constructor DPGClassEnum {class this name} {
  626.     set this [DPGClass::constructor $class $this $name]
  627.     set this [Object::constructor $class $this $name]
  628.     # Start constructor user section
  629.     # End constructor user section
  630.     return $this
  631. }
  632.  
  633. method DPGClassEnum::destructor {this} {
  634.     # Start destructor user section
  635.     # End destructor user section
  636. }
  637.  
  638. method DPGClassEnum::isDerivable {this} {
  639.     return 0
  640. }
  641.  
  642. method DPGClassEnum::generate {this tgt} {
  643.     set unit [DPEnumUnit new]
  644.     set type [$this generateType]
  645.     $unit name "[$type name]"
  646.  
  647.     $tgt setUnit [$this getName] $unit
  648.     $unit unitName "[$this getUnitName]"
  649.  
  650.     set comment [DPComment new]
  651.     $unit comment $comment
  652.     $comment comment [$this getPropertyValue "freeText"]
  653.  
  654.     # Generate enum fields
  655.     foreach feature [$this dataAttrSet] {
  656.         if {[$feature getInitialValue] != ""} {
  657.             m4_warning $W_ENUMDEFAULT [$this getName]
  658.         }
  659.         set comp [DPEnumComponent new]
  660.         $comp name [$feature getName]
  661.         $unit addComponent $comp
  662.     }
  663. }
  664.  
  665. # Do not delete this line -- regeneration end marker
  666.  
  667. Class DPGClassEnumD : {DPGClassEnum OPClassEnum} {
  668. }
  669.  
  670. selfPromoter OPClassEnum {this} {
  671.     DPGClassEnumD promote $this
  672. }
  673.  
  674. #      File:           @(#)dpgclassge.tcl    /main/hindenburg/3
  675.  
  676.  
  677. Class DPGClassGenericTypeDef : {DPGClass} {
  678.     constructor
  679.     method destructor
  680.     method isDerivable
  681.     method generate
  682. }
  683.  
  684. constructor DPGClassGenericTypeDef {class this name} {
  685.     set this [DPGClass::constructor $class $this $name]
  686.     set this [Object::constructor $class $this $name]
  687.     # Start constructor user section
  688.     # End constructor user section
  689.     return $this
  690. }
  691.  
  692. method DPGClassGenericTypeDef::destructor {this} {
  693.     # Start destructor user section
  694.     # End destructor user section
  695. }
  696.  
  697. method DPGClassGenericTypeDef::isDerivable {this} {
  698.     return 0
  699. }
  700.  
  701. method DPGClassGenericTypeDef::generate {this tgt} {
  702.  
  703.     set assoc [lindex [$this genAssocAttrSet] 0]
  704.  
  705.     if {[$assoc isQualified]} {
  706.         set typedefType [$assoc generateQualAssocType]
  707.     } else {
  708.         if {[$assoc getMultiplicity] == "many"} {
  709.             set typedefType [$assoc generateManyAssocType]
  710.         } else {
  711.             set typedefType [[$assoc ooplType] generate]
  712.         }
  713.     }
  714.     set unit [DPTypeDefUnit new $typedefType]
  715.     set type [$this generateType]
  716.     $unit name "[$type name]"
  717.  
  718.     $tgt setUnit [$this getName] $unit
  719.     $unit unitName "[$this getUnitName]"
  720.  
  721.     set comment [DPComment new]
  722.     $unit comment $comment
  723.     $comment comment [$this getPropertyValue "freeText"]
  724. }
  725.  
  726. # Do not delete this line -- regeneration end marker
  727.  
  728. Class DPGClassGenericTypeDefD : {DPGClassGenericTypeDef OPClassGenericTypeDef} {
  729. }
  730.  
  731. selfPromoter OPClassGenericTypeDef {this} {
  732.     DPGClassGenericTypeDefD promote $this
  733. }
  734.  
  735. #      File:           @(#)dpgclasstd.tcl    /main/hindenburg/8
  736.  
  737.  
  738. Class DPGClassTDef : {DPGClass} {
  739.     constructor
  740.     method destructor
  741.     method isDerivable
  742.     method getFinalType
  743.     method getType
  744.     method generate
  745.     attribute cid
  746.     attribute finalType
  747. }
  748.  
  749. global DPGClassTDef::gid
  750. set DPGClassTDef::gid 0
  751.  
  752.  
  753. constructor DPGClassTDef {class this name} {
  754.     set this [DPGClass::constructor $class $this $name]
  755.     set this [Object::constructor $class $this $name]
  756.     $this finalType null
  757.     # Start constructor user section
  758.     # End constructor user section
  759.     return $this
  760. }
  761.  
  762. method DPGClassTDef::destructor {this} {
  763.     # Start destructor user section
  764.     # End destructor user section
  765. }
  766.  
  767. method DPGClassTDef::isDerivable {this} {
  768.     set type [$this getFinalType]
  769.  
  770.     if {$type != ""} {
  771.         if {[$type isA OPBaseType] || [$type isA OPTypeDefType] || [$type isA OPEnumType]} {
  772.             return 0
  773.         }
  774.         if {[$type isA OPClassType] && [[$type ooplClass] baseType] == "TComponent"} {
  775.             return 0
  776.         }
  777.     }
  778.     return 1
  779. }
  780.  
  781. method DPGClassTDef::getFinalType {this} {
  782.     # return the (final) type to which this typedef really refers, i.e. resolve
  783.     #  the typedef trail until a non-typedef is discovered
  784.     # note: this func returns an OPTypeDefType in case of a typedef that refers
  785.     #        to itself
  786.     # currently, this is done non-recursively...
  787.     #
  788.     # note: copy from Forte generator
  789.     #
  790.  
  791.     # Note! Constructor is not called so initialization is done in promotor!!
  792.     #
  793.     if {[$this finalType] != "null"} {
  794.     return [$this finalType]
  795.     }
  796.  
  797.     global DPGClassTDef::gid
  798.     incr DPGClassTDef::gid
  799.     set id ${DPGClassTDef::gid}
  800.     $this cid $id
  801.  
  802.     set type [$this getType]
  803.     while {1} {
  804.         if {$type == ""} {
  805.             $this finalType ""
  806.             return ""
  807.         }
  808.         if {![$type isA OPTypeDefType]} {
  809.             $this finalType $type
  810.             return $type
  811.         }
  812.         set class [$type ooplClass]
  813.         if {$class == ""} {
  814.             $this finalType ""
  815.             return ""
  816.         }
  817.         if {![$class isA OPClassTDef]} {
  818.             $this finalType $type
  819.             return $type
  820.         }
  821.         if {$id == [$class cid]} {
  822.             # loop detected
  823.             $this finalType $type
  824.             return $type
  825.         }
  826.         if {[$class getName] == ""} {
  827.             $this finalType ""
  828.             return ""
  829.         }
  830.         $class cid $id
  831.         set type [$class getType]
  832.     }
  833. }
  834.  
  835. method DPGClassTDef::getType {this} {
  836.     # note: this method should have been a member of OPClassTDef
  837.     #
  838.     set attr [lindex [$this dataAttrSet] 0]
  839.     if {$attr == ""} {
  840.         return ""
  841.     }
  842.  
  843.     # hack: if attr has no type, the OOPL model returns an OPClassType without
  844.     #  an OPCLass... or an OPClass having no name... !!!
  845.     #
  846.     set type [$attr ooplType]
  847.     if {[$type isA OPClassType]} {
  848.         if {[$type ooplClass] == "" || [[$type ooplClass] getName] == ""} {
  849.             return ""
  850.         }
  851.     }
  852.     return $type
  853. }
  854.  
  855. method DPGClassTDef::generate {this tgt} {
  856.     set unit [DPTypeDefUnit new [[[$this dataAttrSet] ooplType] generate]]
  857.     set type [$this generateType]
  858.     $unit name "[$type name]"
  859.  
  860.     $tgt setUnit [$this getName] $unit
  861.     $unit unitName "[$this getUnitName]"
  862.  
  863.     set comment [DPComment new]
  864.     $unit comment $comment
  865.     $comment comment [$this getPropertyValue "freeText"]
  866. }
  867.  
  868. # Do not delete this line -- regeneration end marker
  869.  
  870. Class DPGClassTDefD : {DPGClassTDef OPClassTDef} {
  871. }
  872.  
  873. selfPromoter OPClassTDef {this} {
  874.     DPGClassTDefD promote $this
  875.     $this finalType null
  876. }
  877.  
  878. #      File:           @(#)dpglinkcla.tcl    /main/hindenburg/3
  879.  
  880.  
  881. Class DPGLinkClass : {DPGClass} {
  882.     constructor
  883.     method destructor
  884.     method isDerivable
  885. }
  886.  
  887. constructor DPGLinkClass {class this name} {
  888.     set this [DPGClass::constructor $class $this $name]
  889.     set this [Object::constructor $class $this $name]
  890.     # Start constructor user section
  891.     # End constructor user section
  892.     return $this
  893. }
  894.  
  895. method DPGLinkClass::destructor {this} {
  896.     # Start destructor user section
  897.     # End destructor user section
  898. }
  899.  
  900. method DPGLinkClass::isDerivable {this} {
  901.     return 0
  902. }
  903.  
  904. # Do not delete this line -- regeneration end marker
  905.  
  906. Class DPGLinkClassD : {DPGLinkClass OPLinkClass} {
  907. }
  908.  
  909. selfPromoter OPLinkClass {this} {
  910.     DPGLinkClassD promote $this
  911. }
  912.  
  913. #      File:           @(#)dpgattribu.tcl    /main/hindenburg/1
  914.  
  915.  
  916. Class DPGAttribute : {DPGFeature} {
  917.     constructor
  918.     method destructor
  919. }
  920.  
  921. constructor DPGAttribute {class this name} {
  922.     set this [DPGFeature::constructor $class $this $name]
  923.     # Start constructor user section
  924.     # End constructor user section
  925.     return $this
  926. }
  927.  
  928. method DPGAttribute::destructor {this} {
  929.     # Start destructor user section
  930.     # End destructor user section
  931. }
  932.  
  933. # Do not delete this line -- regeneration end marker
  934.  
  935. Class DPGAttributeD : {DPGAttribute OPAttribute} {
  936. }
  937.  
  938. selfPromoter OPAttribute {this} {
  939.     DPGAttributeD promote $this
  940. }
  941.  
  942. #      File:           @(#)dpgconstru.tcl    /main/hindenburg/13
  943.  
  944.  
  945. Class DPGConstructor : {DPGFeature} {
  946.     constructor
  947.     method destructor
  948.     method generate
  949.     attribute counted
  950. }
  951.  
  952. constructor DPGConstructor {class this name} {
  953.     set this [DPGFeature::constructor $class $this $name]
  954.     $this counted 0
  955.     # Start constructor user section
  956.     # End constructor user section
  957.     return $this
  958. }
  959.  
  960. method DPGConstructor::destructor {this} {
  961.     # Start destructor user section
  962.     # End destructor user section
  963. }
  964.  
  965. method DPGConstructor::generate {this class} {
  966.     if {[$this counted] == ""} {
  967.         $class userConstructors [expr [$class userConstructors] + 1]
  968.         $this counted 1
  969.     }
  970.  
  971.     set ctor [DPConstructor new]
  972.     set comment [DPComment new]
  973.     $ctor comment $comment
  974.     $comment comment [$this getPropertyValue "freeText"]
  975.  
  976.     $ctor name "Create"
  977.     $ctor access [$this getPropertyValue "method_access"]
  978.  
  979.     # ToDo: Check for automatic override generation?
  980. #    $ctor isOverride 1
  981.  
  982.     # Method modifier
  983.  
  984.     switch [$this getPropertyValue "method_modifier"] {
  985.         "Virtual"    {
  986.             $ctor isVirtual 1
  987.         }
  988.         "Dynamic"    {
  989.             $ctor isDynamic 1
  990.         }
  991.         "Virtual Abstract"    {
  992.             $ctor isAbstract 1
  993.             $ctor isVirtual 1
  994.         }
  995.         "Dynamic Abstract"    {
  996.             $ctor isAbstract 1
  997.             $ctor isDynamic 1
  998.         }
  999.         "Override"    {
  1000.             $ctor isOverride 1
  1001.         }
  1002.         default    {
  1003.         }
  1004.     }
  1005.  
  1006.     if {[$ctor access] == ""} {
  1007.         $ctor access "Published"
  1008.     }
  1009.     set gencode [TextSection new]
  1010.     set gentypes [TextSection new]
  1011.     $ctor gencode $gencode
  1012.     $ctor gentypes $gentypes
  1013.  
  1014.     # Generate default Delphi parameter for component constructor
  1015.     #
  1016.     if {[[$this ooplClass] baseType] == "TForm"} {
  1017.         set type [DPType new]
  1018.         $type name "TComponent"
  1019.         $type includeType "system"
  1020.         $type includeName "Classes"
  1021.         set param [DPArgument new $type]
  1022.         $param name "AOwner"
  1023.         $ctor addArg $param
  1024.     }
  1025.  
  1026.     # Generate initializers
  1027.     #
  1028.     set superctor [DPConstructor new]
  1029.     foreach initializer [$this superClassInitializerSet] {
  1030.         $initializer generate $superctor
  1031.     }
  1032.  
  1033.     # Generate key attribute initialization code
  1034.     #
  1035.     foreach initializer [$this attribInitializerSet] {
  1036.         $initializer generate $ctor
  1037.     }
  1038.  
  1039.     # Generate initialized data attribute values
  1040.     #
  1041.     foreach attrib [[$this ooplClass] dataAttrSet] {
  1042.         $attrib generateInitialValue $ctor
  1043.     }
  1044.     [$ctor gencode] append "\n"
  1045.  
  1046.     # Generate association initialization code
  1047.     #
  1048.     foreach initializer [$this assocInitializerSet] {
  1049.         $initializer generate $ctor
  1050.     }
  1051.  
  1052.     # Generate superclass call
  1053.     #
  1054.     $gencode append "inherited Create"
  1055.     if {[[$superctor argSet] contents] != "" || [[$this ooplClass] baseType] == "TForm"} {
  1056.         $gencode append "("
  1057.         set first 1
  1058.         if {[[$this ooplClass] baseType] == "TForm"} {
  1059.             $gencode append "AOwner"
  1060.             set first 0
  1061.         }
  1062.         [$superctor argSet] foreach arg {
  1063.             if {$first} {
  1064.                 set first 0
  1065.             } else {
  1066.                 $gencode append ", "
  1067.             }
  1068.             $gencode append [$arg name]
  1069.         }
  1070.         $gencode append ")"
  1071.     }
  1072.     $gencode append ";\n"
  1073.  
  1074.  
  1075.     # Generate parameters
  1076.     #
  1077.     foreach param [[$this ooplClass] creationParamSet] {
  1078.         if {![$param isGUIComponent [$this ooplClass]]} {
  1079.             $param generate $ctor
  1080.         }
  1081.     }
  1082.  
  1083.     $class constructr $ctor
  1084. }
  1085.  
  1086. # Do not delete this line -- regeneration end marker
  1087.  
  1088. Class DPGConstructorD : {DPGConstructor OPConstructor} {
  1089. }
  1090.  
  1091. selfPromoter OPConstructor {this} {
  1092.     DPGConstructorD promote $this
  1093. }
  1094.  
  1095. #      File:           @(#)dpgoperati.tcl    /main/hindenburg/7
  1096.  
  1097.  
  1098. Class DPGOperation : {DPGFeature} {
  1099.     constructor
  1100.     method destructor
  1101.     method getBaseEvent
  1102.     method generateEvent
  1103.     method generate
  1104. }
  1105.  
  1106. constructor DPGOperation {class this name} {
  1107.     set this [DPGFeature::constructor $class $this $name]
  1108.     # Start constructor user section
  1109.     # End constructor user section
  1110.     return $this
  1111. }
  1112.  
  1113. method DPGOperation::destructor {this} {
  1114.     # Start destructor user section
  1115.     # End destructor user section
  1116. }
  1117.  
  1118. method DPGOperation::getBaseEvent {this class} {
  1119.  
  1120.     # Find base Event with access "Public" or "Published"
  1121.     set eventname [$this getName]
  1122.     while {[llength [$class genNodeSet]] > 0} {
  1123.         foreach operation [$class operationSet] {
  1124.             if {[$operation getName] == $eventname} {
  1125.                 set access [$operation getPropertyValue "method_access"]
  1126.                 if {$access == "Published" || $access == "Public" || $access == ""} {
  1127.                     return $operation
  1128.                 }
  1129.             }
  1130.         }
  1131.         set class [[lindex [$class genNodeSet] 0] superClass]
  1132.     }
  1133.  
  1134.     return ""
  1135. }
  1136.  
  1137. method DPGOperation::generateEvent {this class control} {
  1138.     
  1139.     set event [DPEvent new]
  1140.     $event name [$control name][$this getName]
  1141.  
  1142.     set tempmod [$this getPropertyValue "method_modifier"]
  1143.     if {[$this isClassFeature] || ( $tempmod != "" && $tempmod != "None" )} {
  1144.         m4_warning $W_EVTILLTYPE [$event name] [$control name]
  1145.     }
  1146.  
  1147.     if {[$class getEvent [string tolower [$event name]]] == ""} {
  1148.         $class setEvent [string tolower [$event name]] $event
  1149.     } else {
  1150.         m4_warning $W_EVTDBDEF [$event name] [$control name]
  1151.     }
  1152.  
  1153.     # Search if event is valid
  1154.  
  1155.     if {[[$this ooplClass] isGUIComponent]} {
  1156.         set super [[lindex [[$this ooplClass] genNodeSet] 0] superClass]
  1157.         set baseEvent [$this getBaseEvent $super]
  1158.         if {$baseEvent == ""} {
  1159.             m4_warning $E_EVTNOTEXIST [$this getName] [$control name]
  1160.             return $event
  1161.         }
  1162.  
  1163.         # Generate parameters of base-event
  1164.  
  1165.         foreach param [$baseEvent parameterSet] {
  1166.             $param generate $event
  1167.         }
  1168.     }
  1169.  
  1170.     # Access
  1171.  
  1172.     $event access "Published"
  1173.  
  1174.     # Comment
  1175.  
  1176.     set comment [DPComment new]
  1177.     $event comment $comment
  1178.     $comment comment [$this getPropertyValue "freeText"]
  1179.  
  1180.     # Parameters
  1181.  
  1182.     #foreach param [$this parameterSet] {
  1183.     #    $param generate $event
  1184.     #}
  1185.  
  1186.     return $event
  1187. }
  1188.  
  1189. method DPGOperation::generate {this class} {
  1190.  
  1191.     # No events for non-GUI classes
  1192.  
  1193.     if {[$this getPropertyValue "is_event"] == 1} {
  1194.         if {[[$this ooplClass] isGUIComponent] == 0} {
  1195.             m4_error $E_CANTCONTEVENT [[$this ooplClass] getName] [$this getName]
  1196.         } else {
  1197.             return
  1198.         }
  1199.     }
  1200.  
  1201.     # Constructor
  1202.  
  1203.     if {[string tolower [$this getName]] == "create" && [$this isClassFeature]} {
  1204.         set oper [DPConstructor new]
  1205.         $oper name [$this getName]
  1206.  
  1207.         if {[[$this ooplClass] constructor] != ""} {
  1208.             if {[[[$this ooplClass] constructor] counted] == ""} {
  1209.                 [[$this ooplClass] constructor] counted 1
  1210.                 $class userConstructors [expr [$class userConstructors] + 1]
  1211.             }
  1212.         }
  1213.         $class userConstructors [expr [$class userConstructors] + 1]
  1214.         if {[expr [$class userConstructors] > 1]} {
  1215.             $oper name [$oper name][$class userConstructors]
  1216.         }
  1217.     } else {
  1218.  
  1219.         # Procedure or function
  1220.  
  1221.         set returnType [[$this ooplType] generate]
  1222.         if {[$returnType name] != ""} {
  1223.             set oper [DPFunction new $returnType]
  1224.         } else {
  1225.             set oper [DPProcedure new]
  1226.         }
  1227.         $oper name [$this getName]
  1228.         $oper isClassFeature [$this isClassFeature]
  1229.     }
  1230.  
  1231.     if {[$class getUsermethod [string tolower [$oper name]]] == ""} {
  1232.         $class setUsermethod [string tolower [$oper name]] $oper
  1233.     } else {
  1234.         m4_warning $W_METHDBDEF [$oper name] [$class name]
  1235.     }
  1236.  
  1237.     # Access
  1238.  
  1239.     $oper access [$this getPropertyValue "method_access"]
  1240.     if {[$oper access] == ""} {
  1241.         $oper access "Published"
  1242.     }
  1243.  
  1244.     # Comment
  1245.  
  1246.     set comment [DPComment new]
  1247.     $oper comment $comment
  1248.     $comment comment [$this getPropertyValue "freeText"]
  1249.  
  1250.     # Method modifier
  1251.  
  1252.     switch [$this getPropertyValue "method_modifier"] {
  1253.         "Virtual"    {
  1254.             $oper isVirtual 1
  1255.         }
  1256.         "Dynamic"    {
  1257.             $oper isDynamic 1
  1258.         }
  1259.         "Virtual Abstract"    {
  1260.             $oper isAbstract 1
  1261.             $oper isVirtual 1
  1262.         }
  1263.         "Dynamic Abstract"    {
  1264.             $oper isAbstract 1
  1265.             $oper isDynamic 1
  1266.         }
  1267.         "Override"    {
  1268.             $oper isOverride 1
  1269.         }
  1270.         default    {
  1271.         }
  1272.     }
  1273.     if {[$this isAbstract]} {
  1274.         $oper isAbstract 1
  1275.         $oper isVirtual 1
  1276.     }
  1277.  
  1278.     # Parameters
  1279.  
  1280.     foreach param [$this parameterSet] {
  1281.         $param generate $oper
  1282.     }
  1283. }
  1284.  
  1285. # Do not delete this line -- regeneration end marker
  1286.  
  1287. Class DPGOperationD : {DPGOperation OPOperation} {
  1288. }
  1289.  
  1290. selfPromoter OPOperation {this} {
  1291.     DPGOperationD promote $this
  1292. }
  1293.  
  1294. #      File:           @(#)dpgassocin.tcl    /main/hindenburg/8
  1295.  
  1296.  
  1297. Class DPGAssocInitializer : {DPGInitializer} {
  1298.     constructor
  1299.     method destructor
  1300.     method generate
  1301. }
  1302.  
  1303. constructor DPGAssocInitializer {class this name} {
  1304.     set this [DPGInitializer::constructor $class $this $name]
  1305.     # Start constructor user section
  1306.     # End constructor user section
  1307.     return $this
  1308. }
  1309.  
  1310. method DPGAssocInitializer::destructor {this} {
  1311.     # Start destructor user section
  1312.     # End destructor user section
  1313. }
  1314.  
  1315. method DPGAssocInitializer::generate {this ctor} {
  1316.     if {[[[$this assoc] ooplType] ooplClass] != ""} {
  1317.         if {[[[[$this assoc] ooplType] ooplClass] baseType] == "TComponent"} {
  1318.             return
  1319.         }
  1320.     }
  1321.  
  1322.     set varname "[[$this assoc] getName]"
  1323.     set refname "${varname}Ref"
  1324.     set setname "${varname}Set"
  1325.     set dictname "${varname}Dict"
  1326.     if {[[$this assoc] opposite] != ""} {
  1327.         set opvarname "[[[$this assoc] opposite] getName]"
  1328.         set oprefname "${opvarname}Ref"
  1329.         set opsetname "${opvarname}Set"
  1330.         set opdictname "${opvarname}Dict"
  1331.     }
  1332.  
  1333.     # ToDo: Clean this up!!
  1334.     #
  1335.     set assoctype [[$this assoc] generateAssocType [[[$this constructor] ooplClass] target]]
  1336.  
  1337.  
  1338.     if {[[$this assoc] isMandatory]} {
  1339.         [$ctor gencode] append "if ([$this getName] <> NIL) then\nbegin\n"
  1340.         [$ctor gencode] indent +
  1341.     }
  1342.     if {[[$this assoc] getMultiplicity] == "one"} {
  1343.         if {[[$this assoc] isMandatory] &&
  1344.             [[$this assoc] opposite] != ""} {
  1345.             if {[[[$this assoc] opposite] isQualified]} {
  1346.                 if {[[[$this assoc] opposite] get_obj_type] == "qual_link_attrib"} {
  1347.                     [$ctor gencode] append "${refname} := [$this getName];\n"
  1348.                     set key [[[$this constructor] qualInitializer] getName]
  1349.                     if {[[[$this assoc] opposite] getMultiplicity] == "one"} {
  1350.                         [$ctor gencode] append "(${refname} as [$assoctype name]).${opdictname}.Add(${key}, SELF);\n"
  1351.                     } else {
  1352.                         set tempset "temp${opsetname}"
  1353.                         [$ctor gentypes] append "var\n"
  1354.                         [$ctor gentypes] indent +
  1355.                         [$ctor gentypes] append "${tempset}: TList;\n"
  1356.                         [$ctor gentypes] indent -
  1357.  
  1358.                         [$ctor gencode] append "if (${refname} as [$assoctype name]).${opdictname}.Item(SELF) <> NIL) then\nbegin\n"
  1359.                         [$ctor gencode] indent +
  1360.                         [$ctor gencode] append "${tempset} := (${refname} as [$assoctype name]).${opdictname}.Item(SELF;\n"
  1361.                         [$ctor gencode] indent -
  1362.                         [$ctor gencode] append "end\n"
  1363.                         [$ctor gencode] append "else\n"
  1364.                         [$ctor gencode] append "begin\n"
  1365.                         [$ctor gencode] indent +
  1366.                         [$ctor gencode] append "${tempset} := TList.Create;\n"
  1367.                         [$ctor gencode] append "(${refname} as [$assoctype name]).${opdictname}.Add(${key}, ${tempset})\n"
  1368.                         [$ctor gencode] indent -
  1369.                         [$ctor gencode] append "end;\n"
  1370.                         [$ctor gencode] append "${tempset}.Add(SELF);\n"
  1371.                     }
  1372.                 } else {
  1373.                     m4_warning $W_NOCTORCODE [[[$this assoc] ooplClass] getName] [[[[$this assoc] opposite] ooplClass] getName]
  1374.                 }
  1375.             } else {
  1376.                 [$ctor gencode] append "${refname} := [$this getName];\n"
  1377.                 if {[[[$this assoc] opposite] getMultiplicity] == "one"} {
  1378.                     [$ctor gencode] append "(${refname} as [$assoctype name]).${oprefname} := SELF;\n"
  1379.                 } else {
  1380.                     [$ctor gencode] append "(${refname} as [$assoctype name]).${opsetname}.Add(SELF);\n"
  1381.                 }
  1382.             }
  1383.         } else {
  1384.             [$ctor gencode] append "${refname} := [$this getName];\n"
  1385.         }
  1386.     } else {
  1387.         [$ctor gencode] append "${setname} := TList.Create;\n";
  1388.         [$ctor gencode] append "add[cap ${varname}]([$this getName]);\n"
  1389.     }
  1390.  
  1391.     if {[[$this assoc] isMandatory]} {
  1392.         set sysutilstype [DPType new]
  1393.         $sysutilstype includeName "SysUtils"
  1394.         $sysutilstype includeType "imp"
  1395.         $sysutilstype addAsInclude [[[$this constructor] ooplClass] target]
  1396.  
  1397.         [$ctor gencode] indent -
  1398.         [$ctor gencode] append "end\nelse\n"
  1399.         [$ctor gencode] indent +
  1400.         [$ctor gencode] append "raise EInvalidOp.Create('Object ${varname} has mandatory relation. NIL object reference not allowed.');\n"
  1401.         [$ctor gencode] indent -
  1402.     }
  1403. }
  1404.  
  1405. # Do not delete this line -- regeneration end marker
  1406.  
  1407. Class DPGAssocInitializerD : {DPGAssocInitializer OPAssocInitializer} {
  1408. }
  1409.  
  1410. selfPromoter OPAssocInitializer {this} {
  1411.     DPGAssocInitializerD promote $this
  1412. }
  1413.  
  1414. #      File:           @(#)dpgattribi.tcl    /main/hindenburg/3
  1415.  
  1416.  
  1417. Class DPGAttribInitializer : {DPGInitializer} {
  1418.     constructor
  1419.     method destructor
  1420.     method generate
  1421. }
  1422.  
  1423. constructor DPGAttribInitializer {class this name} {
  1424.     set this [DPGInitializer::constructor $class $this $name]
  1425.     # Start constructor user section
  1426.     # End constructor user section
  1427.     return $this
  1428. }
  1429.  
  1430. method DPGAttribInitializer::destructor {this} {
  1431.     # Start destructor user section
  1432.     # End destructor user section
  1433. }
  1434.  
  1435. method DPGAttribInitializer::generate {this ctor} {
  1436.  
  1437.     if {[[$this attrib] isClassFeature]} {
  1438.         m4_warning $W_NOKEYFEAT [[$this attrib] getName] [[[$this attrib] ooplClass] getName]
  1439.     } else {
  1440.         [$ctor gencode] append "[[$this attrib] getName] := [$this getName];\n"
  1441.     }
  1442. }
  1443.  
  1444. # Do not delete this line -- regeneration end marker
  1445.  
  1446. Class DPGAttribInitializerD : {DPGAttribInitializer OPAttribInitializer} {
  1447. }
  1448.  
  1449. selfPromoter OPAttribInitializer {this} {
  1450.     DPGAttribInitializerD promote $this
  1451. }
  1452.  
  1453. #      File:           @(#)dpginhkeyi.tcl    /main/hindenburg/1
  1454.  
  1455.  
  1456. Class DPGInhKeyInitializer : {DPGInitializer} {
  1457.     constructor
  1458.     method destructor
  1459.     method generate
  1460. }
  1461.  
  1462. constructor DPGInhKeyInitializer {class this name} {
  1463.     set this [DPGInitializer::constructor $class $this $name]
  1464.     # Start constructor user section
  1465.     # End constructor user section
  1466.     return $this
  1467. }
  1468.  
  1469. method DPGInhKeyInitializer::destructor {this} {
  1470.     # Start destructor user section
  1471.     # End destructor user section
  1472. }
  1473.  
  1474. method DPGInhKeyInitializer::generate {this ctor} {
  1475.     # !! Implement this function !!
  1476. }
  1477.  
  1478. # Do not delete this line -- regeneration end marker
  1479.  
  1480. Class DPGInhKeyInitializerD : {DPGInhKeyInitializer OPInhKeyInitializer} {
  1481. }
  1482.  
  1483. selfPromoter OPInhKeyInitializer {this} {
  1484.     DPGInhKeyInitializerD promote $this
  1485. }
  1486.  
  1487. #      File:           @(#)dpgqualini.tcl    /main/hindenburg/2
  1488.  
  1489.  
  1490. Class DPGQualInitializer : {DPGInitializer} {
  1491.     constructor
  1492.     method destructor
  1493.     method generate
  1494. }
  1495.  
  1496. constructor DPGQualInitializer {class this name} {
  1497.     set this [DPGInitializer::constructor $class $this $name]
  1498.     # Start constructor user section
  1499.     # End constructor user section
  1500.     return $this
  1501. }
  1502.  
  1503. method DPGQualInitializer::destructor {this} {
  1504.     # Start destructor user section
  1505.     # End destructor user section
  1506. }
  1507.  
  1508. method DPGQualInitializer::generate {this ctor} {
  1509.     # !! Implement this function !!
  1510. }
  1511.  
  1512. # Do not delete this line -- regeneration end marker
  1513.  
  1514. Class DPGQualInitializerD : {DPGQualInitializer OPQualInitializer} {
  1515. }
  1516.  
  1517. selfPromoter OPQualInitializer {this} {
  1518.     DPGQualInitializerD promote $this
  1519. }
  1520.  
  1521. #      File:           @(#)dpgsupercl.tcl    /main/hindenburg/3
  1522.  
  1523.  
  1524. Class DPGSuperClassInitializer : {DPGInitializer} {
  1525.     constructor
  1526.     method destructor
  1527.     method generate
  1528. }
  1529.  
  1530. constructor DPGSuperClassInitializer {class this name} {
  1531.     set this [DPGInitializer::constructor $class $this $name]
  1532.     # Start constructor user section
  1533.     # End constructor user section
  1534.     return $this
  1535. }
  1536.  
  1537. method DPGSuperClassInitializer::destructor {this} {
  1538.     # Start destructor user section
  1539.     # End destructor user section
  1540. }
  1541.  
  1542. method DPGSuperClassInitializer::generate {this ctor} {
  1543.     foreach param [$this parameterSet] {
  1544.         if {![$param isGUIComponent [$this ooplClass]]} {
  1545.             $param generate $ctor
  1546.         }
  1547.     }
  1548. }
  1549.  
  1550. # Do not delete this line -- regeneration end marker
  1551.  
  1552. Class DPGSuperClassInitializerD : {DPGSuperClassInitializer OPSuperClassInitializer} {
  1553. }
  1554.  
  1555. selfPromoter OPSuperClassInitializer {this} {
  1556.     DPGSuperClassInitializerD promote $this
  1557. }
  1558.  
  1559. #      File:           @(#)dpgctorpar.tcl    /main/hindenburg/3
  1560.  
  1561.  
  1562. Class DPGCtorParameter : {DPGParameter} {
  1563.     constructor
  1564.     method destructor
  1565.     method isGUIComponent
  1566.     method generate
  1567. }
  1568.  
  1569. constructor DPGCtorParameter {class this name} {
  1570.     set this [DPGParameter::constructor $class $this $name]
  1571.     # Start constructor user section
  1572.     # End constructor user section
  1573.     return $this
  1574. }
  1575.  
  1576. method DPGCtorParameter::destructor {this} {
  1577.     # Start destructor user section
  1578.     # End destructor user section
  1579. }
  1580.  
  1581. method DPGCtorParameter::isGUIComponent {this class} {
  1582.     # ToDo: Modify this for future component inheritance
  1583.     if {[$class baseType] != "TForm"} {
  1584.         return 0
  1585.     }
  1586.     set done 0
  1587.     while {!$done} {
  1588.         foreach assoc [$class genAssocAttrSet] {
  1589.             if {[$assoc getName] == [$this getName]} {
  1590.                 if {[[$assoc ooplClass] isGUIComponent]} {
  1591.                     return 1
  1592.                 }
  1593.             }
  1594.         }
  1595.         set class [[lindex [$class genNodeSet] 0] superClass]
  1596.         if {[$class getName] == "TForm"} {
  1597.             set done 1
  1598.         } 
  1599.     }
  1600.     return 0
  1601. }
  1602.  
  1603. method DPGCtorParameter::generate {this method} {
  1604.     if {[$this attrib] != ""} {
  1605.         if [[$this attrib] isClassFeature] {
  1606.             return
  1607.         }
  1608.     }
  1609.  
  1610.     # check if GUI association
  1611.     #
  1612.     if {[$this initializer] != ""} {
  1613.         if {[[$this initializer] isA OPAssocInitializer]} {
  1614.             if {[[[[$this initializer] assoc] ooplType] ooplClass] != ""} {
  1615.                 if {[[[[[$this initializer] assoc] ooplType] ooplClass] baseType] == "TComponent"} {
  1616.                     return
  1617.                 }
  1618.             }
  1619.         }
  1620.     }
  1621.     set param [DPArgument new [[$this ooplType] generate]]
  1622.     $param name [$this getName]
  1623.     $param passedBy [$this getPropertyValue "pass_by"]
  1624.     $method addArg $param
  1625. }
  1626.  
  1627. # Do not delete this line -- regeneration end marker
  1628.  
  1629. Class DPGCtorParameterD : {DPGCtorParameter OPCtorParameter} {
  1630. }
  1631.  
  1632. selfPromoter OPCtorParameter {this} {
  1633.     DPGCtorParameterD promote $this
  1634. }
  1635.  
  1636. #      File:           @(#)dpgoperpar.tcl    /main/hindenburg/1
  1637.  
  1638.  
  1639. Class DPGOperParameter : {DPGParameter} {
  1640.     constructor
  1641.     method destructor
  1642.     method generate
  1643. }
  1644.  
  1645. constructor DPGOperParameter {class this name} {
  1646.     set this [DPGParameter::constructor $class $this $name]
  1647.     # Start constructor user section
  1648.     # End constructor user section
  1649.     return $this
  1650. }
  1651.  
  1652. method DPGOperParameter::destructor {this} {
  1653.     # Start destructor user section
  1654.     # End destructor user section
  1655. }
  1656.  
  1657. method DPGOperParameter::generate {this method} {
  1658.     set param [DPArgument new [[$this ooplType] generate]]
  1659.     $param name [$this getName]
  1660.     $param passedBy [$this getPropertyValue "pass_by"]
  1661.     $method addArg $param
  1662. }
  1663.  
  1664. # Do not delete this line -- regeneration end marker
  1665.  
  1666. Class DPGOperParameterD : {DPGOperParameter OPOperParameter} {
  1667. }
  1668.  
  1669. selfPromoter OPOperParameter {this} {
  1670.     DPGOperParameterD promote $this
  1671. }
  1672.  
  1673. #      File:           @(#)dpgbasetyp.tcl    /main/hindenburg/2
  1674.  
  1675.  
  1676. Class DPGBaseType : {DPGType} {
  1677.     constructor
  1678.     method destructor
  1679.     method generate
  1680. }
  1681.  
  1682. constructor DPGBaseType {class this name name} {
  1683.     set this [DPGType::constructor $class $this $name $name]
  1684.     # Start constructor user section
  1685.     # End constructor user section
  1686.     return $this
  1687. }
  1688.  
  1689. method DPGBaseType::destructor {this} {
  1690.     # Start destructor user section
  1691.     # End destructor user section
  1692. }
  1693.  
  1694. method DPGBaseType::generate {this} {
  1695.     set type [DPType new]
  1696.     $type name [$this getType3GL]
  1697.     $type includeType "none"
  1698.     $type includeName ""
  1699.     return $type
  1700. }
  1701.  
  1702. # Do not delete this line -- regeneration end marker
  1703.  
  1704. Class DPGBaseTypeD : {DPGBaseType OPBaseType} {
  1705. }
  1706.  
  1707. selfPromoter OPBaseType {this} {
  1708.     DPGBaseTypeD promote $this
  1709. }
  1710.  
  1711. #      File:           @(#)dpgclassty.tcl    /main/hindenburg/1
  1712.  
  1713.  
  1714. Class DPGClassType : {DPGType} {
  1715.     constructor
  1716.     method destructor
  1717. }
  1718.  
  1719. constructor DPGClassType {class this name name} {
  1720.     set this [DPGType::constructor $class $this $name $name]
  1721.     # Start constructor user section
  1722.     # End constructor user section
  1723.     return $this
  1724. }
  1725.  
  1726. method DPGClassType::destructor {this} {
  1727.     # Start destructor user section
  1728.     # End destructor user section
  1729. }
  1730.  
  1731. # Do not delete this line -- regeneration end marker
  1732.  
  1733. Class DPGClassTypeD : {DPGClassType OPClassType} {
  1734. }
  1735.  
  1736. selfPromoter OPClassType {this} {
  1737.     DPGClassTypeD promote $this
  1738. }
  1739.  
  1740. #      File:           @(#)dpgenumtyp.tcl    /main/hindenburg/1
  1741.  
  1742.  
  1743. Class DPGEnumType : {DPGType} {
  1744.     constructor
  1745.     method destructor
  1746. }
  1747.  
  1748. constructor DPGEnumType {class this name name} {
  1749.     set this [DPGType::constructor $class $this $name $name]
  1750.     # Start constructor user section
  1751.     # End constructor user section
  1752.     return $this
  1753. }
  1754.  
  1755. method DPGEnumType::destructor {this} {
  1756.     # Start destructor user section
  1757.     # End destructor user section
  1758. }
  1759.  
  1760. # Do not delete this line -- regeneration end marker
  1761.  
  1762. Class DPGEnumTypeD : {DPGEnumType OPEnumType} {
  1763. }
  1764.  
  1765. selfPromoter OPEnumType {this} {
  1766.     DPGEnumTypeD promote $this
  1767. }
  1768.  
  1769. #      File:           @(#)dpgtypedef.tcl    /main/hindenburg/1
  1770.  
  1771.  
  1772. Class DPGTypeDefType : {DPGType} {
  1773.     constructor
  1774.     method destructor
  1775. }
  1776.  
  1777. constructor DPGTypeDefType {class this name name} {
  1778.     set this [DPGType::constructor $class $this $name $name]
  1779.     # Start constructor user section
  1780.     # End constructor user section
  1781.     return $this
  1782. }
  1783.  
  1784. method DPGTypeDefType::destructor {this} {
  1785.     # Start destructor user section
  1786.     # End destructor user section
  1787. }
  1788.  
  1789. # Do not delete this line -- regeneration end marker
  1790.  
  1791. Class DPGTypeDefTypeD : {DPGTypeDefType OPTypeDefType} {
  1792. }
  1793.  
  1794. selfPromoter OPTypeDefType {this} {
  1795.     DPGTypeDefTypeD promote $this
  1796. }
  1797.  
  1798. #      File:           @(#)dpgassocma.tcl    /main/hindenburg/16
  1799.  
  1800.  
  1801. Class DPGAssocMany : {DPGAssocGen} {
  1802.     constructor
  1803.     method destructor
  1804.     method hasAdd
  1805.     method hasDtor
  1806.     method hasRemove
  1807.     method generate
  1808.     method generateAdd
  1809.     method generateGet
  1810.     method generateRemove
  1811.     method generateDtor
  1812. }
  1813.  
  1814. constructor DPGAssocMany {class this assocattr} {
  1815.     set this [DPGAssocGen::constructor $class $this $assocattr]
  1816.     # Start constructor user section
  1817.     # End constructor user section
  1818.     return $this
  1819. }
  1820.  
  1821. method DPGAssocMany::destructor {this} {
  1822.     # Start destructor user section
  1823.     # End destructor user section
  1824.     $this DPGAssocGen::destructor
  1825. }
  1826.  
  1827. method DPGAssocMany::hasAdd {this self} {
  1828.     set wr [$this propWrite]
  1829.     if {$self} {
  1830.         if {$wr == "None"} {
  1831.             return 0
  1832.         }
  1833.     } else {
  1834.         if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  1835.             return 0
  1836.         }
  1837.     }
  1838.     if {[[$this assocattr] opposite] != ""} {
  1839.         if {[[[$this assocattr] opposite] isQualified]} {
  1840.             if {![$this addWarning]} {
  1841.                 $this addWarning 1
  1842.                 m4_warning $W_NOADD [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  1843.             }
  1844.             return 0
  1845.         }
  1846.     }
  1847.     return 1
  1848. }
  1849.  
  1850. method DPGAssocMany::hasDtor {this self} {
  1851.     if {[[$this assocattr] opposite] != ""} {
  1852.         if {[[[$this assocattr] opposite] isQualified]} {
  1853.             if {![$this dtorWarning]} {
  1854.                 $this dtorWarning 1
  1855.                 m4_warning $W_NODTOR [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  1856.             }
  1857.             return 0
  1858.         }
  1859.     }
  1860.     return 1
  1861. }
  1862.  
  1863. method DPGAssocMany::hasRemove {this self} {
  1864.     set wr [$this propWrite]
  1865.     if {$self} {
  1866.         if {$wr == "None"} {
  1867.             return 0
  1868.         }
  1869.     } else {
  1870.         if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  1871.             return 0
  1872.         }
  1873.     }
  1874.     if {[[$this assocattr] opposite] != ""} {
  1875.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  1876.             return 0
  1877.         }
  1878.         if {[[[$this assocattr] opposite] isQualified]} {
  1879.             if {![$this removeWarning]} {
  1880.                 $this removeWarning 1
  1881.                 m4_warning $W_NOREMOVE [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  1882.             }
  1883.             return 0
  1884.         }
  1885.     }
  1886.     return 1
  1887. }
  1888.  
  1889. method DPGAssocMany::generate {this cl} {
  1890.     set type [[$this assocattr] generateManyAssocType]
  1891.     set vari [DPVariable new $type]
  1892.     $vari name "[[$this assocattr] getName]Set"
  1893.     $cl addAssocvar $vari
  1894.     $vari access "Private"
  1895.     if {[$cl constructr] != ""} {
  1896.         [[$cl constructr] gencode] append "[$vari name] := TList.Create;\n"
  1897.     }
  1898.     if {[[$this assocattr] opposite] != ""} {
  1899.         [[$this assocattr] opposite] setGenerator
  1900.     }
  1901.     $this generateGet $vari $cl
  1902.     $this generateAdd $vari $cl
  1903.     $this generateRemove $vari $cl
  1904.     $this generateDtor $vari $cl
  1905. }
  1906.  
  1907. method DPGAssocMany::generateAdd {this vari cl} {
  1908.     # Check if Add method should be generated
  1909.     #
  1910.     if {![$this hasAdd 0]} {
  1911.         $vari access "Published"
  1912.     }
  1913.     if {![$this hasAdd 1]} {
  1914.         return
  1915.     }
  1916.  
  1917.     # Generate
  1918.     #
  1919.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  1920.     set assoctype [[$this assocattr] generateAssocType $cl]
  1921.     set arg "new[$assoctype name]"
  1922.     set param [DPArgument new $type]
  1923.     $param name $arg
  1924.     set addproc [DPProcedure new]
  1925.     $addproc addArg $param
  1926.     set addcode [TextSection new]
  1927.  
  1928.     $addproc gencode $addcode
  1929.     $addproc hasUserSection 0
  1930.     $addproc access [$this propWrite]
  1931.     $addproc name "add[cap [$this varname]]"
  1932.  
  1933.     $addcode append "if ([$vari name].IndexOf(${arg}) = -1) then\nbegin\n"
  1934.     $addcode indent +
  1935.     $addcode append "[$vari name].Add(${arg});\n"
  1936.  
  1937.     if {[[$this assocattr] opposite] != ""} {
  1938.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  1939.             
  1940.             # many-many
  1941.             #
  1942.             if {[[[[$this assocattr] opposite] generator] hasAdd 0]} {
  1943.                 $addcode append "(${arg} as [$assoctype name]).add[cap [$this opvarname]](SELF);\n"
  1944.             } else {
  1945.                 $addcode append "(${arg} as [$assoctype name]).[$this opvarset].Add(SELF);\n"
  1946.             }
  1947.         } else {
  1948.             # one-many
  1949.             if {[[[[$this assocattr] opposite] generator] hasSet 0]} {
  1950.                 $addcode append "(${arg} as [$assoctype name]).set[cap [$this opvarname]](SELF);\n"
  1951.             } else {
  1952.                 $addcode append "(${arg} as [$assoctype name]).[$this opvarname] := SELF;\n"
  1953.             }
  1954.         }
  1955.     }
  1956.  
  1957.     $addcode indent -
  1958.     $addcode append "end;\n"
  1959.  
  1960.     $cl setGenmethod [$addproc name] $addproc
  1961. }
  1962.  
  1963. method DPGAssocMany::generateGet {this vari cl} {
  1964.     # Check if Get method should be generated
  1965.     #
  1966.     if {![$this hasGet 0]} {
  1967.         $vari access "Published"
  1968.     }
  1969.     if {![$this hasGet 1]} {
  1970.         return
  1971.     }
  1972.  
  1973.     # Generate
  1974.     #
  1975.     set type [[$this assocattr] generateManyAssocType]
  1976.     set getproc [DPFunction new $type]
  1977.     set getcode [TextSection new]
  1978.     $getproc gencode $getcode
  1979.     $getproc hasUserSection 0
  1980.     $getproc access [$this propRead]
  1981.     $getproc name "get[cap [$this varname]]"
  1982.     $getcode append "[$getproc name] := "
  1983.     $getcode append "[$this varset];\n"
  1984.     $cl setGenmethod [$getproc name] $getproc
  1985. }
  1986.  
  1987. method DPGAssocMany::generateRemove {this vari cl} {
  1988.     # Check if Remove method should be generated
  1989.     #
  1990.     if {![$this hasRemove 0]} {
  1991.         $vari access "Published"
  1992.     }
  1993.     if {![$this hasRemove 1]} {
  1994.         return
  1995.     }
  1996.  
  1997.     # Generated
  1998.     #
  1999.     set removeproc [DPProcedure new]
  2000.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2001.     set assoctype [[$this assocattr] generateAssocType $cl]
  2002.     set arg "old[$assoctype name]"
  2003.     set param [DPArgument new $type]
  2004.     $param name $arg
  2005.     $removeproc addArg $param
  2006.  
  2007.     set removecode [TextSection new]
  2008.     $removeproc gencode $removecode
  2009.     $removeproc hasUserSection 0
  2010.     $removeproc access [$this propWrite]
  2011.     $removeproc name "remove[cap [$this varname]]"
  2012.  
  2013.     $removecode append "if ([$vari name].IndexOf(${arg}) <> -1) then\nbegin\n"
  2014.     $removecode indent +
  2015.     $removecode append "[$vari name].Remove(${arg});\n"
  2016.  
  2017.     if {[[$this assocattr] opposite] != ""} {
  2018.         if {[[[[$this assocattr] opposite] generator] hasRemove 0]} {
  2019.             $removecode append "(${arg} as [$assoctype name]).remove[cap [$this opvarname]]("
  2020.             if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2021.                 $removecode append "SELF"
  2022.             }
  2023.             $removecode append ");\n"
  2024.         } else {
  2025.             if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2026.                 $removecode append "(${arg} as [$assoctype name]).[$this opvarset].Remove(SELF);\n"
  2027.             } else {
  2028.                 $removecode append "(${arg} as [$assoctype name]).[$this opvarref] := NIL;\n"
  2029.             }
  2030.         }
  2031.     }
  2032.     $removecode indent -
  2033.     $removecode append "end;\n"
  2034.  
  2035.     $cl setGenmethod [$removeproc name] $removeproc
  2036. }
  2037.  
  2038. method DPGAssocMany::generateDtor {this vari cl} {
  2039.  
  2040.     # Check if Destructor should be generated
  2041.     #
  2042.     if {![$this hasDtor 1]} {
  2043.         [[$cl destructr] gencode] append "[$this varset].Destroy;\n"
  2044.         return
  2045.     }
  2046.     # Generate
  2047.     #
  2048.  
  2049.     if {[[$this assocattr] opposite] != ""} {
  2050.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2051.             set sysutilstype [DPType new]
  2052.             $sysutilstype includeName "SysUtils"
  2053.             $sysutilstype includeType "imp"
  2054.             $sysutilstype addAsInclude [[[[[$this assocattr] opposite] ooplType] ooplClass] target]
  2055.             [[$cl destructr] gencode] append "if ([$this varset].Count <> 0) then\n"
  2056.             [[$cl destructr] gencode] indent +
  2057.             [[$cl destructr] gencode] append "raise EInvalidOp.Create('Illegal object destruction. Mandatory relation "
  2058.             [[$cl destructr] gencode] append "[$this varset] not empty.');\n"
  2059.             [[$cl destructr] gencode] indent -
  2060.             [[$cl destructr] gencode] append "[$this varset].Destroy;\n"
  2061.             return
  2062.         }
  2063.  
  2064.         [[$cl destructr] gencode] append "while ([$this varset].Count > 0) do\nbegin\n"
  2065.         [[$cl destructr] gencode] indent +
  2066.         if {[$this hasRemove 1]} {
  2067.             [[$cl destructr] gencode] append "remove[cap [$this varname]]([$this varset].First)\n"
  2068.         } else {
  2069.             set old "old[[[[$this assocattr] ooplType] ooplClass] getName]"
  2070.  
  2071.             [[$cl destructr] gentypes] append "var\n"
  2072.             [[$cl destructr] gentypes] indent +
  2073.             [[$cl destructr] gentypes] append "${old}: [[$vari type] name];\n\n"
  2074.             [[$cl destructr] gentypes] indent -
  2075.             [[$cl destructr] gencode] append "${old} := [$this varset].First;\n"
  2076.             [[$cl destructr] gencode] append "[$this varset].Remove(${old});\n"
  2077.             if {[[[[$this assocattr] opposite] generator] hasRemove 0]} {
  2078.                 [[$cl destructr] gencode] append "${old}.remove[cap [$this varname]];\n"
  2079.             } else {
  2080.                 [[$cl destructr] gencode] append "${old}.[$this opvarname] := NIL;\n"
  2081.             }
  2082.         }
  2083.             
  2084.         [[$cl destructr] gencode] indent -
  2085.         [[$cl destructr] gencode] append "end;\n"
  2086.     }
  2087.  
  2088.     [[$cl destructr] gencode] append "[$this varset].Destroy;\n"
  2089. }
  2090.  
  2091. # Do not delete this line -- regeneration end marker
  2092.  
  2093.  
  2094. #      File:           @(#)dpgassocon.tcl    /main/hindenburg/15
  2095.  
  2096.  
  2097. Class DPGAssocOne : {DPGAssocGen} {
  2098.     constructor
  2099.     method destructor
  2100.     method hasSet
  2101.     method hasDtor
  2102.     method hasRemove
  2103.     method generate
  2104.     method generateSet
  2105.     method generateGet
  2106.     method generateRemove
  2107.     method generateDtor
  2108. }
  2109.  
  2110. constructor DPGAssocOne {class this assocattr} {
  2111.     set this [DPGAssocGen::constructor $class $this $assocattr]
  2112.     # Start constructor user section
  2113.     # End constructor user section
  2114.     return $this
  2115. }
  2116.  
  2117. method DPGAssocOne::destructor {this} {
  2118.     # Start destructor user section
  2119.     # End destructor user section
  2120.     $this DPGAssocGen::destructor
  2121. }
  2122.  
  2123. method DPGAssocOne::hasSet {this self} {
  2124.     set wr [$this propWrite]
  2125.     if {$self} {
  2126.         if {$wr == "None"} {
  2127.                 return 0
  2128.         }
  2129.     } else {
  2130.         if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  2131.                 return 0
  2132.         }
  2133.     }
  2134.     if {[[$this assocattr] opposite] != ""} {
  2135.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2136.             return 0
  2137.         }
  2138.         if {[[[$this assocattr] opposite] isQualified]} {
  2139.             if {![$this setWarning]} {
  2140.                 $this setWarning 1
  2141.                 m4_warning $W_NOSET [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  2142.             }
  2143.             return 0
  2144.         }
  2145.     }
  2146.     return 1
  2147. }
  2148.  
  2149. method DPGAssocOne::hasDtor {this self} {
  2150.     if {[[$this assocattr] opposite] != ""} {
  2151.        if {[[[$this assocattr] opposite] isQualified] && [[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2152.            if {![$this dtorWarning]} {
  2153.             $this dtorWarning 1
  2154.               m4_warning $W_NODTOR [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  2155.           }
  2156.           return 0
  2157.        }
  2158.     }
  2159.     return 1
  2160. }
  2161.  
  2162. method DPGAssocOne::hasRemove {this self} {
  2163.     set wr [$this propWrite]
  2164.     if {$self} {
  2165.             if {$wr == "None"} {
  2166.                     return 0
  2167.             }
  2168.     } else {
  2169.             if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  2170.                     return 0
  2171.             }
  2172.     }
  2173.     if {[[$this assocattr] opposite] != ""} {
  2174.        if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2175.           return 0
  2176.        }
  2177.        if {[[[$this assocattr] opposite] isQualified]} {
  2178.                if {![$this removeWarning]} {
  2179.                 $this removeWarning 1
  2180.               m4_warning $W_NOREMOVE [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  2181.               }
  2182.           return 0
  2183.        }
  2184.     }
  2185.     if {[[$this assocattr] isMandatory]} {
  2186.        return 0
  2187.     }
  2188.     return 1
  2189. }
  2190.  
  2191. method DPGAssocOne::generate {this cl} {
  2192.  
  2193.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2194.     set vari [DPVariable new $type]
  2195.     $vari name [$this varref]
  2196.     $cl addAssocvar $vari
  2197.     $vari access "Private"
  2198.  
  2199.     if {[[$this assocattr] opposite] != ""} {
  2200.         [[$this assocattr] opposite] setGenerator
  2201.     }
  2202.     $this generateGet $vari $cl
  2203.     $this generateSet $vari $cl
  2204.     $this generateRemove $vari $cl
  2205.     $this generateDtor $vari $cl
  2206. }
  2207.  
  2208. method DPGAssocOne::generateSet {this vari cl} {
  2209.  
  2210.     # Check if Set method should be generated
  2211.     #
  2212.     if {![$this hasSet 0]} {
  2213.         $vari access "Published"
  2214.     }
  2215.     if {![$this hasSet 1]} {
  2216.         return
  2217.     }
  2218.  
  2219.     # Generate
  2220.     #
  2221.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2222.     set assoctype [[$this assocattr] generateAssocType $cl]
  2223.     set arg "new[$assoctype name]"
  2224.     set param [DPArgument new $type]
  2225.     $param name $arg
  2226.     set setproc [DPProcedure new]
  2227.     $setproc addArg $param
  2228.     set setcode [TextSection new]
  2229.  
  2230.     $setproc gencode $setcode
  2231.     $setproc hasUserSection 0
  2232.     $setproc access [$this propWrite]
  2233.     $setproc name "set[cap [$this varname]]"
  2234.     if {[[$this assocattr] opposite] != ""} {
  2235.         $setcode append "if (${arg} <> NIL) then\nbegin\n"
  2236.         $setcode indent +
  2237.  
  2238.         if {[[$this assocattr] isMandatory]} {
  2239.             if {[[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2240.                 # one-mtory
  2241.                 #
  2242.                 if {[[[[$this assocattr] opposite] generator] hasGet 0]} {
  2243.                     $setcode append "if ((${arg} as [$assoctype name]).get[cap [$this opvarname]] = NIL) then\nbegin\n"
  2244.                 } else {
  2245.                     $setcode append "if ((${arg} as [$assoctype name]).[$this opvarref] = NIL) then\nbegin\n"
  2246.                 }
  2247.                 $setcode indent +
  2248.                 $setcode append "([$vari name] as [$assoctype name]).[$this opvarref] := NIL;\n"
  2249.             } else {
  2250.                 # many-mtory
  2251.                 #
  2252.                 $setcode append "if (${arg} <> [$vari name]) then\nbegin\n"
  2253.                 $setcode indent +
  2254.                 $setcode append "if ([$vari name] <> NIL) then\nbegin\n"
  2255.                 $setcode indent +
  2256.                 $setcode append "([$vari name] as [$assoctype name]).[$this opvarset].Remove(SELF);\n"
  2257.                 $setcode indent -
  2258.                 $setcode append "end;\n"
  2259.             }
  2260.         } else {
  2261.             
  2262.             # one/many - one
  2263.             #
  2264.             $setcode append "if (${arg} <> [$vari name]) then\nbegin\n"
  2265.             $setcode indent +
  2266.             $setcode append "if ([$vari name] <> NIL) then\nbegin\n"
  2267.             $setcode indent +
  2268.             if {[[[[$this assocattr] opposite] generator] hasRemove 0]} {
  2269.                 $setcode append "([$vari name] as [$assoctype name]).remove[cap [$this opvarname]]"
  2270.                 if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2271.                     $setcode append "(SELF)"
  2272.                 }
  2273.             } else {
  2274.                 if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2275.                     $setcode append "([$vari name] as [$assoctype name]).[$this opvarset].Remove(SELF)"
  2276.                 } else {
  2277.                     $setcode append "([$vari name] as [$assoctype name]).[$this opvarref] := NIL"
  2278.                 }
  2279.             }
  2280.                 
  2281.             $setcode append ";\n"
  2282.             $setcode indent -
  2283.             $setcode append "end;\n"
  2284.         }
  2285.  
  2286.         $setcode append "[$vari name] := ${arg};\n"
  2287.  
  2288.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2289.  
  2290.             # many - one/mtory
  2291.             #
  2292.             if {[[[[$this assocattr] opposite] generator] hasAdd 0]} {
  2293.                 $setcode append "(${arg} as [$assoctype name]).add[cap [$this opvarname]](SELF);\n"
  2294.             } else {
  2295.                 $setcode append "(${arg} as [$assoctype name]).[$this opvarset].Add(SELF);\n"
  2296.             }
  2297.         } else {
  2298.             # one - one/mtory
  2299.             #
  2300.             if {[[[[$this assocattr] opposite] generator] hasSet 0]} {
  2301.                 $setcode append "(${arg} as [$assoctype name]).set[cap [$this opvarname]](SELF);\n"
  2302.             } else {
  2303.                 $setcode append "(${arg} as [$assoctype name]).[$this opvarref] := SELF;\n"
  2304.             }
  2305.         }
  2306.         $setcode indent -
  2307.         $setcode append "end;\n"
  2308.  
  2309.         if {[$this hasRemove 1]} {
  2310.             # one/many - one
  2311.             #
  2312.             $setcode indent -
  2313.             $setcode append "end\nelse\nbegin\n"
  2314.             $setcode indent +
  2315.             $setcode append "remove[cap [$this varname]];\n"
  2316.         }
  2317.         $setcode indent -
  2318.         $setcode append "end;\n"
  2319.  
  2320.     } else {
  2321.         if {[[$this assocattr] isMandatory]} {
  2322.             $setcode append "if (${arg} <> NIL) then\nbegin\n"
  2323.             $setcode indent +
  2324.             $setcode append "[$this varref] := (${arg} as [$assoctype name]);\n"
  2325.             $setcode indent -
  2326.             $setcode append "end;\n"
  2327.         } else {
  2328.             $setcode append "[$this varref] := (${arg} as [$assoctype name]);\n"
  2329.         }
  2330.     }
  2331.     $cl setGenmethod [$setproc name] $setproc
  2332. }
  2333.  
  2334. method DPGAssocOne::generateGet {this vari cl} {
  2335.     # Check if Get method should be generated
  2336.     #
  2337.     if {![$this hasGet 0]} {
  2338.         $vari access "Published"
  2339.     }
  2340.     if {![$this hasGet 1]} {
  2341.         return
  2342.     }
  2343.  
  2344.     # Generate
  2345.     #
  2346.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2347.     set assoctype [[$this assocattr] generateAssocType $cl]
  2348.     set getproc [DPFunction new $type]
  2349.     set getcode [TextSection new]
  2350.     $getproc gencode $getcode
  2351.     $getproc hasUserSection 0
  2352.     $getproc access [$this propRead]
  2353.     $getproc name  "get[cap [$this varname]]"
  2354.     $getcode append "[$getproc name] := ([$vari name] as [$assoctype name]);\n"
  2355.     $cl setGenmethod [$getproc name] $getproc
  2356. }
  2357.  
  2358. method DPGAssocOne::generateRemove {this vari cl} {
  2359.     # Check if remove method should be generated
  2360.     #
  2361.     if {![$this hasRemove 0]} {
  2362.         $vari access "Published"
  2363.     }
  2364.     if {![$this hasRemove 1]} {
  2365.         return
  2366.     }
  2367.  
  2368.     # Generate
  2369.     #
  2370.     set removeproc [DPProcedure new]
  2371.     set removecode [TextSection new]
  2372.     set removetypes [TextSection new]
  2373.  
  2374.     set old "old[[[[$this assocattr] ooplType] ooplClass] getName]"
  2375.     $removeproc gencode $removecode
  2376.     $removeproc gentypes $removetypes
  2377.     $removeproc hasUserSection 0
  2378.     $removeproc access [$this propWrite]
  2379.     $removeproc name "remove[cap [$this varname]]"
  2380.  
  2381.     if {[[$this assocattr] opposite] != ""} {
  2382.         set assoctype [[$this assocattr] generateAssocType $cl]
  2383.         $removecode append "if ([$vari name] <> NIL) then\nbegin\n"
  2384.         $removecode indent +
  2385.         $removetypes append "var\n"
  2386.         $removetypes indent +
  2387.         $removetypes append "${old}: [[$vari type] name];\n\n"
  2388.         $removetypes indent -
  2389.         $removecode append "${old} := [$vari name];\n"
  2390.         $removecode append "[$vari name] := NIL;\n"
  2391.  
  2392.         if {[[[[$this assocattr] opposite] generator] hasRemove 0]} {
  2393.  
  2394.             # Use remove method
  2395.             #
  2396.             $removecode append "(${old} as [$assoctype name]).remove[cap [$this opvarname]]("
  2397.             if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2398.                 $removecode append "SELF"
  2399.             }
  2400.             $removecode append ");\n"
  2401.         } else {
  2402.  
  2403.             # Use direct access
  2404.             #
  2405.             if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2406.                 $removecode append "(${old} as [$assoctype name]).[$this opvarname]].Remove(SELF);\n"
  2407.             } else {
  2408.                 $removecode append "(${old} as [$assoctype name]).[$this opvarref] := NIL;\n"
  2409.             }
  2410.         }
  2411.         $removecode indent -
  2412.         $removecode append "end;\n"
  2413.     } else {
  2414.         $removecode append "[$vari name] := NIL;\n"
  2415.     }
  2416.     $cl setGenmethod [$removeproc name] $removeproc
  2417. }
  2418.  
  2419. method DPGAssocOne::generateDtor {this vari cl} {
  2420.  
  2421.     # Check if Destructor should be generated
  2422.     #
  2423.     if {![$this hasDtor 1]} {
  2424.         return
  2425.     }
  2426.  
  2427.     # Generate
  2428.     #
  2429.     if {[[$this assocattr] opposite] != ""} {
  2430.         set assoctype [[$this assocattr] generateAssocType $cl]
  2431.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2432.             set sysutilstype [DPType new]
  2433.             $sysutilstype includeName "SysUtils"
  2434.             $sysutilstype includeType "imp"
  2435.             $sysutilstype addAsInclude [[[[[$this assocattr] opposite] ooplType] ooplClass] target]
  2436.             [[$cl destructr] gencode] append "if ([$this varref] <> NIL) then\n"
  2437.             [[$cl destructr] gencode] indent +
  2438.             [[$cl destructr] gencode] append "raise EInvalidOp.Create('Illegal object destruction. Object [$this varname] "
  2439.             [[$cl destructr] gencode] append "with mandatory relation exists.');\n"
  2440.             [[$cl destructr] gencode] indent -
  2441.             return
  2442.         }
  2443.         if {[$this hasRemove 1]} {
  2444.             [[$cl destructr] gencode] append "remove[cap [$this varname]];\n"
  2445.         } else { 
  2446.             if {![[[$this assocattr] opposite] isQualified]} {
  2447.                 if {[[[[$this assocattr] opposite] generator] hasRemove 0]} {
  2448.                     if {[[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2449.                         [[$cl destructr] gencode] append "[$this varref].remove[cap [$this opvarname]];\n"
  2450.                     } else {
  2451.                         [[$cl destructr] gencode] append "[$this varset].remove[cap [$this opvarname]](SELF);\n"
  2452.                     }
  2453.                 } else {
  2454.                     if {[[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2455.                         [[$cl destructr] gencode] append "([$this varref] as [$assoctype name]).[$this opvarref] := NIL;\n"
  2456.                     } else {
  2457.                         [[$cl destructr] gencode] append "([$this varref] as [$assoctype name]).[$this opvarset].Remove(SELF);\n"
  2458.                     }
  2459.                 }
  2460.             }
  2461.         }
  2462.     }
  2463. }
  2464.  
  2465. # Do not delete this line -- regeneration end marker
  2466.  
  2467.  
  2468. #      File:           @(#)dpgqual.tcl    /main/hindenburg/1
  2469.  
  2470.  
  2471. Class DPGQual : {DPGAssocGen} {
  2472.     constructor
  2473.     method destructor
  2474.     method hasAdd
  2475.     method hasDtor
  2476.     method hasRemove
  2477. }
  2478.  
  2479. constructor DPGQual {class this assocattr} {
  2480.     set this [DPGAssocGen::constructor $class $this $assocattr]
  2481.     # Start constructor user section
  2482.     # End constructor user section
  2483.     return $this
  2484. }
  2485.  
  2486. method DPGQual::destructor {this} {
  2487.     # Start destructor user section
  2488.     # End destructor user section
  2489.     $this DPGAssocGen::destructor
  2490. }
  2491.  
  2492. method DPGQual::hasAdd {this self} {
  2493.     set wr [$this propWrite]
  2494.     if {$self} {
  2495.         if {$wr == "None"} {
  2496.             return 0
  2497.         }
  2498.     } else {
  2499.         if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  2500.             return 0
  2501.         }
  2502.     }
  2503.     return 1
  2504. }
  2505.  
  2506. method DPGQual::hasDtor {this self} {
  2507. #    if {[[$this assocattr] opposite] != ""} {
  2508. #        if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2509. #            return 0
  2510. #        }
  2511. #    }
  2512.     return 1
  2513. }
  2514.  
  2515. method DPGQual::hasRemove {this self} {
  2516.     set wr [$this propWrite]
  2517.     if {$self} {
  2518.     } else {
  2519.         if {$wr == "None" || $wr == "Private" || $wr == "Protected"} {
  2520.             return 0
  2521.         }
  2522.     }
  2523.     if {[[$this assocattr] opposite] != ""} {
  2524.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2525.             return 0
  2526.         }
  2527.     }
  2528.     return 1
  2529. }
  2530.  
  2531. # Do not delete this line -- regeneration end marker
  2532.  
  2533.  
  2534. #      File:           @(#)dpgdataatt.tcl    /main/hindenburg/4
  2535.  
  2536.  
  2537. Class DPGDataAttr : {DPGAttribute} {
  2538.     constructor
  2539.     method destructor
  2540.     method generateInitialValue
  2541.     method generateAccessors
  2542.     method generate
  2543. }
  2544.  
  2545. constructor DPGDataAttr {class this name} {
  2546.     set this [DPGAttribute::constructor $class $this $name]
  2547.     # Start constructor user section
  2548.     # End constructor user section
  2549.     return $this
  2550. }
  2551.  
  2552. method DPGDataAttr::destructor {this} {
  2553.     # Start destructor user section
  2554.     # End destructor user section
  2555. }
  2556.  
  2557. method DPGDataAttr::generateInitialValue {this method} {
  2558.     if {[$this getInitialValue] == ""} {
  2559.         return
  2560.     }
  2561.  
  2562.     if {[$this isClassFeature]} {
  2563.         m4_warning $W_NODEFAULT [$this getName]
  2564.     } else {
  2565.         [$method gencode] append "[$this getName] := [$this getInitialValue];\n"
  2566.     }
  2567. }
  2568.  
  2569. method DPGDataAttr::generateAccessors {this class var name} {
  2570.  
  2571.     # acquire access settings
  2572.  
  2573.     set accessTxt [$this getPropertyValue "attrib_access"]
  2574.     set accessList [split $accessTxt -]
  2575.     set readAccess [lindex $accessList 0]
  2576.     if {$readAccess == ""} {
  2577.         set readAccess "Published"
  2578.     }
  2579.     set writeAccess [lindex $accessList 1]
  2580.     if {$writeAccess == ""} {
  2581.         set writeAccess "Published"
  2582.     }
  2583.  
  2584.     # create get function
  2585.  
  2586.     if {$readAccess != "None"} {
  2587.         set getname "get[cap $name]"
  2588.         set getmethod [DPFunction new [[$this ooplType] generate]]
  2589.         set getcode [TextSection new]
  2590.  
  2591.         $getmethod gencode $getcode
  2592.         $getmethod access $readAccess
  2593.         $getmethod name $getname
  2594.  
  2595.         $getcode append "[$getmethod name] := [$var name];\n"
  2596.         $class setGenmethod [$getmethod name] $getmethod
  2597.     }
  2598.     
  2599.     #create set procedure
  2600.  
  2601.     if {$writeAccess != "None"} {
  2602.         set setname "set[cap $name]"
  2603.         set setmethod [DPProcedure new]
  2604.         set setcode [TextSection new]
  2605.         $setmethod gencode $setcode
  2606.         $setmethod access $writeAccess
  2607.         $setmethod name $setname
  2608.  
  2609.         set arg [DPArgument new [[$this ooplType] generate]]
  2610.         $arg name "new[cap $name]"
  2611.         $setmethod addArg $arg
  2612.  
  2613.         $setcode append "[$var name] := [$arg name];\n"
  2614.         $class setGenmethod [$setmethod name] $setmethod
  2615.     }
  2616. }
  2617.  
  2618. method DPGDataAttr::generate {this class} {
  2619.  
  2620.     if {[[$this ooplType] getName] == "enum"} {
  2621.         m4_error $E_NOENUM [$class name] [$this getName]
  2622.     }
  2623.     if {[$this getName] == "_"} {
  2624.         m4_error $E_CANTCONTTYPEDEF [$class name]
  2625.     }
  2626.  
  2627.     set variable [DPVariable new [[$this ooplType] generate]]
  2628.     $variable isClassFeature [$this isClassFeature]
  2629.  
  2630.     set comment [DPComment new]
  2631.     $variable comment $comment
  2632.     $comment comment [$this getPropertyValue "freeText"]
  2633.  
  2634.     if {[$this isClassFeature]} {
  2635.         $variable name "[$class name]_[$this getName]"
  2636.         $variable access "Published"
  2637.         $class addGlobvar $variable
  2638.     } else {
  2639.         $variable name [$this getName]
  2640.         $variable access "Private"
  2641.         $class addUservar $variable
  2642.     }
  2643.     $this generateAccessors $class $variable [$this getName]
  2644. }
  2645.  
  2646. # Do not delete this line -- regeneration end marker
  2647.  
  2648. Class DPGDataAttrD : {DPGDataAttr OPDataAttr} {
  2649. }
  2650.  
  2651. selfPromoter OPDataAttr {this} {
  2652.     DPGDataAttrD promote $this
  2653. }
  2654.  
  2655. #      File:           @(#)dpggenasso.tcl    /main/hindenburg/7
  2656.  
  2657.  
  2658. Class DPGGenAssocAttr : {DPGAttribute} {
  2659.     constructor
  2660.     method destructor
  2661.     method getName
  2662.     method hasGUIComponent
  2663.     method generateAssocType
  2664.     method generateQualAssocType
  2665.     method generateManyAssocType
  2666.     method generateComponent
  2667.     method generator
  2668.     attribute _generator
  2669. }
  2670.  
  2671. constructor DPGGenAssocAttr {class this name} {
  2672.     set this [DPGAttribute::constructor $class $this $name]
  2673.     set this [Object::constructor $class $this $name]
  2674.     # Start constructor user section
  2675.     # End constructor user section
  2676.     return $this
  2677. }
  2678.  
  2679. method DPGGenAssocAttr::destructor {this} {
  2680.     set ref [$this _generator]
  2681.     if {$ref != ""} {
  2682.         $ref _assocattr ""
  2683.     }
  2684.     # Start destructor user section
  2685.     # End destructor user section
  2686. }
  2687.  
  2688. method DPGGenAssocAttr::getName {this} {
  2689.     if {[$this isLinkAttr]} {
  2690.         if {[$this opposite] != ""} {
  2691.             return "[uncap [[[$this opposite] ooplClass] getName]]of[$this OPGenAssocAttr::getName]"
  2692.         }
  2693.     }
  2694.     return [$this OPGenAssocAttr::getName]
  2695. }
  2696.  
  2697. method DPGGenAssocAttr::hasGUIComponent {this} {
  2698.     if {![$this isAggregate]} {
  2699.         return 0
  2700.     }
  2701.     set baseType [[[$this ooplType] ooplClass] baseType]
  2702.     if {$baseType == "TComponent"} {
  2703.         return 1
  2704.     } else {
  2705.         return 0
  2706.     }
  2707. }
  2708.  
  2709. method DPGGenAssocAttr::generateAssocType {this unit} {
  2710.     set type [[[$this ooplType] ooplClass] generateType]
  2711.     $type includeType "imp"
  2712.     $type addAsInclude $unit
  2713.     return $type
  2714. }
  2715.  
  2716. method DPGGenAssocAttr::generateQualAssocType {this} {
  2717.     set type [DPType new]
  2718.     $type name "TClassDict"
  2719.     $type includeType "system"
  2720.     $type includeName "ClassDict"
  2721.     return $type
  2722. }
  2723.  
  2724. method DPGGenAssocAttr::generateManyAssocType {this} {
  2725.     set type [DPType new]
  2726.     $type name "TList"
  2727.     $type includeType "system"
  2728.     $type includeName "Classes"
  2729.     return $type
  2730. }
  2731.  
  2732. method DPGGenAssocAttr::generateComponent {this class control} {
  2733.     # Check if associated object is a GUI object
  2734. #    if {![$this hasGUIComponent]} {
  2735. #        m4_error $E_ONLYCONTGUI [[$this ooplClass] getName] [[[$this ooplType] ooplClass] getName]
  2736. #        return
  2737. #    }
  2738.  
  2739.     [[$this ooplType] ooplClass] generateComponent [$this getName] $class $control
  2740. }
  2741.  
  2742. # Do not delete this line -- regeneration end marker
  2743.  
  2744. Class DPGGenAssocAttrD : {DPGGenAssocAttr OPGenAssocAttr} {
  2745. }
  2746.  
  2747. selfPromoter OPGenAssocAttr {this} {
  2748.     DPGGenAssocAttrD promote $this
  2749. }
  2750. method DPGGenAssocAttr::generator {this args} {
  2751.     if {$args == ""} {
  2752.         return [$this _generator]
  2753.     }
  2754.     set ref [$this _generator]
  2755.     if {$ref != ""} {
  2756.         $ref _assocattr ""
  2757.     }
  2758.     set obj [lindex $args 0]
  2759.     if {$obj != ""} {
  2760.         $obj _assocattr $this
  2761.     }
  2762.     $this _generator $obj
  2763. }
  2764.  
  2765.  
  2766. #      File:           @(#)dpgmanyqua.tcl    /main/hindenburg/13
  2767.  
  2768.  
  2769. Class DPGManyQual : {DPGQual} {
  2770.     constructor
  2771.     method destructor
  2772.     method generate
  2773.     method generateAdd
  2774.     method generateGet
  2775.     method generateRemove
  2776.     method generateDtor
  2777. }
  2778.  
  2779. constructor DPGManyQual {class this assocattr} {
  2780.     set this [DPGQual::constructor $class $this $assocattr]
  2781.     # Start constructor user section
  2782.     # End constructor user section
  2783.     return $this
  2784. }
  2785.  
  2786. method DPGManyQual::destructor {this} {
  2787.     # Start destructor user section
  2788.     # End destructor user section
  2789.     $this DPGQual::destructor
  2790. }
  2791.  
  2792. method DPGManyQual::generate {this cl} {
  2793.     set type [[$this assocattr] generateQualAssocType]
  2794.     set vari [DPVariable new $type]
  2795.     $vari name "[$this vardict]"
  2796.     $cl addAssocvar $vari
  2797.     $vari access "Private"
  2798.     if {[$cl constructr] != ""} {
  2799.         [[$cl constructr] gencode] append "[$vari name] := TClassDict.Create;\n"
  2800.     }
  2801.     if {[[$this assocattr] opposite] != ""} {
  2802.         [[$this assocattr] opposite] setGenerator
  2803.     }
  2804.     $this generateGet $vari $cl
  2805.     $this generateAdd $vari $cl
  2806.     $this generateRemove $vari $cl
  2807.     $this generateDtor $vari $cl
  2808. }
  2809.  
  2810. method DPGManyQual::generateAdd {this vari cl} {
  2811.     
  2812.     # Check if Add method should be generated
  2813.     #
  2814.     if {![$this hasAdd 0]} {
  2815.         $vari access "Published"
  2816.     }
  2817.     if {![$this hasAdd 1]} {
  2818.         return
  2819.     }
  2820.  
  2821.     # Generate
  2822.     #
  2823.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2824.     set assoctype [[$this assocattr] generateAssocType $cl]
  2825.     set param [DPArgument new $type]
  2826.     set arg "new[$assoctype name]"
  2827.     $param name "${arg}"
  2828.     set addproc [DPProcedure new]
  2829.     set type [DPType new]
  2830.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  2831.     $type includeType "none"
  2832.     set keyparam [DPArgument new $type]
  2833.     $keyparam name [$this varqual]
  2834.     $addproc addArg $keyparam
  2835.     $addproc addArg $param
  2836.     set addcode [TextSection new]
  2837.     set addtypes [TextSection new]
  2838.  
  2839.     $addproc gencode $addcode
  2840.     $addproc gentypes $addtypes
  2841.     $addproc hasUserSection 0
  2842.     $addproc access [$this propWrite]
  2843.     $addproc name "add[cap [$this varname]]"
  2844.  
  2845.     set tempset "temp[$this varset]"
  2846.     $addtypes append "var\n"
  2847.     $addtypes indent +
  2848.     $addtypes append "${tempset}: TList;\n"
  2849.     $addtypes indent -
  2850.  
  2851.     if {[[$this assocattr] opposite] != ""} {
  2852.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  2853.             $addcode append "(${arg} as [$assoctype name]).[$this opvarset].Add(SELF);\n"
  2854.         } else {
  2855.             $addcode append "(${arg} as [$assoctype name]).[$this opvarref] := SELF;\n"
  2856.         }
  2857.     } 
  2858.     $addcode append "if ([$vari name].Item([$this varqual]) <> NIL) then\nbegin\n"
  2859.     $addcode indent +
  2860.     $addcode append "${tempset} := [$vari name].Item([$this varqual]);\n"
  2861.     $addcode indent -
  2862.     $addcode append "end\n"
  2863.     $addcode append "else\n"
  2864.     $addcode append "begin\n"
  2865.     $addcode indent +
  2866.     $addcode append "${tempset} := TList.Create;\n"
  2867.     $addcode append "[$vari name].Add([$this varqual], ${tempset})\n"
  2868.     $addcode indent -
  2869.     $addcode append "end;\n"
  2870.     $addcode append "${tempset}.Add(${arg});\n"
  2871.  
  2872.     $cl setGenmethod [$addproc name] $addproc
  2873. }
  2874.  
  2875. method DPGManyQual::generateGet {this vari cl} {
  2876.     # Check if Get method should be generated
  2877.     #
  2878.     if {![$this hasGet 0]} {
  2879.         $vari access "Published"
  2880.     }
  2881.     if {![$this hasGet 1]} {
  2882.         return
  2883.     }
  2884.  
  2885.     # Generate
  2886.     #
  2887.     set type [[$this assocattr] generateManyAssocType]
  2888.     set getproc [DPFunction new $type]
  2889.     set getcode [TextSection new]
  2890.     $getproc gencode $getcode
  2891.     $getproc hasUserSection 0
  2892.     $getproc access [$this propRead]
  2893.     $getproc name "get[cap [$this varname]]"
  2894.     $getcode append "[$getproc name] := [$this vardict].Item([$this varqual]);\n"
  2895.  
  2896.     set type [DPType new]
  2897.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  2898.     $type includeType "none"
  2899.     set arg [DPArgument new $type]
  2900.     $arg name [$this varqual]
  2901.     $getproc addArg $arg
  2902.     $cl setGenmethod [$getproc name] $getproc
  2903. }
  2904.  
  2905. method DPGManyQual::generateRemove {this vari cl} {
  2906.     # Check if method should be generated
  2907.     #
  2908.     if {![$this hasRemove 0]} {
  2909.         $vari access "Published"
  2910.     }
  2911.     if {![$this hasRemove 1]} {
  2912.         return
  2913.     }
  2914.  
  2915.     # Generate
  2916.     #
  2917.     set removeproc [DPProcedure new]
  2918.     set type [DPType new]
  2919.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  2920.     $type includeType "none"
  2921.     set param [DPArgument new $type]
  2922.     $param name [$this varqual]
  2923.     $removeproc addArg $param
  2924.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  2925.     set assoctype [[$this assocattr] generateAssocType $cl]
  2926.     set arg "old[$assoctype name]"
  2927.     set param [DPArgument new $type]
  2928.     $param name $arg
  2929.  
  2930.     $removeproc addArg $param
  2931.     set removecode [TextSection new]
  2932.     set removetypes [TextSection new]
  2933.     set tempset "temp[$this varset]"
  2934.     $removeproc gencode $removecode
  2935.     $removeproc gentypes $removetypes
  2936.     $removeproc hasUserSection 0
  2937.     $removeproc name "remove[cap [[$this assocattr] getName]]"
  2938.  
  2939.     if {[$this propWrite] == "None"} {
  2940.         $removeproc access "Private"
  2941.         m4_warning $W_CHANGEDREM [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  2942.     } else {
  2943.         $removeproc access [$this propWrite]
  2944.     }
  2945.  
  2946.     $removetypes append "var\n"
  2947.     $removetypes indent +
  2948.     $removetypes append "${tempset}: TList;\n"
  2949.     $removetypes indent -
  2950.     $removecode append "${tempset} := [$vari name].Item([$this varqual]);\n"
  2951.  
  2952.     $removecode append "if ${tempset} <> NIL then\nbegin\n"
  2953.     $removecode indent +
  2954.  
  2955.     if {[[$this assocattr] opposite] != ""} {
  2956.         if {[[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2957.             $removecode append "(${arg} as [$assoctype name]).[$this opvarref] := NIL;\n"
  2958.         } else {
  2959.             $removecode append "(${arg} as [$assoctype name]).[$this opvarset].Remove(SELF);\n"
  2960.         }
  2961.     }
  2962.  
  2963.     $removecode append "${tempset}.Remove(${arg});\n"
  2964.  
  2965.     if {![[$this assocattr] isMandatory]} {
  2966.        $removecode append "if (${tempset}.Count = 0) then\nbegin\n"
  2967.        $removecode indent +
  2968.        $removecode append "[$vari name].RemoveUsingKey([$this varqual]);\n"
  2969.        $removecode indent -
  2970.        $removecode append "end;\n"
  2971.     }
  2972.  
  2973.     $removecode indent -
  2974.     $removecode append "end;\n"
  2975.     $cl setGenmethod [$removeproc name] $removeproc
  2976. }
  2977.  
  2978. method DPGManyQual::generateDtor {this vari cl} {
  2979.  
  2980.     # Check if Destructor should be generated
  2981.     #
  2982.     if {![$this hasDtor 1]} {
  2983.         [[$cl destructr] gencode] append "[$this vardict].Destroy;\n"
  2984.         return
  2985.     }
  2986.  
  2987.     # Generate
  2988.     #
  2989.     if {[[$this assocattr] opposite] != ""} {
  2990.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  2991.             set sysutilstype [DPType new]
  2992.             $sysutilstype includeName "SysUtils"
  2993.             $sysutilstype includeType "imp"
  2994.             $sysutilstype addAsInclude [[[[[$this assocattr] opposite] ooplType] ooplClass] target]
  2995.                                             
  2996.             [[$cl destructr] gencode] append "if ([$this vardict].Count <> 0) then\n"
  2997.             [[$cl destructr] gencode] indent +
  2998.             [[$cl destructr] gencode] append "raise EInvalidOp.Create('Illegal object destruction. Mandatory relation "
  2999.             [[$cl destructr] gencode] append "[[$this assocattr] getName]Set not empty.');\n"
  3000.             [[$cl destructr] gencode] indent -
  3001.         } else {
  3002.             set assoctype [[$this assocattr] generateAssocType $cl]
  3003.             [[$cl destructr] gentypes] append "var\n"
  3004.             [[$cl destructr] gentypes] indent +
  3005.             [[$cl destructr] gentypes] append "tmp[$this varset]: TList;\n"
  3006.             [[$cl destructr] gentypes] append "tmp[$this varname]: [$assoctype name];\n"
  3007.             [[$cl destructr] gentypes] indent -
  3008.             [[$cl destructr] gencode] append "while ([$this vardict].Count <> 0) do\nbegin\n"
  3009.             [[$cl destructr] gencode] indent +
  3010.             [[$cl destructr] gencode] append "tmp[$this varset] := [$this vardict].First;\n"
  3011.             [[$cl destructr] gencode] append "while (tmp[$this varset].Count > 0) do\nbegin\n"
  3012.             [[$cl destructr] gencode] indent +
  3013.             [[$cl destructr] gencode] append "tmp[$this varname] := tmp[$this varset].First;\n"
  3014.  
  3015.             if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3016.                 [[$cl destructr] gencode] append "tmp[$this varname].[$this opvarset].Remove(SELF);\n"
  3017.             } else {
  3018.                 [[$cl destructr] gencode] append "tmp[$this varname].[$this opvarref] := NIL;\n"
  3019.             }
  3020.             [[$cl destructr] gencode] append "tmp[$this varset].Remove(tmp[$this varname]);\n"
  3021.             [[$cl destructr] gencode] indent -
  3022.             [[$cl destructr] gencode] append "end;\n"
  3023.             [[$cl destructr] gencode] append "[$this vardict].Remove(tmp[$this varset]);\n"
  3024.             [[$cl destructr] gencode] indent -
  3025.             [[$cl destructr] gencode] append "end;\n"
  3026.         }
  3027.     }
  3028.  
  3029.     [[$cl destructr] gencode] append "[$this vardict].Destroy;\n"
  3030. }
  3031.  
  3032. # Do not delete this line -- regeneration end marker
  3033.  
  3034.  
  3035. #      File:           @(#)dpgonequal.tcl    /main/hindenburg/14
  3036.  
  3037.  
  3038. Class DPGOneQual : {DPGQual} {
  3039.     constructor
  3040.     method destructor
  3041.     method generate
  3042.     method generateSet
  3043.     method generateGet
  3044.     method generateRemove
  3045.     method generateDtor
  3046. }
  3047.  
  3048. constructor DPGOneQual {class this assocattr} {
  3049.     set this [DPGQual::constructor $class $this $assocattr]
  3050.     # Start constructor user section
  3051.     # End constructor user section
  3052.     return $this
  3053. }
  3054.  
  3055. method DPGOneQual::destructor {this} {
  3056.     # Start destructor user section
  3057.     # End destructor user section
  3058.     $this DPGQual::destructor
  3059. }
  3060.  
  3061. method DPGOneQual::generate {this cl} {
  3062.     set type [[$this assocattr] generateQualAssocType]
  3063.     set vari [DPVariable new $type]
  3064.     $vari name "[$this vardict]"
  3065.     $cl addAssocvar $vari
  3066.     $vari access "Private"
  3067.     if {[$cl constructr] != ""} {
  3068.         [[$cl constructr] gencode] append "[$vari name] := TClassDict.Create;\n"
  3069.     }
  3070.     if {[[$this assocattr] opposite] != ""} {
  3071.         [[$this assocattr] opposite] setGenerator
  3072.     }
  3073.     $this generateGet $vari $cl
  3074.     $this generateSet $vari $cl
  3075.     $this generateRemove $vari $cl
  3076.     $this generateDtor $vari $cl
  3077. }
  3078.  
  3079. method DPGOneQual::generateSet {this vari cl} {
  3080.     # Check if Set method should be generated
  3081.     #
  3082.     if {![$this hasAdd 0]} {
  3083.         $vari access "Published"
  3084.     }
  3085.     if {![$this hasAdd 1]} {
  3086.         return
  3087.     }
  3088.  
  3089.     # Generate
  3090.     #
  3091.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  3092.     set assoctype [[$this assocattr] generateAssocType $cl]
  3093.     set param [DPArgument new $type]
  3094.     set arg "new[$assoctype name]"
  3095.     $param name $arg
  3096.     set addproc [DPProcedure new]
  3097.  
  3098.     set type [DPType new]
  3099.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  3100.     $type includeType "none"
  3101.     set keyparam [DPArgument new $type]
  3102.     $keyparam name  [$this varqual]
  3103.     $addproc addArg $keyparam
  3104.     $addproc addArg $param
  3105.     set addcode [TextSection new]
  3106.     set addtypes [TextSection new]
  3107.     set vartemp "old[$assoctype name]"
  3108.  
  3109.     $addproc gencode $addcode
  3110.     $addproc gentypes $addtypes
  3111.     $addproc hasUserSection 0
  3112.     $addproc access [$this propWrite]
  3113.     $addproc name "set[cap [$this varname]]"
  3114.  
  3115.     $addtypes append "var\n"
  3116.     $addtypes indent +
  3117.     $addtypes append "${vartemp}: [$assoctype name];\n"
  3118.     $addtypes indent -
  3119.  
  3120.     $addcode append "if (${arg} <> NIL) then\nbegin\n"
  3121.     $addcode indent +
  3122.  
  3123.     if {[[$this assocattr] opposite] != ""} {
  3124.         $addcode append "${vartemp} := [$vari name].Item([$keyparam name]);\n"
  3125.         $addcode append "if (${vartemp} <> NIL) then\nbegin\n"
  3126.         $addcode indent +
  3127.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3128.             $addcode append "(${vartemp} as [$assoctype name]).[$this opvarset].Remove(SELF);\n"
  3129.         } else {
  3130.             $addcode append "(${vartemp} as [$assoctype name]).[$this opvarref] := NIL;\n"
  3131.         }
  3132.         $addcode append "[$vari name].RemoveUsingKey([$keyparam name]);\n"
  3133.         $addcode indent -
  3134.         $addcode append "end;\n"
  3135.  
  3136.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3137.             $addcode append "(${arg} as [$assoctype name]).[$this opvarset].Add(SELF);\n"
  3138.         } else {
  3139.             $addcode append "(${arg} as [$assoctype name]).[$this opvarref] := SELF;\n"
  3140.         }
  3141.     }
  3142.         
  3143.     $addcode append "[$vari name].Add([$keyparam name], ${arg});\n"
  3144.     $addcode indent -
  3145.     $addcode append "end;\n"
  3146.  
  3147.     $cl setGenmethod [$addproc name] $addproc
  3148. }
  3149.  
  3150. method DPGOneQual::generateGet {this vari cl} {
  3151.  
  3152.     # Check if Get method should be generated
  3153.     #
  3154.     if {![$this hasGet 0]} {
  3155.         $vari access "Published"
  3156.     }
  3157.     if {![$this hasGet 1]} {
  3158.         return
  3159.     }
  3160.  
  3161.     # Generate
  3162.     #
  3163.     set type [[[[$this assocattr] ooplType] ooplClass] generateTObjectType]
  3164.     set getproc [DPFunction new $type]
  3165.     set getcode [TextSection new]
  3166.     $getproc gencode $getcode
  3167.     $getproc hasUserSection 0
  3168.     $getproc access [$this propRead]
  3169.     $getproc name "get[cap [$this varname]]"
  3170.     $getcode append "[$getproc name] := [$this vardict].Item([$this varqual]);\n"
  3171.  
  3172.     set type [DPType new]
  3173.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  3174.     $type includeType "none"
  3175.     set param [DPArgument new $type]
  3176.     $param name [$this varqual]
  3177.     $getproc addArg $param
  3178.     $cl setGenmethod [$getproc name] $getproc
  3179. }
  3180.  
  3181. method DPGOneQual::generateRemove {this vari cl} {
  3182.     if {![$this hasRemove 0]} {
  3183.         $vari access "Published"
  3184.     }
  3185.     if {![$this hasRemove 1]} {
  3186.         return
  3187.     }
  3188.  
  3189.     set removeproc [DPProcedure new]
  3190.     set type [DPType new]
  3191.     $type name [[[[$this assocattr] qualifier] ooplType] getType3GL]
  3192.     $type includeType "none"
  3193.     set param [DPArgument new $type]
  3194.     $param name [$this varqual]
  3195.     $removeproc addArg $param
  3196.     set removecode [TextSection new]
  3197.     set removetypes [TextSection new]
  3198.     $removeproc gencode $removecode
  3199.     $removeproc gentypes $removetypes
  3200.     $removeproc hasUserSection 0
  3201.     $removeproc name "remove[cap [$this varname]]"
  3202.     set assoctype [[$this assocattr] generateAssocType $cl]
  3203.     set vartemp "old[$assoctype name]"
  3204.  
  3205.     if {[$this propWrite] == "None"} {
  3206.         $removeproc access "Private"
  3207.         m4_warning $W_CHANGEDREM [[$this assocattr] getName] [[[$this assocattr] ooplClass] getName]
  3208.     } else {
  3209.         $removeproc access [$this propWrite]
  3210.     }
  3211.  
  3212.     if {[[$this assocattr] opposite] != ""} {
  3213.         $removetypes append "var\n"
  3214.         $removetypes indent +
  3215.         $removetypes append "${vartemp}: [$assoctype name];\n"
  3216.         $removetypes indent -
  3217.         $removecode append "${vartemp} := [$vari name].Item([$this varqual]);\n"
  3218.         $removecode append "if (${vartemp} <> NIL) then\nbegin\n"
  3219.         $removecode indent +
  3220.  
  3221.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3222.            $removecode append "if (${vartemp}.[$this opvarset].Count > 1) then\nbegin\n"
  3223.            $removecode indent +
  3224.         }
  3225.         $removecode append "[$vari name].RemoveUsingKey([$this varqual]);\n"
  3226.         if {[[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3227.             $removecode append "${vartemp}.[$this opvarset].Remove(SELF);\n"
  3228.         } else {
  3229.             $removecode append "${vartemp}.[$this opvarref] := NIL;\n"
  3230.         }
  3231.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] != "one"} {
  3232.            $removecode indent -
  3233.            $removecode append "end;\n"
  3234.         }
  3235.  
  3236.        $removecode indent -
  3237.        $removecode append "end;\n"
  3238.     } else {
  3239.         $removecode append "[$vari name].RemoveUsingKey([$this varqual])\n"
  3240.     }
  3241.  
  3242.     $cl setGenmethod [$removeproc name] $removeproc
  3243. }
  3244.  
  3245. method DPGOneQual::generateDtor {this vari cl} {
  3246.  
  3247.     # Check if Destructor should be generated
  3248.     #
  3249.     if {![$this hasDtor 1]} {
  3250.         [[$cl destructr] gencode] append "[$this vardict].Destroy;\n"
  3251.         return
  3252.     }
  3253.  
  3254.     # Generate
  3255.     #
  3256.     if {[[$this assocattr] opposite] != ""} {
  3257.         if {[[[$this assocattr] opposite] isMandatory] && [[[$this assocattr] opposite] getMultiplicity] == "one"} {
  3258.             set sysutilstype [DPType new]
  3259.             $sysutilstype includeName "SysUtils"
  3260.             $sysutilstype includeType "imp"
  3261.             $sysutilstype addAsInclude [[[[[$this assocattr] opposite] ooplType] ooplClass] target]
  3262.  
  3263.             [[$cl destructr] gencode] append "if ([$this vardict].Count <> 0) then\n"
  3264.             [[$cl destructr] gencode] indent +
  3265.             [[$cl destructr] gencode] append "raise EInvalidOp.Create('Illegal object destruction. Mandatory relation "
  3266.             [[$cl destructr] gencode] append "[$this vardict] not empty.');\n"
  3267.             [[$cl destructr] gencode] indent -
  3268.         } else {
  3269.             [[$cl destructr] gencode] append "while ([$this vardict].Count > 0) do\nbegin\n"
  3270.             [[$cl destructr] gencode] indent +
  3271.             [[$cl destructr] gencode] append "remove[cap [$this varname]]([$this vardict].FirstKey)\n"
  3272.             [[$cl destructr] gencode] indent -
  3273.             [[$cl destructr] gencode] append "end;\n"
  3274.         }
  3275.     }
  3276.     [[$cl destructr] gencode] append "[$this vardict].Destroy;\n"
  3277. }
  3278.  
  3279. # Do not delete this line -- regeneration end marker
  3280.  
  3281.  
  3282. #      File:           @(#)dpgassocat.tcl    /main/hindenburg/4
  3283.  
  3284.  
  3285. Class DPGAssocAttr : {DPGGenAssocAttr} {
  3286.     constructor
  3287.     method destructor
  3288.     method setGenerator
  3289.     method generate
  3290. }
  3291.  
  3292. constructor DPGAssocAttr {class this name} {
  3293.     set this [DPGGenAssocAttr::constructor $class $this $name]
  3294.     # Start constructor user section
  3295.     # End constructor user section
  3296.     return $this
  3297. }
  3298.  
  3299. method DPGAssocAttr::destructor {this} {
  3300.     # Start destructor user section
  3301.     # End destructor user section
  3302. }
  3303.  
  3304. method DPGAssocAttr::setGenerator {this} {
  3305.    if {[$this generator] == ""} {
  3306.         if {[$this getMultiplicity] == "one"} {
  3307.             $this generator [DPGAssocOne new $this]
  3308.         } else {
  3309.             $this generator [DPGAssocMany new $this]
  3310.         }
  3311.     }
  3312. }
  3313.  
  3314. method DPGAssocAttr::generate {this class} {
  3315.     if {[$this hasGUIComponent]} {
  3316.         return
  3317.     }
  3318.     $this setGenerator
  3319.     [$this generator] generate $class
  3320. }
  3321.  
  3322. # Do not delete this line -- regeneration end marker
  3323.  
  3324. Class DPGAssocAttrD : {DPGAssocAttr OPAssocAttr} {
  3325. }
  3326.  
  3327. selfPromoter OPAssocAttr {this} {
  3328.     DPGAssocAttrD promote $this
  3329. }
  3330.  
  3331. #      File:           @(#)dpglinkatt.tcl    /main/hindenburg/4
  3332.  
  3333.  
  3334. Class DPGLinkAttr : {DPGGenAssocAttr} {
  3335.     constructor
  3336.     method destructor
  3337.     method setGenerator
  3338.     method generate
  3339. }
  3340.  
  3341. constructor DPGLinkAttr {class this name} {
  3342.     set this [DPGGenAssocAttr::constructor $class $this $name]
  3343.     # Start constructor user section
  3344.     # End constructor user section
  3345.     return $this
  3346. }
  3347.  
  3348. method DPGLinkAttr::destructor {this} {
  3349.     # Start destructor user section
  3350.     # End destructor user section
  3351. }
  3352.  
  3353. method DPGLinkAttr::setGenerator {this} {
  3354.     if {[$this generator] == ""} {
  3355.         if {[$this getMultiplicity] == "one"} {
  3356.             $this generator [DPGAssocOne new $this]
  3357.         } else {
  3358.             $this generator [DPGAssocMany new $this]
  3359.         }
  3360.     }
  3361. }
  3362.  
  3363. method DPGLinkAttr::generate {this class} {
  3364.     if {[$this hasGUIComponent]} {
  3365.         return
  3366.     }
  3367.  
  3368.     if {[[$this ooplType] isA OPBaseType]} {
  3369.         m4_warning $W_ASSOCTYPEERR [$this getName] [[$this ooplType] getName]
  3370.         return
  3371.     }
  3372.  
  3373.     $this setGenerator
  3374.     [$this generator] generate $class
  3375. }
  3376.  
  3377. # Do not delete this line -- regeneration end marker
  3378.  
  3379. Class DPGLinkAttrD : {DPGLinkAttr OPLinkAttr} {
  3380. }
  3381.  
  3382. selfPromoter OPLinkAttr {this} {
  3383.     DPGLinkAttrD promote $this
  3384. }
  3385.  
  3386. #      File:           @(#)dpgqualatt.tcl    /main/hindenburg/5
  3387.  
  3388.  
  3389. Class DPGQualAttr : {DPGGenAssocAttr} {
  3390.     constructor
  3391.     method destructor
  3392.     method setGenerator
  3393.     method generate
  3394. }
  3395.  
  3396. constructor DPGQualAttr {class this name} {
  3397.     set this [DPGGenAssocAttr::constructor $class $this $name]
  3398.     # Start constructor user section
  3399.     # End constructor user section
  3400.     return $this
  3401. }
  3402.  
  3403. method DPGQualAttr::destructor {this} {
  3404.     # Start destructor user section
  3405.     # End destructor user section
  3406. }
  3407.  
  3408. method DPGQualAttr::setGenerator {this} {
  3409.     if {[$this generator] == ""} {
  3410.         if {[$this getMultiplicity] == "one"} {
  3411.             $this generator [DPGOneQual new $this]
  3412.         } else {
  3413.             $this generator [DPGManyQual new $this]
  3414.         }
  3415.     }
  3416. }
  3417.  
  3418. method DPGQualAttr::generate {this class} {
  3419.     if {[$this hasGUIComponent]} {
  3420.         return
  3421.     }
  3422.  
  3423.     if {![[[$this qualifier] ooplType] isA OPBaseType]} {
  3424.         m4_error $E_QUALTYPEWRONG [[$this qualifier] getName] [$this getName]
  3425.         return
  3426.     }
  3427.  
  3428.     $this setGenerator
  3429.     [$this generator] generate $class
  3430. }
  3431.  
  3432. # Do not delete this line -- regeneration end marker
  3433.  
  3434. Class DPGQualAttrD : {DPGQualAttr OPQualAttr} {
  3435. }
  3436.  
  3437. selfPromoter OPQualAttr {this} {
  3438.     DPGQualAttrD promote $this
  3439. }
  3440.  
  3441. #      File:           @(#)dpgreverse.tcl    /main/hindenburg/4
  3442.  
  3443.  
  3444. Class DPGReverseLinkAttr : {DPGGenAssocAttr} {
  3445.     constructor
  3446.     method destructor
  3447.     method setGenerator
  3448.     method generate
  3449. }
  3450.  
  3451. constructor DPGReverseLinkAttr {class this name} {
  3452.     set this [DPGGenAssocAttr::constructor $class $this $name]
  3453.     # Start constructor user section
  3454.     # End constructor user section
  3455.     return $this
  3456. }
  3457.  
  3458. method DPGReverseLinkAttr::destructor {this} {
  3459.     # Start destructor user section
  3460.     # End destructor user section
  3461. }
  3462.  
  3463. method DPGReverseLinkAttr::setGenerator {this} {
  3464.     if {[$this generator] == ""} {
  3465.         if {[$this getMultiplicity] == "one"} {
  3466.             $this generator [DPGAssocOne new $this]
  3467.         } else {
  3468.             $this generator [DPGAssocMany new $this]
  3469.         }
  3470.     }
  3471. }
  3472.  
  3473. method DPGReverseLinkAttr::generate {this class} {
  3474.     if {[$this hasGUIComponent]} {
  3475.         return
  3476.     }
  3477.  
  3478.     if {[[$this ooplType] isA OPBaseType]} {
  3479.         m4_warning $W_ASSOCTYPEERR [$this getName] [[$this ooplType] getName]
  3480.         return
  3481.     }
  3482.  
  3483.     $this setGenerator
  3484.     [$this generator] generate $class
  3485. }
  3486.  
  3487. # Do not delete this line -- regeneration end marker
  3488.  
  3489. Class DPGReverseLinkAttrD : {DPGReverseLinkAttr OPReverseLinkAttr} {
  3490. }
  3491.  
  3492. selfPromoter OPReverseLinkAttr {this} {
  3493.     DPGReverseLinkAttrD promote $this
  3494. }
  3495.  
  3496. #      File:           @(#)dpgqualass.tcl    /main/hindenburg/3
  3497.  
  3498.  
  3499. Class DPGQualAssocAttr : {DPGQualAttr} {
  3500.     constructor
  3501.     method destructor
  3502. }
  3503.  
  3504. constructor DPGQualAssocAttr {class this name} {
  3505.     set this [DPGQualAttr::constructor $class $this $name]
  3506.     # Start constructor user section
  3507.     # End constructor user section
  3508.     return $this
  3509. }
  3510.  
  3511. method DPGQualAssocAttr::destructor {this} {
  3512.     # Start destructor user section
  3513.     # End destructor user section
  3514. }
  3515.  
  3516. # Do not delete this line -- regeneration end marker
  3517.  
  3518. Class DPGQualAssocAttrD : {DPGQualAssocAttr OPQualAssocAttr} {
  3519. }
  3520.  
  3521. selfPromoter OPQualAssocAttr {this} {
  3522.     DPGQualAssocAttrD promote $this
  3523. }
  3524.  
  3525. #      File:           @(#)dpgquallin.tcl    /main/hindenburg/2
  3526.  
  3527.  
  3528. Class DPGQualLinkAttr : {DPGQualAttr} {
  3529.     constructor
  3530.     method destructor
  3531. }
  3532.  
  3533. constructor DPGQualLinkAttr {class this name} {
  3534.     set this [DPGQualAttr::constructor $class $this $name]
  3535.     # Start constructor user section
  3536.     # End constructor user section
  3537.     return $this
  3538. }
  3539.  
  3540. method DPGQualLinkAttr::destructor {this} {
  3541.     # Start destructor user section
  3542.     # End destructor user section
  3543. }
  3544.  
  3545. # Do not delete this line -- regeneration end marker
  3546.  
  3547. Class DPGQualLinkAttrD : {DPGQualLinkAttr OPQualLinkAttr} {
  3548. }
  3549.  
  3550. selfPromoter OPQualLinkAttr {this} {
  3551.     DPGQualLinkAttrD promote $this
  3552. }
  3553.  
  3554.