LISPF4
LISPF4 copied to clipboard
Trying to use MAKEFILE to save own function
I am trying to save the example function MYMAX
to the mymax.lsp
file.
Here is what the UsersGuide.txt
says about the how-to:
Ex.: Define some functions and save them as your file MYFILE on the
logical unit 25.
(OPEN 'MYFILE 'O 25) (this line not needed when your system
uses symbolic file names, or if you let
MAKEFILE prompt you for logical unit
number of MYFILE)
(CURFILE MYFILE)
(DE ....]
(DE ....]
etc.
(MAKEFILE 'MYFILE "filename.l" T)
I am trying the following code:
(OPEN 'MYFILE 'O 25)
(CURFILE 'MYFILE)
(SETQ MYFILECOMS "MYFILE-PACKAGE")
(SETQ MYFILEFNS '(MYMAX MYFILEFNS))
(DE MYMAX (L)
(PROG (X)
(COND ((NULL L) (RETURN NIL)))
(SETQ X (CAR L))
LOOP (SETQ L (CDR L))
(COND ((NULL L) (RETURN X))
((LESSP X (CAR L)) (SETQ X (CAR L))))
(GO LOOP)))
(MAKEFILE 'MYFILE "mymax.lsp" t)
Here is what mymax.lsp
contains:
(FILEHEADER MYFILE)
(PRINT '"MYFILE-PACKAGE")
(PRINT '(VERSION 0))
(DEFINEQ
(*
(SUBR . TIMES))
('(MYFILEFNS MYMAX)
NIL)
)
(PRINT 'MYFILEFNS)
(RPAQQ MYFILEFNS (MYFILEFNS MYMAX))
(RPAQQ MYFILECOMS "MYFILE-PACKAGE")
(RPAQ MYFILEGENNR 0)
STOP
When I rename MYMAX to * ...
(OPEN 'MYFILE 'O 25)
(CURFILE 'MYFILE)
(SETQ MYFILECOMS "MYFILE-PACKAGE")
(SETQ MYFILEFNS '(MYMAX MYFILEFNS))
(DE * (L)
(PROG (X)
(COND ((NULL L) (RETURN NIL)))
(SETQ X (CAR L))
LOOP (SETQ L (CDR L))
(COND ((NULL L) (RETURN X))
((LESSP X (CAR L)) (SETQ X (CAR L))))
(GO LOOP)))
(MAKEFILE 'MYFILE "mymax.lsp" t)
... the result is:
(FILEHEADER MYFILE)
(PRINT '"MYFILE-PACKAGE")
(PRINT '(VERSION 0))
(DEFINEQ
(*
(LAMBDA (L)
(PROG (X)
(COND ((NULL L) (RETURN NIL)))
(SETQ X (CAR L))
LOOP (SETQ L (CDR L))
[COND ((NULL L) (RETURN X))
((LESSP X (CAR L)) (SETQ X (CAR L]
(GO LOOP))))
('(MYFILEFNS MYMAX)
NIL)
)
(PRINT 'MYFILEFNS)
(RPAQQ MYFILEFNS (MYFILEFNS MYMAX))
(RPAQQ MYFILECOMS "MYFILE-PACKAGE")
(RPAQ MYFILEGENNR 0)
STOP
Is this a bug or am I doing something wrong?
First, you don't need (OPEN 'MYFILE 'O 25) The MAKFILE function does that for you.
Second, yes, I see the problem too. I tried building the system under 32 bits, but that had the problem too. So it isn't a 64-bit issue. I used this without problems when it was built with FORTRAN. Apparently, there is a problem. Unfortunately, I do not have the time to debug this right now. If you can, I'd love to get a patch.