Function: org-babel-C-header-to-C
org-babel-C-header-to-C is a byte-compiled function defined in
ob-C.el.gz.
Signature
(org-babel-C-header-to-C HEAD TYPE)
Documentation
Convert an elisp list of header table into a C or D vector specifying a variable with the name of the table.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ob-C.el.gz
(defun org-babel-C-header-to-C (head type)
"Convert an elisp list of header table into a C or D vector
specifying a variable with the name of the table."
(let ((table (car head))
(headers (cdr head))
(typename (pcase type
(`integerp "int")
(`floatp "double")
(`stringp (pcase org-babel-c-variant
((or `c `cpp) "const char*")
(`d "string"))))))
(concat
(pcase org-babel-c-variant
((or `c `cpp)
(format "const char* %s_header[%d] = {%s};"
table
(length headers)
(mapconcat (lambda (h) (format "\"%s\"" h)) headers ",")))
(`d
(format "string[%d] %s_header = [%s];"
(length headers)
table
(mapconcat (lambda (h) (format "\"%s\"" h)) headers ","))))
"\n"
(pcase org-babel-c-variant
((or `c `cpp)
(format
"%s %s_h (int row, const char* col) { return %s[row][get_column_num(%d,%s_header,col)]; }"
typename table table (length headers) table))
(`d
(format
"%s %s_h (size_t row, string col) { return %s[row][get_column_num(%s_header,col)]; }"
typename table table table))))))