// // Bind_Relative_Inner_Loop: C // // Recursive function for relative function word binding. Returns TRUE if // any relative bindings were made. // static void Bind_Relative_Inner_Loop( struct Reb_Binder *binder, RELVAL *head, REBARR *paramlist, REBU64 bind_types ) { RELVAL *value = head; for (; NOT_END(value); value++) { REBU64 type_bit = FLAGIT_KIND(VAL_TYPE(value)); // The two-pass copy-and-then-bind should have gotten rid of all the // relative values to other functions during the copy. // // !!! Long term, in a single pass copy, this would have to deal // with relative values and run them through the specification // process if they were not just getting overwritten. // assert(!IS_RELATIVE(value)); if (type_bit & bind_types) { REBINT n = Try_Get_Binder_Index(binder, VAL_WORD_CANON(value)); if (n != 0) { // // Word's canon symbol is in frame. Relatively bind it. // (clear out existing binding flags first). // UNBIND_WORD(value); SET_VAL_FLAGS(value, WORD_FLAG_BOUND | VALUE_FLAG_RELATIVE); INIT_WORD_FUNC(value, AS_FUNC(paramlist)); // incomplete func INIT_WORD_INDEX(value, n); } } else if (ANY_ARRAY(value)) { Bind_Relative_Inner_Loop( binder, VAL_ARRAY_AT(value), paramlist, bind_types ); // Set the bits in the ANY-ARRAY! REBVAL to indicate that it is // relative to the function. // // !!! Technically speaking it is not necessary for an array to // be marked relative if it doesn't contain any relative words // under it. However, for uniformity in the near term, it's // easiest to debug if there is a clear mark on arrays that are // part of a deep copy of a function body either way. // SET_VAL_FLAG(value, VALUE_FLAG_RELATIVE); INIT_RELATIVE(value, AS_FUNC(paramlist)); // incomplete func } } }
*/ void Unbind_Values_Core(REBVAL value[], REBSER *frame, REBOOL deep) /* ** Unbind words in a block, optionally unbinding those which are ** bound to a particular frame (if frame is NULL, then all ** words will be unbound regardless of their VAL_WORD_FRAME). ** ***********************************************************************/ { for (; NOT_END(value); value++) { if (ANY_WORD(value) && (!frame || VAL_WORD_FRAME(value) == frame)) UNBIND_WORD(value); if (ANY_BLOCK(value) && deep) Unbind_Values_Core(VAL_BLK_DATA(value), frame, TRUE); } }
// // Unbind_Values_Core: C // // Unbind words in a block, optionally unbinding those which are // bound to a particular target (if target is NULL, then all // words will be unbound regardless of their VAL_WORD_CONTEXT). // void Unbind_Values_Core(RELVAL *head, REBCTX *context, REBOOL deep) { RELVAL *value = head; for (; NOT_END(value); value++) { if ( ANY_WORD(value) && ( !context || ( IS_WORD_BOUND(value) && !IS_RELATIVE(value) && VAL_WORD_CONTEXT(KNOWN(value)) == context ) ) ) { UNBIND_WORD(value); } else if (ANY_ARRAY(value) && deep) Unbind_Values_Core(VAL_ARRAY_AT(value), context, TRUE); } }