mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-20 15:48:31 +00:00
* lisp/ob-C.el (org-babel-C-var-to-C): Add list support (org-babel-C-val-to-C-list-type, org-babel-C-val-to-C-type, org-babel-C-format-val): New functions. (org-babel-C-ensure-main-wrap, org-babel-execute:C, org-babel-execute:C++, rg-babel-execute:cpp, org-babel-C++-compiler, org-babel-C-compiler): Improve docstring. * testing/examples/ob-C-test.org (string_var): Add required std:: (Array): Add missing ID. (Matrix): Add tests for list support. * testing/lisp/test-ob-C.el (ob-C/table): Test succeeds. (ob-C/list-var, ob-C/vector-var, ob-C/list-list-var): Add tests for list support. Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
1.7 KiB
1.7 KiB
a collection of examples for ob-C tests
Simple tests
std::cout << 42;
return 0;
std::cout << q;
return 0;
std::cout << p+q;
return 0;
std::cout << q << ' ' << std::strlen(q);
return 0;
std::cout << N;
return 0;
Array
for (int i=1; i<3; i++) {
std::cout << i << '\n';
}
return 0;
Matrix
1 | 2 |
3 | 4 |
std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
std::cout << q[0][0] << ' ' << q[1][0] << '\n'
<< q[0][1] << ' ' << q[1][1] << '\n'; // transpose