Bug 336933 - Ada is generated only for one class per package
Summary: Ada is generated only for one class per package
Status: RESOLVED FIXED
Alias: None
Product: umbrello
Classification: Applications
Component: general (show other bugs)
Version: Git
Platform: unspecified All
: NOR normal
Target Milestone: ---
Assignee: Umbrello Development Group
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-01 15:13 UTC by Oliver Kellogg
Modified: 2014-08-09 09:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.13.80


Attachments
demo XMI file which shows the problem (19.77 KB, text/x-xmi)
2014-07-01 15:13 UTC, Oliver Kellogg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Kellogg 2014-07-01 15:13:20 UTC
Created attachment 87501 [details]
demo XMI file which shows the problem

This bug was introduced by svn commit 247381 on 2003-08-31.

Ada code is generated only for a single class per UML package.
The code for the second to Nth class in a package is missing.

In the attachment, package "pkg" contains the interfaces IGramp and IPa and the classes CMa and TheMan. Of these classes, only CMa is generated in pkg.ads.
Comment 1 Oliver Kellogg 2014-07-01 16:33:25 UTC
Git commit 3b6386203c827fd65937692c5a4fdf9f8457ef2a by Oliver Kellogg.
Committed on 01/07/2014 at 16:33.
Pushed by okellogg into branch 'master'.

umbrello/uml.cpp
- In function setGenerator() revert part of commit ea25b64 which returns
  preexisting m_codegen if (m_codegen->language() == pl).

umbrello/codegenerators/codegenerator.{h,cpp}
- New virtual function finalizeRun() with empty default implementation can
  be reimplemented by concrete code generators to perform additional
  cleanups or other actions that can only be performed once all code has
  been written. The function is called in writeCodeToFile() after return
  from writeListedCodeDocsToFile().

umbrello/codegenerators/simplecodegenerator.cpp
- In function writeCodeToFile(), utilize writeCodeToFile(concepts) for
  minimizing code duplication.
- In function writeCodeToFile(UMLClassifierList&),
  - do not writeClass(c) if Model_Utils::isCommonDataType(c->name());
  - call finalizeRun() after foreach loop over `concepts'.

umbrello/codegenerators/ada/adawriter.{h,cpp}
- Add `static' on declaration of functions isOOClass() and packageName().
- New function declareClass() factors trunk of Ada declaration which is
  common to partial (public) and full (private) view.
- Reimplement function finalizeRun() from CodeGenerator: Cumulative
  generation of the private part is moved from writeClass() to here.
- New member m_pkgsGenerated is required for closing opened files in
  finalizeRun().
- New member m_classesGenerated is required for ensuring that order of code
  generation is consistent with order of dependencies among classifiers in
  the package.

umbrello/codegenerators/ada/adawriter.cpp function writeClass()
- Return immediately without further action if `c' is already present in
  m_classesGenerated.
- If `pkg' is found in m_pkgsGenerated then do not open file / write
  initial declarations but instead use the value() of the PackageFileMap::
  iterator found for `file'.
- If `pkg' is found in m_pkgsGenerated then:
  - Open file and write initial declarations; in loop over `imports', do not
    write "with" if packageName(con) does not match `pkg'.
  - Assign `file' into m_pkgsGenerated[pkg].
- Before declaring the Ada type mapped from `c', loop over
  c->getSuperClasses() and ensure that superclasses in same package are
  written beforehand.
- Move all aggregation/composition/attribute handling to finalizeRun().

umbrello/codegenerators/ada/adawriter.cpp function reservedKeywords()
- Add Ada2005 reserved word "interface".

M  +247  -184  umbrello/codegenerators/ada/adawriter.cpp
M  +24   -2    umbrello/codegenerators/ada/adawriter.h
M  +15   -0    umbrello/codegenerators/codegenerator.cpp
M  +2    -0    umbrello/codegenerators/codegenerator.h
M  +4    -6    umbrello/codegenerators/simplecodegenerator.cpp
M  +4    -5    umbrello/uml.cpp

http://commits.kde.org/umbrello/3b6386203c827fd65937692c5a4fdf9f8457ef2a