Changeset 8660


Ignore:
Timestamp:
02/28/05 02:50:05 (16 years ago)
Author:
piso
Message:

SpecialBinding? refactoring.

Location:
trunk/j/src/org/armedbear/lisp
Files:
21 edited

Legend:

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

    r8159 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: AbstractArray.java,v 1.35 2004-11-13 15:01:57 piso Exp $
     5 * $Id: AbstractArray.java,v 1.36 2005-02-28 02:50:02 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    254254            int currentLevel = Fixnum.getValue(currentPrintLevel);
    255255            if (currentLevel < maxLevel) {
    256                 Binding lastSpecialBinding = thread.lastSpecialBinding;
     256                SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    257257                thread.bindSpecial(_CURRENT_PRINT_LEVEL_, currentPrintLevel.incr());
    258258                try {
  • trunk/j/src/org/armedbear/lisp/AbstractVector.java

    r8552 r8660  
    182182                final int length = length();
    183183                final int limit = Math.min(length, maxLength);
    184                 Binding lastSpecialBinding = thread.lastSpecialBinding;
     184                SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    185185                thread.bindSpecial(_CURRENT_PRINT_LEVEL_, currentPrintLevel.incr());
    186186                try {
  • trunk/j/src/org/armedbear/lisp/Autoload.java

    r8652 r8660  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Autoload.java,v 1.217 2005-02-27 20:09:49 piso Exp $
     5 * $Id: Autoload.java,v 1.218 2005-02-28 02:50:02 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7575        if (className != null) {
    7676            final LispThread thread = LispThread.currentThread();
    77             final Binding lastSpecialBinding = thread.lastSpecialBinding;
     77            final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    7878            int loadDepth = Fixnum.getInt(_LOAD_DEPTH_.symbolValue());
    7979            thread.bindSpecial(_LOAD_DEPTH_, new Fixnum(++loadDepth));
  • trunk/j/src/org/armedbear/lisp/Closure.java

    r8657 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Closure.java,v 1.91 2005-02-28 01:11:57 piso Exp $
     5 * $Id: Closure.java,v 1.92 2005-02-28 02:50:02 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    368368        if (minArgs == 1) {
    369369            final LispThread thread = LispThread.currentThread();
    370             Binding lastSpecialBinding = thread.lastSpecialBinding;
     370            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    371371            Environment ext = new Environment(environment);
    372372            if (specials != null) {
     
    409409        if (minArgs == 2) {
    410410            final LispThread thread = LispThread.currentThread();
    411             Binding lastSpecialBinding = thread.lastSpecialBinding;
     411            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    412412            Environment ext = new Environment(environment);
    413413            if (specials != null) {
     
    453453        if (minArgs == 3) {
    454454            final LispThread thread = LispThread.currentThread();
    455             Binding lastSpecialBinding = thread.lastSpecialBinding;
     455            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    456456            Environment ext = new Environment(environment);
    457457            if (specials != null) {
     
    499499        if (minArgs == 4) {
    500500            final LispThread thread = LispThread.currentThread();
    501             Binding lastSpecialBinding = thread.lastSpecialBinding;
     501            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    502502            Environment ext = new Environment(environment);
    503503            if (specials != null) {
     
    544544    {
    545545        final LispThread thread = LispThread.currentThread();
    546         Binding lastSpecialBinding = thread.lastSpecialBinding;
     546        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    547547        Environment ext = new Environment(environment);
    548548        if (specials != null) {
     
    618618        // returns. They are used only in the evaluation of initforms for
    619619        // optional and keyword arguments.
    620         Binding lastSpecialBinding = thread.lastSpecialBinding;
     620        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    621621        Environment ext = new Environment(environment);
    622622        // Section 3.4.4: "...the &environment parameter is bound along with
  • trunk/j/src/org/armedbear/lisp/Cons.java

    r8278 r8660  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Cons.java,v 1.53 2004-12-21 18:04:13 piso Exp $
     5 * $Id: Cons.java,v 1.54 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    474474        int currentLevel = Fixnum.getValue(currentPrintLevel);
    475475        if (currentLevel < maxLevel) {
    476             Binding lastSpecialBinding = thread.lastSpecialBinding;
     476            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    477477            thread.bindSpecial(_CURRENT_PRINT_LEVEL_, currentPrintLevel.incr());
    478478            try {
  • trunk/j/src/org/armedbear/lisp/Do.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: Do.java,v 1.11 2004-11-13 15:01:57 piso Exp $
     5 * $Id: Do.java,v 1.12 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7676        }
    7777        final LispThread thread = LispThread.currentThread();
    78         Binding lastSpecialBinding = thread.lastSpecialBinding;
     78        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    7979        // Process declarations.
    8080        LispObject specials = NIL;
  • trunk/j/src/org/armedbear/lisp/Interpreter.java

    r8601 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Interpreter.java,v 1.80 2005-02-18 00:43:09 piso Exp $
     5 * $Id: Interpreter.java,v 1.81 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    429429            return signal(new EndOfFile(stream));
    430430        final LispThread thread = LispThread.currentThread();
    431         final Binding lastSpecialBinding = thread.lastSpecialBinding;
     431        final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    432432        thread.bindSpecial(_DEBUGGER_HOOK_, _DEBUGGER_HOOK_FUNCTION);
    433433        try {
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r8652 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Lisp.java,v 1.324 2005-02-27 20:10:54 piso Exp $
     5 * $Id: Lisp.java,v 1.325 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    12411241                        if (j < args.length) {
    12421242                            LispObject obj = args[j++];
    1243                             Binding lastSpecialBinding = thread.lastSpecialBinding;
     1243                            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    12441244                            thread.bindSpecial(_PRINT_ESCAPE_, NIL);
    12451245                            thread.bindSpecial(_PRINT_READABLY_, NIL);
     
    12501250                        if (j < args.length) {
    12511251                            LispObject obj = args[j++];
    1252                             Binding lastSpecialBinding = thread.lastSpecialBinding;
     1252                            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    12531253                            thread.bindSpecial(_PRINT_ESCAPE_, T);
    12541254                            sb.append(obj.writeToString());
     
    12581258                        if (j < args.length) {
    12591259                            LispObject obj = args[j++];
    1260                             Binding lastSpecialBinding = thread.lastSpecialBinding;
     1260                            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    12611261                            thread.bindSpecial(_PRINT_ESCAPE_, NIL);
    12621262                            thread.bindSpecial(_PRINT_RADIX_, NIL);
     
    12681268                        if (j < args.length) {
    12691269                            LispObject obj = args[j++];
    1270                             Binding lastSpecialBinding = thread.lastSpecialBinding;
     1270                            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    12711271                            thread.bindSpecial(_PRINT_ESCAPE_, NIL);
    12721272                            thread.bindSpecial(_PRINT_RADIX_, NIL);
  • trunk/j/src/org/armedbear/lisp/LispThread.java

    r8638 r8660  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: LispThread.java,v 1.75 2005-02-26 17:28:15 piso Exp $
     5 * $Id: LispThread.java,v 1.76 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7575    private boolean destroyed;
    7676    private final LispObject name;
    77     public Binding lastSpecialBinding;
     77    public SpecialBinding lastSpecialBinding;
    7878    public LispObject[] _values;
    7979    private boolean threadInterrupted;
     
    291291    }
    292292
    293     public final void bindSpecial(Symbol symbol, LispObject value)
    294     {
    295         lastSpecialBinding = new Binding(symbol, value, lastSpecialBinding);
    296     }
    297 
    298     public final void bindSpecialToCurrentValue(Symbol symbol)
    299     {
    300         Binding binding = lastSpecialBinding;
     293    public final void bindSpecial(Symbol name, LispObject value)
     294    {
     295        lastSpecialBinding = new SpecialBinding(name, value, lastSpecialBinding);
     296    }
     297
     298    public final void bindSpecialToCurrentValue(Symbol name)
     299    {
     300        SpecialBinding binding = lastSpecialBinding;
    301301        while (binding != null) {
    302             if (binding.symbol == symbol) {
     302            if (binding.name == name) {
    303303                lastSpecialBinding =
    304                     new Binding(symbol, binding.value, lastSpecialBinding);
     304                    new SpecialBinding(name, binding.value, lastSpecialBinding);
    305305                return;
    306306            }
     
    309309        // Not found.
    310310        lastSpecialBinding =
    311             new Binding(symbol, symbol.getSymbolValue(), lastSpecialBinding);
    312     }
    313 
    314     public final LispObject lookupSpecial(LispObject symbol)
    315     {
    316         Binding binding = lastSpecialBinding;
     311            new SpecialBinding(name, name.getSymbolValue(), lastSpecialBinding);
     312    }
     313
     314    public final LispObject lookupSpecial(LispObject name)
     315    {
     316        SpecialBinding binding = lastSpecialBinding;
    317317        while (binding != null) {
    318             if (binding.symbol == symbol)
     318            if (binding.name == name)
    319319                return binding.value;
    320320            binding = binding.next;
     
    323323    }
    324324
    325     public final Binding getSpecialBinding(LispObject symbol)
    326     {
    327         Binding binding = lastSpecialBinding;
     325    public final SpecialBinding getSpecialBinding(LispObject name)
     326    {
     327        SpecialBinding binding = lastSpecialBinding;
    328328        while (binding != null) {
    329             if (binding.symbol == symbol)
     329            if (binding.name == name)
    330330                return binding;
    331331            binding = binding.next;
     
    334334    }
    335335
    336     public final LispObject setSpecialVariable(Symbol symbol, LispObject value)
    337     {
    338         Binding binding = lastSpecialBinding;
     336    public final LispObject setSpecialVariable(Symbol name, LispObject value)
     337    {
     338        SpecialBinding binding = lastSpecialBinding;
    339339        while (binding != null) {
    340             if (binding.symbol == symbol) {
     340            if (binding.name == name) {
    341341                binding.value = value;
    342342                return value;
     
    344344            binding = binding.next;
    345345        }
    346         symbol.setSymbolValue(value);
     346        name.setSymbolValue(value);
    347347        return value;
    348348    }
    349349
    350350    // Returns symbol value or NIL if unbound.
    351     public final LispObject safeSymbolValue(Symbol symbol)
    352     {
    353         Binding binding = lastSpecialBinding;
     351    public final LispObject safeSymbolValue(Symbol name)
     352    {
     353        SpecialBinding binding = lastSpecialBinding;
    354354        while (binding != null) {
    355             if (binding.symbol == symbol)
     355            if (binding.name == name)
    356356                return binding.value;
    357357            binding = binding.next;
    358358        }
    359         LispObject value = symbol.getSymbolValue();
     359        LispObject value = name.getSymbolValue();
    360360        return value != null ? value : NIL;
    361361    }
    362362
    363     public final void rebindSpecial(Symbol symbol, LispObject value)
    364     {
    365         Binding binding = getSpecialBinding(symbol);
     363    public final void rebindSpecial(Symbol name, LispObject value)
     364    {
     365        SpecialBinding binding = getSpecialBinding(name);
    366366        binding.value = value;
    367367    }
  • trunk/j/src/org/armedbear/lisp/Load.java

    r8525 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Load.java,v 1.95 2005-02-10 12:56:42 piso Exp $
     5 * $Id: Load.java,v 1.96 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    134134        LispThread thread = LispThread.currentThread();
    135135        if (auto) {
    136             Binding lastSpecialBinding = thread.lastSpecialBinding;
     136            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    137137            thread.bindSpecial(_READTABLE_,
    138138                               Readtable._STANDARD_READTABLE_.symbolValue(thread));
     
    209209            if (in != null) {
    210210                final LispThread thread = LispThread.currentThread();
    211                 final Binding lastSpecialBinding = thread.lastSpecialBinding;
     211                final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    212212                thread.bindSpecial(_WARN_ON_REDEFINITION_, NIL);
    213213                try {
     
    284284        long start = System.currentTimeMillis();
    285285        LispThread thread = LispThread.currentThread();
    286         Binding lastSpecialBinding = thread.lastSpecialBinding;
     286        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    287287        thread.bindSpecial(_PACKAGE_, _PACKAGE_.symbolValue(thread));
    288288        int loadDepth = Fixnum.getValue(_LOAD_DEPTH_.symbolValue(thread));
     
    359359        Stream in = new Stream(inputStream, Symbol.CHARACTER);
    360360        final LispThread thread = LispThread.currentThread();
    361         Binding lastSpecialBinding = thread.lastSpecialBinding;
     361        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    362362        thread.bindSpecial(_LOAD_STREAM_, in);
    363363        try {
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r8650 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Primitives.java,v 1.739 2005-02-27 20:02:40 piso Exp $
     5 * $Id: Primitives.java,v 1.740 2005-02-28 02:50:03 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    750750            // are bound and then made to have no value." So BOUNDP must
    751751            // explicitly check for a binding with no value.
    752             Binding binding =
     752            SpecialBinding binding =
    753753                LispThread.currentThread().getSpecialBinding(symbol);
    754754            if (binding != null)
     
    14671467
    14681468                    } else {
    1469                         Binding lastSpecialBinding = thread.lastSpecialBinding;
     1469                        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    14701470                        thread.bindSpecial(_PACKAGE_, PACKAGE_CL);
    14711471                        try {
     
    26222622    {
    26232623        StringBuffer sb = new StringBuffer(prefix);
    2624         Binding binding =
     2624        SpecialBinding binding =
    26252625            LispThread.currentThread().getSpecialBinding(_GENSYM_COUNTER_);
    26262626        final LispObject oldValue;
     
    28122812                                        " does not designate any package."));
    28132813            LispThread thread = LispThread.currentThread();
    2814             Binding binding = thread.getSpecialBinding(_PACKAGE_);
     2814            SpecialBinding binding = thread.getSpecialBinding(_PACKAGE_);
    28152815            if (binding != null) {
    28162816                binding.value = pkg;
     
    31853185
    31863186    // ### block
    3187     private static final SpecialOperator BLOCK = new SpecialOperator("block", "name &rest forms")
     3187    private static final SpecialOperator BLOCK =
     3188        new SpecialOperator("block", "name &rest forms")
    31883189    {
    31893190        public LispObject execute(LispObject args, Environment env)
     
    33993400                    break;
    34003401            }
    3401             final Binding lastSpecialBinding = thread.lastSpecialBinding;
     3402            final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    34023403            final Environment ext = new Environment(env);
    34033404            int i = 0;
  • trunk/j/src/org/armedbear/lisp/PrintNotReadable.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2004 Peter Graves
    5  * $Id: PrintNotReadable.java,v 1.6 2004-11-13 15:02:01 piso Exp $
     5 * $Id: PrintNotReadable.java,v 1.7 2005-02-28 02:50:04 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6868        if (object != NIL) {
    6969            final LispThread thread = LispThread.currentThread();
    70             final Binding lastSpecialBinding = thread.lastSpecialBinding;
     70            final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    7171            thread.bindSpecial(_PRINT_READABLY_, NIL);
    7272            thread.bindSpecial(_PRINT_ARRAY_, NIL);
  • trunk/j/src/org/armedbear/lisp/SpecialOperators.java

    r8651 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: SpecialOperators.java,v 1.33 2005-02-27 20:03:42 piso Exp $
     5 * $Id: SpecialOperators.java,v 1.34 2005-02-28 02:50:04 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8484        LispObject result = NIL;
    8585        final LispThread thread = LispThread.currentThread();
    86         final Binding lastSpecialBinding = thread.lastSpecialBinding;
     86        final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    8787        try {
    8888            LispObject varList = checkList(args.car());
     
    188188            LispObject result = NIL;
    189189            if (varList != NIL) {
    190                 Binding lastSpecialBinding = thread.lastSpecialBinding;
     190                SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    191191                try {
    192192                    Environment ext = new Environment(env);
     
    310310        LispObject result;
    311311        if (defs != NIL) {
    312             Binding lastSpecialBinding = thread.lastSpecialBinding;
     312            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    313313            Environment ext = new Environment(env);
    314314            while (defs != NIL) {
     
    385385            final LispObject symbols = checkList(eval(args.car(), env, thread));
    386386            LispObject values = checkList(eval(args.cadr(), env, thread));
    387             Binding lastSpecialBinding = thread.lastSpecialBinding;
     387            SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    388388            try {
    389389                // Set up the new bindings.
     
    492492                }
    493493                args = args.cdr();
    494                 Binding binding = null;
     494//                 Binding binding = null;
    495495                if (symbol.isSpecialVariable() || env.isDeclaredSpecial(symbol)) {
    496                     binding = thread.getSpecialBinding(symbol);
     496//                     binding = thread.getSpecialBinding(symbol);
     497                    SpecialBinding binding = thread.getSpecialBinding(symbol);
     498                    if (binding != null) {
     499                        if (binding.value instanceof SymbolMacro) {
     500                            LispObject expansion =
     501                                ((SymbolMacro)binding.value).getExpansion();
     502                            LispObject form = list3(Symbol.SETF, expansion, args.car());
     503                            value = eval(form, env, thread);
     504                        } else {
     505                            value = eval(args.car(), env, thread);
     506                            binding.value = value;
     507                        }
     508                    } else {
     509                        if (symbol.getSymbolValue() instanceof SymbolMacro) {
     510                            LispObject expansion =
     511                                ((SymbolMacro)symbol.getSymbolValue()).getExpansion();
     512                            LispObject form = list3(Symbol.SETF, expansion, args.car());
     513                            value = eval(form, env, thread);
     514                        } else {
     515                            value = eval(args.car(), env, thread);
     516                            symbol.setSymbolValue(value);
     517                        }
     518                    }
    497519                } else {
    498520                    // Not special.
    499                     binding = env.getBinding(symbol);
    500                 }
    501                 if (binding != null) {
    502                     if (binding.value instanceof SymbolMacro) {
    503                         LispObject expansion =
    504                             ((SymbolMacro)binding.value).getExpansion();
    505                         LispObject form = list3(Symbol.SETF, expansion, args.car());
    506                         value = eval(form, env, thread);
     521                    Binding binding = env.getBinding(symbol);
     522                    if (binding != null) {
     523                        if (binding.value instanceof SymbolMacro) {
     524                            LispObject expansion =
     525                                ((SymbolMacro)binding.value).getExpansion();
     526                            LispObject form = list3(Symbol.SETF, expansion, args.car());
     527                            value = eval(form, env, thread);
     528                        } else {
     529                            value = eval(args.car(), env, thread);
     530                            binding.value = value;
     531                        }
    507532                    } else {
    508                         value = eval(args.car(), env, thread);
    509                         binding.value = value;
    510                     }
    511                 } else {
    512                     if (symbol.getSymbolValue() instanceof SymbolMacro) {
    513                         LispObject expansion =
    514                             ((SymbolMacro)symbol.getSymbolValue()).getExpansion();
    515                         LispObject form = list3(Symbol.SETF, expansion, args.car());
    516                         value = eval(form, env, thread);
    517                     } else {
    518                         value = eval(args.car(), env, thread);
    519                         symbol.setSymbolValue(value);
    520                     }
    521                 }
     533                        if (symbol.getSymbolValue() instanceof SymbolMacro) {
     534                            LispObject expansion =
     535                                ((SymbolMacro)symbol.getSymbolValue()).getExpansion();
     536                            LispObject form = list3(Symbol.SETF, expansion, args.car());
     537                            value = eval(form, env, thread);
     538                        } else {
     539                            value = eval(args.car(), env, thread);
     540                            symbol.setSymbolValue(value);
     541                        }
     542                    }
     543                }
     544//                 if (binding != null) {
     545//                     if (binding.value instanceof SymbolMacro) {
     546//                         LispObject expansion =
     547//                             ((SymbolMacro)binding.value).getExpansion();
     548//                         LispObject form = list3(Symbol.SETF, expansion, args.car());
     549//                         value = eval(form, env, thread);
     550//                     } else {
     551//                         value = eval(args.car(), env, thread);
     552//                         binding.value = value;
     553//                     }
     554//                 } else {
     555//                     if (symbol.getSymbolValue() instanceof SymbolMacro) {
     556//                         LispObject expansion =
     557//                             ((SymbolMacro)symbol.getSymbolValue()).getExpansion();
     558//                         LispObject form = list3(Symbol.SETF, expansion, args.car());
     559//                         value = eval(form, env, thread);
     560//                     } else {
     561//                         value = eval(args.car(), env, thread);
     562//                         symbol.setSymbolValue(value);
     563//                     }
     564//                 }
    522565                args = args.cdr();
    523566            }
  • trunk/j/src/org/armedbear/lisp/Stream.java

    r8630 r8660  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Stream.java,v 1.114 2005-02-24 00:36:12 piso Exp $
     5 * $Id: Stream.java,v 1.115 2005-02-28 02:50:04 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    11711171    {
    11721172        LispThread thread = LispThread.currentThread();
    1173         Binding lastSpecialBinding = thread.lastSpecialBinding;
     1173        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    11741174        thread.bindSpecial(_PRINT_ESCAPE_, T);
    11751175        String s = obj.writeToString();
  • trunk/j/src/org/armedbear/lisp/Symbol.java

    r8654 r8660  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Symbol.java,v 1.173 2005-02-28 00:55:56 piso Exp $
     5 * $Id: Symbol.java,v 1.174 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    268268    {
    269269        final LispThread thread = LispThread.currentThread();
    270         Binding lastSpecialBinding = thread.lastSpecialBinding;
     270        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    271271        thread.bindSpecial(_PRINT_ESCAPE_, NIL);
    272272        try {
  • trunk/j/src/org/armedbear/lisp/TypeError.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: TypeError.java,v 1.24 2004-11-13 15:02:01 piso Exp $
     5 * $Id: TypeError.java,v 1.25 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    9999        try {
    100100            final LispThread thread = LispThread.currentThread();
    101             final Binding lastSpecialBinding = thread.lastSpecialBinding;
     101            final SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    102102            thread.bindSpecial(_PRINT_ESCAPE_, T);
    103103            try {
  • trunk/j/src/org/armedbear/lisp/UnboundVariable.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: UnboundVariable.java,v 1.11 2004-11-13 15:02:01 piso Exp $
     5 * $Id: UnboundVariable.java,v 1.12 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3333    {
    3434        LispThread thread = LispThread.currentThread();
    35         Binding lastSpecialBinding = thread.lastSpecialBinding;
     35        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    3636        thread.bindSpecial(_PRINT_ESCAPE_, T);
    3737        StringBuffer sb = new StringBuffer("The variable ");
  • trunk/j/src/org/armedbear/lisp/arglist.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: arglist.java,v 1.13 2004-11-13 15:02:01 piso Exp $
     5 * $Id: arglist.java,v 1.14 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7070                // Bind *PACKAGE* so we use the EXT package if we need
    7171                // to intern any symbols.
    72                 Binding lastSpecialBinding = thread.lastSpecialBinding;
     72                SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    7373                thread.bindSpecial(_PACKAGE_, PACKAGE_EXT);
    7474                try {
  • trunk/j/src/org/armedbear/lisp/dolist.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: dolist.java,v 1.10 2004-11-13 15:02:01 piso Exp $
     5 * $Id: dolist.java,v 1.11 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3939        final LispThread thread = LispThread.currentThread();
    4040        LispObject resultForm = args.cdr().cdr().car();
    41         Binding lastSpecialBinding = thread.lastSpecialBinding;
     41        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    4242        final LispObject stack = thread.getStack();
    4343        // Process declarations.
     
    7878            ext.addBlock(NIL, new LispObject());
    7979            // Establish a reusable binding.
    80             final Binding binding;
     80            final Object binding;
    8181            if (specials != NIL && memq(var, specials)) {
    8282                thread.bindSpecial(var, null);
     
    9191            }
    9292            while (list != NIL) {
    93                 binding.value = list.car();
     93                if (binding instanceof SpecialBinding)
     94                    ((SpecialBinding)binding).value = list.car();
     95                else
     96                    ((Binding)binding).value = list.car();
    9497                LispObject body = bodyForm;
    9598                while (body != NIL) {
     
    126129                    handleInterrupt();
    127130            }
    128             binding.value = NIL;
     131            if (binding instanceof SpecialBinding)
     132                ((SpecialBinding)binding).value = NIL;
     133            else
     134                ((Binding)binding).value = NIL;
    129135            LispObject result = eval(resultForm, ext, thread);
    130136            return result;
  • trunk/j/src/org/armedbear/lisp/dotimes.java

    r8159 r8660  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: dotimes.java,v 1.13 2004-11-13 15:02:01 piso Exp $
     5 * $Id: dotimes.java,v 1.14 2005-02-28 02:50:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3838        final LispThread thread = LispThread.currentThread();
    3939        LispObject resultForm = args.cdr().cdr().car();
    40         Binding lastSpecialBinding = thread.lastSpecialBinding;
     40        SpecialBinding lastSpecialBinding = thread.lastSpecialBinding;
    4141        final LispObject stack = thread.getStack();
    4242        // Process declarations.
     
    8080            LispObject result;
    8181            // Establish a reusable binding.
    82             final Binding binding;
     82            final Object binding;
    8383            if (specials != NIL && memq(var, specials)) {
    8484                thread.bindSpecial(var, null);
     
    9696                int i;
    9797                for (i = 0; i < count; i++) {
    98                     binding.value = new Fixnum(i);
     98                    if (binding instanceof SpecialBinding)
     99                        ((SpecialBinding)binding).value = new Fixnum(i);
     100                    else
     101                        ((Binding)binding).value = new Fixnum(i);
    99102                    LispObject body = bodyForm;
    100103                    while (body != NIL) {
     
    134137                        handleInterrupt();
    135138                }
    136                 binding.value = new Fixnum(i);
     139                if (binding instanceof SpecialBinding)
     140                    ((SpecialBinding)binding).value = new Fixnum(i);
     141                else
     142                    ((Binding)binding).value = new Fixnum(i);
    137143                result = eval(resultForm, ext, thread);
    138144            } else if (limit instanceof Bignum) {
    139145                LispObject i = Fixnum.ZERO;
    140146                while (i.isLessThan(limit)) {
    141                     binding.value = i;
     147                    if (binding instanceof SpecialBinding)
     148                        ((SpecialBinding)binding).value = i;
     149                    else
     150                        ((Binding)binding).value = i;
    142151                    LispObject body = bodyForm;
    143152                    while (body != NIL) {
     
    179188                        handleInterrupt();
    180189                }
    181                 binding.value = i;
     190                if (binding instanceof SpecialBinding)
     191                    ((SpecialBinding)binding).value = i;
     192                else
     193                    ((Binding)binding).value = i;
    182194                result = eval(resultForm, ext, thread);
    183195            } else
  • trunk/j/src/org/armedbear/lisp/jvm.lisp

    r8627 r8660  
    22;;;
    33;;; Copyright (C) 2003-2005 Peter Graves
    4 ;;; $Id: jvm.lisp,v 1.403 2005-02-23 14:32:46 piso Exp $
     4;;; $Id: jvm.lisp,v 1.404 2005-02-28 02:50:05 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    944944(defconstant +lisp-simple-string+ "Lorg/armedbear/lisp/SimpleString;")
    945945(defconstant +lisp-environment+ "Lorg/armedbear/lisp/Environment;")
    946 (defconstant +lisp-binding+ "Lorg/armedbear/lisp/Binding;")
     946(defconstant +lisp-special-binding+ "Lorg/armedbear/lisp/SpecialBinding;")
    947947(defconstant +lisp-throw-class+ "org/armedbear/lisp/Throw")
    948948(defconstant +lisp-return-class+ "org/armedbear/lisp/Return")
     
    33903390      (setf (block-environment-register block) (allocate-register))
    33913391      (emit-push-current-thread)
    3392       (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+)
     3392      (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+)
    33933393      (emit 'astore (block-environment-register block)))
    33943394    ;; Make sure there are no leftover values from previous calls.
     
    34523452      (emit 'aload *thread*)
    34533453      (emit 'aload (block-environment-register block))
    3454       (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+))))
     3454      (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+))))
    34553455
    34563456(defun p2-let/let*-node (block target)
     
    34713471      (setf (block-environment-register block) (allocate-register))
    34723472      (emit-push-current-thread)
    3473       (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+)
     3473      (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+)
    34743474      (emit 'astore (block-environment-register block)))
    34753475    (ecase (car form)
     
    34873487      (emit 'aload *thread*)
    34883488      (emit 'aload (block-environment-register block))
    3489       (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+))))
     3489      (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+))))
    34903490
    34913491(defun p2-let-bindings (block)
     
    36553655      (setf environment-register (allocate-register))
    36563656      (emit-push-current-thread)
    3657       (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+)
     3657      (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+)
    36583658      (emit 'astore environment-register))
    36593659    (label BEGIN-BLOCK)
     
    37043704            (aver (fixnump environment-register))
    37053705            (emit 'aload environment-register)
    3706             (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+)
     3706            (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+)
    37073707            (emit 'goto (tag-label tag))
    37083708            (label NEXT)))
     
    37493749            (emit 'aload *thread*)
    37503750            (emit 'aload register)
    3751             (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+))
     3751            (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+))
    37523752
    37533753          ;; FIXME Not exactly the right place for this, but better than nothing.
     
    38003800             (setf (block-environment-register block) (allocate-register))
    38013801             (emit-push-current-thread)
    3802              (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+)
     3802             (emit 'getfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+)
    38033803             (emit 'astore (block-environment-register block)))
    38043804            (t
     
    38423842      (emit 'aload *thread*)
    38433843      (emit 'aload (block-environment-register block))
    3844       (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-binding+))))
     3844      (emit 'putfield +lisp-thread-class+ "lastSpecialBinding" +lisp-special-binding+))))
    38453845
    38463846(defun p2-return-from (form &key (target :stack) representation)
Note: See TracChangeset for help on using the changeset viewer.