2016-10-22 17:36:54 +00:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* Mes --- Maxwell Equations of Software
|
|
|
|
* Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
|
|
|
*
|
|
|
|
* This file is part of Mes.
|
|
|
|
*
|
|
|
|
* Mes 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.
|
|
|
|
*
|
|
|
|
* Mes 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 Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !BOOT
|
|
|
|
scm *
|
2016-11-02 09:26:04 +00:00
|
|
|
define_env (scm *x, scm *a)
|
2016-10-22 17:36:54 +00:00
|
|
|
{
|
|
|
|
scm *e;
|
|
|
|
scm *name = cadr (x);
|
|
|
|
if (name->type != PAIR)
|
2016-11-03 20:43:01 +00:00
|
|
|
e = eval_env (caddr (x), cons (cons (cadr (x), cadr (x)), a));
|
2016-10-22 17:36:54 +00:00
|
|
|
else {
|
|
|
|
name = car (name);
|
|
|
|
scm *p = pairlis (cadr (x), cadr (x), a);
|
2016-10-25 06:59:20 +00:00
|
|
|
cache_invalidate_range (p, a);
|
2016-11-03 20:43:01 +00:00
|
|
|
e = eval_env (make_lambda (cdadr (x), cddr (x)), p);
|
2016-10-22 17:36:54 +00:00
|
|
|
}
|
|
|
|
if (eq_p (car (x), &symbol_define_macro) == &scm_t)
|
|
|
|
e = make_macro (name, e);
|
|
|
|
scm *entry = cons (name, e);
|
|
|
|
scm *aa = cons (entry, &scm_nil);
|
|
|
|
set_cdr_x (aa, cdr (a));
|
|
|
|
set_cdr_x (a, aa);
|
|
|
|
scm *cl = assq (&scm_closure, a);
|
|
|
|
set_cdr_x (cl, aa);
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
#else // BOOT
|
2016-11-02 09:26:04 +00:00
|
|
|
scm*define_env (scm *x, scm *a){}
|
2016-10-22 17:36:54 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
scm *
|
|
|
|
define_macro (scm *x, scm *a)
|
|
|
|
{
|
|
|
|
}
|