Bug 114547

Summary: wish: Free Pascal code import and generator
Product: [Applications] umbrello Reporter: Michael Wright <digital.penguin>
Component: generalAssignee: Oliver Kellogg <okellogg>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: OpenSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Michael Wright 2005-10-17 02:31:50 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    SuSE RPMs
OS:                Linux

Please add code generator for the Free Pascal compiler
Comment 1 Michael Wright 2005-10-17 02:32:39 UTC
Thanks for your time.
Comment 2 Jonathan Riddell 2005-10-21 21:08:45 UTC
Is it object orientated?
Comment 3 Sebastian Stein 2005-10-21 22:23:43 UTC
Jonathan Riddell <jr@jriddell.org> [051021 22:19]:
> ------- Additional Comments From jr jriddell org  2005-10-21 21:08 -------
> Is it object orientated?


No, functional.

Sebastian
Comment 4 Michael Wright 2005-10-22 07:26:46 UTC
Sebastian Stein wrote:
[bugs.kde.org quoted mail]
Yes it is.

Michael
Comment 5 Jens Muskewitz 2006-06-01 15:53:56 UTC
Since kylix is around for quite some time it would be good to have both delphi and free pascal support.

Jens
Comment 6 Oliver Kellogg 2006-07-16 10:27:15 UTC
I'll be adding PascalImport too, for importing StarUML (http://www.staruml.com)
Comment 7 Oliver Kellogg 2006-07-16 18:09:25 UTC
It's a breeze, given the NativeImportBase and AdaImport :)
Comment 8 Oliver Kellogg 2006-07-16 22:25:51 UTC
SVN commit 563149 by okellogg:

Move all code import related files to a separate subdirectory, codeimport.
Prepare for Pascal import and generator. ATM they are cheap copies from Ada,
adaptation to Pascal is up next.
Also move the {set,get}OptionState() methods from UMLApp to Settings because
of a crash (that should have happened long ago...)
CCBUG:114547
CCBUG:107347


 M  +1 -0      ChangeLog  
 M  +3 -10     umbrello/Makefile.am  
 D             umbrello/adaimport.cpp  
 D             umbrello/adaimport.h  
 M  +1 -1      umbrello/associationwidget.cpp  
 M  +2 -2      umbrello/classifier.cpp  
 D             umbrello/classimport.cpp  
 D             umbrello/classimport.h  
 M  +1 -1      umbrello/classparser/cpptree2uml.cpp  
 M  +2 -2      umbrello/codegenerators/Makefile.am  
 M  +7 -3      umbrello/codegenerators/codegenfactory.cpp  
 A             umbrello/codegenerators/pascalwriter.cpp   [License: GPL (v2+)]
 A             umbrello/codegenerators/pascalwriter.h   [License: GPL (v2+)]
 A             umbrello/codeimport (directory)  
 A             umbrello/codeimport/Makefile.am  
 A             umbrello/codeimport/adaimport.cpp   umbrello/adaimport.cpp#562821 [License: GPL (v2+)]
 A             umbrello/codeimport/adaimport.h   umbrello/adaimport.h#562821
 A             umbrello/codeimport/classimport.cpp   umbrello/classimport.cpp#562821 [License: GPL (v2+)]
 A             umbrello/codeimport/classimport.h   umbrello/classimport.h#562821
 A             umbrello/codeimport/cppimport.cpp   umbrello/cppimport.cpp#562821 [License: GPL (v2+)]
 A             umbrello/codeimport/cppimport.h   umbrello/cppimport.h#562821
 A             umbrello/codeimport/idlimport.cpp   umbrello/idlimport.cpp#562821 [POSSIBLY UNSAFE: popen] [License: GPL (v2+)]
 A             umbrello/codeimport/idlimport.h   umbrello/idlimport.h#562821
 A             umbrello/codeimport/import_utils.cpp   umbrello/import_utils.cpp#562840 [License: GPL (v2+)]
 A             umbrello/codeimport/import_utils.h   umbrello/import_utils.h#562821 [License: GPL (v2+) GENERATED FILE]
 A             umbrello/codeimport/javaimport.cpp   umbrello/javaimport.cpp#562848 [License: GPL (v2+)]
 A             umbrello/codeimport/javaimport.h   umbrello/javaimport.h#562821
 A             umbrello/codeimport/nativeimportbase.cpp   umbrello/nativeimportbase.cpp#562821
 A             umbrello/codeimport/nativeimportbase.h   umbrello/nativeimportbase.h#562821 [License: GPL (v2+)]
 A             umbrello/codeimport/pascalimport.cpp   [License: GPL (v2+)]
 A             umbrello/codeimport/pascalimport.h   [License: GPL (v2+)]
 A             umbrello/codeimport/pythonimport.cpp   umbrello/pythonimport.cpp#562821 [License: GPL (v2+)]
 A             umbrello/codeimport/pythonimport.h   umbrello/pythonimport.h#562821
 D             umbrello/cppimport.cpp  
 D             umbrello/cppimport.h  
 M  +4 -7      umbrello/dialogs/umlattributedialog.cpp  
 M  +5 -8      umbrello/dialogs/umlwidgetcolorpage.cpp  
 M  +1 -1      umbrello/entity.cpp  
 D             umbrello/idlimport.cpp  
 D             umbrello/idlimport.h  
 D             umbrello/import_utils.cpp  
 D             umbrello/import_utils.h  
 D             umbrello/javaimport.cpp  
 D             umbrello/javaimport.h  
 M  +1 -1      umbrello/listpopupmenu.cpp  
 M  +4 -0      umbrello/model_utils.cpp  
 D             umbrello/nativeimportbase.cpp  
 D             umbrello/nativeimportbase.h  
 A             umbrello/optionstate.cpp   [License: GPL (v2+)]
 M  +7 -1      umbrello/optionstate.h  
 M  +1 -1      umbrello/petaltree2uml.cpp  
 D             umbrello/pythonimport.cpp  
 D             umbrello/pythonimport.h  
 M  +106 -95   umbrello/uml.cpp  
 M  +1 -10     umbrello/uml.h  
 M  +12 -12    umbrello/umldoc.cpp  
 M  +3 -4      umbrello/umllistview.cpp  
 M  +1 -0      umbrello/umlnamespace.h  
 M  +2 -2      umbrello/umlobject.cpp  
