mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-26 07:10:09 +01:00
Nyquist Effects now treat Nyquist code and output as UTF-8. Nyquist Prompt effect accepts both LISP and SAL (in SAL, either define function main or write return <expression> at the top level).
This commit is contained in:
@@ -1026,7 +1026,9 @@
|
||||
(if (token-is '(:define :load :chdir :variable :function
|
||||
; :system
|
||||
:play :print :display))
|
||||
(parse-command)))
|
||||
(parse-command)
|
||||
(if (and (token-is '(:return)) *audacity-top-level-return-flag*)
|
||||
(parse-command))))
|
||||
|
||||
|
||||
(defun parse-command ()
|
||||
@@ -1044,6 +1046,8 @@
|
||||
(parse-print-display :print 'sal-print))
|
||||
((token-is :display)
|
||||
(parse-print-display :display 'display))
|
||||
((and *audacity-top-level-return-flag* (token-is :return))
|
||||
(parse-return))
|
||||
; ((token-is :output)
|
||||
; (parse-output))
|
||||
(t
|
||||
@@ -1251,12 +1255,16 @@
|
||||
|
||||
(defun parse-return ()
|
||||
(or (token-is :return) (error "parse-return internal error"))
|
||||
(let (loc)
|
||||
(if (null *sal-fn-name*)
|
||||
(let (loc expr)
|
||||
;; this seems to be a redundant test
|
||||
(if (and (null *sal-fn-name*)
|
||||
(not *audacity-top-level-return-flag*))
|
||||
(errexit "Return must be inside a function body"))
|
||||
(setf loc (parse-token))
|
||||
(add-line-info-to-stmt (list 'sal-return-from *sal-fn-name*
|
||||
(parse-sexpr)) loc)))
|
||||
(setf expr (parse-sexpr))
|
||||
(if *sal-fn-name*
|
||||
(add-line-info-to-stmt (list 'sal-return-from *sal-fn-name* expr) loc)
|
||||
(list 'defun 'main '() (add-line-info-to-stmt expr loc)))))
|
||||
|
||||
|
||||
(defun parse-load ()
|
||||
|
||||
@@ -487,6 +487,21 @@
|
||||
(if *sal-traceback* (sal-traceback))
|
||||
(setf *sal-call-stack* stack)) ;; clear the stack
|
||||
|
||||
|
||||
;; when true, top-level return statement is legal and compiled into MAIN
|
||||
(setf *audacity-top-level-return-flag* nil)
|
||||
|
||||
;; SAL-COMPILE-AUDACITY -- special treatment of RETURN
|
||||
;;
|
||||
;; This works like SAL-COMPILE, but if there is a top-level
|
||||
;; return statement (not normally legal), it is compiled into
|
||||
;; a function named MAIN. This is a shorthand for Audacity plug-ins
|
||||
;;
|
||||
(defun sal-compile-audacity (input eval-flag multiple-statements filename)
|
||||
(progv '(*audacity-top-level-return-flag*) '(t)
|
||||
(sal-compile input eval-flag multiple-statements filename)))
|
||||
|
||||
|
||||
;; SAL-COMPILE -- translate string or token list to lisp and eval
|
||||
;;
|
||||
;; input is either a string or a token list
|
||||
|
||||
Reference in New Issue
Block a user