/* functions */ u3_noun u3qf_slot(u3_atom axe, u3_noun vax) { u3_noun f*g = u3r_at(axe, u3t(vax)); fprintf(stderr, "slot axe %d\r\n", axe); if ( u3_none == f*g ) { return u3m_bail(c3__exit); } else { u3_noun typ = u3qfu_peek( } c3_w i_w, met_w = c3_min(u3r_met(3, axe), u3r_met(3, vax)); if ( c3n == _slot_fiz(axe, vax) ) { return c3n; } for ( i_w = 0; i_w < met_w; i_w++ ) { c3_y axe_y = u3r_byte(i_w, axe); c3_y vax_y = u3r_byte(i_w, vax); if ( (axe_y >= 'A') && (axe_y <= 'Z') ) axe_y = 0; if ( (vax_y >= 'A') && (vax_y <= 'Z') ) vax_y = 0; if ( axe_y && vax_y && (axe_y != vax_y) ) { return c3n; } } return c3y; }
static u2_flag _nest_fitz(u2_wire wir_r, u2_atom p_sut, u2_atom p_ref) { c3_w i_w, met_w = c3_min(u2_met(3, p_sut), u2_met(3, p_ref)); for ( i_w = 0; i_w < met_w; i_w++ ) { if ( u2_byte(i_w, p_sut) != u2_byte(i_w, p_ref) ) { return u2_no; } } return u2_yes; }
// initialize loss object // static void _lemp(u3_loss* loc_u, u3_noun hel, u3_noun hev) { loc_u->hel = hel; loc_u->lel_w = u3kb_lent(u3k(hel)); // Read hev into array. { c3_w i_w; loc_u->hev = c3_malloc(u3kb_lent(u3k(hev)) * sizeof(u3_noun)); for ( i_w = 0; u3_nul != hev; i_w++ ) { loc_u->hev[i_w] = u3h(hev); hev = u3t(hev); } loc_u->lev_w = i_w; } loc_u->kct_w = 0; loc_u->kad = c3_malloc( (1 + c3_min(loc_u->lev_w, loc_u->lel_w)) * sizeof(u3_noun)); // Compute equivalence classes. // loc_u->sev = u3_nul; { c3_w i_w; for ( i_w = 0; i_w < loc_u->lev_w; i_w++ ) { u3_noun how = loc_u->hev[i_w]; u3_noun hav; u3_noun teg; hav = u3kdb_get(u3k(loc_u->sev), u3k(how)); teg = u3nc(u3i_words(1, &i_w), (hav == u3_none) ? u3_nul : hav); loc_u->sev = u3kdb_put(loc_u->sev, u3k(how), teg); } } }
/* u3a_wealloc(): realloc in words. */ void* u3a_wealloc(void* lag_v, c3_w len_w) { if ( !lag_v ) { return u3a_malloc(len_w); } else { u3a_box* box_u = u3a_botox(lag_v); c3_w* old_w = lag_v; c3_w tiz_w = c3_min(box_u->siz_w, len_w); { c3_w* new_w = u3a_walloc(len_w); c3_w i_w; for ( i_w = 0; i_w < tiz_w; i_w++ ) { new_w[i_w] = old_w[i_w]; } u3a_wfree(lag_v); return new_w; } } }
u3_noun u3qf_fitz(u3_noun yaz, u3_noun wix) { c3_w i_w, met_w = c3_min(u3r_met(3, yaz), u3r_met(3, wix)); if ( c3n == _fitz_fiz(yaz, wix) ) { return c3n; } for ( i_w = 0; i_w < met_w; i_w++ ) { c3_y yaz_y = u3r_byte(i_w, yaz); c3_y wix_y = u3r_byte(i_w, wix); if ( (yaz_y >= 'A') && (yaz_y <= 'Z') ) yaz_y = 0; if ( (wix_y >= 'A') && (wix_y <= 'Z') ) wix_y = 0; if ( yaz_y && wix_y && (yaz_y != wix_y) ) { return c3n; } } return c3y; }
u2_noun // transfer j2_mby(Pt6, fitz)(u2_wire wir_r, u2_noun yaz, // retain u2_noun wix) // retain { c3_w i_w, met_w = c3_min(u2_met(3, yaz), u2_met(3, wix)); if ( u2_no == _fitz_fiz(wir_r, yaz, wix) ) { return u2_no; } for ( i_w = 0; i_w < met_w; i_w++ ) { c3_y yaz_y = u2_byte(i_w, yaz); c3_y wix_y = u2_byte(i_w, wix); if ( (yaz_y >= 'A') && (yaz_y <= 'Z') ) yaz_y = 0; if ( (wix_y >= 'A') && (wix_y <= 'Z') ) wix_y = 0; if ( yaz_y && wix_y && (yaz_y != wix_y) ) { return u2_no; } } return u2_yes; }