shrub/gen164/6/ut_swab.c

61 lines
1.7 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/swab.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* internals
*/
/* functions
*/
2013-12-15 12:23:23 +04:00
u2_noun // produce
2014-09-03 09:46:55 +04:00
_cqfu_snub(u2_noun van, // retain
2013-12-15 12:23:23 +04:00
u2_noun sut, // retain
u2_noun har) // retain
{
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(har) ) {
2013-12-15 12:23:23 +04:00
return u2_nul;
} else {
2014-08-21 01:18:34 +04:00
u2_noun i_har = u2h(har);
u2_noun t_har = u2t(har);
u2_noun pi_har = u2h(i_har);
u2_noun qi_har = u2t(i_har);
2014-09-03 07:36:29 +04:00
u2_noun peh = u2_cqb_flop(pi_har);
2014-08-21 01:18:34 +04:00
u2_noun ret = u2nc(u2nc(peh, u2k(qi_har)),
2014-09-03 09:46:55 +04:00
_cqfu_snub
2014-08-21 01:18:34 +04:00
(van, sut, t_har));
2013-12-15 12:23:23 +04:00
return ret;
}
}
2013-09-29 00:21:18 +04:00
/* boilerplate
*/
2013-12-15 12:23:23 +04:00
u2_noun // transfer
2014-09-03 09:46:55 +04:00
u2_cwfu_snub(
2013-12-15 12:23:23 +04:00
u2_noun cor) // retain
{
u2_noun van, sut, har;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &har,
u2_cv_con, &van,
2013-12-15 12:23:23 +04:00
0)) ||
2014-08-21 01:18:34 +04:00
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2013-12-15 12:23:23 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_cm_bail(c3__fail);
2013-12-15 12:23:23 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_snub(van, sut, har);
2013-12-15 12:23:23 +04:00
}
}
u2_noun // transfer
2014-09-03 07:36:29 +04:00
u2_cqfu_snub(u2_noun van, // retain
2013-12-15 12:23:23 +04:00
u2_noun sut, // retain
u2_noun har) // retain
{
2014-09-03 09:46:55 +04:00
return _cqfu_snub(van, sut, har);
2013-12-15 12:23:23 +04:00
}