Changeset 5082


Ignore:
Timestamp:
12/12/03 13:04:11 (17 years ago)
Author:
piso
Message:

PACKAGE-ERROR-PACKAGE

File:
1 edited

Legend:

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

    r3987 r5082  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: PackageError.java,v 1.7 2003-09-22 11:08:46 piso Exp $
     5 * $Id: PackageError.java,v 1.8 2003-12-12 13:04:11 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public class PackageError extends LispError
    2525{
     26    final LispObject pkg;
     27
    2628    public PackageError()
    2729    {
     30        pkg = NIL;
    2831    }
    2932
    30     public PackageError(LispObject initArgs)
     33    public PackageError(LispObject initArgs) throws ConditionThrowable
    3134    {
    32         this(); // FIXME
     35        LispObject pkg = NIL;
     36        LispObject first, second;
     37        while (initArgs != NIL) {
     38            first = initArgs.car();
     39            initArgs = initArgs.cdr();
     40            second = initArgs.car();
     41            initArgs = initArgs.cdr();
     42            if (first == Keyword.PACKAGE)
     43                pkg = second;
     44        }
     45        this.pkg = pkg;
    3346    }
    3447
     
    3649    {
    3750        super(message);
     51        pkg = NIL;
    3852    }
    3953
     
    5670        return super.typep(type);
    5771    }
     72
     73    private static final Primitive1 PACKAGE_ERROR_PACKAGE =
     74        new Primitive1("package-error-package", "condition")
     75    {
     76        public LispObject execute(LispObject arg) throws ConditionThrowable
     77        {
     78            if (arg instanceof PackageError)
     79                return ((PackageError)arg).pkg;
     80            throw new ConditionThrowable(new TypeError(arg, Symbol.CONDITION));
     81        }
     82    };
    5883}
Note: See TracChangeset for help on using the changeset viewer.