mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-14 21:32:49 -08:00
Change of syntax in WITH-BACKEND.
Using (WITH-BACKEND :BYTECODES form :C/C++ form ...) allows us to coalesce both possibilities without the output value of one suppressed form hiding the other one
This commit is contained in:
parent
21073fd698
commit
d400a096eb
4 changed files with 22 additions and 16 deletions
|
|
@ -25,10 +25,10 @@ ECL 10.4.2:
|
|||
on whether it is going to be processed by the interpreter or by the C
|
||||
compiler.
|
||||
(defun example ()
|
||||
(ext:with-backend (:bytecodes) (print 3))
|
||||
(ext:with-backend (:c/c++) (print 2)))
|
||||
The two currently available backends are :bytecodes and :c/c++. Note that
|
||||
when the backend does not match the value, the form is replaced with (VALUES).
|
||||
(ext:with-backend
|
||||
:bytecodes (print 3)
|
||||
:c/c++ (print 2)))
|
||||
The two currently available backends are :bytecodes and :c/c++.
|
||||
|
||||
|
||||
ECL 10.4.1:
|
||||
|
|
|
|||
|
|
@ -1198,10 +1198,14 @@ c_until(cl_env_ptr env, cl_object body, int flags) {
|
|||
static int
|
||||
c_with_backend(cl_env_ptr env, cl_object args, int flags)
|
||||
{
|
||||
cl_object backend = pop(&args);
|
||||
if (!ecl_member_eq(@':bytecodes', backend))
|
||||
args = Cnil;
|
||||
return compile_body(env, args, flags);
|
||||
cl_object forms = Cnil;
|
||||
while (!Null(args)) {
|
||||
cl_object tag = pop(&args);
|
||||
cl_object form = pop(&args);
|
||||
if (tag == @':bytecodes')
|
||||
forms = CONS(form, forms);
|
||||
}
|
||||
return compile_body(env, forms, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -137,9 +137,11 @@
|
|||
)
|
||||
|
||||
(defun c1with-backend (forms)
|
||||
(destructuring-bind ((&rest conditions) &rest body)
|
||||
forms
|
||||
(c1progn (and (member :c/c++ conditions) body))))
|
||||
(c1progn (loop for tag = (pop forms)
|
||||
for form = (pop forms)
|
||||
while tag
|
||||
when (eq tag :c/c++)
|
||||
collect form)))
|
||||
|
||||
(defun c1progn (forms)
|
||||
(cond ((endp forms) (t1/c1expr 'NIL))
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@
|
|||
(c1translate `(THE ,type ,destination) value)))
|
||||
|
||||
(defun c1with-backend (destination forms)
|
||||
(destructuring-bind ((&rest conditions) &rest body)
|
||||
forms
|
||||
(c1progn destination
|
||||
(and (member :c-backend conditions)
|
||||
body))))
|
||||
(c1progn destination (loop for tag = (pop forms)
|
||||
for form = (pop forms)
|
||||
while tag
|
||||
when (eq tag :c/c++)
|
||||
collect form)))
|
||||
|
||||
(defun c1compiler-let (destination args &aux (symbols nil) (values nil))
|
||||
(when (endp args) (too-few-args 'COMPILER-LET 1 0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue