Thierry Banel <tbanelweb...@free.fr> 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






Reply via email to