01: /*
02: * Jatha - a Common LISP-compatible LISP library in Java.
03: * Copyright (C) 1997-2005 Micheal Scott Hewett
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library 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 GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: *
19: *
20: * For further information, please contact Micheal Hewett at
21: * hewett@cs.stanford.edu
22: *
23: */
24:
25: package org.jatha.machine;
26:
27: import org.jatha.Jatha;
28: import org.jatha.dynatype.LispValue;
29:
30: // @date Sat Feb 1 22:18:53 1997
31: /**
32: * opLD pushes the value of a local variable onto
33: * the S register and removes two values from the C register.
34: * The values on the C register are the constant 'LD'
35: * and the pair (i, j), which are indices into the
36: * value of the E register which is a list of lists.
37: * @see SECDMachine
38: * @author Micheal S. Hewett hewett@cs.stanford.edu
39: */
40: class opLD extends SECDop {
41: /**
42: * It calls <tt>SECDop()</tt> with the machine argument
43: * and the label of this instruction.
44: * @see SECDMachine
45: */
46: //@author Micheal S. Hewett hewett@cs.stanford.edu
47: public opLD(Jatha lisp) {
48: super (lisp, "LD");
49: }
50:
51: public void Execute(SECDMachine machine) {
52: LispValue indexes;
53:
54: indexes = machine.C.value().second();
55: /*
56: System.err.println("----DEBUG----");
57: System.err.println(machine.E.value());
58: System.err.println(indexes);
59: System.err.println(getComponentAt(indexes,machine.E.value()));
60: System.err.println("-------------");
61: */
62: /*
63: print(CREATE_SYMBOL("---DEBUG----"));
64: print(indexes);
65: print(symbol_value(E));
66: push(print(getComponentAt(indexes, symbol_value(E))), S);
67: print(CREATE_SYMBOL("-----------"));
68: */
69:
70: machine.S.push(getComponentAt(indexes, machine.E.value()));
71:
72: machine.C.pop();
73: machine.C.pop();
74: }
75:
76: public LispValue grindef(LispValue code, int indentAmount) {
77: indent(indentAmount);
78:
79: System.out.print(functionName);
80: indent(6);
81: code.second().internal_princ(System.out);
82:
83: f_lisp.NEWLINE.internal_princ(System.out);
84:
85: return code.cdr().cdr();
86: }
87: }
|