From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,4c17e6ae73bd8c51 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Ada and UML Date: Sat, 04 Sep 2010 16:51:51 +0200 Organization: Ada @ Home Message-ID: References: <4c7f5735$0$6766$9b4e6d93@newsspool3.arcor-online.net> <156c1bf7-8744-43a0-b620-017244d4763d@k17g2000prf.googlegroups.com> <1ae9ef14-22a1-447a-836b-9db185439a85@h37g2000pro.googlegroups.com> NNTP-Posting-Host: QL8aors4DlJIFUefC0S8bQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.61 (Win32) Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!feed.ac-versailles.fr!news.ecp.fr!aioe.org!not-for-mail Xref: g2news1.google.com comp.lang.ada:13942 Date: 2010-09-04T16:51:51+02:00 List-Id: Le Fri, 03 Sep 2010 18:14:47 +0200, Matteo Bordin = a =C3=A9crit: > You should use Acceleo 3, which complies with the OMG model-to-text > spec. That was because I first get into trouble with version 3, now it is solv= ed. To not give erroneous picture, here is the same with the relevant versio= n. = Indeed, this is different. Still did not found a way to have a nicer = output (I did the best, but still not nice). Transormation: [comment encoding =3D UTF-8 /] [module Generate('http://www.eclipse.org/uml2/3.0.0/UML')/] [template lined(s : String)] [s.trim().replaceAll('\\s+', ' ')/] [/template] [template indented(s : String)] [s.trim().replaceAll('(\\n)\\s+', '$0 ')/] [/template] [template asTypeName(e : NamedElement) post(lined())] [e.name/]_Type [/template] [template asParameter(p : Parameter) post(lined())] [p.name/] : [p.type.asTypeName()/] [/template] [template asNextParameter(p : Parameter) post(indented())] ; [p.asParameter()/] [/template] [template asFirstParameter(p : Parameter) post(lined())] [p.asParameter()/] [/template] [template asSelfParameter(o : Operation) post(lined())] Self : [o.ancestors(Class).asTypeName()/] [/template] [template asParameterList(o: Operation) post(indented())] ([o.asSelfParameter()/] [for (p : Parameter | o.eAllContents(Parameter))] [if (not p.name.equalsIgnoreCase('return'))] [p.asNextParameter()/] [/if] [/for]) [/template] [template asSignature(o: Operation) post(indented())] [if (o.type =3D null)] procedure [o.name/] [o.asParameterList()/]; [/if] [if (o.type <> null)] function [o.name/] [o.asParameterList()/] return [o.type.asTypeName()/]; [/if] [/template] [template publicPart(pkg: Package) post(indented())] [for (c : Class | pkg.eAllContents(Class))] type [c.asTypeName()/] is private; [for (o : Operation | c.eAllContents(Operation))] [if (o.visibility =3D VisibilityKind::public)] [o.asSignature()/] [/if] [/for] [/for] [/template] [template privatePart(pkg: Package) post(indented())] [for (c : Class | pkg.eAllContents(Class))] type [c.asTypeName()/] is record [for (p : Property | c.eAllContents(Property))] [p.name/] : [p.type.asTypeName()/]; [/for] end record; -- [c.asTypeName()/] [for (o : Operation | c.eAllContents(Operation))] [if (o.visibility <> VisibilityKind::public)] [o.asSignature()/] [/if] [/for] [/for] [/template] [template packageSpecification(pkg : Package) post(trim())] package [pkg.name/] is [pkg.publicPart()/] private [pkg.privatePart()/] end [pkg.name/]; [/template] [template public Generate(pkg : Package)] [file (pkg.name + '.ads', false, 'UTF-8')] [pkg.packageSpecification()/] [/file] [/template] Sample output, using the same UML model as for the prior example (the = =E2=80=9Cindented=E2=80=9D method does not seem to be enough). package Greetings is type Greeting_Box_Type is private; procedure Say_Hi (Self : Greeting_Box_Type ); procedure Set_Greeting_Counter (Self : Greeting_Box_Type ; Value : Natural_Type ); function Get_Greeting_Counter (Self : Greeting_Box_Type ) return Natural_Type; private type Greeting_Box_Type is record Greating_Counter : Natural_Type; end record; -- Greeting_Box_Type procedure Have_A_Private_Time (Self : Greeting_Box_Type ); end Greetings; Useful link in this context: http://www.omg.org/spec/MOFM2T/1.0/ for references about MTL (you will see indeed Acceleo 3 conforms to = = this, while 2.7 was not) -- = =E2=80=9CDual licensing is the Perl's way to disinfect the GNU General P= ublic = Virus!=E2=80=9D (anonymous)