2013-09-29 00:21:18 +04:00
|
|
|
/* j/6/ut_repo.c
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/* logic
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2015-08-28 19:34:36 +03:00
|
|
|
u3qfu_repo(u3_noun van,
|
|
|
|
u3_noun sut)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_sut, q_sut;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(sut) ) switch ( sut ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
default: return u3k(sut);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-04-22 05:22:11 +04:00
|
|
|
case c3__noun:
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nt(c3__fork,
|
2015-08-28 19:34:36 +03:00
|
|
|
u3nc(c3__atom, u3_blip),
|
|
|
|
u3nt(c3__cell, c3__noun, c3__noun));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
else switch ( u3h(sut) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
default: {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_error("repo-flat");
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
case c3__core: {
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nt(c3__cell, c3__noun, u3k(p_sut));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case c3__cube: {
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(q_sut);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case c3__face: {
|
2014-11-06 03:20:01 +03:00
|
|
|
if ( c3n == u3r_cell(u3t(sut), &p_sut, &q_sut)) {
|
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3k(q_sut);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
case c3__hold: {
|
2014-09-06 00:13:24 +04:00
|
|
|
p_sut = u3t(sut);
|
2014-11-06 22:13:57 +03:00
|
|
|
return u3qfu_rest(van, sut, p_sut);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2015-08-28 19:34:36 +03:00
|
|
|
u3wfu_repo(u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun sut;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-18 00:56:51 +03:00
|
|
|
if ( u3_none == (sut = u3r_at(u3x_sam, cor)) ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-11-06 22:13:57 +03:00
|
|
|
return u3qfu_repo(cor, sut);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|