Changeset 4017


Ignore:
Timestamp:
09/23/03 14:55:06 (20 years ago)
Author:
piso
Message:

DOTIMES: implicit TAGBODY.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r4016 r4017  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.428 2003-09-23 14:29:17 piso Exp $
     5 * $Id: Primitives.java,v 1.429 2003-09-23 14:55:06 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    15841584            try {
    15851585                LispObject limit = eval(countForm, env, thread);
     1586                // Look for tags.
     1587                Binding tags = null;
     1588                LispObject remaining = bodyForm;
     1589                while (remaining != NIL) {
     1590                    LispObject current = remaining.car();
     1591                    remaining = remaining.cdr();
     1592                    if (current instanceof Cons)
     1593                        continue;
     1594                    // It's a tag.
     1595                    tags = new Binding(current, remaining, tags);
     1596                }
    15861597                LispObject result;
    15871598                if (limit instanceof Fixnum) {
     
    15931604                        LispObject body = bodyForm;
    15941605                        while (body != NIL) {
    1595                             eval(body.car(), ext, thread);
     1606                            LispObject current = body.car();
     1607                            if (current instanceof Cons) {
     1608                                try {
     1609                                    // Handle GO inline if possible.
     1610                                    if (current.car() == Symbol.GO) {
     1611                                        LispObject code = null;
     1612                                        LispObject tag = current.cadr();
     1613                                        for (Binding binding = tags; binding != null; binding = binding.next) {
     1614                                            if (binding.symbol.eql(tag)) {
     1615                                                code = binding.value;
     1616                                                break;
     1617                                            }
     1618                                        }
     1619                                        if (code != null) {
     1620                                            body = code;
     1621                                            continue;
     1622                                        }
     1623                                        throw new Go(tag);
     1624                                    }
     1625                                    eval(current, ext, thread);
     1626                                }
     1627                                catch (Go go) {
     1628                                    LispObject code = null;
     1629                                    LispObject tag = go.getTag();
     1630                                    for (Binding binding = tags; binding != null; binding = binding.next) {
     1631                                        if (binding.symbol.eql(tag)) {
     1632                                            code = binding.value;
     1633                                            break;
     1634                                        }
     1635                                    }
     1636                                    if (code != null) {
     1637                                        body = code;
     1638                                        thread.setStackDepth(depth);
     1639                                        continue;
     1640                                    }
     1641                                    throw go;
     1642                                }
     1643                            }
    15961644                            body = body.cdr();
    15971645                        }
     
    16071655                        LispObject body = bodyForm;
    16081656                        while (body != NIL) {
    1609                             eval(body.car(), ext, thread);
     1657                            LispObject current = body.car();
     1658                            if (current instanceof Cons) {
     1659                                try {
     1660                                    // Handle GO inline if possible.
     1661                                    if (current.car() == Symbol.GO) {
     1662                                        LispObject code = null;
     1663                                        LispObject tag = current.cadr();
     1664                                        for (Binding binding = tags; binding != null; binding = binding.next) {
     1665                                            if (binding.symbol.eql(tag)) {
     1666                                                code = binding.value;
     1667                                                break;
     1668                                            }
     1669                                        }
     1670                                        if (code != null) {
     1671                                            body = code;
     1672                                            continue;
     1673                                        }
     1674                                        throw new Go(tag);
     1675                                    }
     1676                                    eval(current, ext, thread);
     1677                                }
     1678                                catch (Go go) {
     1679                                    LispObject code = null;
     1680                                    LispObject tag = go.getTag();
     1681                                    for (Binding binding = tags; binding != null; binding = binding.next) {
     1682                                        if (binding.symbol.eql(tag)) {
     1683                                            code = binding.value;
     1684                                            break;
     1685                                        }
     1686                                    }
     1687                                    if (code != null) {
     1688                                        body = code;
     1689                                        thread.setStackDepth(depth);
     1690                                        continue;
     1691                                    }
     1692                                    throw go;
     1693                                }
     1694                            }
    16101695                            body = body.cdr();
    16111696                        }
Note: See TracChangeset for help on using the changeset viewer.