2013-09-29 00:21:18 +04:00
|
|
|
/* j/6/fork.c
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/* functions
|
|
|
|
*/
|
2016-01-11 06:10:47 +03:00
|
|
|
u3_noun
|
|
|
|
u3qf_forq(u3_noun hoz,
|
|
|
|
u3_noun bur)
|
|
|
|
{
|
|
|
|
if ( c3y == u3r_sing(hoz, bur) ) {
|
|
|
|
return u3k(hoz);
|
|
|
|
}
|
|
|
|
else if ( c3__void == bur ) {
|
|
|
|
return u3k(hoz);
|
|
|
|
}
|
|
|
|
else if ( c3__void == hoz ) {
|
|
|
|
return u3k(bur);
|
|
|
|
}
|
2016-01-14 12:52:50 +03:00
|
|
|
else return u3kf_fork(u3nt(u3k(hoz), u3k(bur), u3_nul));
|
2016-01-11 06:10:47 +03:00
|
|
|
}
|
2016-01-11 06:56:53 +03:00
|
|
|
|
2016-01-11 03:27:36 +03:00
|
|
|
u3_noun
|
2016-01-14 12:52:50 +03:00
|
|
|
u3qf_fork(u3_noun yed)
|
2016-01-11 03:27:36 +03:00
|
|
|
{
|
|
|
|
u3_noun lez = u3_nul;
|
|
|
|
|
|
|
|
while ( u3_nul != yed ) {
|
|
|
|
u3_noun i_yed = u3h(yed);
|
|
|
|
|
|
|
|
if ( c3__void != i_yed ) {
|
2016-01-25 01:05:55 +03:00
|
|
|
if ( (c3y == u3du(i_yed)) && (c3__fork == u3h(i_yed)) ) {
|
|
|
|
lez = u3kdi_uni(lez, u3k(u3t(i_yed)));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lez = u3kdi_put(lez, u3k(i_yed));
|
|
|
|
}
|
2016-01-11 03:27:36 +03:00
|
|
|
}
|
2016-01-25 01:05:55 +03:00
|
|
|
|
2016-01-11 03:27:36 +03:00
|
|
|
yed = u3t(yed);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( u3_nul == lez ) {
|
|
|
|
return c3__void;
|
|
|
|
}
|
|
|
|
else if ( (u3_nul == u3h(u3t(lez))) && (u3_nul == u3t(u3t(lez))) ) {
|
|
|
|
u3_noun ret = u3k(u3h(lez));
|
|
|
|
|
|
|
|
u3z(lez);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else {
|
2016-01-11 12:48:41 +03:00
|
|
|
return u3nc(c3__fork, lez);
|
2016-01-11 03:27:36 +03:00
|
|
|
}
|
|
|
|
}
|
2016-01-11 08:08:03 +03:00
|
|
|
|
2016-01-11 08:39:32 +03:00
|
|
|
u3_noun
|
2016-01-14 12:52:50 +03:00
|
|
|
u3wf_fork(u3_noun cor)
|
2016-01-11 08:39:32 +03:00
|
|
|
{
|
|
|
|
u3_noun yed;
|
|
|
|
|
|
|
|
if ( c3n == u3r_mean(cor, u3x_sam, &yed, 0) ) {
|
|
|
|
return u3m_bail(c3__fail);
|
|
|
|
} else {
|
2016-01-14 12:52:50 +03:00
|
|
|
return u3qf_fork(yed);
|
2016-01-11 08:39:32 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-11 08:08:03 +03:00
|
|
|
u3_noun
|
2016-01-14 12:52:50 +03:00
|
|
|
u3kf_fork(u3_noun yed)
|
2016-01-11 08:08:03 +03:00
|
|
|
{
|
2016-01-14 12:52:50 +03:00
|
|
|
u3_noun ret = u3qf_fork(yed);
|
2016-01-11 08:08:03 +03:00
|
|
|
|
|
|
|
u3z(yed);
|
|
|
|
return ret;
|
|
|
|
}
|