[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] babel: ob-C with Visual C++ and compilation-mode
From: |
Ernesto Durante |
Subject: |
Re: [O] babel: ob-C with Visual C++ and compilation-mode |
Date: |
Wed, 20 Aug 2014 22:40:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (gnu/linux) |
Thierry Banel <address@hidden> 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 <stdio.h>
> 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
> <<hello-world-main-begin>>
> <<hello-world-prefix>>
> printf ("| hello world |\n");
> <<hello-world-postfix>>
> <<hello-world-main-end>>
> #+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
- [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/04
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/11
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/12
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/12
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/13
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/14
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/15
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/17
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/18
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/18
- Re: [O] babel: ob-C with Visual C++ and compilation-mode,
Ernesto Durante <=
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/21
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/24
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Thierry Banel, 2014/08/28
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Eric Schulte, 2014/08/21
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Ernesto Durante, 2014/08/24
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Eric Schulte, 2014/08/28
- Re: [O] babel: ob-C with Visual C++ and compilation-mode, Eric Schulte, 2014/08/21
Re: [O] babel: ob-C with Visual C++ and compilation-mode, Eric Schulte, 2014/08/21