Commit a2fcbebf authored by erwan's avatar erwan
Browse files

Docs: fix the CI that build the doc

parent a0d56736
Pipeline #24354 failed with stages
in 9 minutes and 5 seconds
This diff is collapsed.
This diff is collapsed.
;;; lutin.el - Major mode for editing lustre source in Emacs
(require 'font-lock)
; version of lutin-mode
(defconst lutin-mode-version "0.0")
;;; Hooks
(defvar lutin-mode-hook nil
"functions called when entering Lutin Mode.")
;;; Key-map for Lutin-mode
(defvar lutin-mode-map nil
"Keymap for lutin major mode.")
;;; Font-lock -----------------------------------------------------
(defvar lutin-font-lock-keywords nil
"Regular expression used by Font-lock mode.")
(setq lutin-font-lock-keywords
'(
("--.*$" . font-lock-comment-face)
("\\<\\(loop\\|fby\\||raise\\|try\\|trap\\|catch\\|do\\)\\>" . font-lock-builtin-face)
("\\<\\(const\\|extern\\|node\\|run\\|include\\|returns\\|type\\)\\>" . font-lock-keyword-face)
("\\<\\(let\\|assert\\|exist\\|in\\|if\\|then\\|else\\)\\>" . font-lock-keyword-face)
("\\<\\(true\\|and\\|or\\|not\\|false\\)\\>" . font-lock-reference-face)
("\\<\\(trace\\|bool\\|int\\|ref\\|real\\)\\(\\^.+\\)?\\>" . font-lock-type-face)
("\\<\\(pre\\)\\>" . font-lock-constant-face)
))
(defun lutin-font-mode ()
"Initialisation of font-lock for Lutin mode."
(make-local-variable 'font-lock-defaults)
(setq font-lock-defaults
'(lutin-font-lock-keywords t)))
; font-lock isn't used if in a console
(if window-system
(prog2
(add-hook 'lutin-mode-hook
'turn-on-font-lock)
(add-hook 'lutin-mode-hook
'lutin-font-mode)))
(defun lutin-line-is-comment (&optional arg)
"non-nil means line is only a commentary."
(interactive)
(save-excursion
(beginning-of-line arg)
(skip-chars-forward " \t")
(looking-at "--")))
(setq comment-start "(*")
(setq comment-end "*)")
(setq comment-start "-- ")
(setq comment-end "")
;;; Major-mode
(defun lutin-mode ()
"Major mode for editing Lutin files.
Only keywords colaraition for the moment...
"
(interactive)
(kill-all-local-variables)
(setq major-mode 'lutin-mode)
(setq mode-name "Lutin")
(use-local-map lutin-mode-map)
(run-hooks 'lutin-mode-hook))
(provide 'lutin)
;;; lutin .el ends here...
;;; ob-dot.el --- org-babel functions for dot evaluation
;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Org-Babel support for evaluating dot source code.
;;
;; For information on dot see http://www.graphviz.org/
;;
;; This differs from most standard languages in that
;;
;; 1) there is no such thing as a "session" in dot
;;
;; 2) we are generally only going to return results of type "file"
;;
;; 3) we are adding the "file" and "cmdline" header arguments
;;
;; 4) there are no variables (at least for now)
;;; Code:
(require 'ob)
(require 'ob-eval)
(defvar org-babel-default-header-args:dot
'((:results . "file") (:exports . "results"))
"Default arguments to use when evaluating a dot source block.")
(defun org-babel-expand-body:dot (body params)
"Expand BODY according to PARAMS, return the expanded body."
(let ((vars (mapcar #'cdr (org-babel-get-header params :var))))
(mapc
(lambda (pair)
(let ((name (symbol-name (car pair)))
(value (cdr pair)))
(setq body
(replace-regexp-in-string
(concat "\$" (regexp-quote name))
(if (stringp value) value (format "%S" value))
body))))
vars)
body))
(defun org-babel-execute:dot (body params)
"Execute a block of Dot code with org-babel.
This function is called by `org-babel-execute-src-block'."
(let* ((result-params (cdr (assoc :result-params params)))
(out-file (cdr (assoc :file params)))
(cmdline (or (cdr (assoc :cmdline params))
(format "-T%s" (file-name-extension out-file))))
(cmd (or (cdr (assoc :cmd params)) "dot"))
(in-file (org-babel-temp-file "dot-")))
(with-temp-file in-file
(insert (org-babel-expand-body:dot body params)))
(org-babel-eval
(concat cmd
" " (org-babel-process-file-name in-file)
" " cmdline
" -o " (org-babel-process-file-name out-file)) "")
nil)) ;; signal that output has already been written to file
(defun org-babel-prep-session:dot (session params)
"Return an error because Dot does not support sessions."
(error "Dot does not support sessions"))
(provide 'ob-dot)
;;; ob-dot.el ends here
;;; ob-template.el --- org-babel functions for template evaluation
;; Copyright (C) your name here
;; Author: your name here
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; Version: 0.01
;;; License:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This file is not intended to ever be loaded by org-babel, rather it
;; is a template for use in adding new language support to Org-babel.
;; Good first steps are to copy this file to a file named by the
;; language you are adding, and then use `query-replace' to replace
;; all strings of "template" in this file with the name of your new
;; language.
;;
;; If you have questions as to any of the portions of the file defined
;; below please look to existing language support for guidance.
;;
;; If you are planning on adding a language to org-babel we would ask
;; that if possible you fill out the FSF copyright assignment form
;; available at http://orgmode.org/request-assign-future.txt as this
;; will make it possible to include your language support in the core
;; of Org-mode, otherwise unassigned language support files can still
;; be included in the contrib/ directory of the Org-mode repository.
;;; Requirements:
;; Use this section to list the requirements of this language. Most
;; languages will require that at least the language be installed on
;; the user's system, and the Emacs major mode relevant to the
;; language be installed as well.
;;; Code:
(require 'ob)
(require 'ob-ref)
(require 'ob-comint)
(require 'ob-eval)
;; possibly require modes required for your language
;; optionally define a file extension for this language
(add-to-list 'org-babel-tangle-lang-exts '("lustre" . "lus"))
;; optionally declare default header arguments for this language
(defvar org-babel-default-header-args:lustre '())
;; This function expands the body of a source code block by doing
;; things like prepending argument definitions to the body, it should
;; be called by the `org-babel-execute:lustre' function below.
;(defun org-babel-expand-body:lustre (body params &optional processed-params)
; "Expand BODY according to PARAMS, return the expanded body."
; (require 'lustre)
; (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
; (concat
; (mapconcat ;; define any variables
; (lambda (pair)
; (format "%s=%S"
; (car pair) (org-babel-lustre-var-to-lustre (cdr pair))))
; vars "\n") "\n" body "\n")))
;; This is the main function which is called to evaluate a code
;; block.
;;
;; This function will evaluate the body of the source code and
;; return the results as emacs-lisp depending on the value of the
;; :results header argument
;; - output means that the output to STDOUT will be captured and
;; returned
;; - value means that the value of the last statement in the
;; source code block will be returned
;;
;; The most common first step in this function is the expansion of the
;; PARAMS argument using `org-babel-process-params'.
;;
;; Please feel free to not implement options which aren't appropriate
;; for your language (e.g. not all languages support interactive
;; "session" evaluation). Also you are free to define any new header
;; arguments which you feel may be useful -- all header arguments
;; specified by the user will be available in the PARAMS variable.
(defun org-babel-execute:lustre (body params)
"Execute a block of Lustre code with org-babel. This function is
called by `org-babel-execute-src-block'"
(message "executing Lustre source code block")
(let* ((processed-params (org-babel-process-params params))
;; set the session if the session variable is non-nil
(session (org-babel-lustre-initiate-session (first processed-params)))
;; variables assigned for use in the block
(vars (second processed-params))
(result-params (third processed-params))
;; either OUTPUT or VALUE which should behave as described above
(result-type (fourth processed-params))
;; expand the body with `org-babel-expand-body:lustre'
; (full-body (org-babel-expand-body:lustre
; body params processed-params))
)
;; actually execute the source-code block either in a session or
;; possibly by dropping it to a temporary file and evaluating the
;; file.
;;
;; for session based evaluation the functions defined in
;; `org-babel-comint' will probably be helpful.
;;
;; for external evaluation the functions defined in
;; `org-babel-eval' will probably be helpful.
;;
;; when forming a shell command, or a fragment of code in some
;; other language, please preprocess any file names involved with
;; the function `org-babel-process-file-name'. (See the way that
;; function is used in the language files)
))
;; This function should be used to assign any variables in params in
;; the context of the session environment.
(defun org-babel-prep-session:lustre (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
)
(defun org-babel-lustre-var-to-lustre (var)
"Convert an elisp var into a string of lustre source code
specifying a var of the same value."
(format "%S" var))
(defun org-babel-lustre-table-or-string (results)
"If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
)
(defun org-babel-lustre-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION
then create. Return the initialized session."
(unless (string= session "none")
))
(provide 'ob-lustre)
;;; ob-lustre.el ends here
;;; ob-template.el --- org-babel functions for template evaluation
;; Copyright (C) your name here
;; Author: your name here
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; Version: 0.01
;;; License:
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This file is not intended to ever be loaded by org-babel, rather it
;; is a template for use in adding new language support to Org-babel.
;; Good first steps are to copy this file to a file named by the
;; language you are adding, and then use `query-replace' to replace
;; all strings of "template" in this file with the name of your new
;; language.
;;
;; If you have questions as to any of the portions of the file defined
;; below please look to existing language support for guidance.
;;
;; If you are planning on adding a language to org-babel we would ask
;; that if possible you fill out the FSF copyright assignment form
;; available at http://orgmode.org/request-assign-future.txt as this
;; will make it possible to include your language support in the core
;; of Org-mode, otherwise unassigned language support files can still
;; be included in the contrib/ directory of the Org-mode repository.
;;; Requirements:
;; Use this section to list the requirements of this language. Most
;; languages will require that at least the language be installed on
;; the user's system, and the Emacs major mode relevant to the
;; language be installed as well.
;;; Code:
(require 'ob)
(require 'ob-ref)
(require 'ob-comint)
(require 'ob-eval)
;; possibly require modes required for your language
;; optionally define a file extension for this language
(add-to-list 'org-babel-tangle-lang-exts '("lutin" . "lut"))
;; optionally declare default header arguments for this language
(defvar org-babel-default-header-args:lutin '())
;; This function expands the body of a source code block by doing
;; things like prepending argument definitions to the body, it should
;; be called by the `org-babel-execute:lutin' function below.
;(defun org-babel-expand-body:lutin (body params &optional processed-params)
; "Expand BODY according to PARAMS, return the expanded body."
; (require 'lutin)
; (let ((vars (nth 1 (or processed-params (org-babel-process-params params)))))
; (concat
; (mapconcat ;; define any variables
; (lambda (pair)
; (format "%s=%S"
; (car pair) (org-babel-lutin-var-to-lutin (cdr pair))))
; vars "\n") "\n" body "\n")))
;; This is the main function which is called to evaluate a code
;; block.
;;
;; This function will evaluate the body of the source code and
;; return the results as emacs-lisp depending on the value of the
;; :results header argument
;; - output means that the output to STDOUT will be captured and
;; returned
;; - value means that the value of the last statement in the
;; source code block will be returned
;;
;; The most common first step in this function is the expansion of the
;; PARAMS argument using `org-babel-process-params'.
;;
;; Please feel free to not implement options which aren't appropriate
;; for your language (e.g. not all languages support interactive
;; "session" evaluation). Also you are free to define any new header
;; arguments which you feel may be useful -- all header arguments
;; specified by the user will be available in the PARAMS variable.
(defun org-babel-execute:lutin (body params)
"Execute a block of Lutin code with org-babel. This function is
called by `org-babel-execute-src-block'"
(message "executing Lutin source code block")
(let* ((processed-params (org-babel-process-params params))
;; set the session if the session variable is non-nil
(session (org-babel-lutin-initiate-session (first processed-params)))
;; variables assigned for use in the block
(vars (second processed-params))
(result-params (third processed-params))
;; either OUTPUT or VALUE which should behave as described above
(result-type (fourth processed-params))
;; expand the body with `org-babel-expand-body:lutin'
; (full-body (org-babel-expand-body:lutin
; body params processed-params))
)
;; actually execute the source-code block either in a session or
;; possibly by dropping it to a temporary file and evaluating the
;; file.
;;
;; for session based evaluation the functions defined in
;; `org-babel-comint' will probably be helpful.
;;
;; for external evaluation the functions defined in
;; `org-babel-eval' will probably be helpful.
;;
;; when forming a shell command, or a fragment of code in some
;; other language, please preprocess any file names involved with
;; the function `org-babel-process-file-name'. (See the way that
;; function is used in the language files)
))
;; This function should be used to assign any variables in params in
;; the context of the session environment.
(defun org-babel-prep-session:lutin (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
)
(defun org-babel-lutin-var-to-lutin (var)
"Convert an elisp var into a string of lutin source code
specifying a var of the same value."
(format "%S" var))
(defun org-babel-lutin-table-or-string (results)
"If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
)
(defun org-babel-lutin-initiate-session (&optional session)
"If there is not a current inferior-process-buffer in SESSION
then create. Return the initialized session."
(unless (string= session "none")
))
(provide 'ob-lutin)
;;; ob-lutin.el ends here
;;; ob-ocaml.el --- org-babel functions for ocaml evaluation
;; Copyright (C) 2009-2012 Free Software Foundation, Inc.
;; Author: Eric Schulte
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Org-Babel support for evaluating ocaml source code. This one will
;; be sort of tricky because ocaml programs must be compiled before
;; they can be run, but ocaml code can also be run through an
;; interactive interpreter.
;;
;; For now lets only allow evaluation using the ocaml interpreter.
;;; Requirements:
;; - tuareg-mode :: http://www-rocq.inria.fr/~acohen/tuareg/
;;; Code:
(require 'ob)
(require 'ob-comint)
(require 'comint)
(eval-when-compile (require 'cl))
(declare-function tuareg-run-caml "ext:tuareg" ())
(declare-function tuareg-interactive-send-input "ext:tuareg" ())
(defvar org-babel-tangle-lang-exts)
(add-to-list 'org-babel-tangle-lang-exts '("ocaml" . "ml"))
(defvar org-babel-default-header-args:ocaml '())
(defvar org-babel-ocaml-eoe-indicator "\"org-babel-ocaml-eoe\";;")
(defvar org-babel-ocaml-eoe-output "org-babel-ocaml-eoe")
(defun org-babel-execute:ocaml (body params)
"Execute a block of Ocaml code with Babel."
(let* ((vars (mapcar #'cdr (org-babel-get-header params :var)))
(full-body (org-babel-expand-body:generic
body params
(org-babel-variable-assignments:ocaml params)))
(session (org-babel-prep-session:ocaml
(cdr (assoc :session params)) params))
(raw (org-babel-comint-with-output
(session org-babel-ocaml-eoe-output t full-body)
(insert
(concat
(org-babel-chomp full-body)"\n"org-babel-ocaml-eoe-indicator))
(tuareg-interactive-send-input)))
(clean
(car (let ((re (regexp-quote org-babel-ocaml-eoe-output)) out)
(delq nil (mapcar (lambda (line)
(if out
(progn (setq out nil) line)
(when (string-match re line)
(progn (setq out t) nil))))
(mapcar #'org-babel-trim (reverse raw))))))))
(org-babel-reassemble-table
(org-babel-ocaml-parse-output (org-babel-trim clean))
(org-babel-pick-name
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
(org-babel-pick-name
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))
(defvar tuareg-interactive-buffer-name)
(defun org-babel-prep-session:ocaml (session params)
"Prepare SESSION according to the header arguments in PARAMS."
(require 'tuareg)
(let ((tuareg-interactive-buffer-name (if (and (not (string= session "none"))
(not (string= session "default"))
(stringp session))
session
tuareg-interactive-buffer-name)))
(save-window-excursion (tuareg-run-caml)
(get-buffer tuareg-interactive-buffer-name))))
(defun org-babel-variable-assignments:ocaml (params)
"Return list of ocaml statements assigning the block's variables"
(mapcar
(lambda (pair) (format "let %s = %s;;" (car pair)
(org-babel-ocaml-elisp-to-ocaml (cdr pair))))
(mapcar #'cdr (org-babel-get-header params :var))))
(defun org-babel-ocaml-elisp-to-ocaml (val)
"Return a string of ocaml code which evaluates to VAL."
(if (listp val)
(concat "[|" (mapconcat #'org-babel-ocaml-elisp-to-ocaml val "; ") "|]")
(format "%S" val)))
(defun org-babel-ocaml-parse-output (output)
"Parse OUTPUT.
OUTPUT is string output from an ocaml process."
(let ((regexp "%s = \\(.+\\)$"))
(cond
((string-match (format regexp "string") output)
(org-babel-read (match-string 1 output)))
((or (string-match (format regexp "int") output)
(string-match (format regexp "float") output))
(string-to-number (match-string 1 output)))
((string-match (format regexp "list") output)
(org-babel-ocaml-read-list (match-string 1 output)))
((string-match (format regexp "array") output)
(org-babel-ocaml-read-array (match-string 1 output)))
(t (message "don't recognize type of %s" output) output))))
(defun org-babel-ocaml-read-list (results)
"Convert RESULTS into an eli