source: branches/0.15.x/abcl/src/org/armedbear/lisp/SpecialOperator.java

Last change on this file was 11488, checked in by ehuelsmann, 17 years ago

Add @Override annotations.

Patch by: Douglas Miles

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1/*
2 * SpecialOperator.java
3 *
4 * Copyright (C) 2002-2005 Peter Graves
5 * $Id: SpecialOperator.java 11488 2008-12-27 10:50:33Z ehuelsmann $
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 *
21 * As a special exception, the copyright holders of this library give you
22 * permission to link this library with independent modules to produce an
23 * executable, regardless of the license terms of these independent
24 * modules, and to copy and distribute the resulting executable under
25 * terms of your choice, provided that you also meet, for each linked
26 * independent module, the terms and conditions of the license of that
27 * module.  An independent module is a module which is not derived from
28 * or based on this library.  If you modify this library, you may extend
29 * this exception to your version of the library, but you are not
30 * obligated to do so.  If you do not wish to do so, delete this
31 * exception statement from your version.
32 */
33
34package org.armedbear.lisp;
35
36public class SpecialOperator extends Operator
37{
38    private int callCount;
39
40    public SpecialOperator(Symbol symbol)
41    {
42        symbol.setSymbolFunction(this);
43        setLambdaName(symbol);
44    }
45
46    public SpecialOperator(Symbol symbol, String arglist)
47    {
48        symbol.setSymbolFunction(this);
49        setLambdaName(symbol);
50        setLambdaList(new SimpleString(arglist));
51    }
52
53    public SpecialOperator(String name, Package pkg, boolean exported,
54                           String arglist)
55    {
56        try {
57            Symbol symbol;
58            if (exported)
59                symbol = pkg.internAndExport(name.toUpperCase());
60            else
61                symbol = pkg.intern(name.toUpperCase());
62            symbol.setSymbolFunction(this);
63            setLambdaName(symbol);
64            setLambdaList(new SimpleString(arglist));
65        }
66        catch (ConditionThrowable t) {
67            Debug.assertTrue(false);
68        }
69    }
70
71    @Override
72    public LispObject execute() throws ConditionThrowable
73    {
74        return error(new UndefinedFunction(getLambdaName()));
75    }
76
77    @Override
78    public LispObject execute(LispObject arg) throws ConditionThrowable
79    {
80        return error(new UndefinedFunction(getLambdaName()));
81    }
82
83    @Override
84    public LispObject execute(LispObject first, LispObject second)
85        throws ConditionThrowable
86    {
87        return error(new UndefinedFunction(getLambdaName()));
88    }
89
90    @Override
91    public LispObject execute(LispObject first, LispObject second,
92                              LispObject third)
93        throws ConditionThrowable
94    {
95        return error(new UndefinedFunction(getLambdaName()));
96    }
97
98    @Override
99    public LispObject execute(LispObject first, LispObject second,
100                              LispObject third, LispObject fourth)
101        throws ConditionThrowable
102    {
103        return error(new UndefinedFunction(getLambdaName()));
104    }
105
106    @Override
107    public LispObject execute(LispObject first, LispObject second,
108                              LispObject third, LispObject fourth,
109                              LispObject fifth)
110        throws ConditionThrowable
111    {
112        return error(new UndefinedFunction(getLambdaName()));
113    }
114
115    @Override
116    public LispObject execute(LispObject first, LispObject second,
117                              LispObject third, LispObject fourth,
118                              LispObject fifth, LispObject sixth)
119        throws ConditionThrowable
120    {
121        return error(new UndefinedFunction(getLambdaName()));
122    }
123
124    @Override
125    public LispObject execute(LispObject first, LispObject second,
126                              LispObject third, LispObject fourth,
127                              LispObject fifth, LispObject sixth,
128                              LispObject seventh)
129        throws ConditionThrowable
130    {
131        return error(new UndefinedFunction(getLambdaName()));
132    }
133
134    @Override
135    public LispObject execute(LispObject first, LispObject second,
136                              LispObject third, LispObject fourth,
137                              LispObject fifth, LispObject sixth,
138                              LispObject seventh, LispObject eighth)
139        throws ConditionThrowable
140    {
141        return error(new UndefinedFunction(getLambdaName()));
142    }
143
144    @Override
145    public LispObject execute(LispObject[] args) throws ConditionThrowable
146    {
147        return error(new UndefinedFunction(getLambdaName()));
148    }
149
150    @Override
151    public String writeToString() throws ConditionThrowable
152    {
153        StringBuffer sb = new StringBuffer("#<SPECIAL-OPERATOR ");
154        sb.append(lambdaName.writeToString());
155        sb.append(">");
156        return sb.toString();
157    }
158
159    // Profiling.
160    @Override
161    public final int getCallCount()
162    {
163        return callCount;
164    }
165
166    @Override
167    public final void setCallCount(int n)
168    {
169        callCount = n;
170    }
171
172    @Override
173    public final void incrementCallCount()
174    {
175        ++callCount;
176    }
177}
Note: See TracBrowser for help on using the repository browser.