shrub/jets/f/ut_fink.c

75 lines
1.6 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/fink.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
_cqfu_fink(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cog)
2013-09-29 00:21:18 +04:00
{
2014-11-18 00:56:51 +03:00
// u3_noun dun = u3qfu_dunq(van, "type", sut);
2014-09-06 00:13:24 +04:00
u3_noun nuc = (u3_blip == cog)
2015-08-28 19:34:36 +03:00
? u3qfu_shew(van,
u3nc(u3nc('c',
u3i_string("find-limb")),
'$'))
: u3qfu_shep(van, "find-limb", 'a', u3k(cog));
2014-09-06 00:13:24 +04:00
u3_noun pro;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
// u3t_push(u3nc(c3__mean, dun));
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, nuc));
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun hoq = u3qfu_find(van, sut, dep, way, cog);
2014-09-06 00:13:24 +04:00
u3_noun fin = u3t(hoq);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
if ( u3_nul == fin ) {
2015-06-24 01:59:48 +03:00
// u3m_p("cog", cog);
2014-11-06 03:20:01 +03:00
return u3m_error("find-none");
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
pro = u3k(u3t(fin));
u3z(hoq);
2013-09-29 00:21:18 +04:00
}
}
2014-11-18 00:56:51 +03:00
// u3t_drop();
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-09-29 00:21:18 +04:00
return pro;
}
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3wfu_fink(u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sut, dep, way, cog, van;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam_2, &dep,
2015-08-28 19:34:36 +03:00
u3x_sam_6, &way,
u3x_sam_7, &cog,
u3x_con, &van,
0)) ||
2014-11-18 00:56:51 +03:00
(u3_none == (sut = u3r_at(u3x_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_fink(van, sut, dep, way, cog);
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
u3qfu_fink(u3_noun van,
u3_noun sut,
u3_noun dep,
u3_noun way,
u3_noun cog)
2013-09-29 00:21:18 +04:00
{
2014-09-03 09:46:55 +04:00
return _cqfu_fink(van, sut, dep, way, cog);
2013-09-29 00:21:18 +04:00
}