shrub/jets/f/slot.c

56 lines
1.1 KiB
C
Raw Normal View History

2014-05-31 00:57:49 +04:00
/* j/6/slot.c
**
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2014-05-31 00:57:49 +04:00
/* functions
*/
2014-09-06 00:13:24 +04:00
u3_noun
2015-08-28 19:34:36 +03:00
u3qf_slot(u3_atom axe,
u3_noun vax)
2014-05-31 00:57:49 +04:00
{
2014-11-06 03:20:01 +03:00
u3_noun fag = u3r_at(axe, u3t(vax));
2014-05-31 00:57:49 +04:00
fprintf(stderr, "slot axe %d\r\n", axe);
2014-11-06 02:36:30 +03:00
if ( u3_none == fag ) {
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__exit);
2014-05-31 00:57:49 +04:00
}
else {
2014-11-06 22:13:57 +03:00
u3_noun typ = u3qfu_peek(
2014-05-31 00:57:49 +04:00
}
2014-11-06 03:20:01 +03:00
c3_w i_w, met_w = c3_min(u3r_met(3, axe), u3r_met(3, vax));
2014-05-31 00:57:49 +04:00
2014-11-05 04:18:47 +03:00
if ( c3n == _slot_fiz(axe, vax) ) {
return c3n;
2014-05-31 00:57:49 +04:00
}
for ( i_w = 0; i_w < met_w; i_w++ ) {
2014-11-06 03:20:01 +03:00
c3_y axe_y = u3r_byte(i_w, axe);
c3_y vax_y = u3r_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) ) {
2014-11-05 04:18:47 +03:00
return c3n;
2014-05-31 00:57:49 +04:00
}
}
2014-11-05 04:18:47 +03:00
return c3y;
2014-05-31 00:57:49 +04:00
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3we_slot(u3_noun cor)
2014-05-31 00:57:49 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun axe, vax;
2014-05-31 00:57:49 +04:00
2014-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam_2, &axe, u3x_sam_3, &vax, 0)) ||
2014-11-05 04:18:47 +03:00
(c3n == u3ud(axe)) ||
(c3n == u3du(vax)) )
2014-05-31 00:57:49 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2014-05-31 00:57:49 +04:00
} else {
2014-11-06 22:13:57 +03:00
return u3qf_slot(axe, vax);
2014-05-31 00:57:49 +04:00
}
}