From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ernesto Durante Subject: Re: babel: ob-C with Visual C++ and compilation-mode Date: Wed, 20 Aug 2014 22:40:16 +0200 Message-ID: <87sikqhp3j.fsf@gmail.com> References: <878un4ut6c.fsf@gmail.com> <53E91C32.4000002@free.fr> <87lhqt6b0w.fsf@gmail.com> <53EA8F2B.7010205@free.fr> <87zjf8cdjk.fsf@gmail.com> <53ED1EB0.3030500@free.fr> <87lhqp7jnp.fsf@gmail.com> <53F08FE3.20506@free.fr> <87vbpq6o4w.fsf@gmail.com> <53F25B1F.3020804@free.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKCgF-0005Gd-0y for emacs-orgmode@gnu.org; Wed, 20 Aug 2014 16:40:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKCg8-0003fU-TA for emacs-orgmode@gnu.org; Wed, 20 Aug 2014 16:40:26 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:52745) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKCg8-0003eP-L1 for emacs-orgmode@gnu.org; Wed, 20 Aug 2014 16:40:20 -0400 Received: by mail-wg0-f46.google.com with SMTP id m15so8298181wgh.5 for ; Wed, 20 Aug 2014 13:40:19 -0700 (PDT) Received: from localhost.localdomain (col74-1-88-183-113-172.fbx.proxad.net. [88.183.113.172]) by mx.google.com with ESMTPSA id mx10sm12649474wib.1.2014.08.20.13.40.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Aug 2014 13:40:18 -0700 (PDT) In-Reply-To: <53F25B1F.3020804@free.fr> (Thierry Banel's message of "Mon, 18 Aug 2014 21:59:27 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Thierry Banel writes: > You are trying to create a C++ project bigger than a few lines, in Org-mode. > This is very close to the idea of "literate programming" from Donal Knuth. > You may find inspiration here: > http://orgmode.org/worg/org-contrib/babel/intro.html#literate-programming > > There is an example of a "hello world" shell project split over three source > blocks. > Here it is translated from Shell to C++ (try it, it works): > > #+name: hello-world-prefix > #+begin_src C++ :exports none > printf ("/-----------------------------------------------------------\\\n"); > #+end_src > > #+name: hello-world-postfix > #+begin_src C++ :exports none > printf ("\\-----------------------------------------------------------/\n"); > #+end_src > > #+name: hello-world-main-begin > #+begin_src C++ :exports none > #include > int main() > { > #+end_src > > #+name: hello-world-main-end > #+begin_src C++ :exports none > return 0; > } > #+end_src > > #+name: hello-world > #+begin_src C++ :tangle hello :exports none :noweb yes :results output > <> > <> > printf ("| hello world |\n"); > <> > <> > #+end_src > > #+RESULTS: hello-world > : /-----------------------------------------------------------\ > : | hello world | > : \-----------------------------------------------------------/ Really interesting. We can take some blocks and combine them inside a source block. Thanks for this information. Another question if you allow me ? Looking at code in Ob-C you transform a table/list variable in a C array of char*. Should it not be std::wstring ? some unicode string ? Best Ernesto