Changeset 4016
- Timestamp:
- 09/23/03 14:29:17 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/Primitives.java
r4015 r4016 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Primitives.java,v 1.42 7 2003-09-23 13:38:54piso Exp $5 * $Id: Primitives.java,v 1.428 2003-09-23 14:29:17 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 1581 1581 LispObject resultForm = args.cdr().cdr().car(); 1582 1582 Environment oldDynEnv = thread.getDynamicEnvironment(); 1583 LispObject limit = eval(countForm, env, thread);1584 LispObject result;1585 if (limit instanceof Fixnum) {1586 int count = ((Fixnum)limit).getValue();1587 i nt i;1588 for (i = 0; i < count; i++) {1589 Environment ext = new Environment(env);1590 bind(var, new Fixnum(i), ext);1591 LispObject body = bodyForm;1592 int depth = thread.getStackDepth();1593 try {1583 int depth = thread.getStackDepth(); 1584 try { 1585 LispObject limit = eval(countForm, env, thread); 1586 LispObject result; 1587 if (limit instanceof Fixnum) { 1588 int count = ((Fixnum)limit).getValue(); 1589 int i; 1590 for (i = 0; i < count; i++) { 1591 Environment ext = new Environment(env); 1592 bind(var, new Fixnum(i), ext); 1593 LispObject body = bodyForm; 1594 1594 while (body != NIL) { 1595 1595 eval(body.car(), ext, thread); … … 1597 1597 } 1598 1598 } 1599 catch (Return ret) {1600 if (ret.getTag() == NIL) {1601 thread.setStackDepth(depth);1602 return ret.getResult();1603 }1604 throw ret;1605 }1606 }1607 Environment ext = new Environment(env);1608 bind(var, new Fixnum(i), ext);1609 result = eval(resultForm, ext, thread);1610 } else if (limit instanceof Bignum) {1611 LispObject i = Fixnum.ZERO;1612 while (i.isLessThan(limit)) {1613 1599 Environment ext = new Environment(env); 1614 bind(var, i, ext); 1615 LispObject body = bodyForm; 1616 int depth = thread.getStackDepth(); 1617 try { 1600 bind(var, new Fixnum(i), ext); 1601 result = eval(resultForm, ext, thread); 1602 } else if (limit instanceof Bignum) { 1603 LispObject i = Fixnum.ZERO; 1604 while (i.isLessThan(limit)) { 1605 Environment ext = new Environment(env); 1606 bind(var, i, ext); 1607 LispObject body = bodyForm; 1618 1608 while (body != NIL) { 1619 1609 eval(body.car(), ext, thread); 1620 1610 body = body.cdr(); 1621 1611 } 1612 i = i.incr(); 1622 1613 } 1623 catch (Return ret) { 1624 if (ret.getTag() == NIL) { 1625 thread.setStackDepth(depth); 1626 return ret.getResult(); 1627 } 1628 throw ret; 1629 } 1630 i = i.incr(); 1631 } 1632 Environment ext = new Environment(env); 1633 bind(var, i, ext); 1634 result = eval(resultForm, ext, thread); 1635 } else 1636 throw new ConditionThrowable(new TypeError(limit, "integer")); 1637 thread.setDynamicEnvironment(oldDynEnv); 1638 return result; 1614 Environment ext = new Environment(env); 1615 bind(var, i, ext); 1616 result = eval(resultForm, ext, thread); 1617 } else 1618 throw new ConditionThrowable(new TypeError(limit, "integer")); 1619 return result; 1620 } 1621 catch (Return ret) { 1622 if (ret.getTag() == NIL) { 1623 thread.setStackDepth(depth); 1624 return ret.getResult(); 1625 } 1626 throw ret; 1627 } 1628 finally { 1629 thread.setDynamicEnvironment(oldDynEnv); 1630 } 1639 1631 } 1640 1632 };
Note: See TracChangeset
for help on using the changeset viewer.