shrub/gen164/5/mat.c

62 lines
1.3 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/3/mat.c
**
** This file is in the public domain.
*/
#include "all.h"
#include "../pit.h"
/* functions
*/
u2_noun // produce
2014-08-20 10:22:41 +04:00
j2_mby(Pt5, mat)(
2013-09-29 00:21:18 +04:00
u2_atom a) // retain
{
2014-08-20 10:22:41 +04:00
if ( 0 == a ) {
return u2nc(1, 1);
2013-09-29 00:21:18 +04:00
} else {
2014-08-20 10:22:41 +04:00
u2_atom b = j2_mbc(Pt3, met)(0, a);
u2_atom c = j2_mbc(Pt3, met)(0, b);
2013-09-29 00:21:18 +04:00
u2_atom u, v, w, x, y, z;
u2_atom p, q;
2014-08-20 10:22:41 +04:00
u = j2_mbc(Pt1, dec)(c);
v = j2_mbc(Pt1, add)(c, c);
w = j2_mbc(Pt3, bex)(c);
x = j2_mbc(Pt3, end)(0, u, b);
y = j2_mbc(Pt3, lsh)(0, u, a);
z = j2_mbc(Pt3, mix)(x, y);
2013-09-29 00:21:18 +04:00
2014-08-20 10:22:41 +04:00
p = j2_mbc(Pt1, add)(v, b);
q = j2_mbc(Pt3, cat)(0, w, z);
2013-09-29 00:21:18 +04:00
2014-08-20 10:22:41 +04:00
u2z(u);
u2z(v);
u2z(w);
u2z(x);
u2z(y);
u2z(z);
2013-09-29 00:21:18 +04:00
2014-08-20 10:22:41 +04:00
return u2nc(p, q);
2013-09-29 00:21:18 +04:00
}
}
u2_noun // transfer
2014-08-20 10:22:41 +04:00
j2_mb(Pt5, mat)(
2013-09-29 00:21:18 +04:00
u2_noun cor) // retain
{
u2_noun a;
2014-08-20 10:22:41 +04:00
if ( (u2_none == (a = u2_cr_at(u2_cv_sam, cor))) ) {
return u2_cm_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-08-20 10:22:41 +04:00
return j2_mby(Pt5, mat)(a);
2013-09-29 00:21:18 +04:00
}
}
/* structures
*/
u2_ho_jet
2013-09-29 00:21:18 +04:00
j2_mbj(Pt5, mat)[] = {
{ ".2", c3__hevy, j2_mb(Pt5, mat), Tier3, u2_none, u2_none },
{ }
};