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

Last change on this file was 12255, checked in by ehuelsmann, 16 years ago

Rename ConditionThrowable? to ControlTransfer? and remove

try/catch blocks which don't have anything to do with
non-local transfer of control.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.3 KB
Line 
1/*
2 * SpecialOperator.java
3 *
4 * Copyright (C) 2002-2005 Peter Graves
5 * $Id: SpecialOperator.java 12255 2009-11-06 22:36:32Z 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    private int hotCount;
40
41    public SpecialOperator(Symbol symbol)
42    {
43        symbol.setSymbolFunction(this);
44        setLambdaName(symbol);
45    }
46
47    public SpecialOperator(Symbol symbol, String arglist)
48    {
49        symbol.setSymbolFunction(this);
50        setLambdaName(symbol);
51        setLambdaList(new SimpleString(arglist));
52    }
53
54    public SpecialOperator(String name, Package pkg, boolean exported,
55                           String arglist)
56    {
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
67    @Override
68    public LispObject execute()
69    {
70        return error(new UndefinedFunction(getLambdaName()));
71    }
72
73    @Override
74    public LispObject execute(LispObject arg)
75    {
76        return error(new UndefinedFunction(getLambdaName()));
77    }
78
79    @Override
80    public LispObject execute(LispObject first, LispObject second)
81
82    {
83        return error(new UndefinedFunction(getLambdaName()));
84    }
85
86    @Override
87    public LispObject execute(LispObject first, LispObject second,
88                              LispObject third)
89
90    {
91        return error(new UndefinedFunction(getLambdaName()));
92    }
93
94    @Override
95    public LispObject execute(LispObject first, LispObject second,
96                              LispObject third, LispObject fourth)
97
98    {
99        return error(new UndefinedFunction(getLambdaName()));
100    }
101
102    @Override
103    public LispObject execute(LispObject first, LispObject second,
104                              LispObject third, LispObject fourth,
105                              LispObject fifth)
106
107    {
108        return error(new UndefinedFunction(getLambdaName()));
109    }
110
111    @Override
112    public LispObject execute(LispObject first, LispObject second,
113                              LispObject third, LispObject fourth,
114                              LispObject fifth, LispObject sixth)
115
116    {
117        return error(new UndefinedFunction(getLambdaName()));
118    }
119
120    @Override
121    public LispObject execute(LispObject first, LispObject second,
122                              LispObject third, LispObject fourth,
123                              LispObject fifth, LispObject sixth,
124                              LispObject seventh)
125
126    {
127        return error(new UndefinedFunction(getLambdaName()));
128    }
129
130    @Override
131    public LispObject execute(LispObject first, LispObject second,
132                              LispObject third, LispObject fourth,
133                              LispObject fifth, LispObject sixth,
134                              LispObject seventh, LispObject eighth)
135
136    {
137        return error(new UndefinedFunction(getLambdaName()));
138    }
139
140    @Override
141    public LispObject execute(LispObject[] args)
142    {
143        return error(new UndefinedFunction(getLambdaName()));
144    }
145
146    @Override
147    public String writeToString()
148    {
149        StringBuffer sb = new StringBuffer("#<SPECIAL-OPERATOR ");
150        sb.append(lambdaName.writeToString());
151        sb.append(">");
152        return sb.toString();
153    }
154
155    // Profiling.
156    @Override
157    public final int getCallCount()
158    {
159        return callCount;
160    }
161
162    @Override
163    public final void setCallCount(int n)
164    {
165        callCount = n;
166    }
167
168    @Override
169    public final void incrementCallCount()
170    {
171        ++callCount;
172    }
173
174    @Override
175    public final int getHotCount()
176    {
177        return hotCount;
178    }
179
180    @Override
181    public final void setHotCount(int n)
182    {
183        callCount = n;
184    }
185
186    @Override
187    public final void incrementHotCount()
188    {
189        ++hotCount;
190    }
191}
Note: See TracBrowser for help on using the repository browser.