shrub/j/6/slot.c

56 lines
1.1 KiB
C
Raw Normal View History

2014-05-31 00:57:49 +04:00
/* j/6/slot.c
**
** This file is in the public domain.
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2014-05-31 00:57:49 +04:00
/* functions
*/
2014-09-04 01:33:18 +04:00
u2_noun
u2_cqf_slot(u2_atom axe, u2_noun vax)
2014-05-31 00:57:49 +04:00
{
2014-09-04 01:33:18 +04:00
u2_noun fag = u2_cr_at(axe, u2t(vax));
2014-05-31 00:57:49 +04:00
fprintf(stderr, "slot axe %d\r\n", axe);
if ( u2_none == fag ) {
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__exit);
2014-05-31 00:57:49 +04:00
}
else {
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqfu_peek(
2014-05-31 00:57:49 +04:00
}
2014-08-21 01:18:34 +04:00
c3_w i_w, met_w = c3_min(u2_cr_met(3, axe), u2_cr_met(3, vax));
2014-05-31 00:57:49 +04:00
2014-08-21 01:18:34 +04:00
if ( u2_no == _slot_fiz(axe, vax) ) {
2014-05-31 00:57:49 +04:00
return u2_no;
}
for ( i_w = 0; i_w < met_w; i_w++ ) {
2014-08-21 01:18:34 +04:00
c3_y axe_y = u2_cr_byte(i_w, axe);
c3_y vax_y = u2_cr_byte(i_w, vax);
2014-05-31 00:57:49 +04:00
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 u2_no;
}
}
return u2_yes;
}
2014-09-04 01:33:18 +04:00
u2_noun
u2_cwe_slot(u2_noun cor)
2014-05-31 00:57:49 +04:00
{
u2_noun axe, vax;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &axe, u2_cv_sam_3, &vax, 0)) ||
2014-05-31 00:57:49 +04:00
(u2_no == u2ud(axe)) ||
(u2_no == u2du(vax)) )
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2014-05-31 00:57:49 +04:00
} else {
2014-09-04 01:33:18 +04:00
return u2_cqf_slot(axe, vax);
2014-05-31 00:57:49 +04:00
}
}