Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'sufficient': 0.05; 'redirected': 0.07; 'subject:code': 0.07; 'python': 0.09; 'c/c++': 0.09; 'idea?': 0.09; 'cc:addr:python-list': 0.10; 'template': 0.11; ':-)': 0.13; 'hackers': 0.16; 'oct': 0.16; 'question)': 0.16; 'readable': 0.16; 'silly': 0.16; 'wrote:': 0.17; 'code,': 0.18; 'memory': 0.18; 'app': 0.19; 'file.': 0.20; 'trying': 0.21; 'received:209.85.216.46': 0.21; "i'd": 0.22; 'cc:2**0': 0.23; 'programming': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'appreciated.': 0.26; 'extend': 0.26; '+0100': 0.27; 'c++': 0.27; 'translated': 0.27; 'rest': 0.28; 'fine': 0.28; '(maybe': 0.29; 'us!': 0.29; 'url:mailman': 0.29; "i'm": 0.29; 'knows': 0.30; 'sense': 0.31; 'code': 0.31; 'url:python': 0.32; 'file': 0.32; 'anybody': 0.32; 'could': 0.32; 'url:listinfo': 0.32; 'club': 0.33; 'knowledge': 0.33; 'received:google.com': 0.34; 'generic': 0.35; 'requiring': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'message-id:@gmail.com': 0.36; 'url:org': 0.36; 'anything': 0.36; 'too': 0.36; 'charset:us- ascii': 0.36; 'xml': 0.37; 'does': 0.37; 'quite': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'green': 0.38; 'things': 0.38; 'sure': 0.38; 'advice': 0.39; 'build': 0.39; 'google': 0.39; 'little': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'think': 0.40; 'skip:u 10': 0.60; 'header:Message-Id:1': 0.62; 'received:96': 0.62; 'subject': 0.66; 'andrea': 0.84; 'etienne': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type:content-transfer-encoding; bh=MbWd9h9pfhk4Z7CLmv8/UuZbAtLzthiBj9WuVd74LEg=; b=cuiXruAKYURVG3aOY1CSgCQ3Gid+t2RQLO9PwGEEUSckbuLA/eNj4crqZDBXqfMJqF wpcWNXqdUIwMjc3ouuWxaQ7T0+PwDalZXnXwsQrd/BReIyspI7YKZ31WAbWCxJPegZjN H+GqQNEohk2iuCbOEsHHYjs6yfvTw6S3+3yI58okZ9Lf7FRzZPkiWaSmMTazSdpzmHdE PiTW7GqOrZqUatFBy2Y/bGpH6p7/KHwnQYCBeinXiy+V98ARDYfvKRsjmutoUzVM+Thn oHMWshnRe3D+ioAeh0q/d5oSX/s0lQbdVhSJVprzqTw36t0Gb69uAGTDTHyy3+G/zHI+ EDtA== Date: Tue, 9 Oct 2012 16:52:26 -0400 From: Etienne Robillard To: jeanmichel@sequans.com Subject: Re: Generating C++ code In-Reply-To: <50748144.30301@gmail.com> References: <594985467.3115693.1349798400166.JavaMail.root@sequans.com> <50748144.30301@gmail.com> X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1349815941 news.xs4all.nl 6911 [2001:888:2000:d::a6]:33639 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:31054 On Tue, 09 Oct 2012 20:55:48 +0100 Andrea Crotti wrote: > On 10/09/2012 05:00 PM, Jean-Michel Pichavant wrote: > > Greetings, > > > > I'm trying to generate C++ code from an XML file. I'd like to use a template engine, which imo produce something readable and maintainable. > > My google search about this subject has been quite unsuccessful, I've been redirected to template engine specific to html mostly. > > > > Does anybody knows a python template engine for generating C++ code ? > > > > Here's my flow: > > > > XML file -> nice python app -> C++ code > > > > From what I know I could use Cheetah, a generic template engine. I never used it though, I'm not sure this is what I need. > > I'm familiar with jinja2 but I'm not sure I could use it to generate C++ code, did anybody try ? (maybe that's a silly question) > > > > Any advice would be appreciated. > > > > JM > > I think you can use anything to generate C++ code, but is it a good idea? > Are you going to produce this code only one time and then maintain it > manually? > > And are you sure that the design that you would get from the XML file > actually makes sense when > translated in C++? > -- > http://mail.python.org/mailman/listinfo/python-list You can build nice python app with Cython/Pyrex too if you got sufficient knowledge in C/C++ programming to extend the app in C. :-) Otherwise that seem like a little counter-productive to produce a python template only for generating C stubs when python is good for many things without requiring advanced C++ skills like memory management, etc. HTH, E -- Etienne Robillard Green Tea Hackers Club Fine Software Carpentry For The Rest Of Us! http://gthc.org/ erob@gthcfoundation.org