Changeset 4529


Ignore:
Timestamp:
10/25/03 16:35:13 (18 years ago)
Author:
piso
Message:

JVM compiler object table support: recall(), forget(), REMEMBER.

File:
1 edited

Legend:

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

    r4430 r4529  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.167 2003-10-17 14:08:35 piso Exp $
     5 * $Id: Lisp.java,v 1.168 2003-10-25 16:35:13 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2323
    2424import java.math.BigInteger;
     25import java.util.Hashtable;
    2526import java.util.Random;
    2627
     
    10371038        Package pkg = Packages.findPackage(packageName);
    10381039        if (pkg == null)
    1039             throw new ConditionThrowable(new LispError(packageName + " is not the name of a package"));
     1040            throw new ConditionThrowable(new LispError(packageName +
     1041                                                       " is not the name of a package"));
    10401042        return pkg.intern(name);
    10411043    }
     1044
     1045    // The jvm compiler's object table.
     1046    private static final Hashtable objectTable = new Hashtable();
     1047
     1048    public static final LispObject recall(LispString key)
     1049    {
     1050        return (LispObject) objectTable.get(((LispString)key).getValue());
     1051    }
     1052
     1053    public static final void forget(LispString key)
     1054    {
     1055        objectTable.remove(((LispString)key).getValue());
     1056    }
     1057
     1058    public static final Primitive2 REMEMBER =
     1059        new Primitive2("remember", PACKAGE_SYS, false)
     1060    {
     1061        public LispObject execute(LispObject first, LispObject second)
     1062            throws ConditionThrowable
     1063        {
     1064            objectTable.put(LispString.getValue(first), second);
     1065            return NIL;
     1066        }
     1067    };
    10421068
    10431069    public static final Symbol export(String name, Package pkg)
     
    12221248    // ### start-profiler
    12231249    public static final Primitive0 START_PROFILER =
    1224         new Primitive0("start-profiler", PACKAGE_EXT, true) {
     1250        new Primitive0("start-profiler", PACKAGE_EXT, true)
     1251    {
    12251252        public LispObject execute() throws ConditionThrowable
    12261253        {
     
    12521279    // ### stop-profiler
    12531280    public static final Primitive0 STOP_PROFILER =
    1254         new Primitive0("stop-profiler", PACKAGE_EXT, true) {
     1281        new Primitive0("stop-profiler", PACKAGE_EXT, true)
     1282    {
    12551283        public LispObject execute() throws ConditionThrowable
    12561284        {
Note: See TracChangeset for help on using the changeset viewer.