From ali at lnet.fr Wed Jun 13 19:46:27 2007 From: ali at lnet.fr (ali Benabdelaziz) Date: Wed, 13 Jun 2007 21:46:27 +0200 Subject: [as2api-dev] idea Message-ID: <46704993.8070407@lnet.fr> I looked at the code of as2api though I don't know anything about ruby. Well the code looks clear, but there is no doc inside. My idea was just to add an output plugin to export to XMI meaning reverse engineer my own code to make graphs and extend it. From ali at lnet.fr Wed Jun 13 19:48:16 2007 From: ali at lnet.fr (ali Benabdelaziz) Date: Wed, 13 Jun 2007 21:48:16 +0200 Subject: [as2api-dev] as2api > UML out Message-ID: <46704A00.5090805@lnet.fr> I looked at the code of as2api though I don't know anything about ruby. Well the code looks clear, but there is no doc inside. My idea was just to add an output plugin to export to XMI meaning reverse engineer my own code to make graphs and extend it. PS : the goal is to do UML modeling from code that I already have written. From dave at badgers-in-foil.co.uk Wed Jun 13 20:48:21 2007 From: dave at badgers-in-foil.co.uk (David Holroyd) Date: Wed, 13 Jun 2007 20:48:21 +0000 Subject: [as2api-dev] as2api > UML out In-Reply-To: <46704A00.5090805@lnet.fr> References: <46704A00.5090805@lnet.fr> Message-ID: <20070613204820.GA16416@badgers-in-foil.co.uk> On Wed, Jun 13, 2007 at 09:48:16PM +0200, ali Benabdelaziz wrote: > I looked at the code of as2api though I don't know anything about ruby. > Well the code looks clear, but there is no doc inside. > My idea was just to add an output plugin to export to XMI > meaning reverse engineer my own code to make graphs and extend it. Cool! If you're willing to get up to speed with Ruby, and understand how to compose XMI, it should be possible to reuse the guts of as2api for this task. Grab the source from subversion[1] and look at lib/ui/cli.rb The key stuff is in the 'main' method near the end of the file. You'll see that having done all the code parsing work, one of three functions is called and passed the 'type_agregator' reference. Each of these can generates a different output from the parsed API (one of these is the normal HTML API doc). The 'api_export' function (which just invokes the 'generate_api_dump' function defined in lib/output/diff/api_dump.rb) already generates XML output from the API so that as2api can later compare XML dumps of two different releases of an API, and generate a report on what changed (this is a feature that I never properly finished, inspired by the jdiff tool). So, here are two options: 1) Use the code from lib/output/diff (api_serializer.rb in particular) as an example to create your own code for XMI generation, and hook it in to the existing CLI stuff. 2) Evaluate the existing XML output to see if it would be easier to transform this into XMI using a language you are already familiar with. The (undocumented) XML export bits can be enabled by adding the --api-export option to the as2api command line. Hope that helps. If you have any questions, please ask! dave [1] http://svn.badgers-in-foil.co.uk/as2api/trunk/as2api -- http://david.holroyd.me.uk/