Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (55 sloc) 2.188 kb
24ed958 initial git checkin
Peter Graves authored
1 // StandardGenericFunction.cpp
2 //
3 // Copyright (C) 2006-2009 Peter Graves <peter@armedbear.org>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
19 #include "lisp.hpp"
20
21 Value StandardGenericFunction::type_of() const
22 {
23 return S_standard_generic_function;
24 }
25
26 Value StandardGenericFunction::class_of() const
27 {
28 return C_standard_generic_function;
29 }
30
31 bool StandardGenericFunction::typep(Value type) const
32 {
33 return (type == S_standard_generic_function || type == S_generic_function
34 || type == S_metaobject
35 || type == S_funcallable_standard_object || type == S_function
36 || type == S_standard_object || type == S_atom || type == T
37 || type == C_standard_generic_function || type == C_generic_function
38 || type == C_metaobject || type == C_funcallable_standard_object
39 || type == C_standard_object || type == C_function || type == C_t);
40 }
41
42 AbstractString * StandardGenericFunction::write_to_string()
43 {
44 String * string = new String("#<");
45 string->append(the_symbol(S_standard_generic_function)->write_to_string());
46 if (name() != NIL)
47 {
48 string->append_char(' ');
49 string->append(::write_to_string(name()));
50 }
51 char buf[256];
52 SNPRINTF(buf, sizeof(buf), " {%lX}>", (unsigned long) this);
53 string->append(buf);
54 return string;
55 }
56
57 // ### allocate-instance-standard-generic-function layout => instance
58 Value SYS_allocate_instance_standard_generic_function(Value arg)
59 {
60 return make_value(new StandardGenericFunction(check_layout(arg)));
61 }
Something went wrong with that request. Please try again.