From: Robert K. <rik...@ho...> - 2004-03-18 21:47:14
|
Leo, Take a look at the code preservation in the C++ module, which, while a bit more cumbersome than the Java and PHP implementation which you implement, is arguably closer to being useful across more programming languages. Better to have a single implementation of code preservation across dia2code than several -- this is why it's already so difficult to use, no programming language implementation shares anything but the most basic functionality, and fundamentally operates in a vacuum. I wrote d2c_fprintf -- once again look at the C++ implementation to get a sense of how it works: It works with some other functions (whose names escape me for the moment) that are an attempt to abstract out some of the source-code indentation issues. So my advise is, use d2c_fprintf, but look at how the C++ generator handles brackets, and follow accordingly (oh, now I remmeber, I think the name of the functions are d2c_indent and d2c_unindent.) See, d2c_fprintf knows how much you've indented, so it replaces \n with \n, followed by the correct number of spaces to indent your code for you. Really, the C++ code is a template for how that stuff will work. Rob >From: Leonard WEST <le...@ne...> >Reply-To: le...@ne... >To: dia...@li... >Subject: [Dia2code-general] Request fo comment - a simple code preservation >implementation >Date: Tue, 16 Mar 2004 10:16:23 +0100 >MIME-Version: 1.0 >Received: from sc8-sf-list1.sourceforge.net ([66.35.250.206]) by >mc9-f20.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Tue, 16 Mar 2004 >01:23:39 -0800 >Received: from localhost ([127.0.0.1] helo=projects.sourceforge.net)by >sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30)id 1B3AjU-0004cp-2M; >Tue, 16 Mar 2004 01:19:32 -0800 >Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.12] >helo=sc8-sf-mx2.sourceforge.net)by sc8-sf-list1.sourceforge.net with esmtp >(Exim 4.30)id 1B3Afs-0003yW-Iwfor dia...@li...; >Tue, 16 Mar 2004 01:15:48 -0800 >Received: from smtp1.ldcom.fr ([62.39.9.135])by sc8-sf-mx2.sourceforge.net >with esmtp (Exim 4.30)id 1B3Afq-0001yX-SDfor >dia...@li...; Tue, 16 Mar 2004 01:15:47 -0800 >Received: from smtp1.ldcom.fr (localhost [127.0.0.1])by >smtp1.smtp1.ldcom.fr (Postfix) with ESMTP id 81F6D26827Efor ><dia...@li...>; Tue, 16 Mar 2004 10:13:49 +0100 >(MET) >Received: from nr0s0086.servgamma.9telecom.fr >(nr0s0086e0.servgamma.9telecom.fr [10.149.56.136])by smtp1.ldcom.fr >(Postfix) with ESMTP id 5F2E7268012for ><dia...@li...>; Tue, 16 Mar 2004 10:13:49 +0100 >(MET) >Received: from lcopar-cpla.ldcom.fr (lcopar_cpla.blg.ldcom.ld >[10.192.224.127]) by nr0s0086.servgamma.9telecom.fr with SMTP (Microsoft >Exchange Internet Mail Service Version 5.5.2653.13)id G03PW94Q; Tue, 16 Mar >2004 10:16:09 +0100 >Received: from [10.151.17.4] (helo=ianan)by lcopar-cpla.ldcom.fr with esmtp >(Exim 3.36 #1 (Debian))id 1B3Afe-0004ub-00for ><dia...@li...>; Tue, 16 Mar 2004 10:15:34 +0100 >X-Message-Info: JGTYoYF78jGIxTwXWrZZCrh1bHigeMbB >User-Agent: KMail/1.6.1 >Message-Id: <200...@ne...> >X-Spam-Score: 0.0 (/) >X-Spam-Report: Spam Filtering performed by sourceforge.net.See >http://spamassassin.org/tag/ for more details.Report problems to >http://sf.net/tracker/?func=add&group_id=1&atid=200001 >Errors-To: dia...@li... >X-BeenThere: dia...@li... >X-Mailman-Version: 2.0.9-sf.net >Precedence: bulk >List-Unsubscribe: ><https://lists.sourceforge.net/lists/listinfo/dia2code-general>,<mailto:dia...@li...?subject=unsubscribe> >List-Id: General Dia2Code discussion ><dia2code-general.lists.sourceforge.net> >List-Post: <mailto:dia...@li...> >List-Help: ><mailto:dia...@li...?subject=help> >List-Subscribe: ><https://lists.sourceforge.net/lists/listinfo/dia2code-general>,<mailto:dia...@li...?subject=subscribe> >List-Archive: ><http://sourceforge.net/mailarchive/forum.php?forum=dia2code-general> >X-Original-Date: Tue, 16 Mar 2004 10:16:23 +0100 >Return-Path: dia...@li... >X-OriginalArrivalTime: 16 Mar 2004 09:23:42.0531 (UTC) >FILETIME=[5FB9E930:01C40B38] > > >Hello, > >Here is a preliminary dia2code version that preserve the methods source >code. > >I've only adapted java and php generators for now. In order to make it >work, >you must add a @diaoid <oid> tag in the methods comment field. ><oid> must be unique for a method in a class, and may be any string without >spacing character, eg. you can use method name or a number: >"My method description - @diaoid setList" >"My method description - @diaoid m001" > >This should be a temporary constraint as iasked the dia developer team to >add >an oid attribute to methods and attributes in dia XML format. I've included >for a sample diagram under tests/categories.dia. > >I fixed some segfaults, among which a tricky one in parse_diagram.c due to >a ><parent> tag in (i guess recent) dia XML. > >I've added an hidden --debug <level> switch to show a few informations >about >the generation process. > >Most of the code parsing stuff is in source_parser.c (new file). It is very >basic for now, a major "Todo" is to interprets comments and quoted strings >correctly. > >As the list may not accept attachements, you can get the tarball >@ http://lwest.free.fr/dia2code-codepreserve.tgz > >I also have a question about dia2ode history: what is the right way to >output >code , as there are so many functions to do that (d2c_printf, emit, >fprintf....) > > >--Leo > > > >------------------------------------------------------- >This SF.Net email is sponsored by: IBM Linux Tutorials >Free Linux tutorial presented by Daniel Robbins, President and CEO of >GenToo technologies. Learn everything from fundamentals to system >administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >_______________________________________________ >Dia2code-general mailing list >Dia...@li... >https://lists.sourceforge.net/lists/listinfo/dia2code-general _________________________________________________________________ MSN Toolbar provides one-click access to Hotmail from any Web page FREE download! http://clk.atdmt.com/AVE/go/onm00200413ave/direct/01/ |