2014-06-12 07:14:50 +04:00
|
|
|
/* j/4/by_int.c
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2014-06-12 07:14:50 +04:00
|
|
|
|
|
|
|
/* functions
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cqdb_int(
|
|
|
|
u3_noun a,
|
|
|
|
u3_noun b)
|
2014-06-12 07:14:50 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
if ( u3_nul == a ) {
|
|
|
|
return u3k(u3_nul);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
else if ( u3_nul == b ) {
|
|
|
|
return u3k(u3_nul);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a;
|
|
|
|
u3_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b;
|
2014-06-12 07:14:50 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3n == u3_cr_cell(n_a, &p_n_a, &q_n_a) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3n == u3_cr_cell(n_b, &p_n_b, &q_n_b) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3y == u3_cqc_vor(p_n_a, p_n_b) ) {
|
|
|
|
if ( c3y == u3_cr_sing(p_n_a, p_n_b) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nt(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(n_b),
|
|
|
|
u3_cqdb_int(u3k(l_a), u3k(l_b)),
|
|
|
|
u3_cqdb_int(u3k(r_a), u3k(r_b)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3y == u3_cqc_hor(p_n_b, p_n_a) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqdb_uni(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(l_a),
|
|
|
|
u3nt(
|
|
|
|
u3k(n_b),
|
|
|
|
u3k(l_b),
|
|
|
|
u3k(u3_nul))),
|
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(a),
|
|
|
|
u3k(r_b)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqdb_uni(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(r_a),
|
|
|
|
u3nt(
|
|
|
|
u3k(n_b),
|
|
|
|
u3k(u3_nul),
|
|
|
|
u3k(r_b))),
|
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(a),
|
|
|
|
u3k(l_b)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3y == u3_cr_sing(p_n_b, p_n_a) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3nt(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3k(n_b),
|
|
|
|
u3_cqdb_int(u3k(l_b), u3k(l_a)),
|
|
|
|
u3_cqdb_int(u3k(r_b), u3k(r_a)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3y == u3_cqc_hor(p_n_a, p_n_b) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqdb_uni(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(l_b),
|
|
|
|
u3nt(
|
|
|
|
u3k(n_a),
|
|
|
|
u3k(l_a),
|
|
|
|
u3k(u3_nul))),
|
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(a),
|
|
|
|
u3k(r_a)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqdb_uni(
|
2014-09-04 01:33:18 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(r_b),
|
|
|
|
u3nt(
|
|
|
|
u3k(n_a),
|
|
|
|
u3k(u3_nul),
|
|
|
|
u3k(r_a))),
|
|
|
|
u3_cqdb_int(
|
|
|
|
u3k(a),
|
|
|
|
u3k(l_a)));
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cwdb_int(
|
|
|
|
u3_noun cor)
|
2014-06-12 07:14:50 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun a, b;
|
2014-06-12 07:14:50 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cm_bail(c3__exit);
|
2014-06-12 07:14:50 +04:00
|
|
|
} else {
|
2014-09-06 00:13:24 +04:00
|
|
|
return u3_cqdb_int(a, b);
|
2014-06-12 07:14:50 +04:00
|
|
|
}
|
|
|
|
}
|