Author: jimb
Date: Sun Oct 22 23:35:57 2006
New Revision: 665
Modified:
trunk/gc/environments.c
Log:
(mn_is_bound): Implement.
Modified: trunk/gc/environments.c
============================================================
==================
--- trunk/gc/environments.c (original)
+++ trunk/gc/environments.c Sun Oct 22 23:35:57 2006
 -42,9
+42,11 
(RUN-TIME . EXPAND-TIME)
- If EXPAND-TIME is mn__unique_non_value (), then the
symbol is a
- variable, and RUN-TIME is its value. Otherwise, the
symbol is a
- syntactic keyword, and EXPAND-TIME is its binding.
+ If EXPAND-TIME is not mn__unique_non_value (), then the
symbol is a
+ syntactic keyword, and EXPAND-TIME is its binding.
Otherwise, if
+ RUN-TIME is not mn__unique_non_value (), then the symbol
is a
+ variable, and RUN-TIME is its value. Otherwise, the
symbol is
+ unbound.
This arrangement makes it easy to implement the
semantics described
in <minor/minor.h> --- code that refers to a
variable can simply
 -349,7
+351,25 
bool
mn_is_bound (mn_call_t *c, mn_ref_t *env, mn_ref_t *symbol)
{
- return true;
+ bool result = false;
+
+ mn__begin_incoherent (c);
+ {
+ struct environment *e = check_environment
(env->obj);
+ check (mn__is_symbol (symbol->obj));
+
+ tagged_t binding = mn__hash_table_get (c, e->hash,
symbol->obj);
+ if (mn__is_pair (binding))
+ {
+ struct pair *b = mn__untag_pair (binding);
+ if (b->car != mn__unique_non_value ()
+ || b->cdr != mn__unique_non_value ())
+ result = true;
+ }
+ }
+ mn__end_incoherent (c);
+
+ return result;
}
_______________________________________________
Minor mailing list
Minor red-bean.com
http:/
/www.red-bean.com/mailman/listinfo/minor
|