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

Last change on this file was 11951, checked in by astalla, 16 years ago

Fixed javaInstance() from r11834: the arguments for isAssignableFrom were in
the wrong order. (obj.javaInstance(class) is used by abcl to check whether
"obj" is an instance of "class").

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 25.0 KB
Line 
1/*
2 * LispObject.java
3 *
4 * Copyright (C) 2002-2007 Peter Graves
5 * $Id: LispObject.java 11951 2009-05-25 20:53:53Z astalla $
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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 LispObject extends Lisp
37{
38  public LispObject typeOf()
39  {
40    return T;
41  }
42
43  static public LispObject getInstance(boolean b) {
44      return b ? T : NIL;
45  }
46
47  public LispObject classOf()
48  {
49    return BuiltInClass.CLASS_T;
50  }
51
52  public LispObject getDescription() throws ConditionThrowable
53  {
54    FastStringBuffer sb = new FastStringBuffer("An object of type ");
55    sb.append(typeOf().writeToString());
56    sb.append(" at #x");
57    sb.append(Integer.toHexString(System.identityHashCode(this)).toUpperCase());
58    return new SimpleString(sb);
59  }
60
61  public LispObject getParts() throws ConditionThrowable
62  {
63    return NIL;
64  }
65
66  public boolean getBooleanValue()
67  {
68    return true;
69  }
70
71  public LispObject typep(LispObject typeSpecifier) throws ConditionThrowable
72  {
73    if (typeSpecifier == T)
74      return T;
75    if (typeSpecifier == BuiltInClass.CLASS_T)
76      return T;
77    if (typeSpecifier == Symbol.ATOM)
78      return T;
79    return NIL;
80  }
81
82  public boolean constantp()
83  {
84    return true;
85  }
86
87  public LispObject CONSTANTP()
88  {
89    return constantp() ? T : NIL;
90  }
91
92  public LispObject ATOM()
93  {
94    return T;
95  }
96
97  public boolean atom()
98  {
99    return true;
100  }
101
102  public Object javaInstance() throws ConditionThrowable
103  {
104        return this;
105  }
106
107  public Object javaInstance(Class c) throws ConditionThrowable
108  {
109      if (c.isAssignableFrom(getClass()))
110    return this;
111      return error(new LispError("The value " + writeToString() +
112         " is not of class " + c.getName()));
113  }
114
115  public LispObject car() throws ConditionThrowable
116  {
117    return type_error(this, Symbol.LIST);
118  }
119
120  public void setCar(LispObject obj) throws ConditionThrowable
121  {
122    type_error(this, Symbol.CONS);
123  }
124
125  public LispObject RPLACA(LispObject obj) throws ConditionThrowable
126  {
127    return type_error(this, Symbol.CONS);
128  }
129
130  public LispObject cdr() throws ConditionThrowable
131  {
132    return type_error(this, Symbol.LIST);
133  }
134
135  public void setCdr(LispObject obj) throws ConditionThrowable
136  {
137    type_error(this, Symbol.CONS);
138  }
139
140  public LispObject RPLACD(LispObject obj) throws ConditionThrowable
141  {
142    return type_error(this, Symbol.CONS);
143  }
144
145  public LispObject cadr() throws ConditionThrowable
146  {
147    return type_error(this, Symbol.LIST);
148  }
149
150  public LispObject cddr() throws ConditionThrowable
151  {
152    return type_error(this, Symbol.LIST);
153  }
154
155  public LispObject caddr() throws ConditionThrowable
156  {
157    return type_error(this, Symbol.LIST);
158  }
159
160  public LispObject nthcdr(int n) throws ConditionThrowable
161  {
162    if (n < 0)
163      return type_error(Fixnum.getInstance(n),
164                             list(Symbol.INTEGER, Fixnum.ZERO));
165    return type_error(this, Symbol.LIST);
166  }
167
168  public LispObject push(LispObject obj) throws ConditionThrowable
169  {
170    return type_error(this, Symbol.LIST);
171  }
172
173  public LispObject EQ(LispObject obj)
174  {
175    return this == obj ? T : NIL;
176  }
177
178  public boolean eql(char c)
179  {
180    return false;
181  }
182
183  public boolean eql(int n)
184  {
185    return false;
186  }
187
188  public boolean eql(LispObject obj)
189  {
190    return this == obj;
191  }
192
193  public final LispObject EQL(LispObject obj)
194  {
195    return eql(obj) ? T : NIL;
196  }
197
198  public final LispObject EQUAL(LispObject obj) throws ConditionThrowable
199  {
200    return equal(obj) ? T : NIL;
201  }
202
203  public boolean equal(int n)
204  {
205    return false;
206  }
207
208  public boolean equal(LispObject obj) throws ConditionThrowable
209  {
210    return this == obj;
211  }
212
213  public boolean equalp(int n)
214  {
215    return false;
216  }
217
218  public boolean equalp(LispObject obj) throws ConditionThrowable
219  {
220    return this == obj;
221  }
222
223  public LispObject ABS() throws ConditionThrowable
224  {
225    return type_error(this, Symbol.NUMBER);
226  }
227
228  public LispObject NUMERATOR() throws ConditionThrowable
229  {
230    return type_error(this, Symbol.RATIONAL);
231  }
232
233  public LispObject DENOMINATOR() throws ConditionThrowable
234  {
235    return type_error(this, Symbol.RATIONAL);
236  }
237
238  public LispObject EVENP() throws ConditionThrowable
239  {
240    return evenp() ? T : NIL;
241  }
242
243  public boolean evenp() throws ConditionThrowable
244  {
245    type_error(this, Symbol.INTEGER);
246    // Not reached.
247    return false;
248  }
249
250  public LispObject ODDP() throws ConditionThrowable
251  {
252    return oddp() ? T : NIL;
253  }
254
255  public boolean oddp() throws ConditionThrowable
256  {
257    type_error(this, Symbol.INTEGER);
258    // Not reached.
259    return false;
260  }
261
262  public LispObject PLUSP() throws ConditionThrowable
263  {
264    return plusp() ? T : NIL;
265  }
266
267  public boolean plusp() throws ConditionThrowable
268  {
269    type_error(this, Symbol.REAL);
270    // Not reached.
271    return false;
272  }
273
274  public LispObject MINUSP() throws ConditionThrowable
275  {
276    return minusp() ? T : NIL;
277  }
278
279  public boolean minusp() throws ConditionThrowable
280  {
281    type_error(this, Symbol.REAL);
282    // Not reached.
283    return false;
284  }
285
286  public LispObject NUMBERP()
287  {
288    return NIL;
289  }
290
291  public boolean numberp()
292  {
293    return false;
294  }
295
296  public LispObject ZEROP() throws ConditionThrowable
297  {
298    return zerop() ? T : NIL;
299  }
300
301  public boolean zerop() throws ConditionThrowable
302  {
303    type_error(this, Symbol.NUMBER);
304    // Not reached.
305    return false;
306  }
307
308  public LispObject COMPLEXP()
309  {
310    return NIL;
311  }
312
313  public LispObject FLOATP()
314  {
315    return NIL;
316  }
317
318  public boolean floatp()
319  {
320    return false;
321  }
322
323  public LispObject INTEGERP()
324  {
325    return NIL;
326  }
327
328  public boolean integerp()
329  {
330    return false;
331  }
332
333  public LispObject RATIONALP()
334  {
335    return rationalp() ? T : NIL;
336  }
337
338  public boolean rationalp()
339  {
340    return false;
341  }
342
343  public LispObject REALP()
344  {
345    return realp() ? T : NIL;
346  }
347
348  public boolean realp()
349  {
350    return false;
351  }
352
353  public LispObject STRINGP()
354  {
355    return NIL;
356  }
357
358  public boolean stringp()
359  {
360    return false;
361  }
362
363  public LispObject SIMPLE_STRING_P()
364  {
365    return NIL;
366  }
367
368  public LispObject VECTORP()
369  {
370    return NIL;
371  }
372
373  public boolean vectorp()
374  {
375    return false;
376  }
377
378  public LispObject CHARACTERP()
379  {
380    return NIL;
381  }
382
383  public boolean characterp()
384  {
385    return false;
386  }
387
388  public int length() throws ConditionThrowable
389  {
390    type_error(this, Symbol.SEQUENCE);
391    // Not reached.
392    return 0;
393  }
394
395  public final LispObject LENGTH() throws ConditionThrowable
396  {
397    return Fixnum.getInstance(length());
398  }
399
400  public LispObject CHAR(int index) throws ConditionThrowable
401  {
402    return type_error(this, Symbol.STRING);
403  }
404
405  public LispObject SCHAR(int index) throws ConditionThrowable
406  {
407    return type_error(this, Symbol.SIMPLE_STRING);
408  }
409
410  public LispObject NTH(int index) throws ConditionThrowable
411  {
412    return type_error(this, Symbol.LIST);
413  }
414
415  public LispObject NTH(LispObject arg) throws ConditionThrowable
416  {
417    return type_error(this, Symbol.LIST);
418  }
419
420  public LispObject elt(int index) throws ConditionThrowable
421  {
422    return type_error(this, Symbol.SEQUENCE);
423  }
424
425  public LispObject reverse() throws ConditionThrowable
426  {
427    return type_error(this, Symbol.SEQUENCE);
428  }
429
430  public LispObject nreverse() throws ConditionThrowable
431  {
432    return type_error(this, Symbol.SEQUENCE);
433  }
434
435  public long aref_long(int index) throws ConditionThrowable
436  {
437    return AREF(index).longValue();
438  }
439
440  public int aref(int index) throws ConditionThrowable
441  {
442    return AREF(index).intValue();
443  }
444
445  public LispObject AREF(int index) throws ConditionThrowable
446  {
447    return type_error(this, Symbol.ARRAY);
448  }
449
450  public LispObject AREF(LispObject index) throws ConditionThrowable
451  {
452      return AREF(Fixnum.getValue(index));
453  }
454
455  public void aset(int index, int n)
456    throws ConditionThrowable
457  {   
458          aset(index, Fixnum.getInstance(n));
459  }
460
461  public void aset(int index, LispObject newValue)
462    throws ConditionThrowable
463  {
464    type_error(this, Symbol.ARRAY);
465  }
466
467  public void aset(LispObject index, LispObject newValue)
468    throws ConditionThrowable
469  {
470      aset(Fixnum.getValue(index), newValue);
471  }
472
473  public LispObject SVREF(int index) throws ConditionThrowable
474  {
475    return type_error(this, Symbol.SIMPLE_VECTOR);
476  }
477
478  public void svset(int index, LispObject newValue) throws ConditionThrowable
479  {
480    type_error(this, Symbol.SIMPLE_VECTOR);
481  }
482
483  public void vectorPushExtend(LispObject element)
484    throws ConditionThrowable
485  {
486    noFillPointer();
487  }
488
489  public LispObject VECTOR_PUSH_EXTEND(LispObject element)
490    throws ConditionThrowable
491  {
492    return noFillPointer();
493  }
494
495  public LispObject VECTOR_PUSH_EXTEND(LispObject element, LispObject extension)
496    throws ConditionThrowable
497  {
498    return noFillPointer();
499  }
500
501  public final LispObject noFillPointer() throws ConditionThrowable
502  {
503    return type_error(this, list(Symbol.AND, Symbol.VECTOR,
504                                       list(Symbol.SATISFIES,
505                                             Symbol.ARRAY_HAS_FILL_POINTER_P)));
506  }
507
508  public LispObject[] copyToArray() throws ConditionThrowable
509  {
510    type_error(this, Symbol.LIST);
511    // Not reached.
512    return null;
513  }
514
515  public LispObject SYMBOLP()
516  {
517    return NIL;
518  }
519
520  public boolean listp()
521  {
522    return false;
523  }
524
525  public LispObject LISTP()
526  {
527    return NIL;
528  }
529
530  public boolean endp() throws ConditionThrowable
531  {
532    type_error(this, Symbol.LIST);
533    // Not reached.
534    return false;
535  }
536
537  public LispObject ENDP() throws ConditionThrowable
538  {
539    return type_error(this, Symbol.LIST);
540  }
541
542  public LispObject NOT()
543  {
544    return NIL;
545  }
546
547  public boolean isSpecialOperator() throws ConditionThrowable
548  {
549    type_error(this, Symbol.SYMBOL);
550    // Not reached.
551    return false;
552  }
553
554  public boolean isSpecialVariable()
555  {
556    return false;
557  }
558
559  private static final EqHashTable documentationHashTable =
560    new EqHashTable(11, NIL, NIL);
561
562  public LispObject getDocumentation(LispObject docType)
563    throws ConditionThrowable
564  {
565    LispObject alist = documentationHashTable.get(this);
566    if (alist != null)
567      {
568        LispObject entry = assq(docType, alist);
569        if (entry instanceof Cons)
570          return ((Cons)entry).cdr;
571      }
572    return NIL;
573  }
574
575  public void setDocumentation(LispObject docType, LispObject documentation)
576    throws ConditionThrowable
577  {
578    LispObject alist = documentationHashTable.get(this);
579    if (alist == null)
580      alist = NIL;
581    LispObject entry = assq(docType, alist);
582    if (entry instanceof Cons)
583      {
584        ((Cons)entry).cdr = documentation;
585      }
586    else
587      {
588        alist = alist.push(new Cons(docType, documentation));
589        documentationHashTable.put(this, alist);
590      }
591  }
592
593  public LispObject getPropertyList()
594  {
595    return null;
596  }
597
598  public void setPropertyList(LispObject obj)
599  {
600  }
601
602  public LispObject getSymbolValue() throws ConditionThrowable
603  {
604    return type_error(this, Symbol.SYMBOL);
605  }
606
607  public LispObject getSymbolFunction() throws ConditionThrowable
608  {
609    return type_error(this, Symbol.SYMBOL);
610  }
611
612  public LispObject getSymbolFunctionOrDie() throws ConditionThrowable
613  {
614    return type_error(this, Symbol.SYMBOL);
615  }
616
617  public String writeToString() throws ConditionThrowable
618  {
619    return toString();
620  }
621
622  public String unreadableString(String s)
623  {
624    FastStringBuffer sb = new FastStringBuffer("#<");
625    sb.append(s);
626    sb.append(" {");
627    sb.append(Integer.toHexString(System.identityHashCode(this)).toUpperCase());
628    sb.append("}>");
629    return sb.toString();
630  }
631
632  public String unreadableString(Symbol symbol) throws ConditionThrowable
633  {
634    FastStringBuffer sb = new FastStringBuffer("#<");
635    sb.append(symbol.writeToString());
636    sb.append(" {");
637    sb.append(Integer.toHexString(System.identityHashCode(this)).toUpperCase());
638    sb.append("}>");
639    return sb.toString();
640  }
641
642  // Special operator
643  public LispObject execute(LispObject args, Environment env)
644    throws ConditionThrowable
645  {
646    return error(new LispError());
647  }
648
649  public LispObject execute() throws ConditionThrowable
650  {
651    return type_error(this, Symbol.FUNCTION);
652  }
653
654  public LispObject execute(LispObject arg) throws ConditionThrowable
655  {
656    return type_error(this, Symbol.FUNCTION);
657  }
658
659  public LispObject execute(LispObject first, LispObject second)
660    throws ConditionThrowable
661  {
662    return type_error(this, Symbol.FUNCTION);
663  }
664
665  public LispObject execute(LispObject first, LispObject second,
666                            LispObject third)
667    throws ConditionThrowable
668  {
669    return type_error(this, Symbol.FUNCTION);
670  }
671
672  public LispObject execute(LispObject first, LispObject second,
673                            LispObject third, LispObject fourth)
674    throws ConditionThrowable
675  {
676    return type_error(this, Symbol.FUNCTION);
677  }
678
679  public LispObject execute(LispObject first, LispObject second,
680                            LispObject third, LispObject fourth,
681                            LispObject fifth)
682    throws ConditionThrowable
683  {
684    return type_error(this, Symbol.FUNCTION);
685  }
686
687  public LispObject execute(LispObject first, LispObject second,
688                            LispObject third, LispObject fourth,
689                            LispObject fifth, LispObject sixth)
690    throws ConditionThrowable
691  {
692    return type_error(this, Symbol.FUNCTION);
693  }
694
695  public LispObject execute(LispObject first, LispObject second,
696                            LispObject third, LispObject fourth,
697                            LispObject fifth, LispObject sixth,
698                            LispObject seventh)
699    throws ConditionThrowable
700  {
701    return type_error(this, Symbol.FUNCTION);
702  }
703
704  public LispObject execute(LispObject first, LispObject second,
705                            LispObject third, LispObject fourth,
706                            LispObject fifth, LispObject sixth,
707                            LispObject seventh, LispObject eighth)
708    throws ConditionThrowable
709  {
710    return type_error(this, Symbol.FUNCTION);
711  }
712
713  public LispObject execute(LispObject[] args) throws ConditionThrowable
714  {
715    return type_error(this, Symbol.FUNCTION);
716  }
717
718  // Used by COMPILE-MULTIPLE-VALUE-CALL.
719  public LispObject dispatch(LispObject[] args) throws ConditionThrowable
720  {
721    switch (args.length)
722      {
723      case 0:
724        return execute();
725      case 1:
726        return execute(args[0]);
727      case 2:
728        return execute(args[0], args[1]);
729      case 3:
730        return execute(args[0], args[1], args[2]);
731      case 4:
732        return execute(args[0], args[1], args[2], args[3]);
733      case 5:
734        return execute(args[0], args[1], args[2], args[3], args[4]);
735      case 6:
736        return execute(args[0], args[1], args[2], args[3], args[4],
737                       args[5]);
738      case 7:
739        return execute(args[0], args[1], args[2], args[3], args[4],
740                       args[5], args[6]);
741      case 8:
742        return execute(args[0], args[1], args[2], args[3], args[4],
743                       args[5], args[6], args[7]);
744      default:
745        return type_error(this, Symbol.FUNCTION);
746      }
747  }
748
749  public int intValue() throws ConditionThrowable
750  {
751    type_error(this, Symbol.INTEGER);
752    // Not reached.
753    return 0;
754  }
755
756  public long longValue() throws ConditionThrowable
757  {
758    type_error(this, Symbol.INTEGER);
759    // Not reached.
760    return 0;
761  }
762
763  public float floatValue() throws ConditionThrowable
764  {
765    type_error(this, Symbol.SINGLE_FLOAT);
766    // Not reached
767    return 0;
768  }
769
770  public double doubleValue() throws ConditionThrowable
771  {
772    type_error(this, Symbol.DOUBLE_FLOAT);
773    // Not reached
774    return 0;
775  }
776
777  public LispObject incr() throws ConditionThrowable
778  {
779    return type_error(this, Symbol.NUMBER);
780  }
781
782  public LispObject decr() throws ConditionThrowable
783  {
784    return type_error(this, Symbol.NUMBER);
785  }
786
787  public LispObject negate() throws ConditionThrowable
788  {
789    return Fixnum.ZERO.subtract(this);
790  }
791
792  public LispObject add(int n) throws ConditionThrowable
793  {
794    return add(Fixnum.getInstance(n));
795  }
796
797  public LispObject add(LispObject obj) throws ConditionThrowable
798  {
799    return type_error(this, Symbol.NUMBER);
800  }
801
802  public LispObject subtract(int n) throws ConditionThrowable
803  {
804    return subtract(Fixnum.getInstance(n));
805  }
806
807  public LispObject subtract(LispObject obj) throws ConditionThrowable
808  {
809    return type_error(this, Symbol.NUMBER);
810  }
811
812  public LispObject multiplyBy(int n) throws ConditionThrowable
813  {
814    return multiplyBy(Fixnum.getInstance(n));
815  }
816
817  public LispObject multiplyBy(LispObject obj) throws ConditionThrowable
818  {
819    return type_error(this, Symbol.NUMBER);
820  }
821
822  public LispObject divideBy(LispObject obj) throws ConditionThrowable
823  {
824    return type_error(this, Symbol.NUMBER);
825  }
826
827  public boolean isEqualTo(int n) throws ConditionThrowable
828  {
829    return isEqualTo(Fixnum.getInstance(n));
830  }
831
832  public boolean isEqualTo(LispObject obj) throws ConditionThrowable
833  {
834    type_error(this, Symbol.NUMBER);
835    // Not reached.
836    return false;
837  }
838
839  public LispObject IS_E(LispObject obj) throws ConditionThrowable
840  {
841    return isEqualTo(obj) ? T : NIL;
842  }
843
844  public boolean isNotEqualTo(int n) throws ConditionThrowable
845  {
846    return isNotEqualTo(Fixnum.getInstance(n));
847  }
848
849  public boolean isNotEqualTo(LispObject obj) throws ConditionThrowable
850  {
851    type_error(this, Symbol.NUMBER);
852    // Not reached.
853    return false;
854  }
855
856  public LispObject IS_NE(LispObject obj) throws ConditionThrowable
857  {
858    return isNotEqualTo(obj) ? T : NIL;
859  }
860
861  public boolean isLessThan(int n) throws ConditionThrowable
862  {
863    return isLessThan(Fixnum.getInstance(n));
864  }
865
866  public boolean isLessThan(LispObject obj) throws ConditionThrowable
867  {
868    type_error(this, Symbol.REAL);
869    // Not reached.
870    return false;
871  }
872
873  public LispObject IS_LT(LispObject obj) throws ConditionThrowable
874  {
875    return isLessThan(obj) ? T : NIL;
876  }
877
878  public boolean isGreaterThan(int n) throws ConditionThrowable
879  {
880    return isGreaterThan(Fixnum.getInstance(n));
881  }
882
883  public boolean isGreaterThan(LispObject obj) throws ConditionThrowable
884  {
885    type_error(this, Symbol.REAL);
886    // Not reached.
887    return false;
888  }
889
890  public LispObject IS_GT(LispObject obj) throws ConditionThrowable
891  {
892    return isGreaterThan(obj) ? T : NIL;
893  }
894
895  public boolean isLessThanOrEqualTo(int n) throws ConditionThrowable
896  {
897    return isLessThanOrEqualTo(Fixnum.getInstance(n));
898  }
899
900  public boolean isLessThanOrEqualTo(LispObject obj) throws ConditionThrowable
901  {
902    type_error(this, Symbol.REAL);
903    // Not reached.
904    return false;
905  }
906
907  public LispObject IS_LE(LispObject obj) throws ConditionThrowable
908  {
909    return isLessThanOrEqualTo(obj) ? T : NIL;
910  }
911
912  public boolean isGreaterThanOrEqualTo(int n) throws ConditionThrowable
913  {
914    return isGreaterThanOrEqualTo(Fixnum.getInstance(n));
915  }
916
917  public boolean isGreaterThanOrEqualTo(LispObject obj) throws ConditionThrowable
918  {
919    type_error(this, Symbol.REAL);
920    // Not reached.
921    return false;
922  }
923
924  public LispObject IS_GE(LispObject obj) throws ConditionThrowable
925  {
926    return isGreaterThanOrEqualTo(obj) ? T : NIL;
927  }
928
929  public LispObject truncate(LispObject obj) throws ConditionThrowable
930  {
931    return type_error(this, Symbol.REAL);
932  }
933
934  public LispObject MOD(LispObject divisor) throws ConditionThrowable
935  {
936    truncate(divisor);
937    final LispThread thread = LispThread.currentThread();
938    LispObject remainder = thread._values[1];
939    thread.clearValues();
940    if (!remainder.zerop())
941      {
942        if (divisor.minusp())
943          {
944            if (plusp())
945              return remainder.add(divisor);
946          }
947        else
948          {
949            if (minusp())
950              return remainder.add(divisor);
951          }
952      }
953    return remainder;
954  }
955
956  public LispObject MOD(int divisor) throws ConditionThrowable
957  {
958    return MOD(Fixnum.getInstance(divisor));
959  }
960
961  public LispObject ash(int shift) throws ConditionThrowable
962  {
963    return ash(Fixnum.getInstance(shift));
964  }
965
966  public LispObject ash(LispObject obj) throws ConditionThrowable
967  {
968    return type_error(this, Symbol.INTEGER);
969  }
970
971  public LispObject LOGNOT() throws ConditionThrowable
972  {
973    return type_error(this, Symbol.INTEGER);
974  }
975
976  public LispObject LOGAND(int n) throws ConditionThrowable
977  {
978    return LOGAND(Fixnum.getInstance(n));
979  }
980
981  public LispObject LOGAND(LispObject obj) throws ConditionThrowable
982  {
983    return type_error(this, Symbol.INTEGER);
984  }
985
986  public LispObject LOGIOR(int n) throws ConditionThrowable
987  {
988    return LOGIOR(Fixnum.getInstance(n));
989  }
990
991  public LispObject LOGIOR(LispObject obj) throws ConditionThrowable
992  {
993    return type_error(this, Symbol.INTEGER);
994  }
995
996  public LispObject LOGXOR(int n) throws ConditionThrowable
997  {
998    return LOGXOR(Fixnum.getInstance(n));
999  }
1000
1001  public LispObject LOGXOR(LispObject obj) throws ConditionThrowable
1002  {
1003    return type_error(this, Symbol.INTEGER);
1004  }
1005
1006  public LispObject LDB(int size, int position) throws ConditionThrowable
1007  {
1008    return type_error(this, Symbol.INTEGER);
1009  }
1010
1011  public int sxhash()
1012  {
1013    return hashCode() & 0x7fffffff;
1014  }
1015
1016  // For EQUALP hash tables.
1017  public int psxhash()
1018  {
1019    return sxhash();
1020  }
1021
1022  public int psxhash(int depth)
1023  {
1024    return psxhash();
1025  }
1026
1027  public LispObject STRING() throws ConditionThrowable
1028  {
1029    return error(new TypeError(writeToString() + " cannot be coerced to a string."));
1030  }
1031
1032  public char[] chars() throws ConditionThrowable
1033  {
1034    type_error(this, Symbol.STRING);
1035    // Not reached.
1036    return null;
1037  }
1038
1039  public char[] getStringChars() throws ConditionThrowable
1040  {
1041    type_error(this, Symbol.STRING);
1042    // Not reached.
1043    return null;
1044  }
1045
1046  public String getStringValue() throws ConditionThrowable
1047  {
1048    type_error(this, Symbol.STRING);
1049    // Not reached.
1050    return null;
1051  }
1052
1053  public LispObject getSlotValue_0() throws ConditionThrowable
1054  {
1055    return type_error(this, Symbol.STRUCTURE_OBJECT);
1056  }
1057
1058  public LispObject getSlotValue_1() throws ConditionThrowable
1059  {
1060    return type_error(this, Symbol.STRUCTURE_OBJECT);
1061  }
1062
1063  public LispObject getSlotValue_2() throws ConditionThrowable
1064  {
1065    return type_error(this, Symbol.STRUCTURE_OBJECT);
1066  }
1067
1068  public LispObject getSlotValue_3() throws ConditionThrowable
1069  {
1070    return type_error(this, Symbol.STRUCTURE_OBJECT);
1071  }
1072
1073  public LispObject getSlotValue(int index) throws ConditionThrowable
1074  {
1075    return type_error(this, Symbol.STRUCTURE_OBJECT);
1076  }
1077
1078  public int getFixnumSlotValue(int index) throws ConditionThrowable
1079  {
1080    type_error(this, Symbol.STRUCTURE_OBJECT);
1081    // Not reached.
1082    return 0;
1083  }
1084
1085  public boolean getSlotValueAsBoolean(int index) throws ConditionThrowable
1086  {
1087    type_error(this, Symbol.STRUCTURE_OBJECT);
1088    // Not reached.
1089    return false;
1090  }
1091
1092  public void setSlotValue_0(LispObject value)
1093    throws ConditionThrowable
1094  {
1095    type_error(this, Symbol.STRUCTURE_OBJECT);
1096  }
1097
1098  public void setSlotValue_1(LispObject value)
1099    throws ConditionThrowable
1100  {
1101    type_error(this, Symbol.STRUCTURE_OBJECT);
1102  }
1103
1104  public void setSlotValue_2(LispObject value)
1105    throws ConditionThrowable
1106  {
1107    type_error(this, Symbol.STRUCTURE_OBJECT);
1108  }
1109
1110  public void setSlotValue_3(LispObject value)
1111    throws ConditionThrowable
1112  {
1113    type_error(this, Symbol.STRUCTURE_OBJECT);
1114  }
1115
1116  public void setSlotValue(int index, LispObject value)
1117    throws ConditionThrowable
1118  {
1119    type_error(this, Symbol.STRUCTURE_OBJECT);
1120  }
1121
1122  public LispObject SLOT_VALUE(LispObject slotName) throws ConditionThrowable
1123  {
1124    return type_error(this, Symbol.STANDARD_OBJECT);
1125  }
1126
1127  public void setSlotValue(LispObject slotName, LispObject newValue)
1128    throws ConditionThrowable
1129  {
1130    type_error(this, Symbol.STANDARD_OBJECT);
1131  }
1132
1133  // Profiling.
1134  public int getCallCount()
1135  {
1136    return 0;
1137  }
1138
1139  public void setCallCount(int n)
1140  {
1141  }
1142
1143  public void incrementCallCount()
1144  {
1145  }
1146}
Note: See TracBrowser for help on using the repository browser.