2013-09-29 00:21:18 +04:00
|
|
|
/* j/4/gas.c
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/* functions
|
|
|
|
*/
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 07:36:29 +04:00
|
|
|
u2_cqdb_gas(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun a,
|
|
|
|
u2_noun b)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
if ( u2_nul == b ) {
|
2014-08-20 08:30:55 +04:00
|
|
|
return u2k(a);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-08-20 08:30:55 +04:00
|
|
|
if ( u2_no == u2du(b) ) {
|
|
|
|
return u2_cm_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 08:30:55 +04:00
|
|
|
u2_noun i_b = u2h(b);
|
|
|
|
u2_noun t_b = u2t(b);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 08:30:55 +04:00
|
|
|
if ( u2_no == u2du(i_b) ) {
|
|
|
|
return u2_cm_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-08-20 08:30:55 +04:00
|
|
|
u2_noun pi_b = u2h(i_b);
|
|
|
|
u2_noun qi_b = u2t(i_b);
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_noun c;
|
|
|
|
|
2014-09-03 07:36:29 +04:00
|
|
|
if ( u2_none == (c = u2_cqdb_put(a, pi_b, qi_b)) ) {
|
2014-08-20 08:30:55 +04:00
|
|
|
return u2_cm_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 07:36:29 +04:00
|
|
|
u2_noun d = u2_cqdb_gas(c, t_b);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-08-20 08:30:55 +04:00
|
|
|
u2z(c);
|
2013-09-29 00:21:18 +04:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
u2_cwdb_gas(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun a, b;
|
|
|
|
|
2014-08-20 08:30:55 +04:00
|
|
|
if ( u2_no == u2_cr_mean(cor, u2_cv_sam, &b, u2_cv_con_sam, &a, 0) ) {
|
|
|
|
return u2_cm_bail(c3__exit);
|
2013-09-29 00:21:18 +04:00
|
|
|
} else {
|
2014-09-03 07:36:29 +04:00
|
|
|
return u2_cqdb_gas(a, b);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2014-09-05 23:55:16 +04:00
|
|
|
u2_noun
|
|
|
|
u2_ckdb_gas(u2_noun a, u2_noun b)
|
|
|
|
{
|
|
|
|
u2_weak c = u2_cqdb_gas(a, b);
|
|
|
|
|
|
|
|
u2z(a); u2z(b);
|
|
|
|
if ( u2_none == c ) {
|
|
|
|
return u2_cm_bail(c3__exit);
|
|
|
|
}
|
|
|
|
else return c;
|
|
|
|
}
|
|
|
|
|