From bc8dedf65248efed9adced52b1741757e74b43db Mon Sep 17 00:00:00 2001 From: Bertrand BRUN Date: Fri, 5 Nov 2010 22:05:59 +0100 Subject: [PATCH] Ajout des fonctions get-defun, get-defmacro, set-defun et set-defmacro dans util.lisp + correction du readfile + ajout du corps de la fonction m-macroexpand-1 --- lisp2li.lisp | 17 ----------------- util.lisp | 32 +++++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/lisp2li.lisp b/lisp2li.lisp index 7cea678..ec2e39c 100644 --- a/lisp2li.lisp +++ b/lisp2li.lisp @@ -11,23 +11,6 @@ (defun map-lisp2li (expr env) (mapcar (lambda (x) (lisp2li x env)) expr)) -(defun m-macroexpand-1 (macro) - ()) - -(defmacro get-defun (symb) - `(get ,symb :defun)) - -(defun set-defun (li) - (setf (get-defun (cdaddr li)) - (cdddr li))) - -(defmacro get-defmacro (symb) - `(get ,symb :defmacro)) - -(defun set-defmacro (li) - (setf (get-defmacro (cdaddr li)) - (cdddr li))) - (defun make-stat-env (params &optional env) (append (loop diff --git a/util.lisp b/util.lisp index 14255c7..e1c79b9 100644 --- a/util.lisp +++ b/util.lisp @@ -59,10 +59,28 @@ (defun readfile (name) (let ((fd (open name))) - `(progn - ,(loop - for line = (read fd nil 'eof) - when (not (eq line 'eof)) - do (cons line nil) - else return (close fd) - )))) + (cons 'progn + (loop + for line = (read fd nil 'eof) + while (not (eq line 'eof)) + collect line + finally (close fd) + )))) + +(defun m-macroexpand-1 (macro) + ()) + +(defmacro get-defun (symb) + `(get ,symb :defun)) + +(defun set-defun (li) + (setf (get-defun (cdaddr li)) + (cdddr li))) + +(defmacro get-defmacro (symb) + `(get ,symb :defmacro)) + +(defun set-defmacro (li) + (setf (get-defmacro (cdaddr li)) + (cdddr li))) +