2
Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
4
This file is part of GNU Common Lisp, herein referred to as GCL
6
GCL is free software; you can redistribute it and/or modify it under
7
the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
GCL is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14
License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with GCL; see the file COPYING. If not, write to the Free Software
18
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26
Top-Level Forms and Declarations
31
object sLcompile, sLload, sLeval;
37
object sSAinhibit_macro_specialA;
49
if (endp(args) || endp(MMcdr(args)))
50
FEtoo_few_argumentsF(args);
51
if (MMcadr(args) != Cnil && type_of(MMcadr(args)) != t_cons)
52
FEerror("~S is an illegal lambda-list.", 1, MMcadr(args));
54
if (type_of(name) != t_symbol)
56
if (name->s.s_sfdef != NOT_SPECIAL) {
57
if (name->s.s_mflag) {
58
if (symbol_value(sSAinhibit_macro_specialA) != Cnil)
59
name->s.s_sfdef = NOT_SPECIAL;
60
} else if (symbol_value(sSAinhibit_macro_specialA) != Cnil)
61
FEerror("~S, a special form, cannot be redefined.", 1, name);
63
if (name->s.s_hpack == lisp_package &&
64
name->s.s_gfdef != OBJNULL && initflag) {
65
vs_push(make_simple_string(
66
"~S is being redefined."));
67
ifuncall2(sLwarn, vs_head, name);
71
if (lex_env[0] == Cnil && lex_env[1] == Cnil && lex_env[2] == Cnil) {
72
vs_push(MMcons(sLlambda_block, args));
74
vs_push(MMcons(lex_env[2], args));
75
vs_base[0] = MMcons(lex_env[1], vs_base[0]);
76
vs_base[0] = MMcons(lex_env[0], vs_base[0]);
77
vs_base[0] = MMcons(sLlambda_block_closure, vs_base[0]);
79
{object fname = clear_compiler_properties(name,vs_base[0]);
80
fname->s.s_gfdef = vs_base[0];
81
fname->s.s_mflag = FALSE;}
83
for (body = MMcddr(args); !endp(body); body = body->c.c_cdr) {
84
form = macro_expand(body->c.c_car);
85
if (type_of(form) == t_string) {
86
if (endp(body->c.c_cdr))
92
sSfunction_documentation);
96
if (type_of(form) != t_cons || form->c.c_car != sLdeclare)
104
check_type_symbol(&vs_base[0]);
105
if ((enum stype)vs_base[0]->s.s_stype == stp_constant)
106
FEerror("~S is a constant.", 1, vs_base[0]);
107
vs_base[0]->s.s_stype = (short)stp_special;
113
check_type_symbol(&vs_base[0]);
114
if ((enum stype)vs_base[0]->s.s_stype == stp_special)
116
"The argument ~S to DEFCONSTANT is a special variable.",
118
vs_base[0]->s.s_stype = (short)stp_constant;
119
vs_base[0]->s.s_dbind = vs_base[1];
128
object *base = vs_base;
133
FEtoo_few_argumentsF(arg);
134
for (ss = MMcar(arg); !endp(ss); ss = MMcdr(ss))
135
if(MMcar(ss) == sLeval)
137
else if(MMcar(ss) != sLload && MMcar(ss) != sLcompile)
138
FEinvalid_form("~S is an undefined situation for EVAL-WHEN.",
141
vs_push(make_cons(sLprogn, MMcdr(arg)));
153
FEerror("DECLARE appeared in an invalid position.", 0);
159
object *oldlex = lex_env;
163
body = find_special(body, NULL, NULL);
176
if(endp(args) || endp(MMcdr(args)))
177
FEtoo_few_argumentsF(args);
178
if(!endp(MMcddr(args)))
179
FEtoo_many_argumentsF(args);
182
if (type_of(args) == t_cons && MMcar(args) == sLvalues) {
184
for (args=MMcdr(args); !endp(args); args=MMcdr(args), vs++){
186
FEerror("Too many return values.", 0);
187
if (ifuncall2(sLtypep, *vs, MMcar(args)) == Cnil)
188
FEwrong_type_argument(MMcar(args), *vs);
191
FEerror("Too few return values.", 0);
193
if (ifuncall2(sLtypep, vs_base[0], args) == Cnil)
194
FEwrong_type_argument(args, vs_base[0]);
198
DEF_ORDINARY("COMPILE",sLcompile,LISP,"");
199
DEF_ORDINARY("DECLARE",sLdeclare,LISP,"");
200
DEF_ORDINARY("EVAL",sLeval,LISP,"");
201
DEF_ORDINARY("EVAL",sLeval,LISP,"");
202
DEF_ORDINARY("FUNCTION-DOCUMENTATION",sSfunction_documentation,SI,"");
203
DEF_ORDINARY("LOAD",sLload,LISP,"");
204
DEF_ORDINARY("PROGN",sLprogn,LISP,"");
205
DEF_ORDINARY("TYPEP",sLtypep,LISP,"");
206
DEF_ORDINARY("VALUES",sLvalues,LISP,"");
207
DEF_ORDINARY("VARIABLE-DOCUMENTATION",sSvariable_documentation,SI,"");
208
DEF_ORDINARY("WARN",sLwarn,LISP,"");
212
make_special_form("DEFUN",Fdefun);
213
make_si_function("*MAKE-SPECIAL", siLAmake_special);
214
make_si_function("*MAKE-CONSTANT", siLAmake_constant);
215
make_special_form("EVAL-WHEN", Feval_when);
216
make_special_form("THE", Fthe);
217
make_special_form("DECLARE",Fdeclare);
218
make_special_form("LOCALLY",Flocally);