-
Notifications
You must be signed in to change notification settings - Fork 1
/
lsptype.pas
50 lines (38 loc) · 1.42 KB
/
lsptype.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(*----------------------------------------------------------------------------*)
(* Author: Joachim Pimiskern, 1994-2004 *)
(*----------------------------------------------------------------------------*)
unit lsptype;
{$O+,F+}
interface
uses
lspglobl;
function LspTypeOf(Args,Umgebung: pNode): pNode;
implementation
uses
lspmain, lsperr, lspinit, lspbasic;
(*----------------------------------------------------------------------------*)
(* Den Typ eines Lisp-Knotens als Symbol zurueckliefern *)
(*----------------------------------------------------------------------------*)
function LspTypeOf(Args,Umgebung: pNode): pNode;
var e : pNode;
i : pNode;
begin
e := evaluated(Args,Umgebung);
if (e = nil) then
raise ELispException.Create('ErrTooFewArguments','TYPE-OF');
if (LspCdr(e) <> nil) then
raise ELispException.Create('ErrTooManyArguments','TYPE-OF');
i := LspCar(e);
case i^.Typ of
cLspSymbol : result := cLspDPSymbol ;
cLspList : result := cLspDPCons ;
cLspFloat : result := cLspDPFloat ;
cLspInteger : result := cLspDPInteger;
cLspString : result := cLspDPString ;
cLspArray : result := cLspDPArray ;
cLspFile : result := cLspDPFile ;
else raise ELispException.Create('ErrUnknownType','TYPE-OF');
end;
end;
end.