Comment 9 Oliver Kellogg 2006-07-20 21:38:32 UTC
SVN commit 564664 by okellogg:

Basic adaptations to Pascal syntax. Up next: PascalImport.
CCBUG:114547


 M  +83 -298   pascalwriter.cpp  
Comment 10 Oliver Kellogg 2006-07-23 15:22:18 UTC
SVN commit 565431 by okellogg:

Basic adaptations to Pascal syntax, still untested. Up next: Test it. 
CCBUG:114547


 M  +159 -176  pascalimport.cpp  
 M  +17 -0     pascalimport.h  
Comment 11 Oliver Kellogg 2006-07-24 06:47:50 UTC
SVN commit 565677 by okellogg:

Set the PascalImport to work - roughly.
PascalImport right now suffers from the same problems
as JavaImport did concerning placeholder class scoping.
TODO: See how JP Fournier's fix to bug 131270 (r565676)
can be applied to PascalImport.
BUG:114547


 M  +14 -17    pascalimport.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/pascalimport.cpp #565676:565677
@@ -139,8 +139,9 @@
     }
     if (keyword == "unit") {
         const QString& name = advance();
-        UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Package,
-                        name, m_scope[m_scopeIndex], m_comment);
+        UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Package, name,
+                                                      m_scope[m_scopeIndex], m_comment);
+        m_scope[++m_scopeIndex] = static_cast<UMLPackage*>(ns);
         skipStmt();
         return true;
     }
@@ -217,9 +218,7 @@
             return true;
         }
         const QString& name = advance();
-        QString returnType;
-        UMLClassifier *klass = NULL;
-        UMLOperation *op = NULL;
+        UMLOperation *op = Import_Utils::makeOperation(m_klass, name);
         if (m_source[m_srcIndex + 1] == "(") {
             advance();
             const uint MAX_PARNAMES = 16;
@@ -260,6 +259,7 @@
                     break;
             }
         }
+        QString returnType;
         if (keyword == "function") {
             if (advance() != ":") {
                 kdError() << "importPascal: expecting \":\" at function "
@@ -272,9 +272,8 @@
         bool isVirtual = false;
         bool isAbstract = false;
         checkModifiers(isVirtual, isAbstract);
-        if (klass != NULL && op != NULL)
-            Import_Utils::insertMethod(klass, op, m_currentAccess, returnType,
-                                       !isVirtual, isAbstract, false, false, m_comment);
+        Import_Utils::insertMethod(m_klass, op, m_currentAccess, returnType,
+                                   !isVirtual, isAbstract, false, false, m_comment);
         return true;
     }
     if (m_section != sect_TYPE) {
@@ -326,15 +325,13 @@
             m_comment = QString::null;
             if (m_source[m_srcIndex + 1] == "(") {
                 advance();
-                QString base = advance();
-                UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Class, base, NULL);
-                UMLClassifier *parent = static_cast<UMLClassifier*>(ns);
-                ns = Import_Utils::createUMLObject(Uml::ot_Class, name,
-                                                   m_scope[m_scopeIndex], m_comment);
-                m_klass = static_cast<UMLClassifier*>(ns);
-                m_comment = QString::null;
-                Import_Utils::createGeneralization(m_klass, parent);
-                advance();  // skip the closing ")"
+                do {
+                    QString base = advance();
+                    UMLObject *ns = Import_Utils::createUMLObject(Uml::ot_Class, base, NULL);
+                    UMLClassifier *parent = static_cast<UMLClassifier*>(ns);
+                    m_comment = QString::null;
+                    Import_Utils::createGeneralization(m_klass, parent);
+                } while (advance() == ",");
             }
             m_currentAccess = Uml::Visibility::Public;
             return true;