update packages
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
;;; ob-oz.el --- Org-babel functions for Oz evaluation
|
||||
;;; ob-oz.el --- Org-babel functions for Oz evaluation -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2009-2014, 2021 Torsten Anders and Eric Schulte
|
||||
|
||||
@@ -92,6 +92,10 @@
|
||||
;;; major mode for editing Oz programs
|
||||
(require 'mozart nil t)
|
||||
|
||||
(defvar oz-compiler-buffer) ; defined in mozart.el
|
||||
(declare-function oz-send-string "ext:mozart" (string &optional system))
|
||||
(declare-function run-oz "ext:mozart" ())
|
||||
|
||||
;;
|
||||
;; Interface to communicate with Oz.
|
||||
;; (1) For statements without any results: oz-send-string
|
||||
@@ -135,9 +139,9 @@ StartOzServer.oz is located.")
|
||||
|
||||
(defvar org-babel-oz-collected-result nil
|
||||
"Aux var to hand result from org-babel-oz-filter to oz-send-string-expression.")
|
||||
(defun org-babel-oz-filter (proc string)
|
||||
(defun org-babel-oz-filter (_proc string)
|
||||
"Processes output from socket org-babel-oz-OPI-socket."
|
||||
;; (setq org-babel-oz-collected-results (cons string org-babel-oz-collected-results))
|
||||
;; (setq org-babel-oz-collected-results (cons string org-babel-oz-collected-results))
|
||||
(setq org-babel-oz-collected-result string)
|
||||
)
|
||||
|
||||
@@ -165,7 +169,12 @@ StartOzServer.oz is located.")
|
||||
;; communication with org-babel-oz-OPI-socket is asynchronous, but
|
||||
;; oz-send-string-expression turns is into synchronous...
|
||||
(defun oz-send-string-expression (string &optional wait-time)
|
||||
"Similar to oz-send-string, oz-send-string-expression sends a string to the OPI compiler. However, string must be expression and this function returns the result of the expression (as string). oz-send-string-expression is synchronous, wait-time allows to specify a maximum wait time. After wait-time is over with no result, the function returns nil."
|
||||
"Send a string to the OPI compiler.
|
||||
Similar to `oz-send-string', but string must be an expression and this
|
||||
function returns the result of the expression (as string).
|
||||
The function is synchronous, WAIT-TIME allows to specify
|
||||
a maximum wait time. After WAIT-TIME is over with no result, the
|
||||
function returns nil."
|
||||
(if (not org-babel-oz-OPI-socket)
|
||||
(org-babel-oz-create-socket))
|
||||
(let ((polling-delay 0.1)
|
||||
@@ -174,26 +183,21 @@ StartOzServer.oz is located.")
|
||||
;; wait for result
|
||||
(if wait-time
|
||||
(let ((waited 0))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(while
|
||||
;; stop loop if org-babel-oz-collected-result \= nil or waiting time is over
|
||||
(not (or (not (equal org-babel-oz-collected-result nil))
|
||||
(> waited wait-time)))
|
||||
(progn
|
||||
(sit-for polling-delay)
|
||||
;; (message "org-babel-oz: next polling iteration")
|
||||
(setq waited (+ waited polling-delay))))
|
||||
;; (message "org-babel-oz: waiting over, got result or waiting timed out")
|
||||
;; (message (format "wait-time: %s, waited: %s" wait-time waited))
|
||||
(setq result org-babel-oz-collected-result)
|
||||
(setq org-babel-oz-collected-result nil))))
|
||||
(unwind-protect
|
||||
(progn
|
||||
(while (equal org-babel-oz-collected-result nil)
|
||||
(sit-for polling-delay))
|
||||
(setq result org-babel-oz-collected-result)
|
||||
(setq org-babel-oz-collected-result nil))))
|
||||
(while
|
||||
;; stop loop if org-babel-oz-collected-result \= nil or waiting time is over
|
||||
(not (or (not (equal org-babel-oz-collected-result nil))
|
||||
(> waited wait-time)))
|
||||
(sit-for polling-delay)
|
||||
;; (message "org-babel-oz: next polling iteration")
|
||||
(setq waited (+ waited polling-delay)))
|
||||
;; (message "org-babel-oz: waiting over, got result or waiting timed out")
|
||||
;; (message (format "wait-time: %s, waited: %s" wait-time waited))
|
||||
(setq result org-babel-oz-collected-result)
|
||||
(setq org-babel-oz-collected-result nil))
|
||||
(while (equal org-babel-oz-collected-result nil)
|
||||
(sit-for polling-delay))
|
||||
(setq result org-babel-oz-collected-result)
|
||||
(setq org-babel-oz-collected-result nil))
|
||||
result))
|
||||
|
||||
(defun org-babel-expand-body:oz (body params)
|
||||
@@ -234,7 +238,7 @@ called by `org-babel-execute-src-block' via multiple-value-bind."
|
||||
|
||||
;; This function should be used to assign any variables in params in
|
||||
;; the context of the session environment.
|
||||
(defun org-babel-prep-session:oz (session params)
|
||||
(defun org-babel-prep-session:oz (_session _params)
|
||||
"Prepare SESSION according to the header arguments specified in PARAMS."
|
||||
(error "org-babel-prep-session:oz unimplemented"))
|
||||
;; TODO: testing... (copied from org-babel-haskell.el)
|
||||
@@ -264,7 +268,7 @@ called by `org-babel-execute-src-block' via multiple-value-bind."
|
||||
;;
|
||||
;; BUG: does not work yet. Error: ad-Orig-error: buffer none doesn't exist or has no process
|
||||
;; UNUSED DEF
|
||||
(defun org-babel-oz-initiate-session (&optional session params)
|
||||
(defun org-babel-oz-initiate-session (&optional session _params)
|
||||
"If there is not a current inferior-process-buffer in SESSION
|
||||
then create. Return the initialized session."
|
||||
(unless (string= session "none")
|
||||
@@ -284,7 +288,7 @@ specifying a var of the same value."
|
||||
))
|
||||
|
||||
;; TODO:
|
||||
(defun org-babel-oz-table-or-string (results)
|
||||
(defun org-babel-oz-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."
|
||||
(error "org-babel-oz-table-or-string unimplemented"))
|
||||
|
||||
Reference in New Issue
Block a user