1 ;;; ob-vbnet.el --- org-babel functions for VB.Net evaluation
3 ;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
5 ;; Author: thomas "at" friendlyvillagers.com based on ob-java.el by Eric Schulte
6 ;; Keywords: literate programming, reproducible research
7 ;; Homepage: https://orgmode.org
9 ;; This file is not part of GNU Emacs.
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation, either version 3 of the License, or
14 ;; (at your option) any later version.
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; Currently this only supports the external compilation and execution
27 ;; of VB.Net code blocks (i.e., no session support).
32 (defvar org-babel-tangle-lang-exts
)
33 (add-to-list 'org-babel-tangle-lang-exts
'("vbnet" .
"vb"))
35 (defcustom org-babel-vbnet-command
"mono"
36 "Name of the mono command.
37 May be either a command in the path, like mono
38 or an absolute path name, like /usr/local/bin/mono
39 parameters may be used, like mono -verbose"
44 (defcustom org-babel-vbnet-compiler
"vbnc"
45 "Name of the VB.Net compiler.
46 May be either a command in the path, like vbnc
47 or an absolute path name, like /usr/local/bin/vbnc
48 parameters may be used, like vbnc /warnaserror+"
53 (defun org-babel-execute:vbnet
(body params
)
54 (let* ((full-body (org-babel-expand-body:generic body params
))
55 (cmpflag (or (cdr (assq :cmpflag params
)) ""))
56 (cmdline (or (cdr (assq :cmdline params
)) ""))
57 (src-file (org-babel-temp-file "vbnet-src-" ".vb"))
58 (exe-file (concat (file-name-sans-extension src-file
) ".exe"))
60 (progn (with-temp-file src-file
(insert full-body
))
62 (concat org-babel-vbnet-compiler
" " cmpflag
" " src-file
)
64 (let ((results (org-babel-eval (concat org-babel-vbnet-command
" " cmdline
" " exe-file
) "")))
65 (org-babel-reassemble-table
66 (org-babel-result-cond (cdr (assq :result-params params
))
67 (org-babel-read results
)
68 (let ((tmp-file (org-babel-temp-file "c-")))
69 (with-temp-file tmp-file
(insert results
))
70 (org-babel-import-elisp-from-file tmp-file
)))
72 (cdr (assq :colname-names params
)) (cdr (assq :colnames params
)))
74 (cdr (assq :rowname-names params
)) (cdr (assq :rownames params
)))))))
76 (defun org-babel-prep-session:vbnet
(session params
)
77 "Return an error because vbnet does not support sessions."
78 (error "Sessions are not supported for VB.Net"))
84 ;;; ob-vbnet.el ends here