Another great renaming.

This commit is contained in:
C. Guy Yarvin 2014-11-05 16:20:01 -08:00
parent 138711c7cd
commit 4855a9d1d8
174 changed files with 3905 additions and 3915 deletions

View File

@ -168,7 +168,6 @@ In short, use `_()` to turn a loobean into a boolean, `__` to go
the other way. Use `!` as usual, `c3y` for yes and `c3n` for no, the other way. Use `!` as usual, `c3y` for yes and `c3n` for no,
`c3a` for and and `c3o` for or. `c3a` for and and `c3o` for or.
## u3: introduction to the noun world ## u3: introduction to the noun world

554
g/a.c

File diff suppressed because it is too large Load Diff

206
g/e.c
View File

@ -17,7 +17,7 @@
struct { struct {
c3_w nor_w; c3_w nor_w;
c3_w sou_w; c3_w sou_w;
c3_w mug_w[u3_ca_pages]; c3_w mug_w[u3a_pages];
} u3K; } u3K;
/* _ce_check_page(): checksum page. /* _ce_check_page(): checksum page.
@ -25,16 +25,16 @@ struct {
static c3_w static c3_w
_ce_check_page(c3_w pag_w) _ce_check_page(c3_w pag_w)
{ {
c3_w* mem_w = u3_Loom + (pag_w << u3_ca_page); c3_w* mem_w = u3_Loom + (pag_w << u3a_page);
c3_w mug_w = u3_cr_mug_words(mem_w, (1 << u3_ca_page)); c3_w mug_w = u3r_mug_words(mem_w, (1 << u3a_page));
return mug_w; return mug_w;
} }
/* u3_ce_check(): compute a checksum on all memory within the watermarks. /* u3e_check(): compute a checksum on all memory within the watermarks.
*/ */
void void
u3_ce_check(c3_c* cap_c) u3e_check(c3_c* cap_c)
{ {
c3_w nor_w = 0; c3_w nor_w = 0;
c3_w sou_w = 0; c3_w sou_w = 0;
@ -42,10 +42,10 @@ u3_ce_check(c3_c* cap_c)
{ {
c3_w nwr_w, swu_w; c3_w nwr_w, swu_w;
u3_cm_water(&nwr_w, &swu_w); u3m_water(&nwr_w, &swu_w);
nor_w = (nwr_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; nor_w = (nwr_w + ((1 << u3a_page) - 1)) >> u3a_page;
sou_w = (swu_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; sou_w = (swu_w + ((1 << u3a_page) - 1)) >> u3a_page;
} }
/* Count dirty pages. /* Count dirty pages.
@ -62,9 +62,9 @@ u3_ce_check(c3_c* cap_c)
sum_w += mug_w; sum_w += mug_w;
} }
for ( i_w = 0; i_w < sou_w; i_w++ ) { for ( i_w = 0; i_w < sou_w; i_w++ ) {
mug_w = _ce_check_page((u3_ca_pages - (i_w + 1))); mug_w = _ce_check_page((u3a_pages - (i_w + 1)));
if ( strcmp(cap_c, "boot") ) { if ( strcmp(cap_c, "boot") ) {
c3_assert(mug_w == u3K.mug_w[(u3_ca_pages - (i_w + 1))]); c3_assert(mug_w == u3K.mug_w[(u3a_pages - (i_w + 1))]);
} }
sum_w += mug_w; sum_w += mug_w;
} }
@ -73,21 +73,21 @@ u3_ce_check(c3_c* cap_c)
} }
#endif #endif
/* u3_ce_fault(): handle a memory event with libsigsegv protocol. /* u3e_fault(): handle a memory event with libsigsegv protocol.
*/ */
c3_i c3_i
u3_ce_fault(void* adr_v, c3_i ser_i) u3e_fault(void* adr_v, c3_i ser_i)
{ {
c3_w* adr_w = (c3_w*) adr_v; c3_w* adr_w = (c3_w*) adr_v;
if ( (adr_w < u3_Loom) || (adr_w > (u3_Loom + u3_ca_words)) ) { if ( (adr_w < u3_Loom) || (adr_w > (u3_Loom + u3a_words)) ) {
fprintf(stderr, "address %p out of loom!\r\n", adr_v); fprintf(stderr, "address %p out of loom!\r\n", adr_v);
c3_assert(0); c3_assert(0);
return 0; return 0;
} }
else { else {
c3_w off_w = (adr_w - u3_Loom); c3_w off_w = (adr_w - u3_Loom);
c3_w pag_w = off_w >> u3_ca_page; c3_w pag_w = off_w >> u3a_page;
c3_w blk_w = (pag_w >> 5); c3_w blk_w = (pag_w >> 5);
c3_w bit_w = (pag_w & 31); c3_w bit_w = (pag_w & 31);
@ -95,8 +95,8 @@ u3_ce_fault(void* adr_v, c3_i ser_i)
c3_assert(0 == (u3P.dit_w[blk_w] & (1 << bit_w))); c3_assert(0 == (u3P.dit_w[blk_w] & (1 << bit_w)));
u3P.dit_w[blk_w] |= (1 << bit_w); u3P.dit_w[blk_w] |= (1 << bit_w);
if ( -1 == mprotect((void *)(u3_Loom + (pag_w << u3_ca_page)), if ( -1 == mprotect((void *)(u3_Loom + (pag_w << u3a_page)),
(1 << (u3_ca_page + 2)), (1 << (u3a_page + 2)),
(PROT_READ | PROT_WRITE)) ) (PROT_READ | PROT_WRITE)) )
{ {
perror("mprotect"); perror("mprotect");
@ -110,7 +110,7 @@ u3_ce_fault(void* adr_v, c3_i ser_i)
/* _ce_image_open(): open or create image. /* _ce_image_open(): open or create image.
*/ */
static c3_o static c3_o
_ce_image_open(u3_ce_image* img_u, c3_o nuu_o) _ce_image_open(u3e_image* img_u, c3_o nuu_o)
{ {
c3_i mod_i = _(nuu_o) ? (O_RDWR | O_CREAT) : O_RDWR; c3_i mod_i = _(nuu_o) ? (O_RDWR | O_CREAT) : O_RDWR;
c3_c ful_c[8193]; c3_c ful_c[8193];
@ -139,8 +139,8 @@ _ce_image_open(u3_ce_image* img_u, c3_o nuu_o)
} }
else { else {
c3_d siz_d = buf_u.st_size; c3_d siz_d = buf_u.st_size;
c3_d pgs_d = (siz_d + (c3_d)((1 << (u3_ca_page + 2)) - 1)) >> c3_d pgs_d = (siz_d + (c3_d)((1 << (u3a_page + 2)) - 1)) >>
(c3_d)(u3_ca_page + 2); (c3_d)(u3a_page + 2);
if ( c3y == nuu_o ) { if ( c3y == nuu_o ) {
if ( siz_d ) { if ( siz_d ) {
@ -150,7 +150,7 @@ _ce_image_open(u3_ce_image* img_u, c3_o nuu_o)
return c3y; return c3y;
} }
else { else {
if ( siz_d != (pgs_d << (c3_d)(u3_ca_page + 2)) ) { if ( siz_d != (pgs_d << (c3_d)(u3a_page + 2)) ) {
fprintf(stderr, "%s: corrupt size %llx\r\n", ful_c, siz_d); fprintf(stderr, "%s: corrupt size %llx\r\n", ful_c, siz_d);
return c3n; return c3n;
} }
@ -168,8 +168,8 @@ _ce_image_open(u3_ce_image* img_u, c3_o nuu_o)
static void static void
_ce_patch_write_control(u3_cs_patch* pat_u) _ce_patch_write_control(u3_cs_patch* pat_u)
{ {
c3_w len_w = sizeof(u3_ce_control) + c3_w len_w = sizeof(u3e_control) +
(pat_u->con_u->pgs_w * sizeof(u3_ce_line)); (pat_u->con_u->pgs_w * sizeof(u3e_line));
if ( len_w != write(pat_u->ctl_i, pat_u->con_u, len_w) ) { if ( len_w != write(pat_u->ctl_i, pat_u->con_u, len_w) ) {
c3_assert(0); c3_assert(0);
@ -196,8 +196,8 @@ _ce_patch_read_control(u3_cs_patch* pat_u)
pat_u->con_u = malloc(len_w); pat_u->con_u = malloc(len_w);
if ( (len_w != read(pat_u->ctl_i, pat_u->con_u, len_w)) || if ( (len_w != read(pat_u->ctl_i, pat_u->con_u, len_w)) ||
(len_w != sizeof(u3_ce_control) + (len_w != sizeof(u3e_control) +
(pat_u->con_u->pgs_w * sizeof(u3_ce_line))) ) (pat_u->con_u->pgs_w * sizeof(u3e_line))) )
{ {
free(pat_u->con_u); free(pat_u->con_u);
pat_u->con_u = 0; pat_u->con_u = 0;
@ -254,20 +254,20 @@ _ce_patch_verify(u3_cs_patch* pat_u)
for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) { for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) {
c3_w pag_w = pat_u->con_u->mem_u[i_w].pag_w; c3_w pag_w = pat_u->con_u->mem_u[i_w].pag_w;
c3_w mug_w = pat_u->con_u->mem_u[i_w].mug_w; c3_w mug_w = pat_u->con_u->mem_u[i_w].mug_w;
c3_w mem_w[1 << u3_ca_page]; c3_w mem_w[1 << u3a_page];
if ( -1 == lseek(pat_u->mem_i, (i_w << (u3_ca_page + 2)), SEEK_SET) ) { if ( -1 == lseek(pat_u->mem_i, (i_w << (u3a_page + 2)), SEEK_SET) ) {
perror("seek"); perror("seek");
c3_assert(0); c3_assert(0);
return c3n; return c3n;
} }
if ( -1 == read(pat_u->mem_i, mem_w, (1 << (u3_ca_page + 2))) ) { if ( -1 == read(pat_u->mem_i, mem_w, (1 << (u3a_page + 2))) ) {
perror("read"); perror("read");
c3_assert(0); c3_assert(0);
return c3n; return c3n;
} }
{ {
c3_w nug_w = u3_cr_mug_words(mem_w, (1 << u3_ca_page)); c3_w nug_w = u3r_mug_words(mem_w, (1 << u3a_page));
if ( mug_w != nug_w ) { if ( mug_w != nug_w ) {
printf("_ce_patch_verify: mug mismatch %d/%d; (%x, %x)\r\n", printf("_ce_patch_verify: mug mismatch %d/%d; (%x, %x)\r\n",
@ -351,11 +351,11 @@ _ce_patch_write_page(u3_cs_patch* pat_u,
c3_w pgc_w, c3_w pgc_w,
c3_w* mem_w) c3_w* mem_w)
{ {
if ( -1 == lseek(pat_u->mem_i, (pgc_w << (u3_ca_page + 2)), SEEK_SET) ) { if ( -1 == lseek(pat_u->mem_i, (pgc_w << (u3a_page + 2)), SEEK_SET) ) {
c3_assert(0); c3_assert(0);
} }
if ( (1 << (u3_ca_page + 2)) != if ( (1 << (u3a_page + 2)) !=
write(pat_u->mem_i, mem_w, (1 << (u3_ca_page + 2))) ) write(pat_u->mem_i, mem_w, (1 << (u3a_page + 2))) )
{ {
c3_assert(0); c3_assert(0);
} }
@ -387,21 +387,21 @@ _ce_patch_save_page(u3_cs_patch* pat_u,
c3_w bit_w = (pag_w & 31); c3_w bit_w = (pag_w & 31);
if ( u3P.dit_w[blk_w] & (1 << bit_w) ) { if ( u3P.dit_w[blk_w] & (1 << bit_w) ) {
c3_w* mem_w = u3_Loom + (pag_w << u3_ca_page); c3_w* mem_w = u3_Loom + (pag_w << u3a_page);
pat_u->con_u->mem_u[pgc_w].pag_w = pag_w; pat_u->con_u->mem_u[pgc_w].pag_w = pag_w;
pat_u->con_u->mem_u[pgc_w].mug_w = u3_cr_mug_words(mem_w, pat_u->con_u->mem_u[pgc_w].mug_w = u3r_mug_words(mem_w,
(1 << u3_ca_page)); (1 << u3a_page));
#if 0 #if 0
u3K.mug_w[pag_w] = pat_u->con_u->mem_u[pgc_w].mug_w; u3K.mug_w[pag_w] = pat_u->con_u->mem_u[pgc_w].mug_w;
printf("save: page %d, mug %x\r\n", printf("save: page %d, mug %x\r\n",
pag_w, u3_cr_mug_words(mem_w, (1 << u3_ca_page))); pag_w, u3r_mug_words(mem_w, (1 << u3a_page)));
#endif #endif
_ce_patch_write_page(pat_u, pgc_w, mem_w); _ce_patch_write_page(pat_u, pgc_w, mem_w);
if ( -1 == mprotect(u3_Loom + (pag_w << u3_ca_page), if ( -1 == mprotect(u3_Loom + (pag_w << u3a_page),
(1 << (u3_ca_page + 2)), (1 << (u3a_page + 2)),
PROT_READ) ) PROT_READ) )
{ {
c3_assert(0); c3_assert(0);
@ -422,8 +422,8 @@ _ce_patch_junk_page(u3_cs_patch* pat_u,
c3_w blk_w = (pag_w >> 5); c3_w blk_w = (pag_w >> 5);
c3_w bit_w = (pag_w & 31); c3_w bit_w = (pag_w & 31);
if ( -1 == mprotect(u3_Loom + (pag_w << u3_ca_page), if ( -1 == mprotect(u3_Loom + (pag_w << u3a_page),
(1 << (u3_ca_page + 2)), (1 << (u3a_page + 2)),
PROT_READ) ) PROT_READ) )
{ {
c3_assert(0); c3_assert(0);
@ -431,10 +431,10 @@ _ce_patch_junk_page(u3_cs_patch* pat_u,
u3P.dit_w[blk_w] &= ~(1 << bit_w); u3P.dit_w[blk_w] &= ~(1 << bit_w);
} }
/* u3_ce_dirty(): count dirty pages. /* u3e_dirty(): count dirty pages.
*/ */
c3_w c3_w
u3_ce_dirty(void) u3e_dirty(void)
{ {
c3_w pgs_w = 0; c3_w pgs_w = 0;
c3_w nor_w = 0; c3_w nor_w = 0;
@ -445,10 +445,10 @@ u3_ce_dirty(void)
{ {
c3_w nwr_w, swu_w; c3_w nwr_w, swu_w;
u3_cm_water(&nwr_w, &swu_w); u3m_water(&nwr_w, &swu_w);
nor_w = (nwr_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; nor_w = (nwr_w + ((1 << u3a_page) - 1)) >> u3a_page;
sou_w = (swu_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; sou_w = (swu_w + ((1 << u3a_page) - 1)) >> u3a_page;
} }
// u3K.nor_w = nor_w; // u3K.nor_w = nor_w;
// u3K.sou_w = sou_w; // u3K.sou_w = sou_w;
@ -462,7 +462,7 @@ u3_ce_dirty(void)
pgs_w = _ce_patch_count_page(i_w, pgs_w); pgs_w = _ce_patch_count_page(i_w, pgs_w);
} }
for ( i_w = 0; i_w < sou_w; i_w++ ) { for ( i_w = 0; i_w < sou_w; i_w++ ) {
pgs_w = _ce_patch_count_page((u3_ca_pages - (i_w + 1)), pgs_w); pgs_w = _ce_patch_count_page((u3a_pages - (i_w + 1)), pgs_w);
} }
} }
return pgs_w; return pgs_w;
@ -482,10 +482,10 @@ _ce_patch_compose(void)
{ {
c3_w nwr_w, swu_w; c3_w nwr_w, swu_w;
u3_cm_water(&nwr_w, &swu_w); u3m_water(&nwr_w, &swu_w);
nor_w = (nwr_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; nor_w = (nwr_w + ((1 << u3a_page) - 1)) >> u3a_page;
sou_w = (swu_w + ((1 << u3_ca_page) - 1)) >> u3_ca_page; sou_w = (swu_w + ((1 << u3a_page) - 1)) >> u3a_page;
} }
// u3K.nor_w = nor_w; // u3K.nor_w = nor_w;
// u3K.sou_w = sou_w; // u3K.sou_w = sou_w;
@ -499,7 +499,7 @@ _ce_patch_compose(void)
pgs_w = _ce_patch_count_page(i_w, pgs_w); pgs_w = _ce_patch_count_page(i_w, pgs_w);
} }
for ( i_w = 0; i_w < sou_w; i_w++ ) { for ( i_w = 0; i_w < sou_w; i_w++ ) {
pgs_w = _ce_patch_count_page((u3_ca_pages - (i_w + 1)), pgs_w); pgs_w = _ce_patch_count_page((u3a_pages - (i_w + 1)), pgs_w);
} }
} }
@ -512,16 +512,16 @@ _ce_patch_compose(void)
c3_w i_w, pgc_w; c3_w i_w, pgc_w;
_ce_patch_create(pat_u); _ce_patch_create(pat_u);
pat_u->con_u = malloc(sizeof(u3_ce_control) + (pgs_w * sizeof(u3_ce_line))); pat_u->con_u = malloc(sizeof(u3e_control) + (pgs_w * sizeof(u3e_line)));
pgc_w = 0; pgc_w = 0;
for ( i_w = 0; i_w < nor_w; i_w++ ) { for ( i_w = 0; i_w < nor_w; i_w++ ) {
pgc_w = _ce_patch_save_page(pat_u, i_w, pgc_w); pgc_w = _ce_patch_save_page(pat_u, i_w, pgc_w);
} }
for ( i_w = 0; i_w < sou_w; i_w++ ) { for ( i_w = 0; i_w < sou_w; i_w++ ) {
pgc_w = _ce_patch_save_page(pat_u, (u3_ca_pages - (i_w + 1)), pgc_w); pgc_w = _ce_patch_save_page(pat_u, (u3a_pages - (i_w + 1)), pgc_w);
} }
for ( i_w = nor_w; i_w < (u3_ca_pages - sou_w); i_w++ ) { for ( i_w = nor_w; i_w < (u3a_pages - sou_w); i_w++ ) {
_ce_patch_junk_page(pat_u, i_w); _ce_patch_junk_page(pat_u, i_w);
} }
@ -562,7 +562,7 @@ _ce_patch_sync(u3_cs_patch* pat_u)
/* _ce_image_sync(): make sure image is synced to disk. /* _ce_image_sync(): make sure image is synced to disk.
*/ */
static void static void
_ce_image_sync(u3_ce_image* img_u) _ce_image_sync(u3e_image* img_u)
{ {
_ce_sync(img_u->fid_i); _ce_sync(img_u->fid_i);
} }
@ -578,12 +578,12 @@ _ce_patch_apply(u3_cs_patch* pat_u)
//printf("image: sou_w %d, new %d\r\n", u3P.sou_u.pgs_w, pat_u->con_u->sou_w); //printf("image: sou_w %d, new %d\r\n", u3P.sou_u.pgs_w, pat_u->con_u->sou_w);
if ( u3P.nor_u.pgs_w > pat_u->con_u->nor_w ) { if ( u3P.nor_u.pgs_w > pat_u->con_u->nor_w ) {
ftruncate(u3P.nor_u.fid_i, u3P.nor_u.pgs_w << (u3_ca_page + 2)); ftruncate(u3P.nor_u.fid_i, u3P.nor_u.pgs_w << (u3a_page + 2));
} }
u3P.nor_u.pgs_w = pat_u->con_u->nor_w; u3P.nor_u.pgs_w = pat_u->con_u->nor_w;
if ( u3P.sou_u.pgs_w > pat_u->con_u->sou_w ) { if ( u3P.sou_u.pgs_w > pat_u->con_u->sou_w ) {
ftruncate(u3P.sou_u.fid_i, u3P.sou_u.pgs_w << (u3_ca_page + 2)); ftruncate(u3P.sou_u.fid_i, u3P.sou_u.pgs_w << (u3a_page + 2));
} }
u3P.sou_u.pgs_w = pat_u->con_u->sou_w; u3P.sou_u.pgs_w = pat_u->con_u->sou_w;
@ -597,7 +597,7 @@ _ce_patch_apply(u3_cs_patch* pat_u)
for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) { for ( i_w = 0; i_w < pat_u->con_u->pgs_w; i_w++ ) {
c3_w pag_w = pat_u->con_u->mem_u[i_w].pag_w; c3_w pag_w = pat_u->con_u->mem_u[i_w].pag_w;
c3_w mem_w[1 << u3_ca_page]; c3_w mem_w[1 << u3a_page];
c3_i fid_i; c3_i fid_i;
c3_w off_w; c3_w off_w;
@ -607,25 +607,25 @@ _ce_patch_apply(u3_cs_patch* pat_u)
} }
else { else {
fid_i = u3P.sou_u.fid_i; fid_i = u3P.sou_u.fid_i;
off_w = (u3_ca_pages - (pag_w + 1)); off_w = (u3a_pages - (pag_w + 1));
} }
if ( -1 == read(pat_u->mem_i, mem_w, (1 << (u3_ca_page + 2))) ) { if ( -1 == read(pat_u->mem_i, mem_w, (1 << (u3a_page + 2))) ) {
perror("apply: read"); perror("apply: read");
c3_assert(0); c3_assert(0);
} }
else { else {
if ( -1 == lseek(fid_i, (off_w << (u3_ca_page + 2)), SEEK_SET) ) { if ( -1 == lseek(fid_i, (off_w << (u3a_page + 2)), SEEK_SET) ) {
perror("apply: lseek"); perror("apply: lseek");
c3_assert(0); c3_assert(0);
} }
if ( -1 == write(fid_i, mem_w, (1 << (u3_ca_page + 2))) ) { if ( -1 == write(fid_i, mem_w, (1 << (u3a_page + 2))) ) {
perror("apply: write"); perror("apply: write");
c3_assert(0); c3_assert(0);
} }
} }
#if 0 #if 0
printf("apply: %d, %x\n", pag_w, u3_cr_mug_words(mem_w, (1 << u3_ca_page))); printf("apply: %d, %x\n", pag_w, u3r_mug_words(mem_w, (1 << u3a_page)));
#endif #endif
} }
} }
@ -633,7 +633,7 @@ _ce_patch_apply(u3_cs_patch* pat_u)
/* _ce_image_blit(): apply image to memory. /* _ce_image_blit(): apply image to memory.
*/ */
static void static void
_ce_image_blit(u3_ce_image* img_u, _ce_image_blit(u3e_image* img_u,
c3_w* ptr_w, c3_w* ptr_w,
c3_ws stp_ws) c3_ws stp_ws)
{ {
@ -641,17 +641,17 @@ _ce_image_blit(u3_ce_image* img_u,
lseek(img_u->fid_i, 0, SEEK_SET); lseek(img_u->fid_i, 0, SEEK_SET);
for ( i_w=0; i_w < img_u->pgs_w; i_w++ ) { for ( i_w=0; i_w < img_u->pgs_w; i_w++ ) {
if ( -1 == read(img_u->fid_i, ptr_w, (1 << (u3_ca_page + 2))) ) { if ( -1 == read(img_u->fid_i, ptr_w, (1 << (u3a_page + 2))) ) {
perror("read"); perror("read");
c3_assert(0); c3_assert(0);
} }
#if 0 #if 0
{ {
c3_w off_w = (ptr_w - u3_Loom); c3_w off_w = (ptr_w - u3_Loom);
c3_w pag_w = (off_w >> u3_ca_page); c3_w pag_w = (off_w >> u3a_page);
printf("blit: page %d, mug %x\r\n", pag_w, printf("blit: page %d, mug %x\r\n", pag_w,
u3_cr_mug_words(ptr_w, (1 << u3_ca_page))); u3r_mug_words(ptr_w, (1 << u3a_page)));
} }
#endif #endif
ptr_w += stp_ws; ptr_w += stp_ws;
@ -662,26 +662,26 @@ _ce_image_blit(u3_ce_image* img_u,
/* _ce_image_fine(): compare image to memory. /* _ce_image_fine(): compare image to memory.
*/ */
static void static void
_ce_image_fine(u3_ce_image* img_u, _ce_image_fine(u3e_image* img_u,
c3_w* ptr_w, c3_w* ptr_w,
c3_ws stp_ws) c3_ws stp_ws)
{ {
c3_w i_w; c3_w i_w;
c3_w buf_w[1 << u3_ca_page]; c3_w buf_w[1 << u3a_page];
lseek(img_u->fid_i, 0, SEEK_SET); lseek(img_u->fid_i, 0, SEEK_SET);
for ( i_w=0; i_w < img_u->pgs_w; i_w++ ) { for ( i_w=0; i_w < img_u->pgs_w; i_w++ ) {
c3_w mem_w, fil_w; c3_w mem_w, fil_w;
if ( -1 == read(img_u->fid_i, buf_w, (1 << (u3_ca_page + 2))) ) { if ( -1 == read(img_u->fid_i, buf_w, (1 << (u3a_page + 2))) ) {
perror("read"); perror("read");
c3_assert(0); c3_assert(0);
} }
mem_w = u3_cr_mug_words(ptr_w, (1 << u3_ca_page)); mem_w = u3r_mug_words(ptr_w, (1 << u3a_page));
fil_w = u3_cr_mug_words(buf_w, (1 << u3_ca_page)); fil_w = u3r_mug_words(buf_w, (1 << u3a_page));
if ( mem_w != fil_w ) { if ( mem_w != fil_w ) {
c3_w pag_w = (ptr_w - u3_Loom) >> u3_ca_page; c3_w pag_w = (ptr_w - u3_Loom) >> u3a_page;
fprintf(stderr, "mismatch: page %d, mem_w %x, fil_w %x, K %x\r\n", fprintf(stderr, "mismatch: page %d, mem_w %x, fil_w %x, K %x\r\n",
pag_w, pag_w,
@ -695,10 +695,10 @@ _ce_image_fine(u3_ce_image* img_u,
} }
#endif #endif
/* u3_ce_save(): save current changes. /* u3e_save(): save current changes.
*/ */
void void
u3_ce_save(void) u3e_save(void)
{ {
u3_cs_patch* pat_u; u3_cs_patch* pat_u;
@ -714,7 +714,7 @@ u3_ce_save(void)
// Sync the patch files. // Sync the patch files.
// //
// u3_ca_print_memory("sync: save", 4096 * pat_u->con_u->pgs_w); // u3a_print_memory("sync: save", 4096 * pat_u->con_u->pgs_w);
_ce_patch_sync(pat_u); _ce_patch_sync(pat_u);
// Verify the patch - because why not? // Verify the patch - because why not?
@ -731,11 +731,11 @@ u3_ce_save(void)
{ {
_ce_image_fine(&u3P.nor_u, _ce_image_fine(&u3P.nor_u,
u3_Loom, u3_Loom,
(1 << u3_ca_page)); (1 << u3a_page));
_ce_image_fine(&u3P.sou_u, _ce_image_fine(&u3P.sou_u,
(u3_Loom + (1 << u3_ca_bits) - (1 << u3_ca_page)), (u3_Loom + (1 << u3a_bits) - (1 << u3a_page)),
-(1 << u3_ca_page)); -(1 << u3a_page));
c3_assert(u3P.nor_u.pgs_w == u3K.nor_w); c3_assert(u3P.nor_u.pgs_w == u3K.nor_w);
c3_assert(u3P.sou_u.pgs_w == u3K.sou_w); c3_assert(u3P.sou_u.pgs_w == u3K.sou_w);
@ -814,17 +814,17 @@ _ce_limits(void)
static void static void
_ce_signals(void) _ce_signals(void)
{ {
if ( 0 != sigsegv_install_handler(u3_ce_fault) ) { if ( 0 != sigsegv_install_handler(u3e_fault) ) {
fprintf(stderr, "sigsegv install failed\n"); fprintf(stderr, "sigsegv install failed\n");
exit(1); exit(1);
} }
// signal(SIGINT, _loom_stop); // signal(SIGINT, _loom_stop);
} }
/* u3_ce_init(): start the environment, with/without checkpointing. /* u3e_init(): start the environment, with/without checkpointing.
*/ */
void void
u3_ce_init(c3_o chk_o) u3e_init(c3_o chk_o)
{ {
_ce_limits(); _ce_limits();
_ce_signals(); _ce_signals();
@ -832,7 +832,7 @@ u3_ce_init(c3_o chk_o)
/* Map at fixed address. /* Map at fixed address.
*/ */
{ {
c3_w len_w = u3_ca_bytes; c3_w len_w = u3a_bytes;
void* map_v; void* map_v;
map_v = mmap((void *)u3_Loom, map_v = mmap((void *)u3_Loom,
@ -859,16 +859,16 @@ u3_ce_init(c3_o chk_o)
} }
} }
/* u3_ce_grab(): garbage-collect the world, plus extra roots, then /* u3e_grab(): garbage-collect the world, plus extra roots, then
*/ */
void void
u3_ce_grab(c3_c* cap_c, u3_noun som, ...) // terminate with u3_none u3e_grab(c3_c* cap_c, u3_noun som, ...) // terminate with u3_none
{ {
// u3_ch_free(u3R->cax.har_p); // u3h_free(u3R->cax.har_p);
// u3R->cax.har_p = u3_ch_new(); // u3R->cax.har_p = u3h_new();
u3_cv_mark(); u3v_mark();
u3_cm_mark(); u3m_mark();
{ {
va_list vap; va_list vap;
u3_noun tur; u3_noun tur;
@ -876,23 +876,23 @@ u3_ce_grab(c3_c* cap_c, u3_noun som, ...) // terminate with u3_none
va_start(vap, som); va_start(vap, som);
if ( som != u3_none ) { if ( som != u3_none ) {
u3_ca_mark_noun(som); u3a_mark_noun(som);
while ( u3_none != (tur = va_arg(vap, u3_noun)) ) { while ( u3_none != (tur = va_arg(vap, u3_noun)) ) {
u3_ca_mark_noun(tur); u3a_mark_noun(tur);
} }
} }
va_end(vap); va_end(vap);
} }
u3_ca_sweep(cap_c); u3a_sweep(cap_c);
} }
/* u3_ce_boot(): start the u3 system. /* u3e_boot(): start the u3 system.
*/ */
void void
u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c) u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
{ {
u3_ce_init(nuu_o); u3e_init(nuu_o);
u3P.cpu_c = cpu_c; u3P.cpu_c = cpu_c;
u3P.nor_u.nam_c = "north"; u3P.nor_u.nam_c = "north";
@ -943,13 +943,13 @@ u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
{ {
_ce_image_blit(&u3P.nor_u, _ce_image_blit(&u3P.nor_u,
u3_Loom, u3_Loom,
(1 << u3_ca_page)); (1 << u3a_page));
_ce_image_blit(&u3P.sou_u, _ce_image_blit(&u3P.sou_u,
(u3_Loom + (1 << u3_ca_bits) - (1 << u3_ca_page)), (u3_Loom + (1 << u3a_bits) - (1 << u3a_page)),
-(1 << u3_ca_page)); -(1 << u3a_page));
if ( 0 != mprotect((void *)u3_Loom, u3_ca_bytes, PROT_READ) ) { if ( 0 != mprotect((void *)u3_Loom, u3a_bytes, PROT_READ) ) {
perror("protect"); perror("protect");
c3_assert(0); c3_assert(0);
} }
@ -966,11 +966,11 @@ u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
/* Construct or activate the allocator. /* Construct or activate the allocator.
*/ */
u3_cm_boot(nuu_o, bug_o); u3m_boot(nuu_o, bug_o);
/* Initialize the jet system. /* Initialize the jet system.
*/ */
u3_cj_boot(); u3j_boot();
/* Install the kernel. /* Install the kernel.
*/ */
@ -983,12 +983,12 @@ u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
snprintf(pas_c, 2048, "%s/urbit.pill", U3_LIB); snprintf(pas_c, 2048, "%s/urbit.pill", U3_LIB);
} }
printf("boot: loading %s\r\n", pas_c); printf("boot: loading %s\r\n", pas_c);
u3_cv_make(pas_c); u3v_make(pas_c);
u3_cv_jack(); u3v_jack();
} }
else { else {
u3_cv_hose(); u3v_hose();
u3_cj_ream(); u3j_ream();
} }
} }

294
g/h.c
View File

@ -7,13 +7,13 @@
static void* _ch_some_add(void* han_v, c3_w, c3_w, u3_noun); static void* _ch_some_add(void* han_v, c3_w, c3_w, u3_noun);
static void* _ch_some_new(c3_w lef_w); static void* _ch_some_new(c3_w lef_w);
/* u3_ch_new(): create hashtable. /* u3h_new(): create hashtable.
*/ */
u3p(u3_ch_root) u3p(u3h_root)
u3_ch_new(void) u3h_new(void)
{ {
u3_ch_root* har_u = u3_ca_walloc(c3_wiseof(u3_ch_root)); u3h_root* har_u = u3a_walloc(c3_wiseof(u3h_root));
u3p(u3_ch_root) har_p = u3of(u3_ch_root, har_u); u3p(u3h_root) har_p = u3of(u3h_root, har_u);
c3_w i_w; c3_w i_w;
har_u->clk_w = 0; har_u->clk_w = 0;
@ -33,10 +33,10 @@ _ch_popcount(c3_w num_w)
/* _ch_buck_new(): create new, empty bucket. /* _ch_buck_new(): create new, empty bucket.
*/ */
static u3_ch_buck* static u3h_buck*
_ch_buck_new(void) _ch_buck_new(void)
{ {
u3_ch_buck* hab_u = u3_ca_walloc(c3_wiseof(u3_ch_buck)); u3h_buck* hab_u = u3a_walloc(c3_wiseof(u3h_buck));
hab_u->len_w = 0; hab_u->len_w = 0;
return hab_u; return hab_u;
@ -44,14 +44,14 @@ _ch_buck_new(void)
/* ha_buck_add(): add to bucket. /* ha_buck_add(): add to bucket.
*/ */
static u3_ch_buck* static u3h_buck*
_ch_buck_add(u3_ch_buck* hab_u, u3_noun kev) _ch_buck_add(u3h_buck* hab_u, u3_noun kev)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
if ( c3y == u3_cr_sing(u3h(kev), u3h(hab_u->kev[i_w])) ) { if ( c3y == u3r_sing(u3h(kev), u3h(hab_u->kev[i_w])) ) {
u3_ca_lose(hab_u->kev[i_w]); u3a_lose(hab_u->kev[i_w]);
hab_u->kev[i_w] = kev; hab_u->kev[i_w] = kev;
return hab_u; return hab_u;
@ -60,29 +60,29 @@ _ch_buck_add(u3_ch_buck* hab_u, u3_noun kev)
{ {
c3_w len_w = hab_u->len_w; c3_w len_w = hab_u->len_w;
u3_ch_buck* bah_u = u3_ca_walloc(c3_wiseof(u3_ch_buck) + u3h_buck* bah_u = u3a_walloc(c3_wiseof(u3h_buck) +
(len_w + 1) * c3_wiseof(u3_noun)); (len_w + 1) * c3_wiseof(u3_noun));
bah_u->len_w = len_w + 1; bah_u->len_w = len_w + 1;
bah_u->kev[0] = kev; bah_u->kev[0] = kev;
// Optimize: use u3_ca_wealloc(). // Optimize: use u3a_wealloc().
// //
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
bah_u->kev[i_w + 1] = hab_u->kev[i_w]; bah_u->kev[i_w + 1] = hab_u->kev[i_w];
} }
u3_ca_free(hab_u); u3a_free(hab_u);
return bah_u; return bah_u;
} }
} }
/* _ch_node_new(): create new, empty node. /* _ch_node_new(): create new, empty node.
*/ */
static u3_ch_node* static u3h_node*
_ch_node_new(void) _ch_node_new(void)
{ {
u3_ch_node* han_u = u3_ca_walloc(c3_wiseof(u3_ch_node)); u3h_node* han_u = u3a_walloc(c3_wiseof(u3h_node));
han_u->map_w = 0; han_u->map_w = 0;
return han_u; return han_u;
@ -90,8 +90,8 @@ _ch_node_new(void)
/* _ch_node_add(): add to node. /* _ch_node_add(): add to node.
*/ */
static u3_ch_node* static u3h_node*
_ch_node_add(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev) _ch_node_add(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev)
{ {
c3_w bit_w, inx_w, map_w, i_w; c3_w bit_w, inx_w, map_w, i_w;
@ -104,24 +104,24 @@ _ch_node_add(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev)
if ( map_w & (1 << bit_w) ) { if ( map_w & (1 << bit_w) ) {
c3_w sot_w = han_u->sot_w[inx_w]; c3_w sot_w = han_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_node(sot_w)) ) { if ( _(u3h_slot_is_node(sot_w)) ) {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
hav_v = _ch_some_add(hav_v, lef_w, rem_w, kev); hav_v = _ch_some_add(hav_v, lef_w, rem_w, kev);
han_u->sot_w[inx_w] = u3_ch_node_to_slot(hav_v); han_u->sot_w[inx_w] = u3h_node_to_slot(hav_v);
return han_u; return han_u;
} }
else { else {
u3_noun kov = u3_ch_slot_to_noun(sot_w); u3_noun kov = u3h_slot_to_noun(sot_w);
if ( c3y == u3_cr_sing(u3h(kev), u3h(kov)) ) { if ( c3y == u3r_sing(u3h(kev), u3h(kov)) ) {
u3_ca_lose(kov); u3a_lose(kov);
han_u->sot_w[inx_w] = u3_ch_noun_to_slot(kev); han_u->sot_w[inx_w] = u3h_noun_to_slot(kev);
return han_u; return han_u;
} }
else { else {
c3_w rom_w = u3_cr_mug(u3h(kov)) & ((1 << lef_w) - 1); c3_w rom_w = u3r_mug(u3h(kov)) & ((1 << lef_w) - 1);
void* hav_v = _ch_some_new(lef_w); void* hav_v = _ch_some_new(lef_w);
// Optimize: need a custom collision create. // Optimize: need a custom collision create.
@ -129,28 +129,28 @@ _ch_node_add(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun kev)
hav_v = _ch_some_add(hav_v, lef_w, rem_w, kev); hav_v = _ch_some_add(hav_v, lef_w, rem_w, kev);
hav_v = _ch_some_add(hav_v, lef_w, rom_w, kov); hav_v = _ch_some_add(hav_v, lef_w, rom_w, kov);
han_u->sot_w[inx_w] = u3_ch_node_to_slot(hav_v); han_u->sot_w[inx_w] = u3h_node_to_slot(hav_v);
return han_u; return han_u;
} }
} }
} }
else { else {
// Optimize: use u3_ca_wealloc. // Optimize: use u3a_wealloc.
// //
c3_w len_w = _ch_popcount(map_w); c3_w len_w = _ch_popcount(map_w);
u3_ch_node* nah_u = u3_ca_walloc(c3_wiseof(u3_ch_node) + u3h_node* nah_u = u3a_walloc(c3_wiseof(u3h_node) +
((len_w + 1) * c3_wiseof(u3_ch_slot))); ((len_w + 1) * c3_wiseof(u3h_slot)));
nah_u->map_w = han_u->map_w | (1 << bit_w); nah_u->map_w = han_u->map_w | (1 << bit_w);
for ( i_w = 0; i_w < inx_w; i_w++ ) { for ( i_w = 0; i_w < inx_w; i_w++ ) {
nah_u->sot_w[i_w] = han_u->sot_w[i_w]; nah_u->sot_w[i_w] = han_u->sot_w[i_w];
} }
nah_u->sot_w[inx_w] = u3_ch_noun_to_slot(kev); nah_u->sot_w[inx_w] = u3h_noun_to_slot(kev);
for ( i_w = inx_w; i_w < len_w; i_w++ ) { for ( i_w = inx_w; i_w < len_w; i_w++ ) {
nah_u->sot_w[i_w + 1] = han_u->sot_w[i_w]; nah_u->sot_w[i_w + 1] = han_u->sot_w[i_w];
} }
u3_ca_free(han_u); u3a_free(han_u);
return nah_u; return nah_u;
} }
} }
@ -179,50 +179,50 @@ _ch_some_add(void* han_v, c3_w lef_w, c3_w rem_w, u3_noun kev)
else return _ch_node_add(han_v, lef_w, rem_w, kev); else return _ch_node_add(han_v, lef_w, rem_w, kev);
} }
/* u3_ch_put(): insert in hashtable. /* u3h_put(): insert in hashtable.
** **
** `key` is RETAINED; `val` is transferred. ** `key` is RETAINED; `val` is transferred.
*/ */
void void
u3_ch_put(u3p(u3_ch_root) har_p, u3_noun key, u3_noun val) u3h_put(u3p(u3h_root) har_p, u3_noun key, u3_noun val)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
u3_noun kev = u3nc(u3k(key), val); u3_noun kev = u3nc(u3k(key), val);
c3_w mug_w = u3_cr_mug(key); c3_w mug_w = u3r_mug(key);
c3_w inx_w = (mug_w >> 25); c3_w inx_w = (mug_w >> 25);
c3_w rem_w = (mug_w & ((1 << 25) - 1)); c3_w rem_w = (mug_w & ((1 << 25) - 1));
c3_w sot_w = har_u->sot_w[inx_w]; c3_w sot_w = har_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_null(sot_w)) ) { if ( _(u3h_slot_is_null(sot_w)) ) {
har_u->sot_w[inx_w] = u3_ch_noun_to_slot(kev); har_u->sot_w[inx_w] = u3h_noun_to_slot(kev);
} }
else { else {
u3_ch_node* han_u; u3h_node* han_u;
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kov = u3_ch_slot_to_noun(sot_w); u3_noun kov = u3h_slot_to_noun(sot_w);
c3_w rom_w = u3_cr_mug(u3h(kov)) & ((1 << 25) - 1); c3_w rom_w = u3r_mug(u3h(kov)) & ((1 << 25) - 1);
han_u = _ch_node_new(); han_u = _ch_node_new();
han_u = _ch_node_add(han_u, 25, rem_w, kev); han_u = _ch_node_add(han_u, 25, rem_w, kev);
han_u = _ch_node_add(han_u, 25, rom_w, kov); han_u = _ch_node_add(han_u, 25, rom_w, kov);
} }
else { else {
han_u = _ch_node_add(u3_ch_slot_to_node(sot_w), 25, rem_w, kev); han_u = _ch_node_add(u3h_slot_to_node(sot_w), 25, rem_w, kev);
} }
har_u->sot_w[inx_w] = u3_ch_node_to_slot(han_u); har_u->sot_w[inx_w] = u3h_node_to_slot(han_u);
} }
} }
/* _ch_buck_hum(): read in bucket. /* _ch_buck_hum(): read in bucket.
*/ */
static c3_o static c3_o
_ch_buck_hum(u3_ch_buck* hab_u, c3_w mug_w) _ch_buck_hum(u3h_buck* hab_u, c3_w mug_w)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
if ( mug_w == u3_cr_mug(u3h(hab_u->kev[i_w])) ) { if ( mug_w == u3r_mug(u3h(hab_u->kev[i_w])) ) {
return c3y; return c3y;
} }
} }
@ -232,7 +232,7 @@ _ch_buck_hum(u3_ch_buck* hab_u, c3_w mug_w)
/* _ch_node_hum(): read in node. /* _ch_node_hum(): read in node.
*/ */
static c3_o static c3_o
_ch_node_hum(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w) _ch_node_hum(u3h_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w)
{ {
c3_w bit_w, map_w; c3_w bit_w, map_w;
@ -248,10 +248,10 @@ _ch_node_hum(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w)
c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1)); c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1));
c3_w sot_w = han_u->sot_w[inx_w]; c3_w sot_w = han_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( mug_w == u3_cr_mug(u3h(kev)) ) { if ( mug_w == u3r_mug(u3h(kev)) ) {
return c3y; return c3y;
} }
else { else {
@ -259,7 +259,7 @@ _ch_node_hum(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w)
} }
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
return _ch_buck_hum(hav_v, mug_w); return _ch_buck_hum(hav_v, mug_w);
@ -269,25 +269,25 @@ _ch_node_hum(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, c3_w mug_w)
} }
} }
/* u3_ch_hum(): read from hashtable. /* u3h_hum(): read from hashtable.
** **
** `key` is RETAINED. ** `key` is RETAINED.
*/ */
c3_o c3_o
u3_ch_hum(u3p(u3_ch_root) har_p, c3_w mug_w) u3h_hum(u3p(u3h_root) har_p, c3_w mug_w)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w inx_w = (mug_w >> 25); c3_w inx_w = (mug_w >> 25);
c3_w rem_w = (mug_w & ((1 << 25) - 1)); c3_w rem_w = (mug_w & ((1 << 25) - 1));
c3_w sot_w = har_u->sot_w[inx_w]; c3_w sot_w = har_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_null(sot_w)) ) { if ( _(u3h_slot_is_null(sot_w)) ) {
return c3n; return c3n;
} }
else if ( _(u3_ch_slot_is_noun(sot_w)) ) { else if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( mug_w == u3_cr_mug(u3h(kev)) ) { if ( mug_w == u3r_mug(u3h(kev)) ) {
return c3y; return c3y;
} }
else { else {
@ -295,7 +295,7 @@ u3_ch_hum(u3p(u3_ch_root) har_p, c3_w mug_w)
} }
} }
else { else {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
return _ch_node_hum(han_u, 25, rem_w, mug_w); return _ch_node_hum(han_u, 25, rem_w, mug_w);
} }
@ -304,13 +304,13 @@ u3_ch_hum(u3p(u3_ch_root) har_p, c3_w mug_w)
/* _ch_buck_get(): read in bucket. /* _ch_buck_get(): read in bucket.
*/ */
static u3_weak static u3_weak
_ch_buck_get(u3_ch_buck* hab_u, u3_noun key) _ch_buck_get(u3h_buck* hab_u, u3_noun key)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
if ( _(u3_cr_sing(key, u3h(hab_u->kev[i_w]))) ) { if ( _(u3r_sing(key, u3h(hab_u->kev[i_w]))) ) {
return u3_ca_gain(u3t(hab_u->kev[i_w])); return u3a_gain(u3t(hab_u->kev[i_w]));
} }
} }
return u3_none; return u3_none;
@ -319,7 +319,7 @@ _ch_buck_get(u3_ch_buck* hab_u, u3_noun key)
/* _ch_node_get(): read in node. /* _ch_node_get(): read in node.
*/ */
static u3_weak static u3_weak
_ch_node_get(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key) _ch_node_get(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
{ {
c3_w bit_w, map_w; c3_w bit_w, map_w;
@ -335,18 +335,18 @@ _ch_node_get(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1)); c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1));
c3_w sot_w = han_u->sot_w[inx_w]; c3_w sot_w = han_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3_cr_sing(key, u3h(kev))) ) { if ( _(u3r_sing(key, u3h(kev))) ) {
return u3_ca_gain(u3t(kev)); return u3a_gain(u3t(kev));
} }
else { else {
return u3_none; return u3_none;
} }
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
return _ch_buck_get(hav_v, key); return _ch_buck_get(hav_v, key);
@ -356,35 +356,35 @@ _ch_node_get(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
} }
} }
/* u3_ch_get(): read from hashtable. /* u3h_get(): read from hashtable.
** **
** `key` is RETAINED. ** `key` is RETAINED.
*/ */
u3_weak u3_weak
u3_ch_get(u3p(u3_ch_root) har_p, u3_noun key) u3h_get(u3p(u3h_root) har_p, u3_noun key)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w mug_w = u3_cr_mug(key); c3_w mug_w = u3r_mug(key);
c3_w inx_w = (mug_w >> 25); c3_w inx_w = (mug_w >> 25);
c3_w rem_w = (mug_w & ((1 << 25) - 1)); c3_w rem_w = (mug_w & ((1 << 25) - 1));
c3_w sot_w = har_u->sot_w[inx_w]; c3_w sot_w = har_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_null(sot_w)) ) { if ( _(u3h_slot_is_null(sot_w)) ) {
return u3_none; return u3_none;
} }
else if ( _(u3_ch_slot_is_noun(sot_w)) ) { else if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3_cr_sing(key, u3h(kev))) ) { if ( _(u3r_sing(key, u3h(kev))) ) {
har_u->sot_w[inx_w] = u3_ch_noun_be_warm(sot_w); har_u->sot_w[inx_w] = u3h_noun_be_warm(sot_w);
return u3_ca_gain(u3t(kev)); return u3a_gain(u3t(kev));
} }
else { else {
return u3_none; return u3_none;
} }
} }
else { else {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
return _ch_node_get(han_u, 25, rem_w, key); return _ch_node_get(han_u, 25, rem_w, key);
} }
@ -393,13 +393,13 @@ u3_ch_get(u3p(u3_ch_root) har_p, u3_noun key)
/* _ch_buck_gut(): read in bucket, unifying key nouns. /* _ch_buck_gut(): read in bucket, unifying key nouns.
*/ */
static u3_weak static u3_weak
_ch_buck_gut(u3_ch_buck* hab_u, u3_noun key) _ch_buck_gut(u3h_buck* hab_u, u3_noun key)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
if ( _(u3_cr_sung(key, u3h(hab_u->kev[i_w]))) ) { if ( _(u3r_sung(key, u3h(hab_u->kev[i_w]))) ) {
return u3_ca_gain(u3t(hab_u->kev[i_w])); return u3a_gain(u3t(hab_u->kev[i_w]));
} }
} }
return u3_none; return u3_none;
@ -408,7 +408,7 @@ _ch_buck_gut(u3_ch_buck* hab_u, u3_noun key)
/* _ch_node_gut(): read in node, unifying key nouns. /* _ch_node_gut(): read in node, unifying key nouns.
*/ */
static u3_weak static u3_weak
_ch_node_gut(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key) _ch_node_gut(u3h_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
{ {
c3_w bit_w, map_w; c3_w bit_w, map_w;
@ -424,18 +424,18 @@ _ch_node_gut(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1)); c3_w inx_w = _ch_popcount(map_w & ((1 << bit_w) - 1));
c3_w sot_w = han_u->sot_w[inx_w]; c3_w sot_w = han_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3_cr_sung(key, u3h(kev))) ) { if ( _(u3r_sung(key, u3h(kev))) ) {
return u3_ca_gain(u3t(kev)); return u3a_gain(u3t(kev));
} }
else { else {
return u3_none; return u3_none;
} }
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
return _ch_buck_gut(hav_v, key); return _ch_buck_gut(hav_v, key);
@ -445,35 +445,35 @@ _ch_node_gut(u3_ch_node* han_u, c3_w lef_w, c3_w rem_w, u3_noun key)
} }
} }
/* u3_ch_gut(): read from hashtable, unifying key nouns. /* u3h_gut(): read from hashtable, unifying key nouns.
** **
** `key` is RETAINED. ** `key` is RETAINED.
*/ */
u3_weak u3_weak
u3_ch_gut(u3p(u3_ch_root) har_p, u3_noun key) u3h_gut(u3p(u3h_root) har_p, u3_noun key)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w mug_w = u3_cr_mug(key); c3_w mug_w = u3r_mug(key);
c3_w inx_w = (mug_w >> 25); c3_w inx_w = (mug_w >> 25);
c3_w rem_w = (mug_w & ((1 << 25) - 1)); c3_w rem_w = (mug_w & ((1 << 25) - 1));
c3_w sot_w = har_u->sot_w[inx_w]; c3_w sot_w = har_u->sot_w[inx_w];
if ( _(u3_ch_slot_is_null(sot_w)) ) { if ( _(u3h_slot_is_null(sot_w)) ) {
return u3_none; return u3_none;
} }
else if ( _(u3_ch_slot_is_noun(sot_w)) ) { else if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
if ( _(u3_cr_sung(key, u3h(kev))) ) { if ( _(u3r_sung(key, u3h(kev))) ) {
har_u->sot_w[inx_w] = u3_ch_noun_be_warm(sot_w); har_u->sot_w[inx_w] = u3h_noun_be_warm(sot_w);
return u3_ca_gain(u3t(kev)); return u3a_gain(u3t(kev));
} }
else { else {
return u3_none; return u3_none;
} }
} }
else { else {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
return _ch_node_gut(han_u, 25, rem_w, key); return _ch_node_gut(han_u, 25, rem_w, key);
} }
@ -482,20 +482,20 @@ u3_ch_gut(u3p(u3_ch_root) har_p, u3_noun key)
/* _ch_free_buck(): free bucket /* _ch_free_buck(): free bucket
*/ */
static void static void
_ch_free_buck(u3_ch_buck* hab_u) _ch_free_buck(u3h_buck* hab_u)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
u3_ca_lose(hab_u->kev[i_w]); u3a_lose(hab_u->kev[i_w]);
} }
u3_ca_free(hab_u); u3a_free(hab_u);
} }
/* _ch_free_node(): free node. /* _ch_free_node(): free node.
*/ */
static void static void
_ch_free_node(u3_ch_node* han_u, c3_w lef_w) _ch_free_node(u3h_node* han_u, c3_w lef_w)
{ {
c3_w len_w = _ch_popcount(han_u->map_w); c3_w len_w = _ch_popcount(han_u->map_w);
c3_w i_w; c3_w i_w;
@ -505,13 +505,13 @@ _ch_free_node(u3_ch_node* han_u, c3_w lef_w)
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_w sot_w = han_u->sot_w[i_w]; c3_w sot_w = han_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
u3_ca_lose(kev); u3a_lose(kev);
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
_ch_free_buck(hav_v); _ch_free_buck(hav_v);
@ -520,38 +520,38 @@ _ch_free_node(u3_ch_node* han_u, c3_w lef_w)
} }
} }
} }
u3_ca_free(han_u); u3a_free(han_u);
} }
/* u3_ch_free(): free hashtable. /* u3h_free(): free hashtable.
*/ */
void void
u3_ch_free(u3p(u3_ch_root) har_p) u3h_free(u3p(u3h_root) har_p)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < 64; i_w++ ) { for ( i_w = 0; i_w < 64; i_w++ ) {
c3_w sot_w = har_u->sot_w[i_w]; c3_w sot_w = har_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
u3_ca_lose(kev); u3a_lose(kev);
} }
else if ( _(u3_ch_slot_is_node(sot_w)) ) { else if ( _(u3h_slot_is_node(sot_w)) ) {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
_ch_free_node(han_u, 25); _ch_free_node(han_u, 25);
} }
} }
u3_ca_free(har_u); u3a_free(har_u);
} }
/* _ch_walk_buck(): walk bucket for gc. /* _ch_walk_buck(): walk bucket for gc.
*/ */
static void static void
_ch_walk_buck(u3_ch_buck* hab_u, void (*fun_f)(u3_noun)) _ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun))
{ {
c3_w i_w; c3_w i_w;
@ -563,7 +563,7 @@ _ch_walk_buck(u3_ch_buck* hab_u, void (*fun_f)(u3_noun))
/* _ch_walk_node(): walk node for gc. /* _ch_walk_node(): walk node for gc.
*/ */
static void static void
_ch_walk_node(u3_ch_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun)) _ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
{ {
c3_w len_w = _ch_popcount(han_u->map_w); c3_w len_w = _ch_popcount(han_u->map_w);
c3_w i_w; c3_w i_w;
@ -573,13 +573,13 @@ _ch_walk_node(u3_ch_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_w sot_w = han_u->sot_w[i_w]; c3_w sot_w = han_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
fun_f(kev); fun_f(kev);
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
_ch_walk_buck(hav_v, fun_f); _ch_walk_buck(hav_v, fun_f);
@ -590,24 +590,24 @@ _ch_walk_node(u3_ch_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
} }
} }
/* u3_ch_walk(): walk hashtable for gc. /* u3h_walk(): walk hashtable for gc.
*/ */
void void
u3_ch_walk(u3p(u3_ch_root) har_p, void (*fun_f)(u3_noun)) u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < 64; i_w++ ) { for ( i_w = 0; i_w < 64; i_w++ ) {
c3_w sot_w = har_u->sot_w[i_w]; c3_w sot_w = har_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
fun_f(kev); fun_f(kev);
} }
else if ( _(u3_ch_slot_is_node(sot_w)) ) { else if ( _(u3h_slot_is_node(sot_w)) ) {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
_ch_walk_node(han_u, 25, fun_f); _ch_walk_node(han_u, 25, fun_f);
} }
@ -618,20 +618,20 @@ u3_ch_walk(u3p(u3_ch_root) har_p, void (*fun_f)(u3_noun))
/* _ch_mark_buck(): mark bucket for gc. /* _ch_mark_buck(): mark bucket for gc.
*/ */
static void static void
_ch_mark_buck(u3_ch_buck* hab_u) _ch_mark_buck(u3h_buck* hab_u)
{ {
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) { for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
u3_ca_mark_noun(hab_u->kev[i_w]); u3a_mark_noun(hab_u->kev[i_w]);
} }
u3_ca_mark_ptr(hab_u); u3a_mark_ptr(hab_u);
} }
/* _ch_mark_node(): mark node for gc. /* _ch_mark_node(): mark node for gc.
*/ */
static void static void
_ch_mark_node(u3_ch_node* han_u, c3_w lef_w) _ch_mark_node(u3h_node* han_u, c3_w lef_w)
{ {
c3_w len_w = _ch_popcount(han_u->map_w); c3_w len_w = _ch_popcount(han_u->map_w);
c3_w i_w; c3_w i_w;
@ -641,13 +641,13 @@ _ch_mark_node(u3_ch_node* han_u, c3_w lef_w)
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_w sot_w = han_u->sot_w[i_w]; c3_w sot_w = han_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
u3_ca_mark_noun(kev); u3a_mark_noun(kev);
} }
else { else {
void* hav_v = u3_ch_slot_to_node(sot_w); void* hav_v = u3h_slot_to_node(sot_w);
if ( 0 == lef_w ) { if ( 0 == lef_w ) {
_ch_mark_buck(hav_v); _ch_mark_buck(hav_v);
@ -656,30 +656,30 @@ _ch_mark_node(u3_ch_node* han_u, c3_w lef_w)
} }
} }
} }
u3_ca_mark_ptr(han_u); u3a_mark_ptr(han_u);
} }
/* u3_ch_mark(): mark hashtable for gc. /* u3h_mark(): mark hashtable for gc.
*/ */
void void
u3_ch_mark(u3p(u3_ch_root) har_p) u3h_mark(u3p(u3h_root) har_p)
{ {
u3_ch_root* har_u = u3to(u3_ch_root, har_p); u3h_root* har_u = u3to(u3h_root, har_p);
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < 64; i_w++ ) { for ( i_w = 0; i_w < 64; i_w++ ) {
c3_w sot_w = har_u->sot_w[i_w]; c3_w sot_w = har_u->sot_w[i_w];
if ( _(u3_ch_slot_is_noun(sot_w)) ) { if ( _(u3h_slot_is_noun(sot_w)) ) {
u3_noun kev = u3_ch_slot_to_noun(sot_w); u3_noun kev = u3h_slot_to_noun(sot_w);
u3_ca_mark_noun(kev); u3a_mark_noun(kev);
} }
else if ( _(u3_ch_slot_is_node(sot_w)) ) { else if ( _(u3h_slot_is_node(sot_w)) ) {
u3_ch_node* han_u = u3_ch_slot_to_node(sot_w); u3h_node* han_u = u3h_slot_to_node(sot_w);
_ch_mark_node(han_u, 25); _ch_mark_node(han_u, 25);
} }
} }
u3_ca_mark_ptr(har_u); u3a_mark_ptr(har_u);
} }

128
g/i.c
View File

@ -4,12 +4,12 @@
*/ */
#include "all.h" #include "all.h"
/* u3_ci_words(): /* u3i_words():
** **
** Copy [a] words from [b] into an atom. ** Copy [a] words from [b] into an atom.
*/ */
u3_noun u3_noun
u3_ci_words(c3_w a_w, u3i_words(c3_w a_w,
const c3_w* b_w) const c3_w* b_w)
{ {
/* Strip trailing zeroes. /* Strip trailing zeroes.
@ -30,8 +30,8 @@ u3_ci_words(c3_w a_w,
/* Allocate, fill, return. /* Allocate, fill, return.
*/ */
{ {
c3_w* nov_w = u3_ca_walloc(a_w + c3_wiseof(u3_ca_atom)); c3_w* nov_w = u3a_walloc(a_w + c3_wiseof(u3a_atom));
u3_ca_atom* nov_u = (void*)nov_w; u3a_atom* nov_u = (void*)nov_w;
nov_u->mug_w = 0; nov_u->mug_w = 0;
nov_u->len_w = a_w; nov_u->len_w = a_w;
@ -45,16 +45,16 @@ u3_ci_words(c3_w a_w,
nov_u->buf_w[i_w] = b_w[i_w]; nov_u->buf_w[i_w] = b_w[i_w];
} }
} }
return u3_ca_to_pug(u3_ca_outa(nov_w)); return u3a_to_pug(u3a_outa(nov_w));
} }
} }
/* u3_ci_chubs(): /* u3i_chubs():
** **
** Construct `a` double-words from `b`, LSD first, as an atom. ** Construct `a` double-words from `b`, LSD first, as an atom.
*/ */
u3_atom u3_atom
u3_ci_chubs(c3_w a_w, u3i_chubs(c3_w a_w,
const c3_d* b_d) const c3_d* b_d)
{ {
c3_w *b_w = c3_malloc(a_w * 8); c3_w *b_w = c3_malloc(a_w * 8);
@ -65,17 +65,17 @@ u3_ci_chubs(c3_w a_w,
b_w[(2 * i_w)] = b_d[i_w] & 0xffffffffULL; b_w[(2 * i_w)] = b_d[i_w] & 0xffffffffULL;
b_w[(2 * i_w) + 1] = b_d[i_w] >> 32ULL; b_w[(2 * i_w) + 1] = b_d[i_w] >> 32ULL;
} }
p = u3_ci_words((a_w * 2), b_w); p = u3i_words((a_w * 2), b_w);
free(b_w); free(b_w);
return p; return p;
} }
/* u3_ci_bytes(): /* u3i_bytes():
** **
** Copy `a` bytes from `b` to an LSB first atom. ** Copy `a` bytes from `b` to an LSB first atom.
*/ */
u3_noun u3_noun
u3_ci_bytes(c3_w a_w, u3i_bytes(c3_w a_w,
const c3_y* b_y) const c3_y* b_y)
{ {
/* Strip trailing zeroes. /* Strip trailing zeroes.
@ -108,8 +108,8 @@ u3_ci_bytes(c3_w a_w,
*/ */
{ {
c3_w len_w = (a_w + 3) >> 2; c3_w len_w = (a_w + 3) >> 2;
c3_w* nov_w = u3_ca_walloc((len_w + c3_wiseof(u3_ca_atom))); c3_w* nov_w = u3a_walloc((len_w + c3_wiseof(u3a_atom)));
u3_ca_atom* nov_u = (void*)nov_w; u3a_atom* nov_u = (void*)nov_w;
nov_u->mug_w = 0; nov_u->mug_w = 0;
nov_u->len_w = len_w; nov_u->len_w = len_w;
@ -133,16 +133,16 @@ u3_ci_bytes(c3_w a_w,
nov_u->buf_w[i_w >> 2] |= (b_y[i_w] << ((i_w & 3) * 8)); nov_u->buf_w[i_w >> 2] |= (b_y[i_w] << ((i_w & 3) * 8));
} }
} }
return u3_ca_to_pug(u3_ca_outa(nov_w)); return u3a_to_pug(u3a_outa(nov_w));
} }
} }
/* u3_ci_mp(): /* u3i_mp():
** **
** Copy the GMP integer `a` into an atom, and clear it. ** Copy the GMP integer `a` into an atom, and clear it.
*/ */
u3_noun u3_noun
u3_ci_mp(mpz_t a_mp) u3i_mp(mpz_t a_mp)
{ {
/* Efficiency: unnecessary copy. /* Efficiency: unnecessary copy.
*/ */
@ -157,66 +157,66 @@ u3_ci_mp(mpz_t a_mp)
mpz_export(buz_w, 0, -1, 4, 0, 0, a_mp); mpz_export(buz_w, 0, -1, 4, 0, 0, a_mp);
mpz_clear(a_mp); mpz_clear(a_mp);
return u3_ci_words(pyg_w, buz_w); return u3i_words(pyg_w, buz_w);
} }
} }
/* u3_ci_vint(): /* u3i_vint():
** **
** Create `a + 1`. ** Create `a + 1`.
*/ */
u3_noun u3_noun
u3_ci_vint(u3_noun a) u3i_vint(u3_noun a)
{ {
c3_assert(u3_none != a); c3_assert(u3_none != a);
if ( _(u3_ca_is_cat(a)) ) { if ( _(u3a_is_cat(a)) ) {
c3_w vin_w = (a + 1); c3_w vin_w = (a + 1);
if ( a == 0x7fffffff ) { if ( a == 0x7fffffff ) {
return u3_ci_words(1, &vin_w); return u3i_words(1, &vin_w);
} }
else return vin_w; else return vin_w;
} }
else if ( _(u3_ca_is_cell(a)) ) { else if ( _(u3a_is_cell(a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
mpz_t a_mp; mpz_t a_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_ca_lose(a); u3a_lose(a);
mpz_add_ui(a_mp, a_mp, 1); mpz_add_ui(a_mp, a_mp, 1);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
/* u3_ci_cell(): /* u3i_cell():
** **
** Produce the cell `[a b]`. ** Produce the cell `[a b]`.
*/ */
u3_noun u3_noun
u3_ci_cell(u3_noun a, u3_noun b) u3i_cell(u3_noun a, u3_noun b)
{ {
c3_assert(u3_none != a); c3_assert(u3_none != a);
c3_assert(u3_none != b); c3_assert(u3_none != b);
c3_assert(!_(u3_ca_is_junior(u3R, a))); c3_assert(!_(u3a_is_junior(u3R, a)));
c3_assert(!_(u3_ca_is_junior(u3R, b))); c3_assert(!_(u3a_is_junior(u3R, b)));
{ {
c3_w* nov_w = u3_ca_walloc(c3_wiseof(u3_ca_cell)); c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell));
u3_ca_cell* nov_u = (void *)nov_w; u3a_cell* nov_u = (void *)nov_w;
u3_noun pro; u3_noun pro;
nov_u->mug_w = 0; nov_u->mug_w = 0;
nov_u->hed = a; nov_u->hed = a;
nov_u->tel = b; nov_u->tel = b;
pro = u3_ca_to_pom(u3_ca_outa(nov_w)); pro = u3a_to_pom(u3a_outa(nov_w));
#if 0 #if 0
if ( 0x15d47649 == u3_cr_mug(pro) ) { if ( 0x15d47649 == u3r_mug(pro) ) {
fprintf(stderr, "BAD %x\r\n", pro); fprintf(stderr, "BAD %x\r\n", pro);
BAD = pro; BAD = pro;
} }
@ -224,81 +224,81 @@ u3_ci_cell(u3_noun a, u3_noun b)
#if 1 #if 1
return pro; return pro;
#else #else
if ( !FOO ) return u3_ca_to_pom(u3_ca_outa(nov_w)); if ( !FOO ) return u3a_to_pom(u3a_outa(nov_w));
else { else {
u3_noun pro = u3_ca_to_pom(u3_ca_outa(nov_w)); u3_noun pro = u3a_to_pom(u3a_outa(nov_w));
u3_cm_p("leaked", pro); u3m_p("leaked", pro);
printf("pro %u, %x\r\n", pro, u3_cr_mug(pro)); printf("pro %u, %x\r\n", pro, u3r_mug(pro));
abort(); abort();
} }
#endif #endif
} }
} }
/* u3_ci_trel(): /* u3i_trel():
** **
** Produce the triple `[a b c]`. ** Produce the triple `[a b c]`.
*/ */
u3_noun u3_noun
u3_ci_trel(u3_noun a, u3_noun b, u3_noun c) u3i_trel(u3_noun a, u3_noun b, u3_noun c)
{ {
return u3_ci_cell(a, u3_ci_cell(b, c)); return u3i_cell(a, u3i_cell(b, c));
} }
/* u3_ci_qual(): /* u3i_qual():
** **
** Produce the cell `[a b c d]`. ** Produce the cell `[a b c d]`.
*/ */
u3_noun u3_noun
u3_ci_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d) u3i_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d)
{ {
return u3_ci_cell(a, u3_ci_trel(b, c, d)); return u3i_cell(a, u3i_trel(b, c, d));
} }
/* u3_ci_string(): /* u3i_string():
** **
** Produce an LSB-first atom from the C string `a`. ** Produce an LSB-first atom from the C string `a`.
*/ */
u3_noun u3_noun
u3_ci_string(const c3_c* a_c) u3i_string(const c3_c* a_c)
{ {
return u3_ci_bytes(strlen(a_c), (c3_y *)a_c); return u3i_bytes(strlen(a_c), (c3_y *)a_c);
} }
/* u3_ci_tape(): from a C string, to a list of bytes. /* u3i_tape(): from a C string, to a list of bytes.
*/ */
u3_atom u3_atom
u3_ci_tape(const c3_c* txt_c) u3i_tape(const c3_c* txt_c)
{ {
if ( !*txt_c ) { if ( !*txt_c ) {
return u3_nul; return u3_nul;
} else return u3_ci_cell(*txt_c, u3_ci_tape(txt_c + 1)); } else return u3i_cell(*txt_c, u3i_tape(txt_c + 1));
} }
/* u3_ci_decimal(): /* u3i_decimal():
** **
** Parse `a` as a list of decimal digits. ** Parse `a` as a list of decimal digits.
*/ */
u3_atom u3_atom
u3_ci_decimal(u3_noun a); u3i_decimal(u3_noun a);
/* u3_ci_heximal(): /* u3i_heximal():
** **
** Parse `a` as a list of hex digits. ** Parse `a` as a list of hex digits.
*/ */
u3_noun u3_noun
u3_ci_heximal(u3_noun a); u3i_heximal(u3_noun a);
/* u3_ci_list(): /* u3i_list():
** **
** Generate a null-terminated list, with `u3_none` as terminator. ** Generate a null-terminated list, with `u3_none` as terminator.
*/ */
u3_noun u3_noun
u3_ci_list(u3_weak one, ...); u3i_list(u3_weak one, ...);
/* u3_ci_molt(): /* u3i_molt():
** **
** Mutate `som` with a 0-terminated list of axis, noun pairs. ** Mutate `som` with a 0-terminated list of axis, noun pairs.
** Axes must be cats (31 bit). ** Axes must be cats (31 bit).
@ -334,7 +334,7 @@ u3_ci_list(u3_weak one, ...);
struct _molt_pair* pms_m) // transfer struct _molt_pair* pms_m) // transfer
{ {
if ( len_w == 0 ) { if ( len_w == 0 ) {
return u3_ca_gain(som); return u3a_gain(som);
} }
else if ( (len_w == 1) && (1 == pms_m[0].axe_w) ) { else if ( (len_w == 1) && (1 == pms_m[0].axe_w) ) {
return pms_m[0].som; return pms_m[0].som;
@ -342,18 +342,18 @@ u3_ci_list(u3_weak one, ...);
else { else {
c3_w cut_w = _molt_cut(len_w, pms_m); c3_w cut_w = _molt_cut(len_w, pms_m);
if ( c3n == u3_ca_is_cell(som) ) { if ( c3n == u3a_is_cell(som) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3_ci_cell return u3i_cell
(_molt_apply(u3_ca_h(som), cut_w, pms_m), (_molt_apply(u3a_h(som), cut_w, pms_m),
_molt_apply(u3_ca_t(som), (len_w - cut_w), (pms_m + cut_w))); _molt_apply(u3a_t(som), (len_w - cut_w), (pms_m + cut_w)));
} }
} }
} }
u3_noun u3_noun
u3_ci_molt(u3_noun som, ...) u3i_molt(u3_noun som, ...)
{ {
va_list ap; va_list ap;
c3_w len_w; c3_w len_w;
@ -392,7 +392,7 @@ u3_ci_molt(u3_noun som, ...)
/* Apply. /* Apply.
*/ */
pro = _molt_apply(som, len_w, pms_m); pro = _molt_apply(som, len_w, pms_m);
u3_ca_lose(som); u3a_lose(som);
return pro; return pro;
} }

230
g/j.c
View File

@ -7,14 +7,14 @@
/* _cj_count(): count and link dashboard entries. /* _cj_count(): count and link dashboard entries.
*/ */
static c3_w static c3_w
_cj_count(u3_ce_core* par_u, u3_ce_core* dev_u) _cj_count(u3e_core* par_u, u3e_core* dev_u)
{ {
c3_w len_l = 0; c3_w len_l = 0;
c3_w i_w; c3_w i_w;
if ( dev_u ) { if ( dev_u ) {
for ( i_w = 0; 0 != dev_u[i_w].cos_c; i_w++ ) { for ( i_w = 0; 0 != dev_u[i_w].cos_c; i_w++ ) {
u3_ce_core* kid_u = &dev_u[i_w]; u3e_core* kid_u = &dev_u[i_w];
kid_u->par_u = par_u; kid_u->par_u = par_u;
len_l += _cj_count(kid_u, kid_u->dev_u); len_l += _cj_count(kid_u, kid_u->dev_u);
@ -25,13 +25,13 @@
/* _cj_install(): install dashboard entries. /* _cj_install(): install dashboard entries.
*/ */
static c3_w static c3_w
_cj_install(u3_ce_core* ray_u, c3_w jax_l, u3_ce_core* dev_u) _cj_install(u3e_core* ray_u, c3_w jax_l, u3e_core* dev_u)
{ {
c3_w i_w; c3_w i_w;
if ( dev_u ) { if ( dev_u ) {
for ( i_w = 0; 0 != dev_u[i_w].cos_c; i_w++ ) { for ( i_w = 0; 0 != dev_u[i_w].cos_c; i_w++ ) {
u3_ce_core* kid_u = &dev_u[i_w]; u3e_core* kid_u = &dev_u[i_w];
kid_u->jax_l = jax_l; kid_u->jax_l = jax_l;
ray_u[jax_l++] = *kid_u; ray_u[jax_l++] = *kid_u;
@ -52,10 +52,10 @@ _cj_axis(u3_noun fol)
while ( _(u3du(fol)) && (10 == u3h(fol)) ) while ( _(u3du(fol)) && (10 == u3h(fol)) )
{ fol = u3t(u3t(fol)); } { fol = u3t(u3t(fol)); }
if ( !_(u3_cr_trel(fol, &p_fol, &q_fol, &r_fol)) ) { if ( !_(u3r_trel(fol, &p_fol, &q_fol, &r_fol)) ) {
if ( !_(u3_cr_cell(fol, &p_fol, &q_fol)) || if ( !_(u3r_cell(fol, &p_fol, &q_fol)) ||
(0 != p_fol) || (0 != p_fol) ||
(!_(u3_ca_is_cat(q_fol))) ) (!_(u3a_is_cat(q_fol))) )
{ {
fprintf(stderr, "axis: bad a\r\n"); fprintf(stderr, "axis: bad a\r\n");
return 0; return 0;
@ -65,7 +65,7 @@ _cj_axis(u3_noun fol)
else { else {
if ( 9 != p_fol ) if ( 9 != p_fol )
{ fprintf(stderr, "axis: bad b\r\n"); return 0; } { fprintf(stderr, "axis: bad b\r\n"); return 0; }
if ( !_(u3_ca_is_cat(q_fol)) ) if ( !_(u3a_is_cat(q_fol)) )
{ fprintf(stderr, "axis: bad c\r\n"); return 0; } { fprintf(stderr, "axis: bad c\r\n"); return 0; }
if ( !_(u3du(r_fol)) || (0 != u3h(r_fol)) || (1 != u3t(r_fol)) ) if ( !_(u3du(r_fol)) || (0 != u3h(r_fol)) || (1 != u3t(r_fol)) )
{ fprintf(stderr, "axis: bad d\r\n"); return 0; } { fprintf(stderr, "axis: bad d\r\n"); return 0; }
@ -86,10 +86,10 @@ _cj_by_gut(u3_noun a, u3_noun b)
u3_noun l_a, n_a, r_a; u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a; u3_noun pn_a, qn_a;
u3_cx_trel(a, &n_a, &l_a, &r_a); u3x_trel(a, &n_a, &l_a, &r_a);
u3_cx_cell(n_a, &pn_a, &qn_a); u3x_cell(n_a, &pn_a, &qn_a);
{ {
if ( (c3y == u3_cr_sing(b, pn_a)) ) { if ( (c3y == u3r_sing(b, pn_a)) ) {
return qn_a; return qn_a;
} }
else { else {
@ -108,16 +108,16 @@ static c3_c*
_cj_chum(u3_noun chu) _cj_chum(u3_noun chu)
{ {
if ( _(u3ud(chu)) ) { if ( _(u3ud(chu)) ) {
return u3_cr_string(chu); return u3r_string(chu);
} }
else { else {
u3_noun h_chu = u3h(chu); u3_noun h_chu = u3h(chu);
u3_noun t_chu = u3t(chu); u3_noun t_chu = u3t(chu);
if ( !_(u3_ca_is_cat(t_chu)) ) { if ( !_(u3a_is_cat(t_chu)) ) {
return 0; return 0;
} else { } else {
c3_c* h_chu_c = u3_cr_string(h_chu); c3_c* h_chu_c = u3r_string(h_chu);
c3_c buf[33]; c3_c buf[33];
memset(buf, 0, 33); memset(buf, 0, 33);
@ -139,7 +139,7 @@ _cj_je_fsck(u3_noun clu)
c3_c* nam_c; c3_c* nam_c;
c3_l axe_l; c3_l axe_l;
if ( c3n == u3_cr_trel(clu, &p_clu, &q_clu, &r_clu) ) { if ( c3n == u3r_trel(clu, &p_clu, &q_clu, &r_clu) ) {
u3z(clu); return u3_none; u3z(clu); return u3_none;
} }
if ( 0 == (nam_c = _cj_chum(p_clu)) ) { if ( 0 == (nam_c = _cj_chum(p_clu)) ) {
@ -156,7 +156,7 @@ _cj_je_fsck(u3_noun clu)
axe_l = 0; axe_l = 0;
} }
else { else {
if ( (0 != u3h(q_clu)) || !_(u3_ca_is_cat(axe_l = u3t(q_clu))) ) { if ( (0 != u3h(q_clu)) || !_(u3a_is_cat(axe_l = u3t(q_clu))) ) {
u3z(clu); free(nam_c); return u3_none; u3z(clu); free(nam_c); return u3_none;
} }
} }
@ -167,8 +167,8 @@ _cj_je_fsck(u3_noun clu)
while ( _(u3du(r_clu)) ) { while ( _(u3du(r_clu)) ) {
u3_noun ir_clu, tr_clu, pir_clu, qir_clu; u3_noun ir_clu, tr_clu, pir_clu, qir_clu;
if ( (c3n == u3_cr_cell(r_clu, &ir_clu, &tr_clu)) || if ( (c3n == u3r_cell(r_clu, &ir_clu, &tr_clu)) ||
(c3n == u3_cr_cell(ir_clu, &pir_clu, &qir_clu)) || (c3n == u3r_cell(ir_clu, &pir_clu, &qir_clu)) ||
(c3n == u3ud(pir_clu)) ) (c3n == u3ud(pir_clu)) )
{ {
u3z(huk); u3z(clu); free(nam_c); return u3_none; u3z(huk); u3z(clu); free(nam_c); return u3_none;
@ -178,7 +178,7 @@ _cj_je_fsck(u3_noun clu)
} }
} }
u3z(clu); u3z(clu);
return u3nt(u3_ci_string(nam_c), axe_l, huk); return u3nt(u3i_string(nam_c), axe_l, huk);
} }
/* _cj_sham(): ++sham. /* _cj_sham(): ++sham.
@ -199,7 +199,7 @@ _cj_sham(u3_noun som) // XX wrong, does not match ++sham
static u3_weak static u3_weak
_cj_cold_find_sys(u3_noun bat) _cj_cold_find_sys(u3_noun bat)
{ {
u3_cs_road* rod_u = u3R; u3a_road* rod_u = u3R;
while ( 1 ) { while ( 1 ) {
u3_noun pro = _cj_by_gut(u3h(rod_u->jed.das), bat); u3_noun pro = _cj_by_gut(u3h(rod_u->jed.das), bat);
@ -222,7 +222,7 @@ _cj_cold_mine(u3_noun cey, u3_noun cor)
u3_noun bat = u3h(cor); u3_noun bat = u3h(cor);
u3_noun p_cey, q_cey, r_cey; u3_noun p_cey, q_cey, r_cey;
u3_cr_trel(cey, &p_cey, &q_cey, &r_cey); u3r_trel(cey, &p_cey, &q_cey, &r_cey);
{ {
/* Calculate semantic identity (mop). /* Calculate semantic identity (mop).
*/ */
@ -232,10 +232,10 @@ _cj_cold_mine(u3_noun cey, u3_noun cor)
mop = u3nq(u3k(p_cey), 3, c3n, u3k(bat)); mop = u3nq(u3k(p_cey), 3, c3n, u3k(bat));
} }
else { else {
u3_weak rah = u3_cr_at(q_cey, cor); u3_weak rah = u3r_at(q_cey, cor);
if ( (u3_none == rah) || !_(u3du(rah)) ) { if ( (u3_none == rah) || !_(u3du(rah)) ) {
fprintf(stderr, "fund: %s is bogus\r\n", u3_cr_string(p_cey)); fprintf(stderr, "fund: %s is bogus\r\n", u3r_string(p_cey));
return u3_none; return u3_none;
} }
else { else {
@ -243,8 +243,8 @@ _cj_cold_mine(u3_noun cey, u3_noun cor)
if ( u3_none == soh ) { if ( u3_none == soh ) {
fprintf(stderr, "fund: in %s, parent %x not found at %d\r\n", fprintf(stderr, "fund: in %s, parent %x not found at %d\r\n",
u3_cr_string(p_cey), u3r_string(p_cey),
u3_cr_mug(u3h(rah)), u3r_mug(u3h(rah)),
q_cey); q_cey);
return u3_none; return u3_none;
} }
@ -291,10 +291,10 @@ _cj_cold_mine(u3_noun cey, u3_noun cor)
u3_weak u3_weak
_cj_warm_fend(u3_noun bat) _cj_warm_fend(u3_noun bat)
{ {
u3_cs_road* rod_u = u3R; u3a_road* rod_u = u3R;
while ( 1 ) { while ( 1 ) {
u3_weak jaw = u3_ch_gut(rod_u->jed.har_p, bat); u3_weak jaw = u3h_gut(rod_u->jed.har_p, bat);
if ( u3_none != jaw ) { if ( u3_none != jaw ) {
return jaw; return jaw;
@ -313,12 +313,12 @@ static u3_noun
_cj_warm_hump(c3_l jax_l, u3_noun huc) _cj_warm_hump(c3_l jax_l, u3_noun huc)
{ {
u3_noun hap = u3_nul; u3_noun hap = u3_nul;
u3_ce_core* cop_u; u3e_core* cop_u;
/* Compute axes of all correctly declared arms. /* Compute axes of all correctly declared arms.
*/ */
if ( jax_l && (cop_u = &u3D.ray_u[jax_l])->arm_u ) { if ( jax_l && (cop_u = &u3D.ray_u[jax_l])->arm_u ) {
u3_ce_harm* jet_u; u3e_harm* jet_u;
c3_l i_l; c3_l i_l;
for ( i_l = 0; (jet_u = &cop_u->arm_u[i_l])->fcs_c; i_l++ ) { for ( i_l = 0; (jet_u = &cop_u->arm_u[i_l])->fcs_c; i_l++ ) {
@ -336,7 +336,7 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
} }
} }
else { else {
u3_noun nam = u3_ci_string(jet_u->fcs_c); u3_noun nam = u3i_string(jet_u->fcs_c);
u3_noun fol = u3_ckdb_get(u3k(huc), nam); u3_noun fol = u3_ckdb_get(u3k(huc), nam);
if ( u3_none == fol ) { if ( u3_none == fol ) {
@ -362,8 +362,8 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
static c3_l static c3_l
_cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat) _cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat)
{ {
u3_ce_core* par_u; u3e_core* par_u;
u3_ce_core* dev_u; u3e_core* dev_u;
if ( 0 != par_l ) { if ( 0 != par_l ) {
par_u = &u3D.ray_u[par_l]; par_u = &u3D.ray_u[par_l];
@ -376,16 +376,16 @@ _cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat)
{ {
c3_w i_l = 0; c3_w i_l = 0;
u3_ce_core* cop_u; u3e_core* cop_u;
while ( (cop_u = &dev_u[i_l])->cos_c ) { while ( (cop_u = &dev_u[i_l])->cos_c ) {
if ( _(u3_cr_sing_c(cop_u->cos_c, u3h(mop))) ) { if ( _(u3r_sing_c(cop_u->cos_c, u3h(mop))) ) {
#if 0 #if 0
fprintf(stderr, "boil: bound jet %d/%s/%s/%x\r\n", fprintf(stderr, "boil: bound jet %d/%s/%s/%x\r\n",
cop_u->jax_l, cop_u->jax_l,
cop_u->cos_c, cop_u->cos_c,
par_u ? par_u->cos_c : "~", par_u ? par_u->cos_c : "~",
u3_cr_mug(bat)); u3r_mug(bat));
#endif #endif
return cop_u->jax_l; return cop_u->jax_l;
} }
@ -402,15 +402,15 @@ _cj_boil_mine(u3_noun mop, u3_noun cor)
{ {
u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop; u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop;
u3_cx_trel(mop, &p_mop, &q_mop, &r_mop); u3x_trel(mop, &p_mop, &q_mop, &r_mop);
u3_cx_cell(r_mop, &hr_mop, &tr_mop); u3x_cell(r_mop, &hr_mop, &tr_mop);
{ {
c3_l par_l; c3_l par_l;
// Calculate parent axis. // Calculate parent axis.
// //
if ( c3y == hr_mop ) { if ( c3y == hr_mop ) {
u3_noun cax = _cj_warm_fend(u3h(u3_cr_at(q_mop, cor))); u3_noun cax = _cj_warm_fend(u3h(u3r_at(q_mop, cor)));
par_l = u3h(cax); par_l = u3h(cax);
u3z(cax); u3z(cax);
@ -431,7 +431,7 @@ _cj_warm_ream_be(c3_l jax_l,
u3_noun bat, u3_noun bat,
u3_noun huc) u3_noun huc)
{ {
u3_ch_put(u3R->jed.har_p, u3h_put(u3R->jed.har_p,
bat, bat,
u3nq(jax_l, u3nq(jax_l,
u3k(pax), u3k(pax),
@ -449,8 +449,8 @@ _cj_warm_ream_is(c3_l jax_l,
if ( u3_nul != sab ) { if ( u3_nul != sab ) {
u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab; u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab;
u3_cx_trel(sab, &n_sab, &l_sab, &r_sab); u3x_trel(sab, &n_sab, &l_sab, &r_sab);
u3_cx_cell(n_sab, &pn_sab, &qn_sab); u3x_cell(n_sab, &pn_sab, &qn_sab);
_cj_warm_ream_be(jax_l, pax, pn_sab, qn_sab); _cj_warm_ream_be(jax_l, pax, pn_sab, qn_sab);
_cj_warm_ream_is(jax_l, pax, l_sab); _cj_warm_ream_is(jax_l, pax, l_sab);
@ -468,7 +468,7 @@ _cj_warm_ream_un(u3_noun soh)
u3_noun cax; u3_noun cax;
c3_l jax_l; c3_l jax_l;
if ( u3_none != (cax = u3_ch_get(u3R->jed.har_p, u3h(u3h(sab)))) ) { if ( u3_none != (cax = u3h_get(u3R->jed.har_p, u3h(u3h(sab)))) ) {
jax_l = u3h(cax); jax_l = u3h(cax);
u3z(cax); u3z(cax);
} }
@ -488,8 +488,8 @@ _cj_warm_ream_at(u3_noun soh, u3_noun cag)
u3_noun sab = u3t(cag); u3_noun sab = u3t(cag);
u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop; u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop;
u3_cx_trel(mop, &p_mop, &q_mop, &r_mop); u3x_trel(mop, &p_mop, &q_mop, &r_mop);
u3_cx_cell(r_mop, &hr_mop, &tr_mop); u3x_cell(r_mop, &hr_mop, &tr_mop);
{ {
c3_l par_l, jax_l; c3_l par_l, jax_l;
@ -513,8 +513,8 @@ _cj_warm_ream_in(u3_noun taw)
if ( u3_nul != taw ) { if ( u3_nul != taw ) {
u3_noun n_taw, l_taw, r_taw, pn_taw, qn_taw; u3_noun n_taw, l_taw, r_taw, pn_taw, qn_taw;
u3_cx_trel(taw, &n_taw, &l_taw, &r_taw); u3x_trel(taw, &n_taw, &l_taw, &r_taw);
u3_cx_cell(n_taw, &pn_taw, &qn_taw); u3x_cell(n_taw, &pn_taw, &qn_taw);
_cj_warm_ream_at(pn_taw, qn_taw); _cj_warm_ream_at(pn_taw, qn_taw);
_cj_warm_ream_in(l_taw); _cj_warm_ream_in(l_taw);
@ -533,13 +533,13 @@ _cj_warm_ream(void)
} }
} }
/* u3_cj_ream(): reream after restoring from checkpoint. /* u3j_ream(): reream after restoring from checkpoint.
*/ */
void void
u3_cj_ream(void) u3j_ream(void)
{ {
u3_ch_free(u3R->jed.har_p); u3h_free(u3R->jed.har_p);
u3R->jed.har_p = u3_ch_new(); u3R->jed.har_p = u3h_new();
_cj_warm_ream(); _cj_warm_ream();
} }
@ -561,7 +561,7 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
else { else {
u3_noun cey = _cj_je_fsck(clu); u3_noun cey = _cj_je_fsck(clu);
// fprintf(stderr, "warm_mine %s\r\n", u3_cr_string(u3h(cey))); // fprintf(stderr, "warm_mine %s\r\n", u3r_string(u3h(cey)));
if ( u3_none != cey ) { if ( u3_none != cey ) {
u3_noun huc = u3t(u3t(cey)); u3_noun huc = u3t(u3t(cey));
@ -571,8 +571,8 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
if ( u3_none != (mop = _cj_cold_mine(cey, cor)) ) { if ( u3_none != (mop = _cj_cold_mine(cey, cor)) ) {
c3_l jax_l = _cj_boil_mine(mop, cor); c3_l jax_l = _cj_boil_mine(mop, cor);
// fprintf(stderr, "warm: bat %x\r\n", u3_cr_mug(bat)); // fprintf(stderr, "warm: bat %x\r\n", u3r_mug(bat));
u3_ch_put(u3R->jed.har_p, u3h_put(u3R->jed.har_p,
bat, bat,
u3nq(jax_l, u3nq(jax_l,
u3k(pax), u3k(pax),
@ -586,18 +586,18 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
u3z(cor); u3z(cor);
} }
/* u3_cj_boot(): initialize jet system. /* u3j_boot(): initialize jet system.
*/ */
void void
u3_cj_boot(void) u3j_boot(void)
{ {
c3_w jax_l; c3_w jax_l;
u3D.len_l =_cj_count(0, u3D.dev_u); u3D.len_l =_cj_count(0, u3D.dev_u);
u3D.all_l = (2 * u3D.len_l) + 1024; // horrid heuristic u3D.all_l = (2 * u3D.len_l) + 1024; // horrid heuristic
u3D.ray_u = (u3_ce_core*) malloc(u3D.all_l * sizeof(u3_ce_core)); u3D.ray_u = (u3e_core*) malloc(u3D.all_l * sizeof(u3e_core));
memset(u3D.ray_u, 0, (u3D.all_l * sizeof(u3_ce_core))); memset(u3D.ray_u, 0, (u3D.all_l * sizeof(u3e_core)));
jax_l = _cj_install(u3D.ray_u, 1, u3D.dev_u); jax_l = _cj_install(u3D.ray_u, 1, u3D.dev_u);
fprintf(stderr, "boot: installed %d jets\n", jax_l); fprintf(stderr, "boot: installed %d jets\n", jax_l);
@ -608,13 +608,13 @@ u3_cj_boot(void)
c3_l c3_l
_cj_find(u3_noun bat) _cj_find(u3_noun bat)
{ {
u3_cs_road* rod_u = u3R; u3a_road* rod_u = u3R;
while ( 1 ) { while ( 1 ) {
u3_weak jaw = u3_ch_gut(rod_u->jed.har_p, bat); u3_weak jaw = u3h_gut(rod_u->jed.har_p, bat);
if ( u3_none != jaw ) { if ( u3_none != jaw ) {
u3_assure(u3_ca_is_cat(u3h(jaw))); u3_assure(u3a_is_cat(u3h(jaw)));
#if 0 #if 0
if ( rod_u != u3R ) { if ( rod_u != u3R ) {
@ -631,10 +631,10 @@ _cj_find(u3_noun bat)
} }
} }
/* u3_cj_find(): search for jet. `bat` is RETAINED. /* u3j_find(): search for jet. `bat` is RETAINED.
*/ */
c3_l c3_l
u3_cj_find(u3_noun bat) u3j_find(u3_noun bat)
{ {
return _cj_find(bat); return _cj_find(bat);
} }
@ -644,9 +644,9 @@ u3_cj_find(u3_noun bat)
static u3_noun static u3_noun
_cj_soft(u3_noun cor, u3_noun axe) _cj_soft(u3_noun cor, u3_noun axe)
{ {
u3_noun arm = u3_cx_at(axe, cor); u3_noun arm = u3x_at(axe, cor);
return u3_cn_nock_on(cor, u3k(arm)); return u3n_nock_on(cor, u3k(arm));
} }
extern int SLAY; extern int SLAY;
@ -657,7 +657,7 @@ extern int SLAY;
** `axe` is RETAINED. ** `axe` is RETAINED.
*/ */
static u3_weak static u3_weak
_cj_kick_z(u3_noun cor, u3_ce_core* cop_u, u3_ce_harm* ham_u, u3_atom axe) _cj_kick_z(u3_noun cor, u3e_core* cop_u, u3e_harm* ham_u, u3_atom axe)
{ {
if ( 0 == ham_u->fun_f ) { if ( 0 == ham_u->fun_f ) {
return u3_none; return u3_none;
@ -690,15 +690,15 @@ _cj_kick_z(u3_noun cor, u3_ce_core* cop_u, u3_ce_harm* ham_u, u3_atom axe)
ame = _cj_soft(cor, axe); ame = _cj_soft(cor, axe);
ham_u->liv = c3y; ham_u->liv = c3y;
if ( c3n == u3_cr_sing(ame, pro) ) { if ( c3n == u3r_sing(ame, pro) ) {
fprintf(stderr, "test: %s %s: mismatch: good %x, bad %x\r\n", fprintf(stderr, "test: %s %s: mismatch: good %x, bad %x\r\n",
cop_u->cos_c, cop_u->cos_c,
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c, (!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c,
u3_cr_mug(ame), u3r_mug(ame),
u3_cr_mug(pro)); u3r_mug(pro));
c3_assert(0); c3_assert(0);
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
#if 1 #if 1
@ -721,26 +721,26 @@ _cj_hook_in(u3_noun cor,
{ {
u3_noun bat = u3h(cor); u3_noun bat = u3h(cor);
if ( !_(u3du(cor)) ) { return u3_cm_bail(c3__fail); } if ( !_(u3du(cor)) ) { return u3m_bail(c3__fail); }
{ {
u3_weak cax = _cj_warm_fend(bat); u3_weak cax = _cj_warm_fend(bat);
if ( u3_none == cax ) { return u3_cm_bail(c3__fail); } if ( u3_none == cax ) { return u3m_bail(c3__fail); }
{ {
u3_noun jax, pax, huc, hap; u3_noun jax, pax, huc, hap;
u3_cx_qual(cax, &jax, &pax, &hap, &huc); u3x_qual(cax, &jax, &pax, &hap, &huc);
{ {
c3_l jax_l = jax; c3_l jax_l = jax;
u3_ce_core* cop_u = &u3D.ray_u[jax_l]; u3e_core* cop_u = &u3D.ray_u[jax_l];
u3_noun fol = u3_ckdb_get(u3k(huc), u3_ci_string(tam_c)); u3_noun fol = u3_ckdb_get(u3k(huc), u3i_string(tam_c));
if ( u3_none == fol ) { if ( u3_none == fol ) {
// The caller wants a deeper core. // The caller wants a deeper core.
// //
if ( 0 == pax ) { return u3_cm_bail(c3__fail); } if ( 0 == pax ) { return u3m_bail(c3__fail); }
else { else {
u3_noun inn = u3k(u3_cx_at(pax, cor)); u3_noun inn = u3k(u3x_at(pax, cor));
u3z(cax); u3z(cor); u3z(cax); u3z(cor);
return _cj_hook_in(inn, tam_c, jet_o); return _cj_hook_in(inn, tam_c, jet_o);
@ -761,13 +761,13 @@ _cj_hook_in(u3_noun cor,
{ {
if ( 0 == axe_l ) { if ( 0 == axe_l ) {
u3z(cax); u3z(cax);
return u3_cn_nock_on(cor, fol); return u3n_nock_on(cor, fol);
} else { } else {
// Tricky: the above case would work here too, but would // Tricky: the above case would work here too, but would
// disable jet_o and create some infinite recursions. // disable jet_o and create some infinite recursions.
// //
u3z(cax); u3z(fol); u3z(cax); u3z(fol);
return u3_cn_nock_on(cor, u3k(u3_cx_at(axe_l, cor))); return u3n_nock_on(cor, u3k(u3x_at(axe_l, cor)));
} }
} }
else { else {
@ -780,10 +780,10 @@ _cj_hook_in(u3_noun cor,
} }
} }
/* u3_cj_soft(): execute soft hook. /* u3j_soft(): execute soft hook.
*/ */
u3_noun u3_noun
u3_cj_soft(u3_noun cor, u3j_soft(u3_noun cor,
const c3_c* tam_c) const c3_c* tam_c)
{ {
u3_noun pro; u3_noun pro;
@ -792,10 +792,10 @@ u3_cj_soft(u3_noun cor,
return pro; return pro;
} }
/* u3_cj_hook(): execute hook from core, or fail. /* u3j_hook(): execute hook from core, or fail.
*/ */
u3_noun u3_noun
u3_cj_hook(u3_noun cor, u3j_hook(u3_noun cor,
const c3_c* tam_c) const c3_c* tam_c)
{ {
u3_noun pro; u3_noun pro;
@ -804,13 +804,13 @@ u3_cj_hook(u3_noun cor,
return pro; return pro;
} }
/* u3_cj_kick(): new kick. /* u3j_kick(): new kick.
** **
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there ** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
** is no kick, TRANSFERRED if one. ** is no kick, TRANSFERRED if one.
*/ */
u3_weak u3_weak
u3_cj_kick(u3_noun cor, u3_noun axe) u3j_kick(u3_noun cor, u3_noun axe)
{ {
if ( !_(u3du(cor)) ) { return u3_none; } if ( !_(u3du(cor)) ) { return u3_none; }
{ {
@ -827,9 +827,9 @@ u3_cj_kick(u3_noun cor, u3_noun axe)
} }
else { else {
c3_l jax_l = u3h(cax); c3_l jax_l = u3h(cax);
u3_ce_core* cop_u = &u3D.ray_u[jax_l]; u3e_core* cop_u = &u3D.ray_u[jax_l];
c3_l inx_l = inx; c3_l inx_l = inx;
u3_ce_harm* ham_u = &cop_u->arm_u[inx_l]; u3e_harm* ham_u = &cop_u->arm_u[inx_l];
u3_noun pro; u3_noun pro;
u3z(cax); u3z(cax);
@ -841,25 +841,25 @@ u3_cj_kick(u3_noun cor, u3_noun axe)
} }
} }
/* u3_cj_kink(): kick either by jet or by nock. /* u3j_kink(): kick either by jet or by nock.
*/ */
u3_noun u3_noun
u3_cj_kink(u3_noun cor, u3j_kink(u3_noun cor,
u3_noun axe) u3_noun axe)
{ {
u3_weak pro = u3_cj_kick(cor, axe); u3_weak pro = u3j_kick(cor, axe);
if ( u3_none != pro ) { if ( u3_none != pro ) {
return pro; return pro;
} else { } else {
return u3_cn_nock_on(cor, u3nq(9, axe, 0, 1)); return u3n_nock_on(cor, u3nq(9, axe, 0, 1));
} }
} }
/* u3_cj_mine(): register core for jets. Produce registered core. /* u3j_mine(): register core for jets. Produce registered core.
*/ */
void void
u3_cj_mine(u3_noun clu, u3_noun cor) u3j_mine(u3_noun clu, u3_noun cor)
{ {
_cj_warm_mine(clu, cor); _cj_warm_mine(clu, cor);
} }
@ -875,12 +875,12 @@ _cj_cold_reap_un(u3_noun soh, u3_noun sab, u3_noun sys)
else { else {
u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab; u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab;
u3_cx_trel(sab, &n_sab, &l_sab, &r_sab); u3x_trel(sab, &n_sab, &l_sab, &r_sab);
u3_cx_cell(n_sab, &pn_sab, &qn_sab); u3x_cell(n_sab, &pn_sab, &qn_sab);
{ {
sys = _cj_cold_reap_un(soh, l_sab, sys); sys = _cj_cold_reap_un(soh, l_sab, sys);
sys = _cj_cold_reap_un(soh, r_sab, sys); sys = _cj_cold_reap_un(soh, r_sab, sys);
sys = u3_ckdb_put(sys, u3_ca_take(pn_sab), u3k(soh)); sys = u3_ckdb_put(sys, u3a_take(pn_sab), u3k(soh));
return sys; return sys;
} }
@ -898,8 +898,8 @@ _cj_cold_reap_to(u3_noun sab, u3_noun bas)
else { else {
u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab; u3_noun n_sab, l_sab, r_sab, pn_sab, qn_sab;
u3_cx_trel(sab, &n_sab, &l_sab, &r_sab); u3x_trel(sab, &n_sab, &l_sab, &r_sab);
u3_cx_cell(n_sab, &pn_sab, &qn_sab); u3x_cell(n_sab, &pn_sab, &qn_sab);
{ {
bas = _cj_cold_reap_to(l_sab, bas); bas = _cj_cold_reap_to(l_sab, bas);
bas = _cj_cold_reap_to(r_sab, bas); bas = _cj_cold_reap_to(r_sab, bas);
@ -907,10 +907,10 @@ _cj_cold_reap_to(u3_noun sab, u3_noun bas)
// If the battery is not junior, or if it has been // If the battery is not junior, or if it has been
// already collected for the product, promote it. // already collected for the product, promote it.
// //
if ( _(u3_ca_left(pn_sab)) ) { if ( _(u3a_left(pn_sab)) ) {
u3_noun bat = u3_ca_take(pn_sab); u3_noun bat = u3a_take(pn_sab);
bas = u3_ckdb_put(bas, bat, u3_ca_take(qn_sab)); bas = u3_ckdb_put(bas, bat, u3a_take(qn_sab));
} }
return bas; return bas;
} }
@ -927,8 +927,8 @@ _cj_cold_reap_at(u3_noun soh, u3_noun cag)
if ( u3_nul != sab ) { if ( u3_nul != sab ) {
u3_noun sys, haw, das; u3_noun sys, haw, das;
soh = u3_ca_take(soh); soh = u3a_take(soh);
cag = u3nc(u3_ca_take(u3h(cag)), sab); cag = u3nc(u3a_take(u3h(cag)), sab);
sys = _cj_cold_reap_un(soh, sab, u3k(u3h(u3R->jed.das))); sys = _cj_cold_reap_un(soh, sab, u3k(u3h(u3R->jed.das)));
haw = u3_ckdb_put(u3k(u3t(u3R->jed.das)), soh, cag); haw = u3_ckdb_put(u3k(u3t(u3R->jed.das)), soh, cag);
@ -948,8 +948,8 @@ _cj_cold_reap_in(u3_noun taw)
if ( u3_nul != taw ) { if ( u3_nul != taw ) {
u3_noun n_taw, l_taw, r_taw, pn_taw, qn_taw; u3_noun n_taw, l_taw, r_taw, pn_taw, qn_taw;
u3_cx_trel(taw, &n_taw, &l_taw, &r_taw); u3x_trel(taw, &n_taw, &l_taw, &r_taw);
u3_cx_cell(n_taw, &pn_taw, &qn_taw); u3x_cell(n_taw, &pn_taw, &qn_taw);
_cj_cold_reap_at(pn_taw, qn_taw); _cj_cold_reap_at(pn_taw, qn_taw);
_cj_cold_reap_in(l_taw); _cj_cold_reap_in(l_taw);
@ -965,26 +965,26 @@ _cj_warm_reap(u3_noun kev)
u3_noun bat = u3h(kev); u3_noun bat = u3h(kev);
u3_noun cax = u3t(kev); u3_noun cax = u3t(kev);
if ( _(u3_ca_left(bat)) ) { if ( _(u3a_left(bat)) ) {
u3_noun tab = u3_ca_take(bat); u3_noun tab = u3a_take(bat);
u3_noun xac = u3_ca_take(cax); u3_noun xac = u3a_take(cax);
#if 0 #if 0
fprintf(stderr, "reap: bat %x (%d, %d), cax %x\r\n", fprintf(stderr, "reap: bat %x (%d, %d), cax %x\r\n",
u3_cr_mug(tab), u3r_mug(tab),
u3_ca_is_junior(u3R, bat), u3a_is_junior(u3R, bat),
u3_ca_use(tab), u3a_use(tab),
u3_cr_mug(xac)); u3r_mug(xac));
#endif #endif
u3_ch_put(u3R->jed.har_p, tab, xac); u3h_put(u3R->jed.har_p, tab, xac);
u3z(tab); u3z(tab);
} }
} }
/* u3_cj_reap(): promote jet state. RETAINS. /* u3j_reap(): promote jet state. RETAINS.
*/ */
void void
u3_cj_reap(u3_noun das, u3p(u3_ch_root) har_p) u3j_reap(u3_noun das, u3p(u3h_root) har_p)
{ {
_cj_cold_reap_in(u3t(das)); _cj_cold_reap_in(u3t(das));
u3_ch_walk(har_p, _cj_warm_reap); u3h_walk(har_p, _cj_warm_reap);
} }

282
g/m.c
View File

@ -32,7 +32,7 @@ _cm_punt(u3_noun tax)
u3_noun xat; u3_noun xat;
for ( xat = tax; xat; xat = u3t(xat) ) { for ( xat = tax; xat; xat = u3t(xat) ) {
u3_cm_p("&", u3h(xat)); u3m_p("&", u3h(xat));
} }
} }
#endif #endif
@ -138,13 +138,13 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
// A top-level crash - rather odd. We should GC. // A top-level crash - rather odd. We should GC.
// //
_cm_emergency("recover: top", sig_l); _cm_emergency("recover: top", sig_l);
u3H->rod_u.how.fag_w |= u3_ca_flag_gc; u3H->rod_u.how.fag_w |= u3a_flag_gc;
// Reset the top road - the problem could be a fat cap. // Reset the top road - the problem could be a fat cap.
// //
_cm_signal_reset(); _cm_signal_reset();
if ( (c3__meme == sig_l) && (u3_ca_open(u3R) <= 256) ) { if ( (c3__meme == sig_l) && (u3a_open(u3R) <= 256) ) {
// Out of memory at the top level. Error becomes c3__full, // Out of memory at the top level. Error becomes c3__full,
// and we release the emergency buffer. To continue work, // and we release the emergency buffer. To continue work,
// we need to readjust the image, eg, migrate to 64 bit. // we need to readjust the image, eg, migrate to 64 bit.
@ -165,13 +165,13 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
// Descend to the innermost trace, collecting stack. // Descend to the innermost trace, collecting stack.
// //
{ {
u3_cs_road* rod_u; u3a_road* rod_u;
u3R = &(u3H->rod_u); u3R = &(u3H->rod_u);
rod_u = u3R; rod_u = u3R;
while ( rod_u->kid_u ) { while ( rod_u->kid_u ) {
tax = u3_ckb_weld(u3_ca_take(rod_u->kid_u->bug.tax), tax); tax = u3_ckb_weld(u3a_take(rod_u->kid_u->bug.tax), tax);
rod_u = rod_u->kid_u; rod_u = rod_u->kid_u;
} }
} }
@ -199,7 +199,7 @@ _cm_signal_deep(c3_w sec_w)
// go utterly haywire. // go utterly haywire.
// //
if ( 0 == u3H->rod_u.bug.mer ) { if ( 0 == u3H->rod_u.bug.mer ) {
u3H->rod_u.bug.mer = u3_ci_string("emergency buffer"); u3H->rod_u.bug.mer = u3i_string("emergency buffer");
} }
if ( sec_w ) { if ( sec_w ) {
@ -235,18 +235,18 @@ _cm_signal_done()
u3_unix_ef_move(); u3_unix_ef_move();
} }
/* u3_cm_signal(): treat a nock-level exception as a signal interrupt. /* u3m_signal(): treat a nock-level exception as a signal interrupt.
*/ */
void void
u3_cm_signal(u3_noun sig_l) u3m_signal(u3_noun sig_l)
{ {
siglongjmp(u3_Signal, sig_l); siglongjmp(u3_Signal, sig_l);
} }
/* u3_cm_file(): load file, as atom, or bail. /* u3m_file(): load file, as atom, or bail.
*/ */
u3_noun u3_noun
u3_cm_file(c3_c* pas_c) u3m_file(c3_c* pas_c)
{ {
struct stat buf_b; struct stat buf_b;
c3_i fid_i = open(pas_c, O_RDONLY, 0644); c3_i fid_i = open(pas_c, O_RDONLY, 0644);
@ -255,7 +255,7 @@ u3_cm_file(c3_c* pas_c)
if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) { if ( (fid_i < 0) || (fstat(fid_i, &buf_b) < 0) ) {
fprintf(stderr, "%s: %s\r\n", pas_c, strerror(errno)); fprintf(stderr, "%s: %s\r\n", pas_c, strerror(errno));
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
fln_w = buf_b.st_size; fln_w = buf_b.st_size;
pad_y = c3_malloc(buf_b.st_size); pad_y = c3_malloc(buf_b.st_size);
@ -265,10 +265,10 @@ u3_cm_file(c3_c* pas_c)
if ( fln_w != red_w ) { if ( fln_w != red_w ) {
free(pad_y); free(pad_y);
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
u3_noun pad = u3_ci_bytes(fln_w, (c3_y *)pad_y); u3_noun pad = u3i_bytes(fln_w, (c3_y *)pad_y);
free(pad_y); free(pad_y);
return pad; return pad;
@ -342,74 +342,74 @@ _boot_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
static void static void
_boot_parts(void) _boot_parts(void)
{ {
u3R->cax.har_p = u3_ch_new(); u3R->cax.har_p = u3h_new();
u3R->jed.har_p = u3_ch_new(); u3R->jed.har_p = u3h_new();
u3R->jed.das = u3nc(u3_nul, u3_nul); u3R->jed.das = u3nc(u3_nul, u3_nul);
} }
/* u3_cm_mark(): mark all nouns in the road. /* u3m_mark(): mark all nouns in the road.
*/ */
void void
u3_cm_mark(void) u3m_mark(void)
{ {
u3_ch_mark(u3R->jed.har_p); u3h_mark(u3R->jed.har_p);
u3_ca_mark_noun(u3R->jed.das); u3a_mark_noun(u3R->jed.das);
u3_ca_mark_noun(u3R->ski.flu); u3a_mark_noun(u3R->ski.flu);
u3_ca_mark_noun(u3R->bug.tax); u3a_mark_noun(u3R->bug.tax);
u3_ca_mark_noun(u3R->bug.mer); u3a_mark_noun(u3R->bug.mer);
u3_ca_mark_noun(u3R->pro.don); u3a_mark_noun(u3R->pro.don);
u3_ca_mark_noun(u3R->pro.day); u3a_mark_noun(u3R->pro.day);
u3_ch_mark(u3R->cax.har_p); u3h_mark(u3R->cax.har_p);
} }
/* u3_cm_boot(): instantiate or activate image. /* u3m_boot(): instantiate or activate image.
*/ */
void void
u3_cm_boot(c3_o nuu_o, c3_o bug_o) u3m_boot(c3_o nuu_o, c3_o bug_o)
{ {
if ( c3y == nuu_o ) { if ( c3y == nuu_o ) {
u3H = (void *)_boot_north(u3_Loom + 1, u3H = (void *)_boot_north(u3_Loom + 1,
c3_wiseof(u3_cv_home), c3_wiseof(u3v_home),
u3_ca_words - 1); u3a_words - 1);
u3R = &u3H->rod_u; u3R = &u3H->rod_u;
_boot_parts(); _boot_parts();
} }
else { else {
u3H = (void *)_find_north(u3_Loom + 1, u3H = (void *)_find_north(u3_Loom + 1,
c3_wiseof(u3_cv_home), c3_wiseof(u3v_home),
u3_ca_words - 1); u3a_words - 1);
u3R = &u3H->rod_u; u3R = &u3H->rod_u;
} }
if ( _(bug_o) ) { if ( _(bug_o) ) {
u3R->how.fag_w |= u3_ca_flag_debug; u3R->how.fag_w |= u3a_flag_debug;
} }
} }
/* u3_cm_clear(): clear all allocated data in road. /* u3m_clear(): clear all allocated data in road.
*/ */
void void
u3_cm_clear(void) u3m_clear(void)
{ {
u3_ch_free(u3R->cax.har_p); u3h_free(u3R->cax.har_p);
u3_ch_free(u3R->jed.har_p); u3h_free(u3R->jed.har_p);
u3_ca_lose(u3R->jed.das); u3a_lose(u3R->jed.das);
} }
#if 0 #if 0
void void
u3_cm_dump(void) u3m_dump(void)
{ {
c3_w hat_w; c3_w hat_w;
c3_w fre_w = 0; c3_w fre_w = 0;
c3_w i_w; c3_w i_w;
hat_w = _(u3_ca_is_north(u3R)) ? u3R->hat_w - u3R->rut_w hat_w = _(u3a_is_north(u3R)) ? u3R->hat_w - u3R->rut_w
: u3R->rut_w - u3R->hat_w; : u3R->rut_w - u3R->hat_w;
for ( i_w = 0; i_w < u3_cc_fbox_no; i_w++ ) { for ( i_w = 0; i_w < u3_cc_fbox_no; i_w++ ) {
u3_ca_fbox* fre_u = u3R->all.fre_u[i_w]; u3a_fbox* fre_u = u3R->all.fre_u[i_w];
while ( fre_u ) { while ( fre_u ) {
fre_w += fre_u->box_u.siz_w; fre_w += fre_u->box_u.siz_w;
@ -420,11 +420,11 @@ u3_cm_dump(void)
hat_w, fre_w, (hat_w - fre_w)); hat_w, fre_w, (hat_w - fre_w));
if ( 0 != (hat_w - fre_w) ) { if ( 0 != (hat_w - fre_w) ) {
c3_w* box_w = _(u3_ca_is_north(u3R)) ? u3R->rut_w : u3R->hat_w; c3_w* box_w = _(u3a_is_north(u3R)) ? u3R->rut_w : u3R->hat_w;
c3_w mem_w = 0; c3_w mem_w = 0;
while ( box_w < (_(u3_ca_is_north(u3R)) ? u3R->hat_w : u3R->rut_w) ) { while ( box_w < (_(u3a_is_north(u3R)) ? u3R->hat_w : u3R->rut_w) ) {
u3_ca_box* box_u = (void *)box_w; u3a_box* box_u = (void *)box_w;
if ( 0 != box_u->use_w ) { if ( 0 != box_u->use_w ) {
#ifdef U3_MEMORY_DEBUG #ifdef U3_MEMORY_DEBUG
@ -442,7 +442,7 @@ u3_cm_dump(void)
c3_w Exit; c3_w Exit;
/* u3_cm_bail(): bail out. Does not return. /* u3m_bail(): bail out. Does not return.
** **
** Bail motes: ** Bail motes:
** **
@ -464,7 +464,7 @@ c3_w Exit;
** == ** ==
*/ */
c3_i c3_i
u3_cm_bail(u3_noun how) u3m_bail(u3_noun how)
{ {
if ( (c3__exit == how) && (u3R == &u3H->rod_u) ) { if ( (c3__exit == how) && (u3R == &u3H->rod_u) ) {
abort(); abort();
@ -492,7 +492,7 @@ u3_cm_bail(u3_noun how)
c3_assert(_(u3ud(u3h(how)))); c3_assert(_(u3ud(u3h(how))));
fprintf(stderr, "bail: %d\r\n", u3h(how)); fprintf(stderr, "bail: %d\r\n", u3h(how));
u3_cm_p("bail", u3t(how)); u3m_p("bail", u3t(how));
} }
} }
@ -505,8 +505,8 @@ u3_cm_bail(u3_noun how)
// choice but to use the signal process; and we require the flat // choice but to use the signal process; and we require the flat
// form of how. // form of how.
// //
c3_assert(_(u3_ca_is_cat(how))); c3_assert(_(u3a_is_cat(how)));
u3_cm_signal(how); u3m_signal(how);
} }
/* Reconstruct a correct error ball. /* Reconstruct a correct error ball.
@ -535,21 +535,21 @@ u3_cm_bail(u3_noun how)
return 0; return 0;
} }
int c3_cooked() { return u3_cm_bail(c3__oops); } int c3_cooked() { return u3m_bail(c3__oops); }
/* u3_cm_error(): bail out with %exit, ct_pushing error. /* u3m_error(): bail out with %exit, ct_pushing error.
*/ */
c3_i c3_i
u3_cm_error(c3_c* str_c) u3m_error(c3_c* str_c)
{ {
fprintf(stderr, "error: %s\r\n", str_c); // rong fprintf(stderr, "error: %s\r\n", str_c); // rong
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
/* u3_cm_leap(): in u3R, create a new road within the existing one. /* u3m_leap(): in u3R, create a new road within the existing one.
*/ */
void void
u3_cm_leap(c3_w pad_w) u3m_leap(c3_w pad_w)
{ {
c3_w len_w; c3_w len_w;
u3_road* rod_u; u3_road* rod_u;
@ -563,10 +563,10 @@ u3_cm_leap(c3_w pad_w)
else { else {
pad_w -= u3R->all.fre_w; pad_w -= u3R->all.fre_w;
} }
if ( (pad_w + c3_wiseof(u3_cs_road)) >= u3_ca_open(u3R) ) { if ( (pad_w + c3_wiseof(u3a_road)) >= u3a_open(u3R) ) {
u3_cm_bail(c3__meme); u3m_bail(c3__meme);
} }
len_w = u3_ca_open(u3R) - (pad_w + c3_wiseof(u3_cs_road)); len_w = u3a_open(u3R) - (pad_w + c3_wiseof(u3a_road));
} }
/* Allocate a region on the cap. /* Allocate a region on the cap.
@ -574,11 +574,11 @@ u3_cm_leap(c3_w pad_w)
{ {
u3p(c3_w) bot_p; u3p(c3_w) bot_p;
if ( c3y == u3_ca_is_north(u3R) ) { if ( c3y == u3a_is_north(u3R) ) {
bot_p = (u3R->cap_p - len_w); bot_p = (u3R->cap_p - len_w);
u3R->cap_p -= len_w; u3R->cap_p -= len_w;
rod_u = _boot_south(u3_ca_into(bot_p), c3_wiseof(u3_cs_road), len_w); rod_u = _boot_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
#if 0 #if 0
fprintf(stderr, "leap: from north %p (cap %x), to south %p\r\n", fprintf(stderr, "leap: from north %p (cap %x), to south %p\r\n",
u3R, u3R,
@ -590,7 +590,7 @@ u3_cm_leap(c3_w pad_w)
bot_p = u3R->cap_p; bot_p = u3R->cap_p;
u3R->cap_p += len_w; u3R->cap_p += len_w;
rod_u = _boot_north(u3_ca_into(bot_p), c3_wiseof(u3_cs_road), len_w); rod_u = _boot_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
#if 0 #if 0
fprintf(stderr, "leap: from north %p (cap %p), to south %p\r\n", fprintf(stderr, "leap: from north %p (cap %p), to south %p\r\n",
u3R, u3R,
@ -611,26 +611,26 @@ u3_cm_leap(c3_w pad_w)
/* Set up the new road. /* Set up the new road.
*/ */
{ {
if ( u3R->how.fag_w & u3_ca_flag_debug ) { if ( u3R->how.fag_w & u3a_flag_debug ) {
rod_u->how.fag_w |= u3_ca_flag_debug; rod_u->how.fag_w |= u3a_flag_debug;
} }
u3R = rod_u; u3R = rod_u;
_boot_parts(); _boot_parts();
} }
} }
/* u3_cm_fall(): in u3R, return an inner road to its parent. /* u3m_fall(): in u3R, return an inner road to its parent.
*/ */
void void
u3_cm_fall() u3m_fall()
{ {
c3_assert(0 != u3R->par_u); c3_assert(0 != u3R->par_u);
#if 0 #if 0
fprintf(stderr, "fall: from %s %p, to %s %p (cap %p, was %p)\r\n", fprintf(stderr, "fall: from %s %p, to %s %p (cap %p, was %p)\r\n",
_(u3_ca_is_north(u3R)) ? "north" : "south", _(u3a_is_north(u3R)) ? "north" : "south",
u3R, u3R,
_(u3_ca_is_north(u3R)) ? "north" : "south", _(u3a_is_north(u3R)) ? "north" : "south",
u3R->par_u, u3R->par_u,
u3R->hat_w, u3R->hat_w,
u3R->rut_w); u3R->rut_w);
@ -646,30 +646,30 @@ u3_cm_fall()
u3R->kid_u = 0; u3R->kid_u = 0;
} }
/* u3_cm_hate(): new, integrated leap mechanism (enter). /* u3m_hate(): new, integrated leap mechanism (enter).
*/ */
void void
u3_cm_hate(c3_w pad_w) u3m_hate(c3_w pad_w)
{ {
c3_assert(0 == u3R->ear_p); c3_assert(0 == u3R->ear_p);
u3R->ear_p = u3R->cap_p; u3R->ear_p = u3R->cap_p;
u3_cm_leap(pad_w); u3m_leap(pad_w);
} }
/* u3_cm_love(): return product from leap. /* u3m_love(): return product from leap.
*/ */
u3_noun u3_noun
u3_cm_love(u3_noun pro) u3m_love(u3_noun pro)
{ {
u3_noun das = u3R->jed.das; u3_noun das = u3R->jed.das;
u3p(u3_ch_root) har_p = u3R->jed.har_p; u3p(u3h_root) har_p = u3R->jed.har_p;
u3_cm_fall(); u3m_fall();
pro = u3_ca_take(pro); pro = u3a_take(pro);
u3_cj_reap(das, har_p); u3j_reap(das, har_p);
u3R->cap_p = u3R->ear_p; u3R->cap_p = u3R->ear_p;
u3R->ear_p = 0; u3R->ear_p = 0;
@ -677,12 +677,12 @@ u3_cm_love(u3_noun pro)
return pro; return pro;
} }
/* u3_cm_golf(): record cap_p length for u3_flog(). /* u3m_golf(): record cap_p length for u3_flog().
*/ */
c3_w c3_w
u3_cm_golf(void) u3m_golf(void)
{ {
if ( c3y == u3_ca_is_north(u3R) ) { if ( c3y == u3a_is_north(u3R) ) {
return u3R->mat_p - u3R->cap_p; return u3R->mat_p - u3R->cap_p;
} }
else { else {
@ -690,14 +690,14 @@ u3_cm_golf(void)
} }
} }
/* u3_cm_flog(): reset cap_p. /* u3m_flog(): reset cap_p.
*/ */
void void
u3_cm_flog(c3_w gof_w) u3m_flog(c3_w gof_w)
{ {
// Enable memsets in case of memory corruption. // Enable memsets in case of memory corruption.
// //
if ( c3y == u3_ca_is_north(u3R) ) { if ( c3y == u3a_is_north(u3R) ) {
u3_post bot_p = (u3R->mat_p - gof_w); u3_post bot_p = (u3R->mat_p - gof_w);
// c3_w len_w = (bot_w - u3R->cap_w); // c3_w len_w = (bot_w - u3R->cap_w);
@ -713,21 +713,21 @@ u3_cm_flog(c3_w gof_w)
} }
} }
/* u3_cm_water(): produce watermarks. /* u3m_water(): produce watermarks.
*/ */
void void
u3_cm_water(c3_w* low_w, c3_w* hig_w) u3m_water(c3_w* low_w, c3_w* hig_w)
{ {
c3_assert(u3R == &u3H->rod_u); c3_assert(u3R == &u3H->rod_u);
*low_w = (u3H->rod_u.hat_p - u3H->rod_u.rut_p); *low_w = (u3H->rod_u.hat_p - u3H->rod_u.rut_p);
*hig_w = (u3H->rod_u.mat_p - u3H->rod_u.cap_p) + c3_wiseof(u3_cv_home); *hig_w = (u3H->rod_u.mat_p - u3H->rod_u.cap_p) + c3_wiseof(u3v_home);
} }
/* u3_cm_soft_top(): top-level safety wrapper. /* u3m_soft_top(): top-level safety wrapper.
*/ */
u3_noun u3_noun
u3_cm_soft_top(c3_w sec_w, // timer seconds u3m_soft_top(c3_w sec_w, // timer seconds
c3_w pad_w, // base memory pad c3_w pad_w, // base memory pad
u3_funk fun_f, u3_funk fun_f,
u3_noun arg) u3_noun arg)
@ -751,17 +751,17 @@ u3_cm_soft_top(c3_w sec_w, // timer seconds
/* Record the cap, and leap. /* Record the cap, and leap.
*/ */
u3_cm_hate(pad_w); u3m_hate(pad_w);
/* Trap for ordinary nock exceptions. /* Trap for ordinary nock exceptions.
*/ */
if ( 0 == (why = u3_cm_trap()) ) { if ( 0 == (why = u3m_trap()) ) {
pro = fun_f(arg); pro = fun_f(arg);
/* Make sure the inner routine did not create garbage. /* Make sure the inner routine did not create garbage.
*/ */
if ( u3R->how.fag_w & u3_ca_flag_debug ) { if ( u3R->how.fag_w & u3a_flag_debug ) {
u3_ce_grab("top", pro, u3_none); u3e_grab("top", pro, u3_none);
} }
/* Revert to external signal regime. /* Revert to external signal regime.
@ -770,12 +770,12 @@ u3_cm_soft_top(c3_w sec_w, // timer seconds
/* Produce success, on the old road. /* Produce success, on the old road.
*/ */
pro = u3nc(0, u3_cm_love(pro)); pro = u3nc(0, u3m_love(pro));
} }
else { else {
/* Overload the error result. /* Overload the error result.
*/ */
pro = u3_cm_love(why); pro = u3m_love(why);
} }
/* Revert to external signal regime. /* Revert to external signal regime.
@ -791,12 +791,12 @@ u3_cm_soft_top(c3_w sec_w, // timer seconds
return pro; return pro;
} }
/* u3_cm_soft_sure(): top-level call assumed correct. /* u3m_soft_sure(): top-level call assumed correct.
*/ */
u3_noun u3_noun
u3_cm_soft_sure(u3_funk fun_f, u3_noun arg) u3m_soft_sure(u3_funk fun_f, u3_noun arg)
{ {
u3_noun pro, pru = u3_cm_soft_top(0, 32768, fun_f, arg); u3_noun pro, pru = u3m_soft_top(0, 32768, fun_f, arg);
c3_assert(_(u3du(pru))); c3_assert(_(u3du(pru)));
pro = u3k(u3t(pru)); pro = u3k(u3t(pru));
@ -805,19 +805,19 @@ u3_cm_soft_sure(u3_funk fun_f, u3_noun arg)
return pro; return pro;
} }
/* u3_cm_soft_slam: top-level call. /* u3m_soft_slam: top-level call.
*/ */
u3_noun _cm_slam(u3_noun arg) { return u3_cn_slam_on(u3h(arg), u3t(arg)); } u3_noun _cm_slam(u3_noun arg) { return u3n_slam_on(u3h(arg), u3t(arg)); }
u3_noun u3_noun
u3_cm_soft_slam(u3_noun gat, u3_noun sam) u3m_soft_slam(u3_noun gat, u3_noun sam)
{ {
return u3_cm_soft_sure(_cm_slam, u3nc(gat, sam)); return u3m_soft_sure(_cm_slam, u3nc(gat, sam));
} }
/* u3_cm_soft_run(): descend into virtualization context. /* u3m_soft_run(): descend into virtualization context.
*/ */
u3_noun u3_noun
u3_cm_soft_run(u3_noun fly, u3m_soft_run(u3_noun fly,
u3_funq fun_f, u3_funq fun_f,
u3_noun aga, u3_noun aga,
u3_noun agb) u3_noun agb)
@ -826,7 +826,7 @@ u3_cm_soft_run(u3_noun fly,
/* Record the cap, and leap. /* Record the cap, and leap.
*/ */
u3_cm_hate(32768); u3m_hate(32768);
/* Configure the new road. /* Configure the new road.
*/ */
@ -838,16 +838,16 @@ u3_cm_soft_run(u3_noun fly,
/* Trap for exceptions. /* Trap for exceptions.
*/ */
if ( 0 == (why = u3_cm_trap()) ) { if ( 0 == (why = u3m_trap()) ) {
pro = fun_f(aga, agb); pro = fun_f(aga, agb);
if ( u3R->how.fag_w & u3_ca_flag_debug ) { if ( u3R->how.fag_w & u3a_flag_debug ) {
u3_ce_grab("top", pro, u3_none); u3e_grab("top", pro, u3_none);
} }
/* Produce success, on the old road. /* Produce success, on the old road.
*/ */
pro = u3nc(0, u3_cm_love(pro)); pro = u3nc(0, u3m_love(pro));
} }
else { else {
/* Produce - or fall again. /* Produce - or fall again.
@ -858,28 +858,28 @@ u3_cm_soft_run(u3_noun fly,
default: c3_assert(0); return 0; default: c3_assert(0); return 0;
case 0: { // unusual: bail with success. case 0: { // unusual: bail with success.
pro = u3_cm_love(why); pro = u3m_love(why);
} break; } break;
case 1: { // blocking request case 1: { // blocking request
pro = u3_cm_love(why); pro = u3m_love(why);
} break; } break;
case 2: { // true exit case 2: { // true exit
pro = u3_cm_love(why); pro = u3m_love(why);
} break; } break;
case 3: { // failure; rebail w/trace case 3: { // failure; rebail w/trace
u3_noun yod = u3_cm_love(u3t(why)); u3_noun yod = u3m_love(u3t(why));
u3_cm_bail u3m_bail
(u3nt(3, (u3nt(3,
u3_ca_take(u3h(yod)), u3a_take(u3h(yod)),
u3_ckb_weld(u3t(yod), u3k(u3R->bug.tax)))); u3_ckb_weld(u3t(yod), u3k(u3R->bug.tax))));
} break; } break;
case 4: { // meta-bail case 4: { // meta-bail
u3_cm_bail(u3_cm_love(u3t(why))); u3m_bail(u3m_love(u3t(why)));
} break; } break;
} }
} }
@ -898,10 +898,10 @@ u3_cm_soft_run(u3_noun fly,
return pro; return pro;
} }
/* u3_cm_soft_esc(): namespace lookup. Produces direct result. /* u3m_soft_esc(): namespace lookup. Produces direct result.
*/ */
u3_noun u3_noun
u3_cm_soft_esc(u3_noun sam) u3m_soft_esc(u3_noun sam)
{ {
u3_noun why, fly, pro; u3_noun why, fly, pro;
@ -914,7 +914,7 @@ u3_cm_soft_esc(u3_noun sam)
/* Record the cap, and leap. /* Record the cap, and leap.
*/ */
u3_cm_hate(32768); u3m_hate(32768);
/* Configure the new road. /* Configure the new road.
*/ */
@ -926,18 +926,18 @@ u3_cm_soft_esc(u3_noun sam)
/* Trap for exceptions. /* Trap for exceptions.
*/ */
if ( 0 == (why = u3_cm_trap()) ) { if ( 0 == (why = u3m_trap()) ) {
pro = u3_cn_slam_on(fly, sam); pro = u3n_slam_on(fly, sam);
/* Fall back to the old road, leaving temporary memory intact. /* Fall back to the old road, leaving temporary memory intact.
*/ */
pro = u3_cm_love(pro); pro = u3m_love(pro);
} }
else { else {
/* Push the error back up to the calling context - not the run we /* Push the error back up to the calling context - not the run we
** are in, but the caller of the run, matching pure nock semantics. ** are in, but the caller of the run, matching pure nock semantics.
*/ */
u3_cm_bail(u3nc(4, u3_cm_love(why))); u3m_bail(u3nc(4, u3m_love(why)));
} }
/* Release the sample. /* Release the sample.
@ -949,18 +949,18 @@ u3_cm_soft_esc(u3_noun sam)
return pro; return pro;
} }
/* u3_cm_soft(): top-level wrapper. /* u3m_soft(): top-level wrapper.
** **
** Produces [0 product] or [%error (list tank)], top last. ** Produces [0 product] or [%error (list tank)], top last.
*/ */
u3_noun u3_noun
u3_cm_soft(c3_w sec_w, u3m_soft(c3_w sec_w,
u3_funk fun_f, u3_funk fun_f,
u3_noun arg) u3_noun arg)
{ {
u3_noun why; u3_noun why;
why = u3_cm_soft_top(sec_w, (1 << 17), fun_f, arg); // 512K pad why = u3m_soft_top(sec_w, (1 << 17), fun_f, arg); // 512K pad
if ( 0 == u3h(why) ) { if ( 0 == u3h(why) ) {
return why; return why;
@ -997,7 +997,7 @@ _cm_is_tas(u3_atom som, c3_w len_w)
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_c c_c = u3_cr_byte(i_w, som); c3_c c_c = u3r_byte(i_w, som);
if ( islower(c_c) || if ( islower(c_c) ||
(isdigit(c_c) && (0 != i_w) && ((len_w - 1) != i_w)) (isdigit(c_c) && (0 != i_w) && ((len_w - 1) != i_w))
@ -1018,7 +1018,7 @@ _cm_is_ta(u3_noun som, c3_w len_w)
c3_w i_w; c3_w i_w;
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_c c_c = u3_cr_byte(i_w, som); c3_c c_c = u3r_byte(i_w, som);
if ( (c_c < 32) || (c_c > 127) ) { if ( (c_c < 32) || (c_c > 127) ) {
return c3n; return c3n;
@ -1076,14 +1076,14 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
return len_w; return len_w;
} }
else { else {
c3_w len_w = u3_cr_met(3, som); c3_w len_w = u3r_met(3, som);
if ( _(_cm_is_tas(som, len_w)) ) { if ( _(_cm_is_tas(som, len_w)) ) {
c3_w len_w = u3_cr_met(3, som); c3_w len_w = u3r_met(3, som);
if ( str_c ) { if ( str_c ) {
*(str_c++) = '%'; *(str_c++) = '%';
u3_cr_bytes(0, len_w, (c3_y *)str_c, som); u3r_bytes(0, len_w, (c3_y *)str_c, som);
str_c += len_w; str_c += len_w;
} }
return len_w + 1; return len_w + 1;
@ -1091,14 +1091,14 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
else if ( _(_cm_is_ta(som, len_w)) ) { else if ( _(_cm_is_ta(som, len_w)) ) {
if ( str_c ) { if ( str_c ) {
*(str_c++) = '\''; *(str_c++) = '\'';
u3_cr_bytes(0, len_w, (c3_y *)str_c, som); u3r_bytes(0, len_w, (c3_y *)str_c, som);
str_c += len_w; str_c += len_w;
*(str_c++) = '\''; *(str_c++) = '\'';
} }
return len_w + 2; return len_w + 2;
} }
else { else {
c3_w len_w = u3_cr_met(3, som); c3_w len_w = u3r_met(3, som);
c3_c *buf_c = malloc(2 + (2 * len_w) + 1); c3_c *buf_c = malloc(2 + (2 * len_w) + 1);
c3_w i_w = 0; c3_w i_w = 0;
c3_w a_w = 0; c3_w a_w = 0;
@ -1107,7 +1107,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
buf_c[a_w++] = 'x'; buf_c[a_w++] = 'x';
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
c3_y c_y = u3_cr_byte(len_w - (i_w + 1), som); c3_y c_y = u3r_byte(len_w - (i_w + 1), som);
if ( (i_w == 0) && (c_y <= 0xf) ) { if ( (i_w == 0) && (c_y <= 0xf) ) {
buf_c[a_w++] = _cm_hex(c_y); buf_c[a_w++] = _cm_hex(c_y);
@ -1128,10 +1128,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
} }
} }
/* u3_cm_pretty(): dumb prettyprint to string. /* u3m_pretty(): dumb prettyprint to string.
*/ */
c3_c* c3_c*
u3_cm_pretty(u3_noun som) u3m_pretty(u3_noun som)
{ {
c3_w len_w = _cm_in_pretty(som, c3y, 0); c3_w len_w = _cm_in_pretty(som, c3y, 0);
c3_c* pre_c = malloc(len_w + 1); c3_c* pre_c = malloc(len_w + 1);
@ -1141,21 +1141,21 @@ u3_cm_pretty(u3_noun som)
return pre_c; return pre_c;
} }
/* u3_cm_p(): dumb print with caption. /* u3m_p(): dumb print with caption.
*/ */
void void
u3_cm_p(const c3_c* cap_c, u3_noun som) u3m_p(const c3_c* cap_c, u3_noun som)
{ {
c3_c* pre_c = u3_cm_pretty(som); c3_c* pre_c = u3m_pretty(som);
fprintf(stderr, "%s: %s\r\n", cap_c, pre_c); fprintf(stderr, "%s: %s\r\n", cap_c, pre_c);
free(pre_c); free(pre_c);
} }
/* u3_cm_tape(): dump a tape to stdout. /* u3m_tape(): dump a tape to stdout.
*/ */
void void
u3_cm_tape(u3_noun tep) u3m_tape(u3_noun tep)
{ {
u3_noun tap = tep; u3_noun tap = tep;
@ -1172,15 +1172,15 @@ u3_cm_tape(u3_noun tep)
u3z(tep); u3z(tep);
} }
/* u3_cm_wall(): dump a wall to stdout. /* u3m_wall(): dump a wall to stdout.
*/ */
void void
u3_cm_wall(u3_noun wol) u3m_wall(u3_noun wol)
{ {
u3_noun wal = wol; u3_noun wal = wol;
while ( u3_nul != wal ) { while ( u3_nul != wal ) {
u3_cm_tape(u3k(u3h(wal))); u3m_tape(u3k(u3h(wal)));
putc(13, stdout); putc(13, stdout);
putc(10, stdout); putc(10, stdout);

176
g/n.c
View File

@ -16,11 +16,11 @@ _cn_hint(u3_noun zep,
{ {
switch ( zep ) { switch ( zep ) {
default: { default: {
// u3_cm_p("weird zep", zep); // u3m_p("weird zep", zep);
u3_ca_lose(zep); u3a_lose(zep);
u3_ca_lose(hod); u3a_lose(hod);
return u3_cn_nock_on(bus, nex); return u3n_nock_on(bus, nex);
} }
case c3__hunk: case c3__hunk:
@ -30,7 +30,7 @@ _cn_hint(u3_noun zep,
u3_noun tac = u3nc(zep, hod); u3_noun tac = u3nc(zep, hod);
u3_noun pro; u3_noun pro;
u3_ct_push(tac); u3t_push(tac);
#if 0 #if 0
if ( c3__spot == zep ) { if ( c3__spot == zep ) {
printf("spot %d/%d : %d/%d\r\n", printf("spot %d/%d : %d/%d\r\n",
@ -40,21 +40,21 @@ _cn_hint(u3_noun zep,
u3t(u3t(u3t(hod)))); u3t(u3t(u3t(hod))));
} }
#endif #endif
pro = u3_cn_nock_on(bus, nex); pro = u3n_nock_on(bus, nex);
u3_ct_drop(); u3t_drop();
return pro; return pro;
} }
case c3__slog: { case c3__slog: {
u3_ct_slog(hod); u3t_slog(hod);
return u3_cn_nock_on(bus, nex); return u3n_nock_on(bus, nex);
} }
case c3__germ: { case c3__germ: {
u3_noun pro = u3_cn_nock_on(bus, nex); u3_noun pro = u3n_nock_on(bus, nex);
if ( c3y == u3_cr_sing(pro, hod) ) { if ( c3y == u3r_sing(pro, hod) ) {
u3z(pro); return hod; u3z(pro); return hod;
} else { } else {
u3z(hod); return pro; u3z(hod); return pro;
@ -62,27 +62,27 @@ _cn_hint(u3_noun zep,
} }
case c3__fast: { case c3__fast: {
u3_noun pro = u3_cn_nock_on(bus, nex); u3_noun pro = u3n_nock_on(bus, nex);
u3_cj_mine(hod, u3k(pro)); u3j_mine(hod, u3k(pro));
return pro; return pro;
} }
case c3__memo: { case c3__memo: {
u3z(hod); u3z(hod);
#if 0 #if 0
return u3_cn_nock_on(bus, nex); return u3n_nock_on(bus, nex);
#else #else
{ {
u3_noun pro = u3_cz_find_2(c3__nock, bus, nex); u3_noun pro = u3z_find_2(c3__nock, bus, nex);
if ( pro != u3_none ) { if ( pro != u3_none ) {
u3z(bus); u3z(nex); u3z(bus); u3z(nex);
return pro; return pro;
} }
pro = u3_cn_nock_on(u3k(bus), u3k(nex)); pro = u3n_nock_on(u3k(bus), u3k(nex));
u3_cz_save_2(c3__nock, bus, nex, pro); u3z_save_2(c3__nock, bus, nex, pro);
u3z(bus); u3z(nex); u3z(bus); u3z(nex);
return pro; return pro;
@ -93,9 +93,9 @@ _cn_hint(u3_noun zep,
case c3__sole: { case c3__sole: {
u3z(hod); u3z(hod);
{ {
u3_noun pro = u3_cn_nock_on(bus, nex); u3_noun pro = u3n_nock_on(bus, nex);
// return u3_cz_uniq(pro); // return u3z_uniq(pro);
return pro; return pro;
} }
} }
@ -104,10 +104,10 @@ _cn_hint(u3_noun zep,
extern u3_noun BAD; extern u3_noun BAD;
/* u3_cn_nock_on(): produce .*(bus fol). Do not virtualize. /* u3n_nock_on(): produce .*(bus fol). Do not virtualize.
*/ */
u3_noun u3_noun
u3_cn_nock_on(u3_noun bus, u3_noun fol) u3n_nock_on(u3_noun bus, u3_noun fol)
{ {
u3_noun hib, gal; u3_noun hib, gal;
@ -117,26 +117,26 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
u3R->pro.nox_d += 1; u3R->pro.nox_d += 1;
if ( c3y == u3_cr_du(hib) ) { if ( c3y == u3r_du(hib) ) {
u3_noun poz, riv; u3_noun poz, riv;
poz = u3_cn_nock_on(u3k(bus), u3k(hib)); poz = u3n_nock_on(u3k(bus), u3k(hib));
riv = u3_cn_nock_on(bus, u3k(gal)); riv = u3n_nock_on(bus, u3k(gal));
u3_ca_lose(fol); u3a_lose(fol);
return u3_ci_cell(poz, riv); return u3i_cell(poz, riv);
} }
else switch ( hib ) { else switch ( hib ) {
default: return u3_cm_bail(c3__exit); default: return u3m_bail(c3__exit);
case 0: { case 0: {
if ( c3n == u3_cr_ud(gal) ) { if ( c3n == u3r_ud(gal) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun pro = u3k(u3at(gal, bus)); u3_noun pro = u3k(u3at(gal, bus));
u3_ca_lose(bus); u3_ca_lose(fol); u3a_lose(bus); u3a_lose(fol);
return pro; return pro;
} }
} }
@ -145,16 +145,16 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 1: { case 1: {
u3_noun pro = u3k(gal); u3_noun pro = u3k(gal);
u3_ca_lose(bus); u3_ca_lose(fol); u3a_lose(bus); u3a_lose(fol);
return pro; return pro;
} }
c3_assert(!"not reached"); c3_assert(!"not reached");
case 2: { case 2: {
u3_noun nex = u3_cn_nock_on(u3k(bus), u3k(u3t(gal))); u3_noun nex = u3n_nock_on(u3k(bus), u3k(u3t(gal)));
u3_noun seb = u3_cn_nock_on(bus, u3k(u3h(gal))); u3_noun seb = u3n_nock_on(bus, u3k(u3h(gal)));
u3_ca_lose(fol); u3a_lose(fol);
bus = seb; bus = seb;
fol = nex; fol = nex;
continue; continue;
@ -164,10 +164,10 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 3: { case 3: {
u3_noun gof, pro; u3_noun gof, pro;
gof = u3_cn_nock_on(bus, u3k(gal)); gof = u3n_nock_on(bus, u3k(gal));
pro = u3_cr_du(gof); pro = u3r_du(gof);
u3_ca_lose(gof); u3_ca_lose(fol); u3a_lose(gof); u3a_lose(fol);
return pro; return pro;
} }
c3_assert(!"not reached"); c3_assert(!"not reached");
@ -175,19 +175,19 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 4: { case 4: {
u3_noun gof, pro; u3_noun gof, pro;
gof = u3_cn_nock_on(bus, u3k(gal)); gof = u3n_nock_on(bus, u3k(gal));
pro = u3_ci_vint(gof); pro = u3i_vint(gof);
u3_ca_lose(fol); u3a_lose(fol);
return pro; return pro;
} }
c3_assert(!"not reached"); c3_assert(!"not reached");
case 5: { case 5: {
u3_noun wim = u3_cn_nock_on(bus, u3k(gal)); u3_noun wim = u3n_nock_on(bus, u3k(gal));
u3_noun pro = u3_cr_sing(u3h(wim), u3t(wim)); u3_noun pro = u3r_sing(u3h(wim), u3t(wim));
u3_ca_lose(wim); u3_ca_lose(fol); u3a_lose(wim); u3a_lose(fol);
return pro; return pro;
} }
c3_assert(!"not reached"); c3_assert(!"not reached");
@ -195,18 +195,18 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 6: { case 6: {
u3_noun b_gal, c_gal, d_gal; u3_noun b_gal, c_gal, d_gal;
u3_cx_trel(gal, &b_gal, &c_gal, &d_gal); u3x_trel(gal, &b_gal, &c_gal, &d_gal);
{ {
u3_noun tys = u3_cn_nock_on(u3k(bus), u3k(b_gal)); u3_noun tys = u3n_nock_on(u3k(bus), u3k(b_gal));
u3_noun nex; u3_noun nex;
if ( 0 == tys ) { if ( 0 == tys ) {
nex = u3k(c_gal); nex = u3k(c_gal);
} else if ( 1 == tys ) { } else if ( 1 == tys ) {
nex = u3k(d_gal); nex = u3k(d_gal);
} else return u3_cm_bail(c3__exit); } else return u3m_bail(c3__exit);
u3_ca_lose(fol); u3a_lose(fol);
fol = nex; fol = nex;
continue; continue;
} }
@ -216,12 +216,12 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 7: { case 7: {
u3_noun b_gal, c_gal; u3_noun b_gal, c_gal;
u3_cx_cell(gal, &b_gal, &c_gal); u3x_cell(gal, &b_gal, &c_gal);
{ {
u3_noun bod = u3_cn_nock_on(bus, u3k(b_gal)); u3_noun bod = u3n_nock_on(bus, u3k(b_gal));
u3_noun nex = u3k(c_gal); u3_noun nex = u3k(c_gal);
u3_ca_lose(fol); u3a_lose(fol);
bus = bod; bus = bod;
fol = nex; fol = nex;
continue; continue;
@ -232,13 +232,13 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 8: { case 8: {
u3_noun b_gal, c_gal; u3_noun b_gal, c_gal;
u3_cx_cell(gal, &b_gal, &c_gal); u3x_cell(gal, &b_gal, &c_gal);
{ {
u3_noun heb = u3_cn_nock_on(u3k(bus), u3k(b_gal)); u3_noun heb = u3n_nock_on(u3k(bus), u3k(b_gal));
u3_noun bod = u3nc(heb, bus); u3_noun bod = u3nc(heb, bus);
u3_noun nex = u3k(c_gal); u3_noun nex = u3k(c_gal);
u3_ca_lose(fol); u3a_lose(fol);
bus = bod; bus = bod;
fol = nex; fol = nex;
continue; continue;
@ -249,23 +249,23 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 9: { case 9: {
u3_noun b_gal, c_gal; u3_noun b_gal, c_gal;
u3_cx_cell(gal, &b_gal, &c_gal); u3x_cell(gal, &b_gal, &c_gal);
{ {
u3_noun seb = u3_cn_nock_on(bus, u3k(c_gal)); u3_noun seb = u3n_nock_on(bus, u3k(c_gal));
u3_noun pro = u3_cj_kick(seb, b_gal); u3_noun pro = u3j_kick(seb, b_gal);
if ( u3_none != pro ) { if ( u3_none != pro ) {
u3_ca_lose(fol); u3a_lose(fol);
return pro; return pro;
} }
else { else {
if ( c3n == u3_cr_ud(b_gal) ) { if ( c3n == u3r_ud(b_gal) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun nex = u3k(u3at(b_gal, seb)); u3_noun nex = u3k(u3at(b_gal, seb));
u3_ca_lose(fol); u3a_lose(fol);
bus = seb; bus = seb;
fol = nex; fol = nex;
continue; continue;
@ -278,17 +278,17 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
case 10: { case 10: {
u3_noun p_gal, q_gal; u3_noun p_gal, q_gal;
u3_cx_cell(gal, &p_gal, &q_gal); u3x_cell(gal, &p_gal, &q_gal);
{ {
u3_noun zep, hod, nex; u3_noun zep, hod, nex;
if ( c3y == u3_cr_du(p_gal) ) { if ( c3y == u3r_du(p_gal) ) {
u3_noun b_gal = u3h(p_gal); u3_noun b_gal = u3h(p_gal);
u3_noun c_gal = u3t(p_gal); u3_noun c_gal = u3t(p_gal);
u3_noun d_gal = q_gal; u3_noun d_gal = q_gal;
zep = u3k(b_gal); zep = u3k(b_gal);
hod = u3_cn_nock_on(u3k(bus), u3k(c_gal)); hod = u3n_nock_on(u3k(bus), u3k(c_gal));
nex = u3k(d_gal); nex = u3k(d_gal);
} }
else { else {
@ -300,17 +300,17 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
nex = u3k(c_gal); nex = u3k(c_gal);
} }
u3_ca_lose(fol); u3a_lose(fol);
return _cn_hint(zep, hod, bus, nex); return _cn_hint(zep, hod, bus, nex);
} }
} }
case 11: { case 11: {
u3_noun gof = u3_cn_nock_on(bus, u3k(gal)); u3_noun gof = u3n_nock_on(bus, u3k(gal));
u3_noun val = u3_cm_soft_esc(gof); u3_noun val = u3m_soft_esc(gof);
if ( !_(u3du(val)) ) { if ( !_(u3du(val)) ) {
u3_cm_bail(u3nt(1, gof, 0)); u3m_bail(u3nt(1, gof, 0));
} }
else { else {
u3_noun pro; u3_noun pro;
@ -327,20 +327,20 @@ u3_cn_nock_on(u3_noun bus, u3_noun fol)
} }
} }
/* u3_cn_kick_on(): fire `gat` without changing the sample. /* u3n_kick_on(): fire `gat` without changing the sample.
*/ */
u3_noun u3_noun
u3_cn_kick_on(u3_noun gat) u3n_kick_on(u3_noun gat)
{ {
return u3_cj_kink(gat, 2); return u3j_kink(gat, 2);
} }
c3_w exc_w; c3_w exc_w;
/* u3_cn_slam_on(): produce (gat sam). /* u3n_slam_on(): produce (gat sam).
*/ */
u3_noun u3_noun
u3_cn_slam_on(u3_noun gat, u3_noun sam) u3n_slam_on(u3_noun gat, u3_noun sam)
{ {
u3_noun cor = u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat))))); u3_noun cor = u3nc(u3k(u3h(gat)), u3nc(sam, u3k(u3t(u3t(gat)))));
@ -353,51 +353,51 @@ u3_cn_slam_on(u3_noun gat, u3_noun sam)
} }
#endif #endif
u3z(gat); u3z(gat);
return u3_cn_kick_on(cor); return u3n_kick_on(cor);
} }
/* u3_cn_nock_un(): produce .*(bus fol), as ++toon. /* u3n_nock_un(): produce .*(bus fol), as ++toon.
*/ */
u3_noun u3_noun
u3_cn_nock_un(u3_noun bus, u3_noun fol) u3n_nock_un(u3_noun bus, u3_noun fol)
{ {
u3_noun fly = u3nt(u3nt(11, 0, 6), 0, 0); // |=(a=* .^(a)) u3_noun fly = u3nt(u3nt(11, 0, 6), 0, 0); // |=(a=* .^(a))
return u3_cn_nock_in(fly, bus, fol); return u3n_nock_in(fly, bus, fol);
} }
/* u3_cn_slam_un(): produce (gat sam), as ++toon. /* u3n_slam_un(): produce (gat sam), as ++toon.
*/ */
u3_noun u3_noun
u3_cn_slam_un(u3_noun gat, u3_noun sam) u3n_slam_un(u3_noun gat, u3_noun sam)
{ {
u3_noun fly = u3nt(u3nt(11, 0, 6), 0, 0); // |=(a=* .^(a)) u3_noun fly = u3nt(u3nt(11, 0, 6), 0, 0); // |=(a=* .^(a))
return u3_cn_slam_in(fly, gat, sam); return u3n_slam_in(fly, gat, sam);
} }
/* u3_cn_nock_in(): produce .*(bus fol), as ++toon, in namespace. /* u3n_nock_in(): produce .*(bus fol), as ++toon, in namespace.
*/ */
u3_noun u3_noun
u3_cn_nock_in(u3_noun fly, u3_noun bus, u3_noun fol) u3n_nock_in(u3_noun fly, u3_noun bus, u3_noun fol)
{ {
return u3_cm_soft_run(fly, u3_cn_nock_on, bus, fol); return u3m_soft_run(fly, u3n_nock_on, bus, fol);
} }
/* u3_cn_slam_in(): produce (gat sam), as ++toon, in namespace. /* u3n_slam_in(): produce (gat sam), as ++toon, in namespace.
*/ */
u3_noun u3_noun
u3_cn_slam_in(u3_noun fly, u3_noun gat, u3_noun sam) u3n_slam_in(u3_noun fly, u3_noun gat, u3_noun sam)
{ {
return u3_cm_soft_run(fly, u3_cn_slam_on, gat, sam); return u3m_soft_run(fly, u3n_slam_on, gat, sam);
} }
/* u3_cn_nock_an(): as slam_in(), but with empty fly. /* u3n_nock_an(): as slam_in(), but with empty fly.
*/ */
u3_noun u3_noun
u3_cn_nock_an(u3_noun bus, u3_noun fol) u3n_nock_an(u3_noun bus, u3_noun fol)
{ {
u3_noun fly = u3nt(u3nc(1, 0), 0, 0); // |=(a=* ~) u3_noun fly = u3nt(u3nc(1, 0), 0, 0); // |=(a=* ~)
return u3_cn_nock_in(fly, bus, fol); return u3n_nock_in(fly, bus, fol);
} }

438
g/r.c

File diff suppressed because it is too large Load Diff

60
g/t.c
View File

@ -4,26 +4,26 @@
*/ */
#include "all.h" #include "all.h"
/* u3_ct_push(): push on trace stack. /* u3t_push(): push on trace stack.
*/ */
void void
u3_ct_push(u3_noun mon) u3t_push(u3_noun mon)
{ {
u3R->bug.tax = u3nc(mon, u3R->bug.tax); u3R->bug.tax = u3nc(mon, u3R->bug.tax);
} }
/* u3_ct_mean(): push `[%mean roc]` on trace stack. /* u3t_mean(): push `[%mean roc]` on trace stack.
*/ */
void void
u3_ct_mean(u3_noun roc) u3t_mean(u3_noun roc)
{ {
u3R->bug.tax = u3nc(u3nc(c3__mean, roc), u3R->bug.tax); u3R->bug.tax = u3nc(u3nc(c3__mean, roc), u3R->bug.tax);
} }
/* u3_ct_drop(): drop from meaning stack. /* u3t_drop(): drop from meaning stack.
*/ */
void void
u3_ct_drop(void) u3t_drop(void)
{ {
c3_assert(_(u3du(u3R->bug.tax))); c3_assert(_(u3du(u3R->bug.tax)));
{ {
@ -37,10 +37,10 @@ u3_ct_drop(void)
extern void extern void
u3_lo_tank(c3_l tab_l, u3_noun tac); u3_lo_tank(c3_l tab_l, u3_noun tac);
/* u3_ct_slog(): print directly. /* u3t_slog(): print directly.
*/ */
void void
u3_ct_slog(u3_noun hod) u3t_slog(u3_noun hod)
{ {
if ( c3y == u3du(hod) ) { if ( c3y == u3du(hod) ) {
u3_noun pri = u3h(hod); u3_noun pri = u3h(hod);
@ -55,42 +55,42 @@ u3_ct_slog(u3_noun hod)
u3z(hod); u3z(hod);
} }
/* u3_ct_heck(): profile point. /* u3t_heck(): profile point.
*/ */
void void
u3_ct_heck(u3_atom cog) u3t_heck(u3_atom cog)
{ {
printf("ct: heck %s\r\n", u3_cr_string(cog)); printf("ct: heck %s\r\n", u3r_string(cog));
if ( 0 == u3R->pro.day ) { u3R->pro.day = u3_cv_do("doss", 0); } if ( 0 == u3R->pro.day ) { u3R->pro.day = u3v_do("doss", 0); }
u3R->pro.day = u3_dc("pi-heck", cog, u3R->pro.day); u3R->pro.day = u3_dc("pi-heck", cog, u3R->pro.day);
} }
/* u3_ct_samp(): sample. /* u3t_samp(): sample.
*/ */
void void
u3_ct_samp(void) u3t_samp(void)
{ {
if ( 0 == u3R->pro.day ) { u3R->pro.day = u3_cv_do("doss", 0); } if ( 0 == u3R->pro.day ) { u3R->pro.day = u3v_do("doss", 0); }
u3R->pro.day = u3_dc("pi-noon", u3k(u3R->pro.don), u3R->pro.day); u3R->pro.day = u3_dc("pi-noon", u3k(u3R->pro.don), u3R->pro.day);
} }
/* u3_ct_come(): push on profile stack. /* u3t_come(): push on profile stack.
*/ */
void void
u3_ct_come(u3_atom cog) u3t_come(u3_atom cog)
{ {
printf("ct: come %s\r\n", u3_cr_string(cog)); printf("ct: come %s\r\n", u3r_string(cog));
u3R->pro.don = u3nc(cog, u3R->pro.don); u3R->pro.don = u3nc(cog, u3R->pro.don);
} }
/* u3_ct_flee(): pop off profile stack. /* u3t_flee(): pop off profile stack.
*/ */
void void
u3_ct_flee(void) u3t_flee(void)
{ {
c3_assert(_(u3du(u3R->pro.don))); c3_assert(_(u3du(u3R->pro.don)));
{ {
@ -101,16 +101,16 @@ u3_ct_flee(void)
} }
} }
/* u3_ct_damp(): print and clear profile data. /* u3t_damp(): print and clear profile data.
*/ */
void void
u3_ct_damp(void) u3t_damp(void)
{ {
if ( 0 != u3R->pro.day ) { if ( 0 != u3R->pro.day ) {
u3_noun wol = u3_do("pi-tell", u3R->pro.day); u3_noun wol = u3_do("pi-tell", u3R->pro.day);
u3_cm_wall(wol); u3m_wall(wol);
u3R->pro.day = u3_cv_do("doss", 0); u3R->pro.day = u3v_do("doss", 0);
} }
if ( 0 != u3R->pro.nox_d ) { if ( 0 != u3R->pro.nox_d ) {
@ -121,12 +121,12 @@ u3_ct_damp(void)
/* _ct_sigaction(): profile sigaction callback. /* _ct_sigaction(): profile sigaction callback.
*/ */
void _ct_sigaction(c3_i x_i) { u3_ct_samp(); } void _ct_sigaction(c3_i x_i) { u3t_samp(); }
/* u3_ct_boot(): turn sampling on. /* u3t_boot(): turn sampling on.
*/ */
void void
u3_ct_boot(void) u3t_boot(void)
{ {
printf("ct: now profiling.\r\n"); printf("ct: now profiling.\r\n");
@ -160,10 +160,10 @@ u3_ct_boot(void)
#endif #endif
} }
/* u3_ct_boff(): turn profile sampling off. /* u3t_boff(): turn profile sampling off.
*/ */
void void
u3_ct_boff(void) u3t_boff(void)
{ {
#if defined(U3_OS_osx) #if defined(U3_OS_osx)
struct sigaction sig_s; struct sigaction sig_s;
@ -178,7 +178,7 @@ u3_ct_boff(void)
setitimer(ITIMER_PROF, &itm_v, 0); setitimer(ITIMER_PROF, &itm_v, 0);
sigaction(SIGPROF, &sig_s, 0); sigaction(SIGPROF, &sig_s, 0);
u3_ct_damp(); u3t_damp();
#elif defined(U3_OS_linux) #elif defined(U3_OS_linux)
// TODO: support profiling on linux // TODO: support profiling on linux
#elif defined(U3_OS_bsd) #elif defined(U3_OS_bsd)

222
g/v.c
View File

@ -14,61 +14,61 @@ _cv_nock_wish(u3_noun txt)
u3_noun fun, pro; u3_noun fun, pro;
WISH = 1; WISH = 1;
fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(20, u3A->roc))); fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(20, u3A->roc)));
pro = u3_cn_slam_on(fun, txt); pro = u3n_slam_on(fun, txt);
WISH = 0; WISH = 0;
return pro; return pro;
} }
/* u3_cv_make(): make a new pier and instantiate pill. /* u3v_make(): make a new pier and instantiate pill.
*/ */
void void
u3_cv_make(c3_c* pas_c) u3v_make(c3_c* pas_c)
{ {
u3_noun sys = u3_cke_cue(u3_cm_file(pas_c)); u3_noun sys = u3_cke_cue(u3m_file(pas_c));
printf("cv_make: loaded pill %s, as %x\n", pas_c, u3_cr_mug(sys)); printf("cv_make: loaded pill %s, as %x\n", pas_c, u3r_mug(sys));
u3A->ken = u3k(u3h(sys)); u3A->ken = u3k(u3h(sys));
u3A->roc = u3k(u3t(sys)); u3A->roc = u3k(u3t(sys));
printf("cv_make: kernel %x, core %x\n", printf("cv_make: kernel %x, core %x\n",
u3_cr_mug(u3A->ken), u3_cr_mug(u3A->roc)); u3r_mug(u3A->ken), u3r_mug(u3A->roc));
u3z(sys); u3z(sys);
} }
int JACK; int JACK;
/* u3_cv_jack(): execute kernel formula to bind jets. /* u3v_jack(): execute kernel formula to bind jets.
*/ */
void void
u3_cv_jack(void) u3v_jack(void)
{ {
u3_noun cor; u3_noun cor;
JACK = 1; JACK = 1;
printf("cv_jack: activating kernel %x\n", u3_cr_mug(u3A->ken)); printf("cv_jack: activating kernel %x\n", u3r_mug(u3A->ken));
cor = u3_cn_nock_on(0, u3k(u3A->ken)); cor = u3n_nock_on(0, u3k(u3A->ken));
printf("cv_jack: activated\n"); printf("cv_jack: activated\n");
JACK = 0; JACK = 0;
u3z(cor); u3z(cor);
} }
/* u3_cv_hose(): clear initial ovum queue. /* u3v_hose(): clear initial ovum queue.
*/ */
void void
u3_cv_hose(void) u3v_hose(void)
{ {
u3p(u3_cv_cart) egg_p = u3A->ova.egg_p; u3p(u3v_cart) egg_p = u3A->ova.egg_p;
while ( egg_p ) { while ( egg_p ) {
u3_cv_cart* egg_u = u3to(u3_cv_cart, egg_p); u3v_cart* egg_u = u3to(u3v_cart, egg_p);
u3p(u3_cv_cart) nex_p = egg_u->nex_p; u3p(u3v_cart) nex_p = egg_u->nex_p;
u3_ca_lose(egg_u->vir); u3a_lose(egg_u->vir);
u3_ca_free(egg_u); u3a_free(egg_u);
egg_p = nex_p; egg_p = nex_p;
} }
@ -77,31 +77,31 @@ u3_cv_hose(void)
u3A->roe = u3_nul; u3A->roe = u3_nul;
} }
/* u3_cv_start(): start time. /* u3v_start(): start time.
*/ */
void void
u3_cv_start(u3_noun now) u3v_start(u3_noun now)
{ {
u3_cv_time(now); u3v_time(now);
u3_cv_numb(); u3v_numb();
{ {
c3_c* wen_c = u3_cr_string(u3A->wen); c3_c* wen_c = u3r_string(u3A->wen);
printf("cv_start: time: %s\n", wen_c); printf("cv_start: time: %s\n", wen_c);
free(wen_c); free(wen_c);
} }
} }
/* u3_cv_wish(): text expression with cache. /* u3v_wish(): text expression with cache.
*/ */
u3_noun u3_noun
u3_cv_wish(const c3_c* str_c) u3v_wish(const c3_c* str_c)
{ {
u3_noun exp; u3_noun exp;
if ( u3R == &u3H->rod_u ) { if ( u3R == &u3H->rod_u ) {
u3_noun txt = u3_ci_string(str_c); u3_noun txt = u3i_string(str_c);
exp = u3_ckdb_get(u3k(u3A->yot), u3k(txt)); exp = u3_ckdb_get(u3k(u3A->yot), u3k(txt));
@ -113,10 +113,10 @@ u3_cv_wish(const c3_c* str_c)
return exp; return exp;
} }
else { else {
// It's probably not a good idea to use u3_cv_wish() // It's probably not a good idea to use u3v_wish()
// outside the top level... // outside the top level...
// //
return _cv_nock_wish(u3_ci_string(str_c)); return _cv_nock_wish(u3i_string(str_c));
} }
} }
@ -125,7 +125,7 @@ u3_cv_wish(const c3_c* str_c)
static u3_noun static u3_noun
_cv_mung_in(u3_noun gam) _cv_mung_in(u3_noun gam)
{ {
u3_noun pro = u3_cn_slam_on(u3k(u3h(gam)), u3k(u3t(gam))); u3_noun pro = u3n_slam_on(u3k(u3h(gam)), u3k(u3t(gam)));
u3z(gam); return pro; u3z(gam); return pro;
} }
@ -134,24 +134,24 @@ _cv_mung(c3_w sec_w, u3_noun gat, u3_noun sam)
{ {
u3_noun gam = u3nc(gat, sam); u3_noun gam = u3nc(gat, sam);
return u3_cm_soft(0, _cv_mung_in, gam); return u3m_soft(0, _cv_mung_in, gam);
} }
/* u3_cv_pike(): poke with floating core. /* u3v_pike(): poke with floating core.
*/ */
u3_noun u3_noun
u3_cv_pike(u3_noun ovo, u3_noun cor) u3v_pike(u3_noun ovo, u3_noun cor)
{ {
u3_noun fun = u3_cn_nock_on(cor, u3k(u3_cx_at(42, cor))); u3_noun fun = u3n_nock_on(cor, u3k(u3x_at(42, cor)));
u3_noun sam = u3nc(u3k(u3A->now), ovo); u3_noun sam = u3nc(u3k(u3A->now), ovo);
return _cv_mung(0, fun, sam); return _cv_mung(0, fun, sam);
} }
/* u3_cv_nick(): transform enveloped packets, [vir cor]. /* u3v_nick(): transform enveloped packets, [vir cor].
*/ */
u3_noun u3_noun
u3_cv_nick(u3_noun vir, u3_noun cor) u3v_nick(u3_noun vir, u3_noun cor)
{ {
if ( u3_nul == vir ) { if ( u3_nul == vir ) {
return u3nt(u3_blip, vir, cor); return u3nt(u3_blip, vir, cor);
@ -161,13 +161,13 @@ u3_cv_nick(u3_noun vir, u3_noun cor)
u3_noun pi_vir, qi_vir; u3_noun pi_vir, qi_vir;
u3_noun vix; u3_noun vix;
if ( (c3y == u3_cr_cell((i_vir=u3h(vir)), &pi_vir, &qi_vir)) && if ( (c3y == u3r_cell((i_vir=u3h(vir)), &pi_vir, &qi_vir)) &&
(c3y == u3du(qi_vir)) && (c3y == u3du(qi_vir)) &&
(c3__hear == u3h(qi_vir)) ) (c3__hear == u3h(qi_vir)) )
{ {
u3_noun gon; u3_noun gon;
gon = u3_cv_pike(u3k(i_vir), cor); gon = u3v_pike(u3k(i_vir), cor);
if ( u3_blip != u3h(gon) ) { if ( u3_blip != u3h(gon) ) {
u3z(vir); u3z(vir);
return gon; return gon;
@ -182,11 +182,11 @@ u3_cv_nick(u3_noun vir, u3_noun cor)
viz = u3_ckb_weld(vix, u3k(u3t(vir))); viz = u3_ckb_weld(vix, u3k(u3t(vir)));
u3z(vir); u3z(vir);
return u3_cv_nick(viz, cor); return u3v_nick(viz, cor);
} }
} }
else { else {
u3_noun nez = u3_cv_nick(u3k(u3t(vir)), cor); u3_noun nez = u3v_nick(u3k(u3t(vir)), cor);
if ( u3_blip != u3h(nez) ) { if ( u3_blip != u3h(nez) ) {
u3z(vir); u3z(vir);
@ -211,28 +211,28 @@ u3_cv_nick(u3_noun vir, u3_noun cor)
static u3_noun static u3_noun
_cv_nock_poke(u3_noun ovo) _cv_nock_poke(u3_noun ovo)
{ {
u3_noun fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(42, u3A->roc))); u3_noun fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(42, u3A->roc)));
u3_noun sam, pro; u3_noun sam, pro;
sam = u3nc(u3k(u3A->now), ovo); sam = u3nc(u3k(u3A->now), ovo);
#if 0 #if 0
{ {
c3_c* ovi_c = u3_cr_string(u3h(u3t(ovo))); c3_c* ovi_c = u3r_string(u3h(u3t(ovo)));
u3_noun tox = u3_do("spat", u3k(u3h(ovo))); u3_noun tox = u3_do("spat", u3k(u3h(ovo)));
c3_c* tox_c = u3_cr_string(tox); c3_c* tox_c = u3r_string(tox);
printf("poke: %%%s (%x) on %s\r\n", ovi_c, u3_cr_mug(ovo), tox_c); printf("poke: %%%s (%x) on %s\r\n", ovi_c, u3r_mug(ovo), tox_c);
free(tox_c); free(ovi_c); u3z(tox); free(tox_c); free(ovi_c); u3z(tox);
} }
#endif #endif
// u3_leak_on(1); // u3_leak_on(1);
pro = u3_cn_slam_on(fun, sam); pro = u3n_slam_on(fun, sam);
// u3_leak_off; // u3_leak_off;
#if 0 #if 0
{ {
c3_c* ovi_c = u3_cr_string(u3h(u3t(ovo))); c3_c* ovi_c = u3r_string(u3h(u3t(ovo)));
printf("poked: %s\r\n", ovi_c); printf("poked: %s\r\n", ovi_c);
@ -248,10 +248,10 @@ _cv_nock_poke(u3_noun ovo)
static u3_noun static u3_noun
_cv_nock_peek(u3_noun hap) _cv_nock_peek(u3_noun hap)
{ {
u3_noun fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(87, u3A->roc))); u3_noun fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(87, u3A->roc)));
u3_noun sam = u3nc(u3k(u3A->now), hap); u3_noun sam = u3nc(u3k(u3A->now), hap);
return u3_cn_slam_on(fun, sam); return u3n_slam_on(fun, sam);
} }
/* _cv_nock_keep(): call wait through hardcoded interface. /* _cv_nock_keep(): call wait through hardcoded interface.
@ -259,29 +259,29 @@ _cv_nock_peek(u3_noun hap)
static u3_noun static u3_noun
_cv_nock_keep(u3_noun hap) _cv_nock_keep(u3_noun hap)
{ {
u3_noun fun = u3_cn_nock_on(u3k(u3A->roc), u3k(u3_cx_at(4, u3A->roc))); u3_noun fun = u3n_nock_on(u3k(u3A->roc), u3k(u3x_at(4, u3A->roc)));
u3_noun sam = u3nc(u3k(u3A->now), hap); u3_noun sam = u3nc(u3k(u3A->now), hap);
return u3_cn_slam_on(fun, sam); return u3n_slam_on(fun, sam);
} }
/* u3_cv_do(): use a kernel gate. /* u3v_do(): use a kernel gate.
*/ */
u3_noun u3_noun
u3_cv_do(const c3_c* txt_c, u3_noun sam) u3v_do(const c3_c* txt_c, u3_noun sam)
{ {
u3_noun gat = u3_cv_wish(txt_c); u3_noun gat = u3v_wish(txt_c);
u3_noun pro; u3_noun pro;
#if 0 #if 0
if ( &u3H->rod_u == u3R ) { if ( &u3H->rod_u == u3R ) {
pro = u3_cm_soft_slam(gat, sam); pro = u3m_soft_slam(gat, sam);
} }
else { else {
pro = u3_cn_slam_on(gat, sam); pro = u3n_slam_on(gat, sam);
} }
#else #else
pro = u3_cn_slam_on(gat, sam); pro = u3n_slam_on(gat, sam);
#endif #endif
return pro; return pro;
@ -295,10 +295,10 @@ _cv_scot(u3_noun dim)
return u3_do("scot", dim); return u3_do("scot", dim);
} }
/* u3_cv_time(): set the reck time. /* u3v_time(): set the reck time.
*/ */
void void
u3_cv_time(u3_noun now) u3v_time(u3_noun now)
{ {
u3z(u3A->now); u3z(u3A->now);
u3A->now = now; u3A->now = now;
@ -307,12 +307,12 @@ u3_cv_time(u3_noun now)
u3A->wen = _cv_scot(u3nc(c3__da, u3k(u3A->now))); u3A->wen = _cv_scot(u3nc(c3__da, u3k(u3A->now)));
} }
/* u3_cv_numb(): set the instance number. /* u3v_numb(): set the instance number.
*/ */
void void
u3_cv_numb() u3v_numb()
{ {
u3A->sev_l = u3_cr_mug(u3A->now); u3A->sev_l = u3r_mug(u3A->now);
u3z(u3A->sen); u3z(u3A->sen);
u3A->sen = _cv_scot(u3nc(c3__uv, u3A->sev_l)); u3A->sen = _cv_scot(u3nc(c3__uv, u3A->sev_l));
} }
@ -325,24 +325,24 @@ _cv_time_bump(u3_reck* rec_u)
{ {
c3_d bum_d = (1ULL << 48ULL); c3_d bum_d = (1ULL << 48ULL);
u3A->now = u3_cka_add(u3A->now, u3_ci_chubs(1, &bum_d)); u3A->now = u3_cka_add(u3A->now, u3i_chubs(1, &bum_d));
} }
#endif #endif
/* u3_cv_peek(): query the reck namespace (protected). /* u3v_peek(): query the reck namespace (protected).
*/ */
u3_noun u3_noun
u3_cv_peek(u3_noun hap) u3v_peek(u3_noun hap)
{ {
return u3_cm_soft_sure(_cv_nock_peek, hap); return u3m_soft_sure(_cv_nock_peek, hap);
} }
/* u3_cv_keep(): measure timer. /* u3v_keep(): measure timer.
*/ */
u3_noun u3_noun
u3_cv_keep(u3_noun hap) u3v_keep(u3_noun hap)
{ {
return u3_cm_soft_sure(_cv_nock_keep, hap); return u3m_soft_sure(_cv_nock_keep, hap);
} }
#if 0 #if 0
@ -356,17 +356,17 @@ _cv_mole(u3_noun fot,
u3_noun uco = u3_do("slay", san); u3_noun uco = u3_do("slay", san);
u3_noun p_uco, q_uco, r_uco, s_uco; u3_noun p_uco, q_uco, r_uco, s_uco;
if ( (c3n == u3_cr_qual(uco, &p_uco, &q_uco, &r_uco, &s_uco)) || if ( (c3n == u3r_qual(uco, &p_uco, &q_uco, &r_uco, &s_uco)) ||
(0 != p_uco) || (0 != p_uco) ||
(0 != q_uco) || (0 != q_uco) ||
(c3n == u3_sing(fot, r_uco)) ) (c3n == u3_sing(fot, r_uco)) )
{ {
uL(fprintf(uH, "strange mole %s\n", u3_cr_string(san))); uL(fprintf(uH, "strange mole %s\n", u3r_string(san)));
u3z(fot); u3z(uco); return c3n; u3z(fot); u3z(uco); return c3n;
} }
else { else {
*ato_d = u3_cr_chub(0, s_uco); *ato_d = u3r_chub(0, s_uco);
u3z(fot); u3z(uco); return c3y; u3z(fot); u3z(uco); return c3y;
} }
@ -393,35 +393,35 @@ _cv_lily(u3_noun fot, u3_noun txt, c3_l* tid_l)
} }
#endif #endif
/* u3_cv_poke(): insert and apply an input ovum (protected). /* u3v_poke(): insert and apply an input ovum (protected).
*/ */
u3_noun u3_noun
u3_cv_poke(u3_noun ovo) u3v_poke(u3_noun ovo)
{ {
return _cv_nock_poke(ovo); return _cv_nock_poke(ovo);
} }
/* u3_cv_http_request(): hear http request on channel (unprotected). /* u3v_http_request(): hear http request on channel (unprotected).
*/ */
void void
u3_cv_http_request(u3_bean sec, u3_noun pox, u3_noun req) u3v_http_request(u3_bean sec, u3_noun pox, u3_noun req)
{ {
// uL(fprintf(uH, "http: request\n")); // uL(fprintf(uH, "http: request\n"));
u3_cv_plan(pox, u3nq(c3__this, sec, 0, req)); u3v_plan(pox, u3nq(c3__this, sec, 0, req));
} }
/* u3_cv_tank(): dump single tank. /* u3v_tank(): dump single tank.
*/ */
void void
u3_cv_tank(u3_noun blu, c3_l tab_l, u3_noun tac) u3v_tank(u3_noun blu, c3_l tab_l, u3_noun tac)
{ {
u3_cv_punt(blu, tab_l, u3nc(tac, u3_nul)); u3v_punt(blu, tab_l, u3nc(tac, u3_nul));
} }
/* u3_cv_punt(): dump tank list. /* u3v_punt(): dump tank list.
*/ */
void void
u3_cv_punt(u3_noun blu, c3_l tab_l, u3_noun tac) u3v_punt(u3_noun blu, c3_l tab_l, u3_noun tac)
{ {
#if 0 #if 0
u3_noun blu = u3_term_get_blew(0); u3_noun blu = u3_term_get_blew(0);
@ -431,64 +431,64 @@ u3_cv_punt(u3_noun blu, c3_l tab_l, u3_noun tac)
// We are calling nock here, but hopefully need no protection. // We are calling nock here, but hopefully need no protection.
// //
while ( c3y == u3_cr_du(cat) ) { while ( c3y == u3r_du(cat) ) {
u3_noun wol = u3_dc("wash", u3nc(tab_l, col_l), u3k(u3h(cat))); u3_noun wol = u3_dc("wash", u3nc(tab_l, col_l), u3k(u3h(cat)));
u3_cm_wall(wol); u3m_wall(wol);
cat = u3t(cat); cat = u3t(cat);
} }
u3z(tac); u3z(tac);
u3z(blu); u3z(blu);
} }
/* u3_cv_sway(): print trace. /* u3v_sway(): print trace.
*/ */
void void
u3_cv_sway(u3_noun blu, c3_l tab_l, u3_noun tax) u3v_sway(u3_noun blu, c3_l tab_l, u3_noun tax)
{ {
u3_noun mok = u3_dc("mook", 2, tax); u3_noun mok = u3_dc("mook", 2, tax);
u3_cv_punt(blu, tab_l, u3k(u3t(mok))); u3v_punt(blu, tab_l, u3k(u3t(mok)));
u3z(mok); u3z(mok);
} }
/* u3_cv_plan(): queue ovum (external). /* u3v_plan(): queue ovum (external).
*/ */
void void
u3_cv_plan(u3_noun pax, u3_noun fav) u3v_plan(u3_noun pax, u3_noun fav)
{ {
u3_noun egg = u3nc(pax, fav); u3_noun egg = u3nc(pax, fav);
u3A->roe = u3nc(u3nc(u3_nul, egg), u3A->roe); u3A->roe = u3nc(u3nc(u3_nul, egg), u3A->roe);
} }
/* u3_cv_plow(): queue multiple ova (external). /* u3v_plow(): queue multiple ova (external).
*/ */
void void
u3_cv_plow(u3_noun ova) u3v_plow(u3_noun ova)
{ {
u3_noun ovi = ova; u3_noun ovi = ova;
while ( u3_nul != ovi ) { while ( u3_nul != ovi ) {
u3_noun ovo=u3h(ovi); u3_noun ovo=u3h(ovi);
u3_cv_plan(u3k(u3h(ovo)), u3k(u3t(ovo))); u3v_plan(u3k(u3h(ovo)), u3k(u3t(ovo)));
ovi = u3t(ovi); ovi = u3t(ovi);
} }
u3z(ova); u3z(ova);
} }
/* u3_cv_louse(): last-minute deviltry upon a bail. /* u3v_louse(): last-minute deviltry upon a bail.
*/ */
void void
u3_cv_louse(c3_m how_m) u3v_louse(c3_m how_m)
{ {
#if 0 #if 0
if ( c3__exit == how_m ) { if ( c3__exit == how_m ) {
printf("louse: nocks: %d\n", NOX); printf("louse: nocks: %d\n", NOX);
printf("louse: washing kernel %x %d\n", u3A->ken, u3_ca_is_dog(u3A->ken)); printf("louse: washing kernel %x %d\n", u3A->ken, u3a_is_dog(u3A->ken));
u3_cm_wash(u3A->ken); u3m_wash(u3A->ken);
printf("kernel %x; washed mug %x\n", u3A->ken, u3_cr_mug(u3A->ken)); printf("kernel %x; washed mug %x\n", u3A->ken, u3r_mug(u3A->ken));
} }
#endif #endif
} }
@ -496,36 +496,36 @@ u3_cv_louse(c3_m how_m)
/* _cv_mark_ova(): mark ova queue. /* _cv_mark_ova(): mark ova queue.
*/ */
static void static void
_cv_mark_ova(u3p(u3_cv_cart) egg_p) _cv_mark_ova(u3p(u3v_cart) egg_p)
{ {
while ( egg_p ) { while ( egg_p ) {
u3_cv_cart* egg_u = u3to(u3_cv_cart, egg_p); u3v_cart* egg_u = u3to(u3v_cart, egg_p);
u3_ca_mark_ptr(egg_u); u3a_mark_ptr(egg_u);
u3_ca_mark_noun(egg_u->vir); u3a_mark_noun(egg_u->vir);
egg_p = egg_u->nex_p; egg_p = egg_u->nex_p;
} }
} }
/* u3_cv_mark(): mark arvo kernel. /* u3v_mark(): mark arvo kernel.
*/ */
void void
u3_cv_mark(void) u3v_mark(void)
{ {
u3_cv_arvo* arv_u = &(u3H->arv_u); u3v_arvo* arv_u = &(u3H->arv_u);
u3_ca_mark_noun(arv_u->yot); u3a_mark_noun(arv_u->yot);
u3_ca_mark_noun(arv_u->now); u3a_mark_noun(arv_u->now);
u3_ca_mark_noun(arv_u->wen); u3a_mark_noun(arv_u->wen);
u3_ca_mark_noun(arv_u->sen); u3a_mark_noun(arv_u->sen);
u3_ca_mark_noun(arv_u->own); u3a_mark_noun(arv_u->own);
u3_ca_mark_noun(arv_u->roe); u3a_mark_noun(arv_u->roe);
u3_ca_mark_noun(arv_u->key); u3a_mark_noun(arv_u->key);
u3_ca_mark_noun(arv_u->ken); u3a_mark_noun(arv_u->ken);
u3_ca_mark_noun(arv_u->roc); u3a_mark_noun(arv_u->roc);
_cv_mark_ova(arv_u->ova.egg_p); _cv_mark_ova(arv_u->ova.egg_p);
} }

46
g/x.c
View File

@ -4,88 +4,88 @@
*/ */
#include "all.h" #include "all.h"
/* u3_cx_good(): test for u3_none. /* u3x_good(): test for u3_none.
*/ */
u3_noun u3_noun
u3_cx_good(u3_weak som) u3x_good(u3_weak som)
{ {
if ( u3_none == som ) { if ( u3_none == som ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return som; else return som;
} }
/* u3_cx_at (u3at): fragment. /* u3x_at (u3at): fragment.
*/ */
u3_noun u3_noun
u3_cx_at(u3_noun axe, u3_noun som) u3x_at(u3_noun axe, u3_noun som)
{ {
u3_weak pro = u3_cr_at(axe, som); u3_weak pro = u3r_at(axe, som);
if ( u3_none == pro ) { if ( u3_none == pro ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else return pro; } else return pro;
} }
/* u3_cx_cell(): /* u3x_cell():
** **
** Divide `a` as a cell `[b c]`. ** Divide `a` as a cell `[b c]`.
*/ */
void void
u3_cx_cell(u3_noun a, u3x_cell(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c) u3_noun* c)
{ {
if ( c3n == u3_cr_cell(a, b, c) ) { if ( c3n == u3r_cell(a, b, c) ) {
u3_cm_bail(c3__exit); u3m_bail(c3__exit);
} }
} }
/* u3_cx_trel(): /* u3x_trel():
** **
** Divide `a` as a trel `[b c d]`, or bail. ** Divide `a` as a trel `[b c d]`, or bail.
*/ */
void void
u3_cx_trel(u3_noun a, u3x_trel(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d) u3_noun* d)
{ {
if ( c3n == u3_cr_trel(a, b, c, d) ) { if ( c3n == u3r_trel(a, b, c, d) ) {
u3_cm_bail(c3__exit); u3m_bail(c3__exit);
} }
} }
/* u3_cx_qual(): /* u3x_qual():
** **
** Divide `a` as a quadruple `[b c d e]`. ** Divide `a` as a quadruple `[b c d e]`.
*/ */
void void
u3_cx_qual(u3_noun a, u3x_qual(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e) u3_noun* e)
{ {
if ( c3n == u3_cr_qual(a, b, c, d, e) ) { if ( c3n == u3r_qual(a, b, c, d, e) ) {
u3_cm_bail(c3__exit); u3m_bail(c3__exit);
} }
} }
/* u3_cx_quil(): /* u3x_quil():
** **
** Divide `a` as a quintuple `[b c d e f]`. ** Divide `a` as a quintuple `[b c d e f]`.
*/ */
void void
u3_cx_quil(u3_noun a, u3x_quil(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e, u3_noun* e,
u3_noun* f) u3_noun* f)
{ {
if ( c3n == u3_cr_quil(a, b, c, d, e, f) ) { if ( c3n == u3r_quil(a, b, c, d, e, f) ) {
u3_cm_bail(c3__exit); u3m_bail(c3__exit);
} }
} }

44
g/z.c
View File

@ -4,80 +4,80 @@
*/ */
#include "all.h" #include "all.h"
/* u3_cz_find(): find in memo cache. Arguments retained. /* u3z_find(): find in memo cache. Arguments retained.
*/ */
u3_weak u3_weak
u3_cz_find(u3_mote fun, u3_noun one) u3z_find(u3_mote fun, u3_noun one)
{ {
u3_noun key = u3nc(fun, u3k(one)); u3_noun key = u3nc(fun, u3k(one));
u3_noun val; u3_noun val;
val = u3_ch_get(u3R->cax.har_p, key); val = u3h_get(u3R->cax.har_p, key);
u3z(key); u3z(key);
return val; return val;
} }
u3_weak u3_weak
u3_cz_find_2(u3_mote fun, u3_noun one, u3_noun two) u3z_find_2(u3_mote fun, u3_noun one, u3_noun two)
{ {
u3_noun key = u3nt(fun, u3k(one), u3k(two)); u3_noun key = u3nt(fun, u3k(one), u3k(two));
u3_noun val; u3_noun val;
val = u3_ch_get(u3R->cax.har_p, key); val = u3h_get(u3R->cax.har_p, key);
u3z(key); u3z(key);
return val; return val;
} }
u3_weak u3_weak
u3_cz_find_3(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri) u3z_find_3(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri)
{ {
u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri)); u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri));
u3_noun val; u3_noun val;
val = u3_ch_get(u3R->cax.har_p, key); val = u3h_get(u3R->cax.har_p, key);
u3z(key); u3z(key);
return val; return val;
} }
u3_weak u3_weak
u3_cz_find_4(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun qua) u3z_find_4(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun qua)
{ {
u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua))); u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua)));
u3_noun val; u3_noun val;
val = u3_ch_get(u3R->cax.har_p, key); val = u3h_get(u3R->cax.har_p, key);
u3z(key); u3z(key);
return val; return val;
} }
/* u3_cz_save*(): save in memo cache. /* u3z_save*(): save in memo cache.
*/ */
u3_noun u3_noun
u3_cz_save(u3_mote fun, u3_noun one, u3_noun val) u3z_save(u3_mote fun, u3_noun one, u3_noun val)
{ {
u3_noun key = u3nc(fun, u3k(one)); u3_noun key = u3nc(fun, u3k(one));
u3_ch_put(u3R->cax.har_p, key, u3k(val)); u3h_put(u3R->cax.har_p, key, u3k(val));
u3z(key); u3z(key);
return val; return val;
} }
u3_noun u3_noun
u3_cz_save_2(u3_mote fun, u3_noun one, u3_noun two, u3_noun val) u3z_save_2(u3_mote fun, u3_noun one, u3_noun two, u3_noun val)
{ {
u3_noun key = u3nt(fun, u3k(one), u3k(two)); u3_noun key = u3nt(fun, u3k(one), u3k(two));
u3_ch_put(u3R->cax.har_p, key, u3k(val)); u3h_put(u3R->cax.har_p, key, u3k(val));
u3z(key); u3z(key);
return val; return val;
} }
u3_noun u3_noun
u3_cz_save_3(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun val) u3z_save_3(u3_mote fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun val)
{ {
u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri)); u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri));
u3_ch_put(u3R->cax.har_p, key, u3k(val)); u3h_put(u3R->cax.har_p, key, u3k(val));
u3z(key); u3z(key);
return val; return val;
} }
u3_noun u3_noun
u3_cz_save_4(u3_mote fun, u3z_save_4(u3_mote fun,
u3_noun one, u3_noun one,
u3_noun two, u3_noun two,
u3_noun tri, u3_noun tri,
@ -86,24 +86,24 @@ u3_cz_save_4(u3_mote fun,
{ {
u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua))); u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua)));
u3_ch_put(u3R->cax.har_p, key, u3k(val)); u3h_put(u3R->cax.har_p, key, u3k(val));
u3z(key); u3z(key);
return val; return val;
} }
/* u3_cz_uniq(): uniquify with memo cache. /* u3z_uniq(): uniquify with memo cache.
*/ */
u3_noun u3_noun
u3_cz_uniq(u3_noun som) u3z_uniq(u3_noun som)
{ {
u3_noun key = u3nc(c3__uniq, u3k(som)); u3_noun key = u3nc(c3__uniq, u3k(som));
u3_noun val = u3_ch_get(u3R->cax.har_p, key); u3_noun val = u3h_get(u3R->cax.har_p, key);
if ( u3_none != val ) { if ( u3_none != val ) {
u3z(key); u3z(som); return val; u3z(key); u3z(som); return val;
} }
else { else {
u3_ch_put(u3R->cax.har_p, key, u3k(som)); u3h_put(u3R->cax.har_p, key, u3k(som));
return som; return som;
} }
} }

41
i/all.h
View File

@ -48,46 +48,37 @@
** **
** Our Martian booleans and list terminator; empty string; not a noun. ** Our Martian booleans and list terminator; empty string; not a noun.
*/ */
# define u3_yes 0
# define u3_no 1
# define u3_nul 0 # define u3_nul 0
# define u3_blip 0 # define u3_blip 0
/* Tools for Martian booleans. /* Tools for Martian booleans.
*/ */
# define u3_so(x) (u3_yes == (x)) # define u3_assure(x) if ( !_(x) ) { u3m_bail(c3__fail); }
# define u3_ne(x) (u3_no == (x)) # define u3_assent(x) if ( !_(x) ) { u3m_bail(c3__exit); }
# define u3_say(x) ( (x) ? u3_yes : u3_no )
# define u3_not(x) ( (x == u3_yes) ? u3_no : u3_yes )
# define u3_and(x, y) ( (u3_so(x) && u3_so(y)) ? u3_yes : u3_no )
# define u3_or(x, y) ( (u3_so(x) || u3_so(y)) ? u3_yes : u3_no )
# define u3_assure(x) if ( u3_ne(x) ) { u3_cm_bail(c3__fail); }
# define u3_assent(x) if ( u3_ne(x) ) { u3_cm_bail(c3__exit); }
/** Aliases - selective and syntactically unique. /** Aliases - selective and syntactically unique.
**/ **/
# define u3h(som) u3_cx_h(som) # define u3h(som) u3x_h(som)
# define u3t(som) u3_cx_t(som) # define u3t(som) u3x_t(som)
# define u3at(axe, som) u3_cx_at(axe, som) # define u3at(axe, som) u3x_at(axe, som)
# define u3nc(a, b) u3_ci_cell(a, b) # define u3nc(a, b) u3i_cell(a, b)
# define u3nt(a, b, c) u3_ci_trel(a, b, c) # define u3nt(a, b, c) u3i_trel(a, b, c)
# define u3nq(a, b, c, d) u3_ci_qual(a, b, c, d) # define u3nq(a, b, c, d) u3i_qual(a, b, c, d)
# define u3du(som) (u3_cr_du(som)) # define u3du(som) (u3r_du(som))
# define u3ud(som) (u3_cr_ud(som)) # define u3ud(som) (u3r_ud(som))
# define u3k(som) u3_ca_gain(som) # define u3k(som) u3a_gain(som)
# define u3z(som) u3_ca_lose(som) # define u3z(som) u3a_lose(som)
/** Arvo macros. /** Arvo macros.
**/ **/
# define u3_do(txt_c, arg) u3_cv_do(txt_c, arg) # define u3_do(txt_c, arg) u3v_do(txt_c, arg)
# define u3_dc(txt_c, a, b) u3_cv_do(txt_c, u3nc(a, b)) # define u3_dc(txt_c, a, b) u3v_do(txt_c, u3nc(a, b))
# define u3_dt(txt_c, a, b, c) u3_cv_do(txt_c, u3nt(a, b, c)) # define u3_dt(txt_c, a, b, c) u3v_do(txt_c, u3nt(a, b, c))
# define u3_dq(txt_c, a, b, c, d) u3_cv_do(txt_c, u3nt(a, b, c, d)) # define u3_dq(txt_c, a, b, c, d) u3v_do(txt_c, u3nt(a, b, c, d))
/** g: the u3 layer, functions. /** g: the u3 layer, functions.
**/ **/

322
i/g/a.h
View File

@ -6,15 +6,15 @@
**/ **/
# undef U3_MEMORY_DEBUG # undef U3_MEMORY_DEBUG
# ifdef U3_MEMORY_DEBUG # ifdef U3_MEMORY_DEBUG
# define u3_ca_leak_on(x) (u3_Code = x) # define u3a_leak_on(x) (u3_Code = x)
# define u3_ca_leak_off (u3_Code = 0) # define u3a_leak_off (u3_Code = 0)
# endif # endif
# define u3_ca_bits U3_OS_LoomBits // 28, max 29 # define u3a_bits U3_OS_LoomBits // 28, max 29
# define u3_ca_page 12 // 16Kbyte pages # define u3a_page 12 // 16Kbyte pages
# define u3_ca_pages (1 << (u3_ca_bits - u3_ca_page)) // 2^16 pages # define u3a_pages (1 << (u3a_bits - u3a_page)) // 2^16 pages
# define u3_ca_words (1 << u3_ca_bits) # define u3a_words (1 << u3a_bits)
# define u3_ca_bytes (c3_w)((1 << (2 + u3_ca_bits))) # define u3a_bytes (c3_w)((1 << (2 + u3a_bits)))
/** Data structures. /** Data structures.
@ -58,49 +58,49 @@
*/ */
typedef struct { typedef struct {
c3_w mug_w; c3_w mug_w;
} u3_ca_noun; } u3a_noun;
typedef struct { typedef struct {
c3_w mug_w; c3_w mug_w;
c3_w len_w; c3_w len_w;
c3_w buf_w[0]; c3_w buf_w[0];
} u3_ca_atom; } u3a_atom;
typedef struct { typedef struct {
c3_w mug_w; c3_w mug_w;
u3_noun hed; u3_noun hed;
u3_noun tel; u3_noun tel;
} u3_ca_cell; } u3a_cell;
/* Inside a noun. /* Inside a noun.
*/ */
# define u3_ca_is_cat(som) (((som) >> 31) ? c3n : c3y) # define u3a_is_cat(som) (((som) >> 31) ? c3n : c3y)
# define u3_ca_is_dog(som) (((som) >> 31) ? c3y : c3n) # define u3a_is_dog(som) (((som) >> 31) ? c3y : c3n)
# define u3_ca_is_pug(som) ((2 == ((som) >> 30)) ? c3y : c3n) # define u3a_is_pug(som) ((2 == ((som) >> 30)) ? c3y : c3n)
# define u3_ca_is_pom(som) ((3 == ((som) >> 30)) ? c3y : c3n) # define u3a_is_pom(som) ((3 == ((som) >> 30)) ? c3y : c3n)
# define u3_ca_to_off(som) ((som) & 0x3fffffff) # define u3a_to_off(som) ((som) & 0x3fffffff)
# define u3_ca_to_ptr(som) (u3_ca_into(u3_ca_to_off(som))) # define u3a_to_ptr(som) (u3a_into(u3a_to_off(som)))
# define u3_ca_to_wtr(som) ((c3_w *)u3_ca_to_ptr(som)) # define u3a_to_wtr(som) ((c3_w *)u3a_to_ptr(som))
# define u3_ca_to_pug(off) (off | 0x80000000) # define u3a_to_pug(off) (off | 0x80000000)
# define u3_ca_to_pom(off) (off | 0xc0000000) # define u3a_to_pom(off) (off | 0xc0000000)
# define u3_ca_is_atom(som) c3o(u3_ca_is_cat(som), \ # define u3a_is_atom(som) c3o(u3a_is_cat(som), \
u3_ca_is_pug(som)) u3a_is_pug(som))
# define u3_ca_is_cell(som) u3_ca_is_pom(som) # define u3a_is_cell(som) u3a_is_pom(som)
# define u3_ca_de_twin(dog, dog_w) ((dog & 0xc0000000) | u3_ca_outa(dog_w)) # define u3a_de_twin(dog, dog_w) ((dog & 0xc0000000) | u3a_outa(dog_w))
# define u3_ca_h(som) \ # define u3a_h(som) \
( _(u3_ca_is_cell(som)) \ ( _(u3a_is_cell(som)) \
? ( ((u3_ca_cell *)u3_ca_to_ptr(som))->hed )\ ? ( ((u3a_cell *)u3a_to_ptr(som))->hed )\
: u3_cm_bail(c3__exit) ) : u3m_bail(c3__exit) )
# define u3_ca_t(som) \ # define u3a_t(som) \
( _(u3_ca_is_cell(som)) \ ( _(u3a_is_cell(som)) \
? ( ((u3_ca_cell *)u3_ca_to_ptr(som))->tel )\ ? ( ((u3a_cell *)u3a_to_ptr(som))->tel )\
: u3_cm_bail(c3__exit) ) : u3m_bail(c3__exit) )
/* u3_ca_box: classic allocation box. /* u3a_box: classic allocation box.
** **
** The box size is also stored at the end of the box in classic ** The box size is also stored at the end of the box in classic
** bad ass malloc style. Hence a box is: ** bad ass malloc style. Hence a box is:
@ -115,38 +115,38 @@
** **
** Do not attempt to adjust this structure! ** Do not attempt to adjust this structure!
*/ */
typedef struct _u3_ca_box { typedef struct _u3a_box {
c3_w siz_w; // size of this box c3_w siz_w; // size of this box
c3_w use_w; // reference count; free if 0 c3_w use_w; // reference count; free if 0
# ifdef U3_MEMORY_DEBUG # ifdef U3_MEMORY_DEBUG
c3_w eus_w; // recomputed refcount c3_w eus_w; // recomputed refcount
c3_w cod_w; // tracing code c3_w cod_w; // tracing code
# endif # endif
} u3_ca_box; } u3a_box;
# define u3_ca_boxed(len_w) (len_w + c3_wiseof(u3_ca_box) + 1) # define u3a_boxed(len_w) (len_w + c3_wiseof(u3a_box) + 1)
# define u3_ca_boxto(box_v) ( (void *) \ # define u3a_boxto(box_v) ( (void *) \
( ((c3_w *)(void*)(box_v)) + \ ( ((c3_w *)(void*)(box_v)) + \
c3_wiseof(u3_ca_box) ) ) c3_wiseof(u3a_box) ) )
# define u3_ca_botox(tox_v) ( (struct _u3_ca_box *) \ # define u3a_botox(tox_v) ( (struct _u3a_box *) \
(void *) \ (void *) \
( ((c3_w *)(void*)(tox_v)) - \ ( ((c3_w *)(void*)(tox_v)) - \
c3_wiseof(u3_ca_box) ) ) c3_wiseof(u3a_box) ) )
/* u3_ca_fbox: free node in heap. Sets minimum node size. /* u3a_fbox: free node in heap. Sets minimum node size.
** **
*/ */
typedef struct _u3_ca_fbox { typedef struct _u3a_fbox {
u3_ca_box box_u; u3a_box box_u;
u3p(struct _u3_ca_fbox) pre_p; u3p(struct _u3a_fbox) pre_p;
u3p(struct _u3_ca_fbox) nex_p; u3p(struct _u3a_fbox) nex_p;
} u3_ca_fbox; } u3a_fbox;
# define u3_cc_minimum 6 # define u3_cc_minimum 6
# define u3_cc_fbox_no 28 # define u3_cc_fbox_no 28
/* u3_cs_road: contiguous allocation and execution context. /* u3a_road: contiguous allocation and execution context.
** **
** A road is a normal heap-stack system, except that the heap ** A road is a normal heap-stack system, except that the heap
** and stack can point in either direction. Therefore, inside ** and stack can point in either direction. Therefore, inside
@ -214,12 +214,12 @@
** In all cases, the pointer in a u3_noun is a word offset into ** In all cases, the pointer in a u3_noun is a word offset into
** u3H, the top-level road. ** u3H, the top-level road.
*/ */
typedef struct _u3_cs_road { typedef struct _u3a_road {
struct _u3_cs_road* par_u; // parent road struct _u3a_road* par_u; // parent road
struct _u3_cs_road* kid_u; // child road list struct _u3a_road* kid_u; // child road list
struct _u3_cs_road* nex_u; // sibling road struct _u3a_road* nex_u; // sibling road
struct _u3_cs_road* now_u; // current road pointer struct _u3a_road* now_u; // current road pointer
u3p(c3_w) cap_p; // top of transient region u3p(c3_w) cap_p; // top of transient region
u3p(c3_w) hat_p; // top of durable region u3p(c3_w) hat_p; // top of durable region
@ -241,12 +241,12 @@
} how; // } how; //
struct { // allocation pools struct { // allocation pools
u3p(u3_ca_fbox) fre_p[u3_cc_fbox_no]; // heap by node size log u3p(u3a_fbox) fre_p[u3_cc_fbox_no]; // heap by node size log
c3_w fre_w; // number of free words c3_w fre_w; // number of free words
} all; } all;
struct { // jet dashboard struct { // jet dashboard
u3p(u3_ch_root) har_p; // jet index (old style) u3p(u3h_root) har_p; // jet index (old style)
u3_noun das; // dashboard (new style) u3_noun das; // dashboard (new style)
} jed; } jed;
@ -266,74 +266,74 @@
} pro; } pro;
struct { // memoization struct { // memoization
u3p(u3_ch_root) har_p; // (map (pair term noun) noun) u3p(u3h_root) har_p; // (map (pair term noun) noun)
} cax; } cax;
} u3_cs_road; } u3a_road;
typedef u3_cs_road u3_road; typedef u3a_road u3_road;
/** Flags. /** Flags.
**/ **/
enum u3_ca_flag { enum u3a_flag {
u3_ca_flag_debug = 0x1, // debug memory u3a_flag_debug = 0x1, // debug memory
u3_ca_flag_gc = 0x2, // garbage collect once u3a_flag_gc = 0x2, // garbage collect once
u3_ca_flag_sand = 0x4, // sand mode, bump allocation u3a_flag_sand = 0x4, // sand mode, bump allocation
u3_ca_flag_die = 0x8 // process was asked to exit u3a_flag_die = 0x8 // process was asked to exit
}; };
/** Macros. /** Macros.
**/ **/
# define u3_ca_into(x) ((void *)(u3_Loom + (x))) # define u3a_into(x) ((void *)(u3_Loom + (x)))
# define u3_ca_outa(p) (((c3_w*)(void*)(p)) - u3_Loom) # define u3a_outa(p) (((c3_w*)(void*)(p)) - u3_Loom)
# define u3to(type, x) ((type *) u3_ca_into(x)) # define u3to(type, x) ((type *) u3a_into(x))
# define u3of(type, x) (u3_ca_outa((type *)x)) # define u3of(type, x) (u3a_outa((type *)x))
# define u3_ca_is_north(r) __(r->cap_p > r->hat_p) # define u3a_is_north(r) __(r->cap_p > r->hat_p)
# define u3_ca_is_south(r) !u3_ca_is_north(r) # define u3a_is_south(r) !u3a_is_north(r)
# define u3_ca_open(r) ( (c3y == u3_ca_is_north(r)) \ # define u3a_open(r) ( (c3y == u3a_is_north(r)) \
? (c3_w)(r->cap_p - r->hat_p) \ ? (c3_w)(r->cap_p - r->hat_p) \
: (c3_w)(r->hat_p - r->cap_p) ) : (c3_w)(r->hat_p - r->cap_p) )
# define u3_ca_north_is_senior(r, dog) \ # define u3a_north_is_senior(r, dog) \
__((u3_ca_to_off(dog) < r->rut_p) || \ __((u3a_to_off(dog) < r->rut_p) || \
(u3_ca_to_off(dog) >= r->mat_p)) (u3a_to_off(dog) >= r->mat_p))
# define u3_ca_north_is_junior(r, dog) \ # define u3a_north_is_junior(r, dog) \
__((u3_ca_to_off(dog) >= r->cap_p) && \ __((u3a_to_off(dog) >= r->cap_p) && \
(u3_ca_to_off(dog) < r->mat_p)) (u3a_to_off(dog) < r->mat_p))
# define u3_ca_north_is_normal(r, dog) \ # define u3a_north_is_normal(r, dog) \
c3a(!(u3_ca_north_is_senior(r, dog)), \ c3a(!(u3a_north_is_senior(r, dog)), \
!(u3_ca_north_is_junior(r, dog))) !(u3a_north_is_junior(r, dog)))
# define u3_ca_south_is_senior(r, dog) \ # define u3a_south_is_senior(r, dog) \
__((u3_ca_to_off(dog) < r->mat_p) || \ __((u3a_to_off(dog) < r->mat_p) || \
(u3_ca_to_off(dog) >= r->rut_p)) (u3a_to_off(dog) >= r->rut_p))
# define u3_ca_south_is_junior(r, dog) \ # define u3a_south_is_junior(r, dog) \
__((u3_ca_to_off(dog) < r->cap_p) && \ __((u3a_to_off(dog) < r->cap_p) && \
(u3_ca_to_off(dog) >= r->mat_p)) (u3a_to_off(dog) >= r->mat_p))
# define u3_ca_south_is_normal(r, dog) \ # define u3a_south_is_normal(r, dog) \
c3a(!(u3_ca_south_is_senior(r, dog)), \ c3a(!(u3a_south_is_senior(r, dog)), \
!(u3_ca_south_is_junior(r, dog))) !(u3a_south_is_junior(r, dog)))
# define u3_ca_is_junior(r, som) \ # define u3a_is_junior(r, som) \
( _(u3_ca_is_cat(som)) \ ( _(u3a_is_cat(som)) \
? c3n \ ? c3n \
: _(u3_ca_is_north(r)) \ : _(u3a_is_north(r)) \
? u3_ca_north_is_junior(r, som) \ ? u3a_north_is_junior(r, som) \
: u3_ca_south_is_junior(r, som) ) : u3a_south_is_junior(r, som) )
# define u3_ca_is_senior(r, som) \ # define u3a_is_senior(r, som) \
( _(u3_ca_is_cat(som)) \ ( _(u3a_is_cat(som)) \
? c3y \ ? c3y \
: _(u3_ca_is_north(r)) \ : _(u3a_is_north(r)) \
? u3_ca_north_is_senior(r, som) \ ? u3a_north_is_senior(r, som) \
: u3_ca_south_is_senior(r, som) ) : u3a_south_is_senior(r, som) )
/* Word axis macros. For 31-bit axes only. /* Word axis macros. For 31-bit axes only.
*/ */
@ -357,23 +357,23 @@
/* Conventional axes for gate call. /* Conventional axes for gate call.
*/ */
# define u3_cv_pay 3 // payload # define u3v_pay 3 // payload
# define u3_cv_sam 6 // sample # define u3v_sam 6 // sample
# define u3_cv_sam_1 6 # define u3v_sam_1 6
# define u3_cv_sam_2 12 # define u3v_sam_2 12
# define u3_cv_sam_3 13 # define u3v_sam_3 13
# define u3_cv_sam_4 24 # define u3v_sam_4 24
# define u3_cv_sam_5 25 # define u3v_sam_5 25
# define u3_cv_sam_6 26 # define u3v_sam_6 26
# define u3_cv_sam_12 52 # define u3v_sam_12 52
# define u3_cv_sam_13 53 # define u3v_sam_13 53
# define u3_cv_sam_7 27 # define u3v_sam_7 27
# define u3_cv_con 7 // context # define u3v_con 7 // context
# define u3_cv_con_2 14 // context # define u3v_con_2 14 // context
# define u3_cv_con_3 15 // context # define u3v_con_3 15 // context
# define u3_cv_con_sam 30 // sample in gate context # define u3v_con_sam 30 // sample in gate context
# define u3_cv_noc 2 // deprecated # define u3v_noc 2 // deprecated
# define u3_cv_bat 2 // battery # define u3v_bat 2 // battery
/** Globals. /** Globals.
@ -397,131 +397,131 @@
**/ **/
/* Basic allocation. /* Basic allocation.
*/ */
/* u3_ca_walloc(): allocate storage measured in words. /* u3a_walloc(): allocate storage measured in words.
*/ */
void* void*
u3_ca_walloc(c3_w len_w); u3a_walloc(c3_w len_w);
/* u3_ca_malloc(): allocate storage measured in bytes. /* u3a_malloc(): allocate storage measured in bytes.
*/ */
void* void*
u3_ca_malloc(c3_w len_w); u3a_malloc(c3_w len_w);
/* u3_ca_free(): free storage. /* u3a_free(): free storage.
*/ */
void void
u3_ca_free(void* lag_v); u3a_free(void* lag_v);
/* u3_ca_wealloc(): word realloc. /* u3a_wealloc(): word realloc.
*/ */
void* void*
u3_ca_wealloc(void* lag_v, c3_w len_w); u3a_wealloc(void* lag_v, c3_w len_w);
/* u3_ca_realloc(): byte realloc. /* u3a_realloc(): byte realloc.
*/ */
void* void*
u3_ca_realloc(void* lag_v, c3_w len_w); u3a_realloc(void* lag_v, c3_w len_w);
/* Reference and arena control. /* Reference and arena control.
*/ */
/* u3_ca_gain(): gain a reference count in normal space. /* u3a_gain(): gain a reference count in normal space.
*/ */
u3_weak u3_weak
u3_ca_gain(u3_weak som); u3a_gain(u3_weak som);
/* u3_ca_take(): gain, copying juniors. /* u3a_take(): gain, copying juniors.
*/ */
u3_noun u3_noun
u3_ca_take(u3_noun som); u3a_take(u3_noun som);
/* u3_ca_left(): true of junior if preserved. /* u3a_left(): true of junior if preserved.
*/ */
c3_o c3_o
u3_ca_left(u3_noun som); u3a_left(u3_noun som);
/* u3_ca_lose(): lose a reference. /* u3a_lose(): lose a reference.
*/ */
void void
u3_ca_lose(u3_weak som); u3a_lose(u3_weak som);
/* u3_ca_wash(): wash all lazy mugs in subtree. RETAIN. /* u3a_wash(): wash all lazy mugs in subtree. RETAIN.
*/ */
void void
u3_ca_wash(u3_noun som); u3a_wash(u3_noun som);
/* u3_ca_use(): reference count. /* u3a_use(): reference count.
*/ */
c3_w c3_w
u3_ca_use(u3_noun som); u3a_use(u3_noun som);
/* u3_ca_mark_ptr(): mark a pointer for gc. Produce size. /* u3a_mark_ptr(): mark a pointer for gc. Produce size.
*/ */
c3_w c3_w
u3_ca_mark_ptr(void* ptr_v); u3a_mark_ptr(void* ptr_v);
/* u3_ca_mark_noun(): mark a noun for gc. Produce size. /* u3a_mark_noun(): mark a noun for gc. Produce size.
*/ */
c3_w c3_w
u3_ca_mark_noun(u3_noun som); u3a_mark_noun(u3_noun som);
/* u3_ca_sweep(): sweep a fully marked road. /* u3a_sweep(): sweep a fully marked road.
*/ */
void void
u3_ca_sweep(c3_c* cap_c); u3a_sweep(c3_c* cap_c);
/* u3_ca_sane(): check allocator sanity. /* u3a_sane(): check allocator sanity.
*/ */
void void
u3_ca_sane(void); u3a_sane(void);
/* u3_ca_detect(): axis (som) is referenced from (fum). /* u3a_detect(): axis (som) is referenced from (fum).
** **
** (som) and (fum) are both RETAINED. ** (som) and (fum) are both RETAINED.
*/ */
c3_d c3_d
u3_ca_detect(u3_noun fum, u3_noun som); u3a_detect(u3_noun fum, u3_noun som);
/* u3_ca_lush(): leak push. /* u3a_lush(): leak push.
*/ */
c3_w c3_w
u3_ca_lush(c3_w lab_w); u3a_lush(c3_w lab_w);
/* u3_ca_lop(): leak pop. /* u3a_lop(): leak pop.
*/ */
void void
u3_ca_lop(c3_w lab_w); u3a_lop(c3_w lab_w);
/* u3_ca_print_memory: print memory amount. /* u3a_print_memory: print memory amount.
*/ */
void void
u3_ca_print_memory(c3_c* cap_c, c3_w wor_w); u3a_print_memory(c3_c* cap_c, c3_w wor_w);
/* Atoms from proto-atoms. /* Atoms from proto-atoms.
*/ */
/* u3_ca_slab(): create a length-bounded proto-atom. /* u3a_slab(): create a length-bounded proto-atom.
*/ */
c3_w* c3_w*
u3_ca_slab(c3_w len_w); u3a_slab(c3_w len_w);
/* u3_ca_slaq(): u3_ca_slaq() with a defined blocksize. /* u3a_slaq(): u3a_slaq() with a defined blocksize.
*/ */
c3_w* c3_w*
u3_ca_slaq(c3_g met_g, c3_w len_w); u3a_slaq(c3_g met_g, c3_w len_w);
/* u3_ca_malt(): measure and finish a proto-atom. /* u3a_malt(): measure and finish a proto-atom.
*/ */
u3_noun u3_noun
u3_ca_malt(c3_w* sal_w); u3a_malt(c3_w* sal_w);
/* u3_ca_moot(): finish a pre-measured proto-atom; dangerous. /* u3a_moot(): finish a pre-measured proto-atom; dangerous.
*/ */
u3_noun u3_noun
u3_ca_moot(c3_w* sal_w); u3a_moot(c3_w* sal_w);
/* u3_ca_mint(): finish a measured proto-atom. /* u3a_mint(): finish a measured proto-atom.
*/ */
u3_noun u3_noun
u3_ca_mint(c3_w* sal_w, c3_w len_w); u3a_mint(c3_w* sal_w, c3_w len_w);

60
i/g/e.h
View File

@ -4,87 +4,87 @@
*/ */
/** Data structures. /** Data structures.
**/ **/
/* u3_ce_line: control line. /* u3e_line: control line.
*/ */
typedef struct _u3_ce_line { typedef struct _u3e_line {
c3_w pag_w; c3_w pag_w;
c3_w mug_w; c3_w mug_w;
} u3_ce_line; } u3e_line;
/* u3_ce_control: memory change, control file. /* u3e_control: memory change, control file.
*/ */
typedef struct _u3_ce_control { typedef struct _u3e_control {
c3_d evt_d; // event number c3_d evt_d; // event number
c3_w nor_w; // new page count north c3_w nor_w; // new page count north
c3_w sou_w; // new page count south c3_w sou_w; // new page count south
c3_w pgs_w; // number of changed pages c3_w pgs_w; // number of changed pages
u3_ce_line mem_u[0]; // per page u3e_line mem_u[0]; // per page
} u3_ce_control; } u3e_control;
/* u3_cs_patch: memory change, top level. /* u3_cs_patch: memory change, top level.
*/ */
typedef struct _u3_cs_patch { typedef struct _u3_cs_patch {
c3_i ctl_i; c3_i ctl_i;
c3_i mem_i; c3_i mem_i;
u3_ce_control* con_u; u3e_control* con_u;
} u3_cs_patch; } u3_cs_patch;
/* u3_ce_image: memory segment, open file. /* u3e_image: memory segment, open file.
*/ */
typedef struct _u3_ce_image { typedef struct _u3e_image {
c3_c* nam_c; // segment name c3_c* nam_c; // segment name
c3_i fid_i; // open file, or 0 c3_i fid_i; // open file, or 0
c3_w pgs_w; // length in pages c3_w pgs_w; // length in pages
} u3_ce_image; } u3e_image;
/* u3_ce_pool: entire memory system. /* u3e_pool: entire memory system.
*/ */
typedef struct _u3_ce_pool { typedef struct _u3e_pool {
c3_c* cpu_c; // path to c3_c* cpu_c; // path to
c3_d evt_d; // last patch written at event c3_d evt_d; // last patch written at event
c3_w dit_w[u3_ca_pages >> 5]; // touched since last save c3_w dit_w[u3a_pages >> 5]; // touched since last save
u3_ce_image nor_u; // north segment u3e_image nor_u; // north segment
u3_ce_image sou_u; // south segment u3e_image sou_u; // south segment
} u3_ce_pool; } u3e_pool;
/** Globals. /** Globals.
**/ **/
/* u3_Pool / u3P: global memory control. /* u3_Pool / u3P: global memory control.
*/ */
c3_global u3_ce_pool u3_Pool; c3_global u3e_pool u3_Pool;
# define u3P u3_Pool # define u3P u3_Pool
/** Functions. /** Functions.
**/ **/
/* u3_ce_fault(): handle a memory event with libsigsegv protocol. /* u3e_fault(): handle a memory event with libsigsegv protocol.
*/ */
c3_i c3_i
u3_ce_fault(void* adr_v, c3_i ser_i); u3e_fault(void* adr_v, c3_i ser_i);
/* u3_ce_save(): /* u3e_save():
*/ */
void void
u3_ce_save(void); u3e_save(void);
/* u3_ce_boot(): start the memory system. /* u3e_boot(): start the memory system.
*/ */
void void
u3_ce_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c); u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c);
/* u3_ce_init(): start the environment, with/without checkpointing. /* u3e_init(): start the environment, with/without checkpointing.
*/ */
void void
u3_ce_init(c3_o chk_o); u3e_init(c3_o chk_o);
/* u3_ce_grab(): garbage-collect the world, plus extra roots. /* u3e_grab(): garbage-collect the world, plus extra roots.
*/ */
void void
u3_ce_grab(c3_c* cap_c, u3_noun som, ...); // terminate with u3_none u3e_grab(c3_c* cap_c, u3_noun som, ...); // terminate with u3_none
/* u3_ce_dirty(): count dirty pages. /* u3e_dirty(): count dirty pages.
*/ */
c3_w c3_w
u3_ce_dirty(void); u3e_dirty(void);

88
i/g/h.h
View File

@ -15,10 +15,10 @@
*** clock-algorithm reclamation policy, not yet implemented. *** clock-algorithm reclamation policy, not yet implemented.
*** Search "clock algorithm" to figure it out. *** Search "clock algorithm" to figure it out.
**/ **/
/* u3_ch_slot: map slot. /* u3h_slot: map slot.
** **
** Either a key-value cell or a loom offset, decoded as a pointer ** Either a key-value cell or a loom offset, decoded as a pointer
** to a u3_ch_node. Matches the u3_noun format - coordinate with ** to a u3h_node. Matches the u3_noun format - coordinate with
** meme.h. The top two bits are: ** meme.h. The top two bits are:
** **
** 00 - empty (in the root table only) ** 00 - empty (in the root table only)
@ -26,95 +26,95 @@
** 02 - entry, stale ** 02 - entry, stale
** 03 - entry, fresh ** 03 - entry, fresh
*/ */
typedef c3_w u3_ch_slot; typedef c3_w u3h_slot;
/* u3_ch_node: map node. /* u3h_node: map node.
*/ */
typedef struct { typedef struct {
c3_w map_w; c3_w map_w;
u3_ch_slot sot_w[0]; u3h_slot sot_w[0];
} u3_ch_node; } u3h_node;
/* u3_ch_root: hash root table, with future-proof clock. /* u3h_root: hash root table, with future-proof clock.
*/ */
typedef struct { typedef struct {
c3_w clk_w; c3_w clk_w;
u3_ch_slot sot_w[64]; u3h_slot sot_w[64];
} u3_ch_root; } u3h_root;
/* u3_ch_buck: bottom bucket. /* u3h_buck: bottom bucket.
*/ */
typedef struct { typedef struct {
c3_w len_w; c3_w len_w;
u3_noun kev[0]; u3_noun kev[0];
} u3_ch_buck; } u3h_buck;
/** HAMT macros. /** HAMT macros.
*** ***
*** Coordinate with u3_noun definition! *** Coordinate with u3_noun definition!
**/ **/
/* u3_ch_slot_is_null(): yes iff slot is empty /* u3h_slot_is_null(): yes iff slot is empty
** u3_ch_slot_is_noun(): yes iff slot contains a key/value cell ** u3h_slot_is_noun(): yes iff slot contains a key/value cell
** u3_ch_slot_is_node(): yes iff slot contains a subtable/bucket ** u3h_slot_is_node(): yes iff slot contains a subtable/bucket
** u3_ch_slot_is_warm(): yes iff fresh bit is set ** u3h_slot_is_warm(): yes iff fresh bit is set
** u3_ch_slot_to_node(): slot to node pointer ** u3h_slot_to_node(): slot to node pointer
** u3_ch_node_to_slot(): node pointer to slot ** u3h_node_to_slot(): node pointer to slot
** u3_ch_slot_to_noun(): slot to cell ** u3h_slot_to_noun(): slot to cell
** u3_ch_noun_to_slot(): cell to slot ** u3h_noun_to_slot(): cell to slot
*/ */
# define u3_ch_slot_is_null(sot) ((0 == ((sot) >> 30)) ? c3y : c3n) # define u3h_slot_is_null(sot) ((0 == ((sot) >> 30)) ? c3y : c3n)
# define u3_ch_slot_is_node(sot) ((1 == ((sot) >> 30)) ? c3y : c3n) # define u3h_slot_is_node(sot) ((1 == ((sot) >> 30)) ? c3y : c3n)
# define u3_ch_slot_is_noun(sot) ((1 == ((sot) >> 31)) ? c3y : c3n) # define u3h_slot_is_noun(sot) ((1 == ((sot) >> 31)) ? c3y : c3n)
# define u3_ch_slot_is_warm(sot) (((sot) & 0x40000000) ? c3y : c3n) # define u3h_slot_is_warm(sot) (((sot) & 0x40000000) ? c3y : c3n)
# define u3_ch_slot_to_node(sot) (u3_ca_into((sot) & 0x3fffffff)) # define u3h_slot_to_node(sot) (u3a_into((sot) & 0x3fffffff))
# define u3_ch_node_to_slot(ptr) (u3_ca_outa(ptr) | 0x40000000) # define u3h_node_to_slot(ptr) (u3a_outa(ptr) | 0x40000000)
# define u3_ch_slot_to_noun(sot) (0x40000000 | (sot)) # define u3h_slot_to_noun(sot) (0x40000000 | (sot))
# define u3_ch_noun_to_slot(som) (som) # define u3h_noun_to_slot(som) (som)
# define u3_ch_noun_be_warm(sot) ((sot) | 0x40000000) # define u3h_noun_be_warm(sot) ((sot) | 0x40000000)
# define u3_ch_noun_be_cold(sot) ((sot) & ~0x40000000) # define u3h_noun_be_cold(sot) ((sot) & ~0x40000000)
/** Functions. /** Functions.
*** ***
*** Needs: delete and merge functions; clock reclamation function. *** Needs: delete and merge functions; clock reclamation function.
**/ **/
/* u3_ch_new(): create hashtable. /* u3h_new(): create hashtable.
*/ */
u3p(u3_ch_root) u3p(u3h_root)
u3_ch_new(void); u3h_new(void);
/* u3_ch_put(): insert in hashtable. /* u3h_put(): insert in hashtable.
** **
** `key` is RETAINED; `val` is transferred. ** `key` is RETAINED; `val` is transferred.
*/ */
void void
u3_ch_put(u3p(u3_ch_root) har_p, u3_noun key, u3_noun val); u3h_put(u3p(u3h_root) har_p, u3_noun key, u3_noun val);
/* u3_ch_get(): read from hashtable. /* u3h_get(): read from hashtable.
** **
** `key` is RETAINED. ** `key` is RETAINED.
*/ */
u3_weak u3_weak
u3_ch_get(u3p(u3_ch_root) har_p, u3_noun key); u3h_get(u3p(u3h_root) har_p, u3_noun key);
/* u3_ch_gut(): read from hashtable, unifying key nouns. /* u3h_gut(): read from hashtable, unifying key nouns.
** **
** `key` is RETAINED. ** `key` is RETAINED.
*/ */
u3_weak u3_weak
u3_ch_gut(u3p(u3_ch_root) har_p, u3_noun key); u3h_gut(u3p(u3h_root) har_p, u3_noun key);
/* u3_ch_free(): free hashtable. /* u3h_free(): free hashtable.
*/ */
void void
u3_ch_free(u3p(u3_ch_root) har_p); u3h_free(u3p(u3h_root) har_p);
/* u3_ch_mark(): mark hashtable for gc. /* u3h_mark(): mark hashtable for gc.
*/ */
void void
u3_ch_mark(u3p(u3_ch_root) har_p); u3h_mark(u3p(u3h_root) har_p);
/* u3_ch_walk(): traverse hashtable with key, value fn; RETAINS. /* u3h_walk(): traverse hashtable with key, value fn; RETAINS.
*/ */
void void
u3_ch_walk(u3p(u3_ch_root) har_p, void (*fun_f)(u3_noun)); u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun));

44
i/g/i.h
View File

@ -4,83 +4,83 @@
*/ */
/* General constructors. /* General constructors.
*/ */
/* u3_ci_words(): /* u3i_words():
** **
** Copy [a] words from [b] into an atom. ** Copy [a] words from [b] into an atom.
*/ */
u3_noun u3_noun
u3_ci_words(c3_w a_w, u3i_words(c3_w a_w,
const c3_w* b_w); const c3_w* b_w);
/* u3_ci_bytes(): /* u3i_bytes():
** **
** Copy `a` bytes from `b` to an LSB first atom. ** Copy `a` bytes from `b` to an LSB first atom.
*/ */
u3_noun u3_noun
u3_ci_bytes(c3_w a_w, u3i_bytes(c3_w a_w,
const c3_y* b_y); const c3_y* b_y);
/* u3_ci_mp(): /* u3i_mp():
** **
** Copy the GMP integer `a` into an atom, and clear it. ** Copy the GMP integer `a` into an atom, and clear it.
*/ */
u3_noun u3_noun
u3_ci_mp(mpz_t a_mp); u3i_mp(mpz_t a_mp);
/* u3_ci_vint(): /* u3i_vint():
** **
** Create `a + 1`. ** Create `a + 1`.
*/ */
u3_noun u3_noun
u3_ci_vint(u3_noun a); u3i_vint(u3_noun a);
/* u3_ci_cell(): /* u3i_cell():
** **
** Produce the cell `[a b]`. ** Produce the cell `[a b]`.
*/ */
u3_noun u3_noun
u3_ci_cell(u3_noun a, u3_noun b); u3i_cell(u3_noun a, u3_noun b);
/* u3_ci_trel(): /* u3i_trel():
** **
** Produce the triple `[a b c]`. ** Produce the triple `[a b c]`.
*/ */
u3_noun u3_noun
u3_ci_trel(u3_noun a, u3_noun b, u3_noun c); u3i_trel(u3_noun a, u3_noun b, u3_noun c);
/* u3_ci_qual(): /* u3i_qual():
** **
** Produce the cell `[a b c d]`. ** Produce the cell `[a b c d]`.
*/ */
u3_noun u3_noun
u3_ci_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d); u3i_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d);
/* u3_ci_string(): /* u3i_string():
** **
** Produce an LSB-first atom from the C string `a`. ** Produce an LSB-first atom from the C string `a`.
*/ */
u3_noun u3_noun
u3_ci_string(const c3_c* a_c); u3i_string(const c3_c* a_c);
/* u3_ci_molt(): /* u3i_molt():
** **
** Mutate `som` with a 0-terminated list of axis, noun pairs. ** Mutate `som` with a 0-terminated list of axis, noun pairs.
** Axes must be cats (31 bit). ** Axes must be cats (31 bit).
*/ */
u3_noun u3_noun
u3_ci_molt(u3_noun som, ...); u3i_molt(u3_noun som, ...);
/* u3_ci_chubs(): /* u3i_chubs():
** **
** Construct `a` double-words from `b`, LSD first, as an atom. ** Construct `a` double-words from `b`, LSD first, as an atom.
*/ */
u3_atom u3_atom
u3_ci_chubs(c3_w a_w, u3i_chubs(c3_w a_w,
const c3_d* b_d); const c3_d* b_d);
/* u3_ci_tape(): from a C string, to a list of bytes. /* u3i_tape(): from a C string, to a list of bytes.
*/ */
u3_atom u3_atom
u3_ci_tape(const c3_c* txt_c); u3i_tape(const c3_c* txt_c);

72
i/g/j.h
View File

@ -62,9 +62,9 @@
*** ***
*** All of these are transient structures allocated with malloc. *** All of these are transient structures allocated with malloc.
**/ **/
/* u3_ce_harm: jet arm. /* u3e_harm: jet arm.
*/ */
typedef struct _u3_ce_harm { typedef struct _u3e_harm {
c3_c* fcs_c; // `.axe` or name c3_c* fcs_c; // `.axe` or name
u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer
// u3_bean (*val_f)(u3_noun); // validate or 0 / retain // u3_bean (*val_f)(u3_noun); // validate or 0 / retain
@ -72,99 +72,99 @@
c3_o tot; // total (never punts) c3_o tot; // total (never punts)
c3_o liv; // live (enabled) c3_o liv; // live (enabled)
c3_l axe_l; // computed/discovered axis c3_l axe_l; // computed/discovered axis
struct _u3_ce_core* cop_u; // containing core struct _u3e_core* cop_u; // containing core
} u3_ce_harm; } u3e_harm;
/* u3_ce_core: driver definition. /* u3e_core: driver definition.
*/ */
typedef struct _u3_ce_core { typedef struct _u3e_core {
c3_c* cos_c; // control string c3_c* cos_c; // control string
struct _u3_ce_harm* arm_u; // blank-terminated static list struct _u3e_harm* arm_u; // blank-terminated static list
struct _u3_ce_core* dev_u; // blank-terminated static list struct _u3e_core* dev_u; // blank-terminated static list
struct _u3_ce_core* par_u; // dynamic parent pointer struct _u3e_core* par_u; // dynamic parent pointer
c3_l axe_l; // axis to parent c3_l axe_l; // axis to parent
c3_l jax_l; // index in global dashboard c3_l jax_l; // index in global dashboard
} u3_ce_core; } u3e_core;
/* u3_ce_dash, u3_Dash, u3D: jet dashboard singleton /* u3e_dash, u3_Dash, u3D: jet dashboard singleton
*/ */
typedef struct _u3_ce_dash { typedef struct _u3e_dash {
u3_ce_core* dev_u; // null-terminated static list u3e_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length c3_l len_l; // dynamic array length
c3_l all_l; // allocated length c3_l all_l; // allocated length
u3_ce_core* ray_u; // dynamic array by axis u3e_core* ray_u; // dynamic array by axis
} u3_ce_dash; } u3e_dash;
/** Globals. /** Globals.
**/ **/
/* u3_Dash: jet dashboard. /* u3_Dash: jet dashboard.
*/ */
extern u3_ce_dash u3_Dash; extern u3e_dash u3_Dash;
# define u3D u3_Dash # define u3D u3_Dash
/** Functions. /** Functions.
**/ **/
/* u3_cj_boot(): initialize jet system. /* u3j_boot(): initialize jet system.
*/ */
void void
u3_cj_boot(void); u3j_boot(void);
/* u3_cj_clear(): clear jet table to re-register. /* u3j_clear(): clear jet table to re-register.
*/ */
void void
u3_cj_clear(void); u3j_clear(void);
/* u3_cj_hook(): /* u3j_hook():
** **
** Execute hook from core. ** Execute hook from core.
*/ */
u3_noun u3_noun
u3_cj_hook(u3_noun cor, u3j_hook(u3_noun cor,
const c3_c* tam_c); const c3_c* tam_c);
/* u3_cj_soft(): /* u3j_soft():
** **
** Execute hook from core, without jet. ** Execute hook from core, without jet.
*/ */
u3_noun u3_noun
u3_cj_soft(u3_noun cor, u3j_soft(u3_noun cor,
const c3_c* tam_c); const c3_c* tam_c);
/* u3_cj_find(): battery to driver number, or 0. /* u3j_find(): battery to driver number, or 0.
** **
** `bat` is RETAINED by the caller. ** `bat` is RETAINED by the caller.
*/ */
c3_l c3_l
u3_cj_find(u3_noun bat); u3j_find(u3_noun bat);
/* u3_cj_kick(): try to kick by jet. If no kick, produce u3_none. /* u3j_kick(): try to kick by jet. If no kick, produce u3_none.
** **
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there ** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
** is no kick, TRANSFERRED if one. ** is no kick, TRANSFERRED if one.
*/ */
u3_weak u3_weak
u3_cj_kick(u3_noun cor, u3j_kick(u3_noun cor,
u3_noun axe); u3_noun axe);
/* u3_cj_kink(): kick either by jet or by nock. /* u3j_kink(): kick either by jet or by nock.
*/ */
u3_noun u3_noun
u3_cj_kink(u3_noun cor, u3j_kink(u3_noun cor,
u3_noun axe); u3_noun axe);
/* u3_cj_mine(): register core for jets. /* u3j_mine(): register core for jets.
*/ */
void void
u3_cj_mine(u3_noun clu, u3j_mine(u3_noun clu,
u3_noun cor); u3_noun cor);
/* u3_cj_ream(): refresh after restoring from checkpoint. /* u3j_ream(): refresh after restoring from checkpoint.
*/ */
void void
u3_cj_ream(void); u3j_ream(void);
/* u3_cj_reap(): promote jet state. RETAINS. /* u3j_reap(): promote jet state. RETAINS.
*/ */
void void
u3_cj_reap(u3_noun das, u3p(u3_ch_root) har_p); u3j_reap(u3_noun das, u3p(u3h_root) har_p);

120
i/g/m.h
View File

@ -4,26 +4,26 @@
*/ */
/** System management. /** System management.
**/ **/
/* u3_cm_boot(): set up top-level road. /* u3m_boot(): set up top-level road.
*/ */
void void
u3_cm_boot(c3_o nuu_o, c3_o bug_o); u3m_boot(c3_o nuu_o, c3_o bug_o);
/* u3_cm_trap(): setjmp within road. /* u3m_trap(): setjmp within road.
*/ */
#if 0 #if 0
c3_o c3_o
u3_cm_trap(void); u3m_trap(void);
#else #else
# define u3_cm_trap() (u3_noun)(setjmp(u3R->esc.buf)) # define u3m_trap() (u3_noun)(setjmp(u3R->esc.buf))
#endif #endif
/* u3_cm_signal(): treat a nock-level exception as a signal interrupt. /* u3m_signal(): treat a nock-level exception as a signal interrupt.
*/ */
void void
u3_cm_signal(u3_noun sig_l); u3m_signal(u3_noun sig_l);
/* u3_cm_bail(): bail out. Does not return. /* u3m_bail(): bail out. Does not return.
** **
** Bail motes: ** Bail motes:
** **
@ -36,138 +36,138 @@
** %meme :: out of memory ** %meme :: out of memory
*/ */
c3_i c3_i
u3_cm_bail(c3_m how_m); u3m_bail(c3_m how_m);
/* u3_cm_dump(): dump the current road to stderr. /* u3m_dump(): dump the current road to stderr.
*/ */
void void
u3_cm_dump(void); u3m_dump(void);
/* u3_cm_file(): load file, as atom, or bail. /* u3m_file(): load file, as atom, or bail.
*/ */
u3_noun u3_noun
u3_cm_file(c3_c* pas_c); u3m_file(c3_c* pas_c);
/* u3_cm_clear(): clear all allocated data in road. /* u3m_clear(): clear all allocated data in road.
*/ */
void void
u3_cm_clear(void); u3m_clear(void);
/* u3_cm_mark(): mark all nouns in the road. /* u3m_mark(): mark all nouns in the road.
*/ */
void void
u3_cm_mark(void); u3m_mark(void);
/* u3_cm_error(): bail out with %exit, ct_pushing error. /* u3m_error(): bail out with %exit, ct_pushing error.
*/ */
c3_i c3_i
u3_cm_error(c3_c* str_c); u3m_error(c3_c* str_c);
/* u3_cm_check(): checkpoint memory to file. Asserts u3R == u3H. /* u3m_check(): checkpoint memory to file. Asserts u3R == u3H.
*/ */
void void
u3_cm_check(void); u3m_check(void);
/* u3_cm_fall(): return to parent road. /* u3m_fall(): return to parent road.
*/ */
void void
u3_cm_fall(void); u3m_fall(void);
/* u3_cm_hate(): new, integrated leap mechanism (enter). /* u3m_hate(): new, integrated leap mechanism (enter).
*/ */
void void
u3_cm_hate(c3_w pad_w); u3m_hate(c3_w pad_w);
/* u3_cm_love(): return product from leap. /* u3m_love(): return product from leap.
*/ */
u3_noun u3_noun
u3_cm_love(u3_noun pro); u3m_love(u3_noun pro);
/* u3_cm_leap(): in u3R, create a new road within the existing one. /* u3m_leap(): in u3R, create a new road within the existing one.
*/ */
void void
u3_cm_leap(c3_w pad_w); u3m_leap(c3_w pad_w);
/* u3_cm_golf(): record cap length for u3_flog(). /* u3m_golf(): record cap length for u3_flog().
*/ */
c3_w c3_w
u3_cm_golf(void); u3m_golf(void);
/* u3_cm_flog(): pop the cap. /* u3m_flog(): pop the cap.
** **
** A common sequence for inner allocation is: ** A common sequence for inner allocation is:
** **
** c3_w gof_w = u3_cm_golf(); ** c3_w gof_w = u3m_golf();
** u3_cm_leap(); ** u3m_leap();
** // allocate some inner stuff... ** // allocate some inner stuff...
** u3_cm_fall(); ** u3m_fall();
** // inner stuff is still valid, but on cap ** // inner stuff is still valid, but on cap
** u3_cm_flog(gof_w); ** u3m_flog(gof_w);
** **
** u3_cm_flog(0) simply clears the cap. ** u3m_flog(0) simply clears the cap.
*/ */
void void
u3_cm_flog(c3_w gof_w); u3m_flog(c3_w gof_w);
/* u3_cm_soft(): system soft wrapper. unifies unix and nock errors. /* u3m_soft(): system soft wrapper. unifies unix and nock errors.
** **
** Produces [%$ result] or [%error (list tank)]. ** Produces [%$ result] or [%error (list tank)].
*/ */
u3_noun u3_noun
u3_cm_soft(c3_w sec_w, u3_funk fun_f, u3_noun arg); u3m_soft(c3_w sec_w, u3_funk fun_f, u3_noun arg);
/* u3_cm_soft_top(): top-level safety wrapper. /* u3m_soft_top(): top-level safety wrapper.
*/ */
u3_noun u3_noun
u3_cm_soft_top(c3_w sec_w, // timer seconds u3m_soft_top(c3_w sec_w, // timer seconds
c3_w pad_w, // base memory pad c3_w pad_w, // base memory pad
u3_funk fun_f, u3_funk fun_f,
u3_noun arg); u3_noun arg);
/* u3_cm_soft_slam: top-level call. /* u3m_soft_slam: top-level call.
*/ */
u3_noun u3_noun
u3_cm_soft_slam(u3_noun gat, u3_noun sam); u3m_soft_slam(u3_noun gat, u3_noun sam);
/* u3_cm_soft_sure(): top-level call assumed correct. /* u3m_soft_sure(): top-level call assumed correct.
*/ */
u3_noun u3_noun
u3_cm_soft_sure(u3_funk fun_f, u3_noun arg); u3m_soft_sure(u3_funk fun_f, u3_noun arg);
/* u3_cm_soft_run(): descend into virtualization context. /* u3m_soft_run(): descend into virtualization context.
*/ */
u3_noun u3_noun
u3_cm_soft_run(u3_noun fly, u3m_soft_run(u3_noun fly,
u3_funq fun_f, u3_funq fun_f,
u3_noun aga, u3_noun aga,
u3_noun agb); u3_noun agb);
/* u3_cm_soft_esc(): namespace lookup to (unit ,*). /* u3m_soft_esc(): namespace lookup to (unit ,*).
*/ */
u3_noun u3_noun
u3_cm_soft_esc(u3_noun sam); u3m_soft_esc(u3_noun sam);
/* u3_cm_water(): produce high and low watermarks. Asserts u3R == u3H. /* u3m_water(): produce high and low watermarks. Asserts u3R == u3H.
*/ */
void void
u3_cm_water(c3_w *low_w, c3_w *hig_w); u3m_water(c3_w *low_w, c3_w *hig_w);
/* u3_cm_pretty(): dumb prettyprint to string. RETAIN. /* u3m_pretty(): dumb prettyprint to string. RETAIN.
*/ */
c3_c* c3_c*
u3_cm_pretty(u3_noun som); u3m_pretty(u3_noun som);
/* u3_cm_p(): dumb print with caption. RETAIN. /* u3m_p(): dumb print with caption. RETAIN.
*/ */
void void
u3_cm_p(const c3_c* cap_c, u3_noun som); u3m_p(const c3_c* cap_c, u3_noun som);
/* u3_cm_tape(): dump a tape to stdout. /* u3m_tape(): dump a tape to stdout.
*/ */
void void
u3_cm_tape(u3_noun tep); u3m_tape(u3_noun tep);
/* u3_cm_wall(): dump a wall to stdout. /* u3m_wall(): dump a wall to stdout.
*/ */
void void
u3_cm_wall(u3_noun wol); u3m_wall(u3_noun wol);

32
i/g/n.h
View File

@ -4,42 +4,42 @@
*/ */
/** Functions. /** Functions.
**/ **/
/* u3_cn_nock_on(): produce .*(bus fol). /* u3n_nock_on(): produce .*(bus fol).
*/ */
u3_noun u3_noun
u3_cn_nock_on(u3_noun bus, u3_noun fol); u3n_nock_on(u3_noun bus, u3_noun fol);
/* u3_cn_slam_on(): produce (gat sam). /* u3n_slam_on(): produce (gat sam).
*/ */
u3_noun u3_noun
u3_cn_slam_on(u3_noun gat, u3_noun sam); u3n_slam_on(u3_noun gat, u3_noun sam);
/* u3_cn_kick_on(): fire `gat` without changing the sample. /* u3n_kick_on(): fire `gat` without changing the sample.
*/ */
u3_noun u3_noun
u3_cn_kick_on(u3_noun gat); u3n_kick_on(u3_noun gat);
/* u3_cn_nock_un(): produce .*(bus fol), as ++toon. /* u3n_nock_un(): produce .*(bus fol), as ++toon.
*/ */
u3_noun u3_noun
u3_cn_nock_un(u3_noun bus, u3_noun fol); u3n_nock_un(u3_noun bus, u3_noun fol);
/* u3_cn_slam_un(): produce (gat sam), as ++toon. /* u3n_slam_un(): produce (gat sam), as ++toon.
*/ */
u3_noun u3_noun
u3_cn_slam_un(u3_noun gat, u3_noun sam); u3n_slam_un(u3_noun gat, u3_noun sam);
/* u3_cn_nock_in(): produce .*(bus fol), as ++toon, in namespace. /* u3n_nock_in(): produce .*(bus fol), as ++toon, in namespace.
*/ */
u3_noun u3_noun
u3_cn_nock_in(u3_noun fly, u3_noun bus, u3_noun fol); u3n_nock_in(u3_noun fly, u3_noun bus, u3_noun fol);
/* u3_cn_slam_in(): produce (gat sam), as ++toon, in namespace. /* u3n_slam_in(): produce (gat sam), as ++toon, in namespace.
*/ */
u3_noun u3_noun
u3_cn_slam_in(u3_noun fly, u3_noun gat, u3_noun sam); u3n_slam_in(u3_noun fly, u3_noun gat, u3_noun sam);
/* u3_cn_nock_an(): as slam_in(), but with empty fly. /* u3n_nock_an(): as slam_in(), but with empty fly.
*/ */
u3_noun u3_noun
u3_cn_nock_an(u3_noun bus, u3_noun fol); u3n_nock_an(u3_noun bus, u3_noun fol);

188
i/g/r.h
View File

@ -2,318 +2,318 @@
** **
** This file is in the public domain. ** This file is in the public domain.
*/ */
/** u3_cr_*: read without ever crashing. /** u3r_*: read without ever crashing.
**/ **/
#if 1 #if 1
# define u3_cr_du(a) u3_ca_is_cell(a) # define u3r_du(a) u3a_is_cell(a)
# define u3_cr_ud(a) u3_ca_is_atom(a) # define u3r_ud(a) u3a_is_atom(a)
#else #else
/* u3_cr_du(): c3y iff `a` is cell. /* u3r_du(): c3y iff `a` is cell.
*/ */
u3_bean u3_bean
u3_cr_du(u3_noun a); u3r_du(u3_noun a);
/* u3_cr_ud(): c3n iff `a` is cell. /* u3r_ud(): c3n iff `a` is cell.
*/ */
u3_bean u3_bean
u3_cr_ud(u3_noun a); u3r_ud(u3_noun a);
#endif #endif
/* u3_cr_at(): fragment `a` of `b`, or u3_none. /* u3r_at(): fragment `a` of `b`, or u3_none.
*/ */
u3_weak u3_weak
u3_cr_at(u3_atom a, u3r_at(u3_atom a,
u3_weak b); u3_weak b);
/* u3_cr_mean(): /* u3r_mean():
** **
** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates. ** Attempt to deconstruct `a` by axis, noun pairs; 0 terminates.
** Axes must be sorted in tree order. ** Axes must be sorted in tree order.
*/ */
u3_bean u3_bean
u3_cr_mean(u3_noun a, u3r_mean(u3_noun a,
...); ...);
/* u3_cr_mug(): /* u3r_mug():
** **
** Compute and/or recall the mug (31-bit hash) of (a). ** Compute and/or recall the mug (31-bit hash) of (a).
*/ */
c3_w c3_w
u3_cr_mug(u3_noun a); u3r_mug(u3_noun a);
/* u3_cr_mug_string(): /* u3r_mug_string():
** **
** Compute the mug of `a`, LSB first. ** Compute the mug of `a`, LSB first.
*/ */
c3_w c3_w
u3_cr_mug_string(const c3_c *a_c); u3r_mug_string(const c3_c *a_c);
/* u3_cr_mug_words(): /* u3r_mug_words():
** **
** Compute the mug of `buf`, `len`, LSW first. ** Compute the mug of `buf`, `len`, LSW first.
*/ */
c3_w c3_w
u3_cr_mug_words(const c3_w *buf_w, u3r_mug_words(const c3_w *buf_w,
c3_w len_w); c3_w len_w);
/* u3_cr_mug_cell(): /* u3r_mug_cell():
** **
** Compute the mug of `[a b]`. ** Compute the mug of `[a b]`.
*/ */
c3_w c3_w
u3_cr_mug_cell(u3_noun a, u3r_mug_cell(u3_noun a,
u3_noun b); u3_noun b);
/* u3_cr_mug_trel(): /* u3r_mug_trel():
** **
** Compute the mug of `[a b c]`. ** Compute the mug of `[a b c]`.
*/ */
c3_w c3_w
u3_cr_mug_trel(u3_noun a, u3r_mug_trel(u3_noun a,
u3_noun b, u3_noun b,
u3_noun c); u3_noun c);
/* u3_cr_mug_qual(): /* u3r_mug_qual():
** **
** Compute the mug of `[a b c d]`. ** Compute the mug of `[a b c d]`.
*/ */
c3_w c3_w
u3_cr_mug_qual(u3_noun a, u3r_mug_qual(u3_noun a,
u3_noun b, u3_noun b,
u3_noun c, u3_noun c,
u3_noun d); u3_noun d);
/* u3_cr_mug_both(): /* u3r_mug_both():
** **
** Join two mugs. ** Join two mugs.
*/ */
c3_w c3_w
u3_cr_mug_both(c3_w a_w, u3r_mug_both(c3_w a_w,
c3_w b_w); c3_w b_w);
/* u3_cr_fing(): /* u3r_fing():
** **
** Yes iff (a) and (b) are the same copy of the same noun. ** Yes iff (a) and (b) are the same copy of the same noun.
** (Ie, by pointer equality - u3_cr_sing with false negatives.) ** (Ie, by pointer equality - u3r_sing with false negatives.)
*/ */
u3_bean u3_bean
u3_cr_fing(u3_noun a, u3r_fing(u3_noun a,
u3_noun b); u3_noun b);
/* u3_cr_fing_cell(): /* u3r_fing_cell():
** **
** Yes iff `[p q]` and `b` are the same copy of the same noun. ** Yes iff `[p q]` and `b` are the same copy of the same noun.
*/ */
u3_bean u3_bean
u3_cr_fing_cell(u3_noun p, u3r_fing_cell(u3_noun p,
u3_noun q, u3_noun q,
u3_noun b); u3_noun b);
/* u3_cr_fing_mixt(): /* u3r_fing_mixt():
** **
** Yes iff `[p q]` and `b` are the same copy of the same noun. ** Yes iff `[p q]` and `b` are the same copy of the same noun.
*/ */
u3_bean u3_bean
u3_cr_fing_mixt(const c3_c* p_c, u3r_fing_mixt(const c3_c* p_c,
u3_noun q, u3_noun q,
u3_noun b); u3_noun b);
/* u3_cr_fing_trel(): /* u3r_fing_trel():
** **
** Yes iff `[p q r]` and `b` are the same copy of the same noun. ** Yes iff `[p q r]` and `b` are the same copy of the same noun.
*/ */
u3_bean u3_bean
u3_cr_fing_trel(u3_noun p, u3r_fing_trel(u3_noun p,
u3_noun q, u3_noun q,
u3_noun r, u3_noun r,
u3_noun b); u3_noun b);
/* u3_cr_fing_qual(): /* u3r_fing_qual():
** **
** Yes iff `[p q r s]` and `b` are the same copy of the same noun. ** Yes iff `[p q r s]` and `b` are the same copy of the same noun.
*/ */
u3_bean u3_bean
u3_cr_fing_qual(u3_noun p, u3r_fing_qual(u3_noun p,
u3_noun q, u3_noun q,
u3_noun r, u3_noun r,
u3_noun s, u3_noun s,
u3_noun b); u3_noun b);
/* u3_cr_sing(): /* u3r_sing():
** **
** Yes iff (a) and (b) are the same noun. ** Yes iff (a) and (b) are the same noun.
*/ */
u3_bean u3_bean
u3_cr_sing(u3_noun a, u3r_sing(u3_noun a,
u3_noun b); u3_noun b);
/* u3_cr_sung(): yes iff (a) and (b) are the same noun, unifying equals. /* u3r_sung(): yes iff (a) and (b) are the same noun, unifying equals.
** **
** Make sure you have no live, uncounted pointers to any noun ** Make sure you have no live, uncounted pointers to any noun
** within (a) or (b)! ** within (a) or (b)!
*/ */
u3_bean u3_bean
u3_cr_sung(u3_noun a, u3r_sung(u3_noun a,
u3_noun b); u3_noun b);
/* u3_cr_sing_c): /* u3r_sing_c):
** **
** Yes iff (b) is the same noun as the C string [a]. ** Yes iff (b) is the same noun as the C string [a].
*/ */
u3_bean u3_bean
u3_cr_sing_c(const c3_c* a_c, u3r_sing_c(const c3_c* a_c,
u3_noun b); u3_noun b);
/* u3_cr_sing_cell(): /* u3r_sing_cell():
** **
** Yes iff `[p q]` and `b` are the same noun. ** Yes iff `[p q]` and `b` are the same noun.
*/ */
u3_bean u3_bean
u3_cr_sing_cell(u3_noun p, u3r_sing_cell(u3_noun p,
u3_noun q, u3_noun q,
u3_noun b); u3_noun b);
/* u3_cr_sing_mixt(): /* u3r_sing_mixt():
** **
** Yes iff `[p q]` and `b` are the same noun. ** Yes iff `[p q]` and `b` are the same noun.
*/ */
u3_bean u3_bean
u3_cr_sing_mixt(const c3_c* p_c, u3r_sing_mixt(const c3_c* p_c,
u3_noun q, u3_noun q,
u3_noun b); u3_noun b);
/* u3_cr_sing_trel(): /* u3r_sing_trel():
** **
** Yes iff `[p q r]` and `b` are the same noun. ** Yes iff `[p q r]` and `b` are the same noun.
*/ */
u3_bean u3_bean
u3_cr_sing_trel(u3_noun p, u3r_sing_trel(u3_noun p,
u3_noun q, u3_noun q,
u3_noun r, u3_noun r,
u3_noun b); u3_noun b);
/* u3_cr_sing_qual(): /* u3r_sing_qual():
** **
** Yes iff `[p q r s]` and `b` are the same noun. ** Yes iff `[p q r s]` and `b` are the same noun.
*/ */
u3_bean u3_bean
u3_cr_sing_qual(u3_noun p, u3r_sing_qual(u3_noun p,
u3_noun q, u3_noun q,
u3_noun r, u3_noun r,
u3_noun s, u3_noun s,
u3_noun b); u3_noun b);
/* u3_cr_nord(): /* u3r_nord():
** **
** Return 0, 1 or 2 if `a` is below, equal to, or above `b`. ** Return 0, 1 or 2 if `a` is below, equal to, or above `b`.
*/ */
u3_atom u3_atom
u3_cr_nord(u3_noun a, u3r_nord(u3_noun a,
u3_noun b); u3_noun b);
/* u3_cr_mold(): /* u3r_mold():
** **
** Divide `a` as a mold `[b.[p q] c]`. ** Divide `a` as a mold `[b.[p q] c]`.
*/ */
u3_bean u3_bean
u3_cr_mold(u3_noun a, u3r_mold(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c); u3_noun* c);
/* u3_cr_cell(): /* u3r_cell():
** **
** Divide `a` as a cell `[b c]`. ** Divide `a` as a cell `[b c]`.
*/ */
u3_bean u3_bean
u3_cr_cell(u3_noun a, u3r_cell(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c); u3_noun* c);
/* u3_cr_trel(): /* u3r_trel():
** **
** Divide `a` as a trel `[b c]`. ** Divide `a` as a trel `[b c]`.
*/ */
u3_bean u3_bean
u3_cr_trel(u3_noun a, u3r_trel(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d); u3_noun* d);
/* u3_cr_qual(): /* u3r_qual():
** **
** Divide (a) as a qual [b c d e f]. ** Divide (a) as a qual [b c d e f].
*/ */
u3_bean u3_bean
u3_cr_qual(u3_noun a, u3r_qual(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e); u3_noun* e);
/* u3_cr_quil(): /* u3r_quil():
** **
** Divide (a) as a quil [b c d e f]. ** Divide (a) as a quil [b c d e f].
*/ */
u3_bean u3_bean
u3_cr_quil(u3_noun a, u3r_quil(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e, u3_noun* e,
u3_noun* f); u3_noun* f);
/* u3_cr_p(): /* u3r_p():
** **
** & [0] if [a] is of the form [b *c]. ** & [0] if [a] is of the form [b *c].
*/ */
u3_bean u3_bean
u3_cr_p(u3_noun a, u3r_p(u3_noun a,
u3_noun b, u3_noun b,
u3_noun* c); u3_noun* c);
/* u3_cr_bush(): /* u3r_bush():
** **
** Factor [a] as a bush [b.[p q] c]. ** Factor [a] as a bush [b.[p q] c].
*/ */
u3_bean u3_bean
u3_cr_bush(u3_noun a, u3r_bush(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c); u3_noun* c);
/* u3_cr_pq(): /* u3r_pq():
** **
** & [0] if [a] is of the form [b *c d]. ** & [0] if [a] is of the form [b *c d].
*/ */
u3_bean u3_bean
u3_cr_pq(u3_noun a, u3r_pq(u3_noun a,
u3_noun b, u3_noun b,
u3_noun* c, u3_noun* c,
u3_noun* d); u3_noun* d);
/* u3_cr_pqr(): /* u3r_pqr():
** **
** & [0] if [a] is of the form [b *c *d *e]. ** & [0] if [a] is of the form [b *c *d *e].
*/ */
u3_bean u3_bean
u3_cr_pqr(u3_noun a, u3r_pqr(u3_noun a,
u3_noun b, u3_noun b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e); u3_noun* e);
/* u3_cr_pqrs(): /* u3r_pqrs():
** **
** & [0] if [a] is of the form [b *c *d *e *f]. ** & [0] if [a] is of the form [b *c *d *e *f].
*/ */
u3_bean u3_bean
u3_cr_pqrs(u3_noun a, u3r_pqrs(u3_noun a,
u3_noun b, u3_noun b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e, u3_noun* e,
u3_noun* f); u3_noun* f);
/* u3_cr_met(): /* u3r_met():
** **
** Return the size of (b) in bits, rounded up to ** Return the size of (b) in bits, rounded up to
** (1 << a_y). ** (1 << a_y).
@ -321,89 +321,89 @@
** For example, (a_y == 3) returns the size in bytes. ** For example, (a_y == 3) returns the size in bytes.
*/ */
c3_w c3_w
u3_cr_met(c3_y a_y, u3r_met(c3_y a_y,
u3_atom b); u3_atom b);
/* u3_cr_bit(): /* u3r_bit():
** **
** Return bit (a_w) of (b). ** Return bit (a_w) of (b).
*/ */
c3_b c3_b
u3_cr_bit(c3_w a_w, u3r_bit(c3_w a_w,
u3_atom b); u3_atom b);
/* u3_cr_byte(): /* u3r_byte():
** **
** Return byte (a_w) of (b). ** Return byte (a_w) of (b).
*/ */
c3_y c3_y
u3_cr_byte(c3_w a_w, u3r_byte(c3_w a_w,
u3_atom b); u3_atom b);
/* u3_cr_bytes(): /* u3r_bytes():
** **
** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c). ** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c).
*/ */
void void
u3_cr_bytes(c3_w a_w, u3r_bytes(c3_w a_w,
c3_w b_w, c3_w b_w,
c3_y* c_y, c3_y* c_y,
u3_atom d); u3_atom d);
/* u3_cr_chop(): /* u3r_chop():
** **
** Into the bloq space of `met`, from position `fum` for a ** Into the bloq space of `met`, from position `fum` for a
** span of `wid`, to position `tou`, XOR from atom `src` ** span of `wid`, to position `tou`, XOR from atom `src`
** into ray `dst`. ** into ray `dst`.
*/ */
void void
u3_cr_chop(c3_g met_g, u3r_chop(c3_g met_g,
c3_w fum_w, c3_w fum_w,
c3_w wid_w, c3_w wid_w,
c3_w tou_w, c3_w tou_w,
c3_w* dst_w, c3_w* dst_w,
u3_atom src); u3_atom src);
/* u3_cr_mp(): /* u3r_mp():
** **
** Copy (b) into (a_mp). ** Copy (b) into (a_mp).
*/ */
void void
u3_cr_mp(mpz_t a_mp, u3r_mp(mpz_t a_mp,
u3_atom b); u3_atom b);
/* u3_cr_word(): /* u3r_word():
** **
** Return word (a_w) of (b). ** Return word (a_w) of (b).
*/ */
c3_w c3_w
u3_cr_word(c3_w a_w, u3r_word(c3_w a_w,
u3_atom b); u3_atom b);
/* u3_cr_chub(): /* u3r_chub():
** **
** Return double-word (a_w) of (b). ** Return double-word (a_w) of (b).
*/ */
c3_d c3_d
u3_cr_chub(c3_w a_w, u3r_chub(c3_w a_w,
u3_atom b); u3_atom b);
/* u3_cr_words(): /* u3r_words():
** **
** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c). ** Copy words (a_w) through (a_w + b_w - 1) from (d) to (c).
*/ */
void void
u3_cr_words(c3_w a_w, u3r_words(c3_w a_w,
c3_w b_w, c3_w b_w,
c3_w* c_w, c3_w* c_w,
u3_atom d); u3_atom d);
/* u3_cr_string(): `a`, a text atom, as malloced C string. /* u3r_string(): `a`, a text atom, as malloced C string.
*/ */
c3_c* c3_c*
u3_cr_string(u3_atom a); u3r_string(u3_atom a);
/* u3_cr_tape(): `a`, a list of bytes, as malloced C string. /* u3r_tape(): `a`, a list of bytes, as malloced C string.
*/ */
c3_y* c3_y*
u3_cr_tape(u3_noun a); u3r_tape(u3_noun a);

44
i/g/t.h
View File

@ -4,57 +4,57 @@
*/ */
/** Tracing. /** Tracing.
**/ **/
/* u3_ct_push(): push on trace stack. /* u3t_push(): push on trace stack.
*/ */
void void
u3_ct_push(u3_noun mon); u3t_push(u3_noun mon);
/* u3_ct_mean(): push `[%mean roc]` on trace stack. /* u3t_mean(): push `[%mean roc]` on trace stack.
*/ */
void void
u3_ct_mean(u3_noun roc); u3t_mean(u3_noun roc);
/* u3_ct_drop(): drop from meaning stack. /* u3t_drop(): drop from meaning stack.
*/ */
void void
u3_ct_drop(void); u3t_drop(void);
/* u3_ct_slog(): print directly. /* u3t_slog(): print directly.
*/ */
void void
u3_ct_slog(u3_noun hod); u3t_slog(u3_noun hod);
/* u3_ct_heck(): profile point. /* u3t_heck(): profile point.
*/ */
void void
u3_ct_heck(u3_atom cog); u3t_heck(u3_atom cog);
/* u3_ct_samp(): sample. /* u3t_samp(): sample.
*/ */
void void
u3_ct_samp(void); u3t_samp(void);
/* u3_ct_come(): push on profile stack. /* u3t_come(): push on profile stack.
*/ */
void void
u3_ct_come(u3_atom cog); u3t_come(u3_atom cog);
/* u3_ct_flee(): pop off profile stack. /* u3t_flee(): pop off profile stack.
*/ */
void void
u3_ct_flee(void); u3t_flee(void);
/* u3_ct_damp(): print and clear profile data. /* u3t_damp(): print and clear profile data.
*/ */
void void
u3_ct_damp(void); u3t_damp(void);
/* u3_ct_boff(): turn profile sampling off. /* u3t_boff(): turn profile sampling off.
*/ */
void void
u3_ct_boff(void); u3t_boff(void);
/* u3_ct_boot(): turn sampling on. /* u3t_boot(): turn sampling on.
*/ */
void void
u3_ct_boot(void); u3t_boot(void);

122
i/g/v.h
View File

@ -6,19 +6,19 @@
**/ **/
/* u3_cart: ovum carton. /* u3_cart: ovum carton.
*/ */
struct _u3_cv_arvo; struct _u3v_arvo;
typedef struct _u3_cv_cart { typedef struct _u3v_cart {
u3_noun vir; // effects of ovum u3_noun vir; // effects of ovum
u3_bean did; // cart considered for commit? u3_bean did; // cart considered for commit?
u3_bean cit; // cart committed? u3_bean cit; // cart committed?
c3_d ent_d; // entry in raft queue? c3_d ent_d; // entry in raft queue?
u3p(struct _u3_cv_cart) nex_p; u3p(struct _u3v_cart) nex_p;
} u3_cv_cart; } u3v_cart;
/* u3_cv_arvo: modern arvo structure. /* u3v_arvo: modern arvo structure.
*/ */
typedef struct _u3_cv_arvo { typedef struct _u3v_arvo {
c3_d ent_d; // event number c3_d ent_d; // event number
u3_noun yot; // cached gates u3_noun yot; // cached gates
u3_noun now; // current time, as noun u3_noun now; // current time, as noun
@ -34,140 +34,140 @@
u3_noun roc; // kernel core u3_noun roc; // kernel core
struct { // ova waiting to process struct { // ova waiting to process
u3p(u3_cv_cart) egg_p; // exit of ovum queue u3p(u3v_cart) egg_p; // exit of ovum queue
u3p(u3_cv_cart) geg_p; // entry of ovum queue u3p(u3v_cart) geg_p; // entry of ovum queue
} ova; } ova;
} u3_cv_arvo; } u3v_arvo;
/* u3_cv_home: all internal (within image) state. /* u3v_home: all internal (within image) state.
*/ */
typedef struct _u3_cv_home { typedef struct _u3v_home {
u3_cs_road rod_u; // storage state u3a_road rod_u; // storage state
u3_cv_arvo arv_u; // arvo state u3v_arvo arv_u; // arvo state
} u3_cv_home; } u3v_home;
/** Globals. /** Globals.
**/ **/
/* u3_Home / u3H: root of thread. /* u3_Home / u3H: root of thread.
*/ */
c3_global u3_cv_home* u3_Home; c3_global u3v_home* u3_Home;
# define u3H u3_Home # define u3H u3_Home
# define u3A (&(u3_Home->arv_u)) # define u3A (&(u3_Home->arv_u))
/** Functions. /** Functions.
**/ **/
/* u3_cv_do(): use a kernel function. /* u3v_do(): use a kernel function.
*/ */
u3_noun u3_noun
u3_cv_do(const c3_c* txt_c, u3_noun arg); u3v_do(const c3_c* txt_c, u3_noun arg);
/* u3_cv_make(): make a new pier by loading a pill. /* u3v_make(): make a new pier by loading a pill.
*/ */
void void
u3_cv_make(c3_c* pas_c); u3v_make(c3_c* pas_c);
/* u3_cv_jack(): execute kernel formula to bind jets. /* u3v_jack(): execute kernel formula to bind jets.
*/ */
void void
u3_cv_jack(void); u3v_jack(void);
/* u3_cv_start(): start time. /* u3v_start(): start time.
*/ */
void void
u3_cv_start(u3_noun now); u3v_start(u3_noun now);
/* u3_cv_arm(): load a kernel arm. /* u3v_arm(): load a kernel arm.
*/ */
u3_noun u3_noun
u3_cv_arm(const c3_c* txt_c); u3v_arm(const c3_c* txt_c);
/* u3_cv_pike(): poke with floating core. /* u3v_pike(): poke with floating core.
*/ */
u3_noun u3_noun
u3_cv_pike(u3_noun ovo, u3_noun cor); u3v_pike(u3_noun ovo, u3_noun cor);
/* u3_cv_nick(): transform enveloped packets, [vir cor]. /* u3v_nick(): transform enveloped packets, [vir cor].
*/ */
u3_noun u3_noun
u3_cv_nick(u3_noun vir, u3_noun cor); u3v_nick(u3_noun vir, u3_noun cor);
/* u3_cv_do(): use a kernel function. /* u3v_do(): use a kernel function.
*/ */
u3_noun u3_noun
u3_cv_do(const c3_c* txt_c, u3_noun arg); u3v_do(const c3_c* txt_c, u3_noun arg);
/* u3_cv_wish(): text expression with cache. /* u3v_wish(): text expression with cache.
*/ */
u3_noun u3_noun
u3_cv_wish(const c3_c* str_c); u3v_wish(const c3_c* str_c);
/* u3_cv_numb(): set the instance number. /* u3v_numb(): set the instance number.
*/ */
void void
u3_cv_numb(void); u3v_numb(void);
/* u3_cv_time(): set the reck time. /* u3v_time(): set the reck time.
*/ */
void void
u3_cv_time(u3_noun now); u3v_time(u3_noun now);
/* u3_cv_peek(): query the reck namespace. /* u3v_peek(): query the reck namespace.
*/ */
u3_noun u3_noun
u3_cv_peek(u3_noun hap); u3v_peek(u3_noun hap);
/* u3_cv_keep(): measure timer. /* u3v_keep(): measure timer.
*/ */
u3_noun u3_noun
u3_cv_keep(u3_noun hap); u3v_keep(u3_noun hap);
/* u3_cv_poke(): insert and apply an input ovum (protected). /* u3v_poke(): insert and apply an input ovum (protected).
*/ */
u3_noun u3_noun
u3_cv_poke(u3_noun ovo); u3v_poke(u3_noun ovo);
/* u3_cv_http_request(): hear http request on channel (unprotected). /* u3v_http_request(): hear http request on channel (unprotected).
*/ */
void void
u3_cv_http_request(u3_bean sec, u3_noun pox, u3_noun req); u3v_http_request(u3_bean sec, u3_noun pox, u3_noun req);
/* u3_cv_tank(): dump single tank. /* u3v_tank(): dump single tank.
*/ */
void void
u3_cv_tank(u3_noun blu, c3_l tab_l, u3_noun tac); u3v_tank(u3_noun blu, c3_l tab_l, u3_noun tac);
/* u3_cv_punt(): dump tank list. /* u3v_punt(): dump tank list.
*/ */
void void
u3_cv_punt(u3_noun blu, c3_l tab_l, u3_noun tac); u3v_punt(u3_noun blu, c3_l tab_l, u3_noun tac);
/* u3_cv_sway(): print trace. /* u3v_sway(): print trace.
*/ */
void void
u3_cv_sway(u3_noun blu, c3_l tab_l, u3_noun tax); u3v_sway(u3_noun blu, c3_l tab_l, u3_noun tax);
/* u3_cv_plan(): queue ovum (external). /* u3v_plan(): queue ovum (external).
*/ */
void void
u3_cv_plan(u3_noun pax, u3_noun fav); u3v_plan(u3_noun pax, u3_noun fav);
/* u3_cv_plow(): queue multiple ova (external). /* u3v_plow(): queue multiple ova (external).
*/ */
void void
u3_cv_plow(u3_noun ova); u3v_plow(u3_noun ova);
/* u3_cv_hose(): clear initial ovum queue. /* u3v_hose(): clear initial ovum queue.
*/ */
void void
u3_cv_hose(void); u3v_hose(void);
/* u3_cv_louse(): last-minute deviltry upon a bail. /* u3v_louse(): last-minute deviltry upon a bail.
*/ */
void void
u3_cv_louse(c3_m how_m); u3v_louse(c3_m how_m);
/* u3_cv_mark(): mark arvo kernel. /* u3v_mark(): mark arvo kernel.
*/ */
void void
u3_cv_mark(void); u3v_mark(void);

38
i/g/x.h
View File

@ -2,68 +2,68 @@
** **
** This file is in the public domain. ** This file is in the public domain.
*/ */
/** u3_cx_*: read, but bail with c3__exit on a crash. /** u3x_*: read, but bail with c3__exit on a crash.
**/ **/
#if 1 #if 1
# define u3_cx_h(som) u3_ca_h(som) # define u3x_h(som) u3a_h(som)
# define u3_cx_t(som) u3_ca_t(som) # define u3x_t(som) u3a_t(som)
#else #else
/* u3_cx_h (u3h): head. /* u3x_h (u3h): head.
*/ */
u3_noun u3_noun
u3_cx_h(u3_noun som); u3x_h(u3_noun som);
/* u3_cx_t (u3t): tail. /* u3x_t (u3t): tail.
*/ */
u3_noun u3_noun
u3_cx_t(u3_noun som); u3x_t(u3_noun som);
#endif #endif
/* u3_cx_good(): test for u3_none. /* u3x_good(): test for u3_none.
*/ */
u3_noun u3_noun
u3_cx_good(u3_weak som); u3x_good(u3_weak som);
/* u3_cx_at (u3at): fragment. /* u3x_at (u3at): fragment.
*/ */
u3_noun u3_noun
u3_cx_at(u3_noun axe, u3_noun som); u3x_at(u3_noun axe, u3_noun som);
/* u3_cx_cell(): /* u3x_cell():
** **
** Divide `a` as a cell `[b c]`. ** Divide `a` as a cell `[b c]`.
*/ */
void void
u3_cx_cell(u3_noun a, u3x_cell(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c); u3_noun* c);
/* u3_cx_trel(): /* u3x_trel():
** **
** Divide `a` as a trel `[b c d]`, or bail. ** Divide `a` as a trel `[b c d]`, or bail.
*/ */
void void
u3_cx_trel(u3_noun a, u3x_trel(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d); u3_noun* d);
/* u3_cx_qual(): /* u3x_qual():
** **
** Divide `a` as a quadruple `[b c d e]`. ** Divide `a` as a quadruple `[b c d e]`.
*/ */
void void
u3_cx_qual(u3_noun a, u3x_qual(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,
u3_noun* e); u3_noun* e);
/* u3_cx_quil(): /* u3x_quil():
** **
** Divide `a` as a quintuple `[b c d e f]`. ** Divide `a` as a quintuple `[b c d e f]`.
*/ */
void void
u3_cx_quil(u3_noun a, u3x_quil(u3_noun a,
u3_noun* b, u3_noun* b,
u3_noun* c, u3_noun* c,
u3_noun* d, u3_noun* d,

24
i/g/z.h
View File

@ -12,23 +12,23 @@
*** ***
*** Memo functions RETAIN keys and transfer values. *** Memo functions RETAIN keys and transfer values.
**/ **/
/* u3_cz_find*(): find in memo cache. /* u3z_find*(): find in memo cache.
*/ */
u3_weak u3_cz_find(u3_mote, u3_noun); u3_weak u3z_find(u3_mote, u3_noun);
u3_weak u3_cz_find_2(u3_mote, u3_noun, u3_noun); u3_weak u3z_find_2(u3_mote, u3_noun, u3_noun);
u3_weak u3_cz_find_3(u3_mote, u3_noun, u3_noun, u3_noun); u3_weak u3z_find_3(u3_mote, u3_noun, u3_noun, u3_noun);
u3_weak u3_cz_find_4(u3_mote, u3_noun, u3_noun, u3_noun, u3_noun); u3_weak u3z_find_4(u3_mote, u3_noun, u3_noun, u3_noun, u3_noun);
/* u3_cz_save*(): save in memo cache. /* u3z_save*(): save in memo cache.
*/ */
u3_noun u3_cz_save(u3_mote, u3_noun, u3_noun); u3_noun u3z_save(u3_mote, u3_noun, u3_noun);
u3_noun u3_cz_save_2(u3_mote, u3_noun, u3_noun, u3_noun); u3_noun u3z_save_2(u3_mote, u3_noun, u3_noun, u3_noun);
u3_noun u3_cz_save_3(u3_mote, u3_noun, u3_noun, u3_noun, u3_noun); u3_noun u3z_save_3(u3_mote, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3_cz_save_4 u3_noun u3z_save_4
(u3_mote, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun); (u3_mote, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
/* u3_cz_uniq(): uniquify with memo cache. /* u3z_uniq(): uniquify with memo cache.
*/ */
u3_noun u3_noun
u3_cz_uniq(u3_noun som); u3z_uniq(u3_noun som);

View File

@ -11,21 +11,21 @@
u3_cqa_add(u3_atom a, u3_cqa_add(u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
c3_w c = a + b; c3_w c = a + b;
return u3_ci_words(1, &c); return u3i_words(1, &c);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
mpz_add(a_mp, a_mp, b_mp); mpz_add(a_mp, a_mp, b_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
u3_noun u3_noun
@ -33,11 +33,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_add(a, b); return u3_cqa_add(a, b);
} }

View File

@ -10,26 +10,26 @@
u3_noun u3_noun
u3_cqa_inc(u3_atom a) u3_cqa_inc(u3_atom a)
{ {
return u3_ci_vint(u3k(a)); return u3i_vint(u3k(a));
} }
u3_noun u3_noun
u3_cqa_dec(u3_atom a) u3_cqa_dec(u3_atom a)
{ {
if ( 0 == a ) { if ( 0 == a ) {
return u3_cm_error("decrement-underflow"); return u3m_error("decrement-underflow");
} }
else { else {
if ( _(u3_ca_is_cat(a)) ) { if ( _(u3a_is_cat(a)) ) {
return a - 1; return a - 1;
} }
else { else {
mpz_t a_mp; mpz_t a_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
mpz_sub_ui(a_mp, a_mp, 1); mpz_sub_ui(a_mp, a_mp, 1);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
} }
@ -38,10 +38,10 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) || if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_dec(a); return u3_cqa_dec(a);
} }

View File

@ -12,22 +12,22 @@
u3_atom b) u3_atom b)
{ {
if ( 0 == b ) { if ( 0 == b ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
return a / b; return a / b;
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
mpz_tdiv_q(a_mp, a_mp, b_mp); mpz_tdiv_q(a_mp, a_mp, b_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
} }
@ -36,11 +36,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_div(a, b); return u3_cqa_div(a, b);
} }

View File

@ -10,15 +10,15 @@
u3_noun u3_noun
u3_cqa_gte(u3_atom a, u3_atom b) u3_cqa_gte(u3_atom a, u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
return __(a >= b); return __(a >= b);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_bean cmp; u3_bean cmp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
cmp = (mpz_cmp(a_mp, b_mp) >= 0) ? c3y : c3n; cmp = (mpz_cmp(a_mp, b_mp) >= 0) ? c3y : c3n;
@ -34,11 +34,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_gte(a, b); return u3_cqa_gte(a, b);
} }

View File

@ -11,15 +11,15 @@
u3_cqa_gth(u3_atom a, u3_cqa_gth(u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
return __(a > b); return __(a > b);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_bean cmp; u3_bean cmp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
cmp = (mpz_cmp(a_mp, b_mp) > 0) ? c3y : c3n; cmp = (mpz_cmp(a_mp, b_mp) > 0) ? c3y : c3n;
@ -34,11 +34,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_gth(a, b); return u3_cqa_gth(a, b);
} }

View File

@ -10,15 +10,15 @@
u3_noun u3_noun
u3_cqa_lte(u3_atom a, u3_atom b) u3_cqa_lte(u3_atom a, u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
return __(a <= b); return __(a <= b);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_bean cmp; u3_bean cmp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
cmp = (mpz_cmp(a_mp, b_mp) <= 0) ? c3y : c3n; cmp = (mpz_cmp(a_mp, b_mp) <= 0) ? c3y : c3n;
@ -33,11 +33,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_lte(a, b); return u3_cqa_lte(a, b);
} }

View File

@ -11,15 +11,15 @@
u3_cqa_lth(u3_atom a, u3_cqa_lth(u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
return __(a < b); return __(a < b);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_bean cmp; u3_bean cmp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
cmp = (mpz_cmp(a_mp, b_mp) < 0) ? c3y : c3n; cmp = (mpz_cmp(a_mp, b_mp) < 0) ? c3y : c3n;
@ -34,11 +34,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_lth(a, b); return u3_cqa_lth(a, b);
} }

View File

@ -13,17 +13,17 @@
u3_atom b) u3_atom b)
{ {
if ( 0 == b ) { if ( 0 == b ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
mpz_tdiv_r(a_mp, a_mp, b_mp); mpz_tdiv_r(a_mp, a_mp, b_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
@ -32,11 +32,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_mod(a, b); return u3_cqa_mod(a, b);
} }

View File

@ -11,21 +11,21 @@
u3_cqa_mul(u3_atom a, u3_cqa_mul(u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
c3_d c = ((c3_d) a) * ((c3_d) b); c3_d c = ((c3_d) a) * ((c3_d) b);
return u3_ci_chubs(1, &c); return u3i_chubs(1, &c);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
mpz_mul(a_mp, a_mp, b_mp); mpz_mul(a_mp, a_mp, b_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
u3_noun u3_noun
@ -33,11 +33,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_mul(a, b); return u3_cqa_mul(a, b);
} }

View File

@ -10,28 +10,28 @@
u3_noun u3_noun
u3_cqa_sub(u3_atom a, u3_atom b) u3_cqa_sub(u3_atom a, u3_atom b)
{ {
if ( _(u3_ca_is_cat(a)) && _(u3_ca_is_cat(b)) ) { if ( _(u3a_is_cat(a)) && _(u3a_is_cat(b)) ) {
if ( a < b ) { if ( a < b ) {
return u3_cm_error("subtract-underflow"); return u3m_error("subtract-underflow");
} }
else return (a - b); else return (a - b);
} }
else { else {
mpz_t a_mp, b_mp; mpz_t a_mp, b_mp;
u3_cr_mp(a_mp, a); u3r_mp(a_mp, a);
u3_cr_mp(b_mp, b); u3r_mp(b_mp, b);
if ( mpz_cmp(a_mp, b_mp) < 0 ) { if ( mpz_cmp(a_mp, b_mp) < 0 ) {
mpz_clear(a_mp); mpz_clear(a_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_cm_error("subtract-underflow"); return u3m_error("subtract-underflow");
} }
mpz_sub(a_mp, a_mp, b_mp); mpz_sub(a_mp, a_mp, b_mp);
mpz_clear(b_mp); mpz_clear(b_mp);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
@ -40,11 +40,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqa_sub(a, b); return u3_cqa_sub(a, b);
} }

View File

@ -15,7 +15,7 @@
if ( 0 == a ) { if ( 0 == a ) {
return 0; return 0;
} else { } else {
return u3nc(0, u3_cn_slam_on(u3k(b), u3k(u3t(a)))); return u3nc(0, u3n_slam_on(u3k(b), u3k(u3t(a))));
} }
} }
u3_noun u3_noun
@ -24,8 +24,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_bind(a, b); return u3_cqb_bind(a, b);
} }

View File

@ -19,7 +19,7 @@
return u3k(a); return u3k(a);
} }
else { else {
return u3nc(0, u3_cn_slam_on(u3k(c), u3nc(u3k(u3t(a)), u3k(u3t(b))))); return u3nc(0, u3n_slam_on(u3k(c), u3nc(u3k(u3t(a)), u3k(u3t(b)))));
} }
} }
u3_noun u3_noun
@ -27,10 +27,10 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_6, &b, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0) ) { u3v_sam_7, &c, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_clap(a, b, c); return u3_cqb_clap(a, b, c);
} }

View File

@ -22,7 +22,7 @@
{ {
u3_noun a; u3_noun a;
if ( u3_none == (a = u3_cr_at(u3_cv_sam, cor)) ) { if ( u3_none == (a = u3r_at(u3v_sam, cor)) ) {
return u3_none; return u3_none;
} else { } else {
return u3_cqb_drop(a); return u3_cqb_drop(a);

View File

@ -19,7 +19,7 @@
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
u3z(b); u3z(b);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
b = u3nc(u3k(u3h(a)), b); b = u3nc(u3k(u3h(a)), b);
@ -32,8 +32,8 @@
{ {
u3_noun a; u3_noun a;
if ( u3_none == (a = u3_cr_at(u3_cv_sam, cor)) ) { if ( u3_none == (a = u3r_at(u3v_sam, cor)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_flop(a); return u3_cqb_flop(a);
} }

View File

@ -18,10 +18,10 @@
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
u3z(len); u3z(len);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
len = u3_ci_vint(len); len = u3i_vint(len);
a = u3t(a); a = u3t(a);
} }
} }
@ -31,8 +31,8 @@
{ {
u3_noun a; u3_noun a;
if ( u3_none == (a = u3_cr_at(u3_cv_sam, cor)) ) { if ( u3_none == (a = u3r_at(u3v_sam, cor)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_lent(a); return u3_cqb_lent(a);
} }

View File

@ -18,13 +18,13 @@
u3_noun loz; u3_noun loz;
if ( c3n == u3du(a) ) { if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else switch ( (loz = u3_cn_slam_on(u3k(b), u3k(u3h(a)))) ) { else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
case c3y: return u3_cqb_levy(u3t(a), b); case c3y: return u3_cqb_levy(u3t(a), b);
case c3n: return c3n; case c3n: return c3n;
default: u3z(loz); default: u3z(loz);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
} }
} }
@ -34,8 +34,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_levy(a, b); return u3_cqb_levy(a, b);
} }

View File

@ -17,13 +17,13 @@
u3_noun loz; u3_noun loz;
if ( c3n == u3du(a) ) { if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else switch ( (loz = u3_cn_slam_on(u3k(b), u3k(u3h(a)))) ) { else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
case c3y: return c3y; case c3y: return c3y;
case c3n: return u3_cqb_lien(u3t(a), b); case c3n: return u3_cqb_lien(u3t(a), b);
default: u3z(loz); default: u3z(loz);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
} }
} }
@ -32,8 +32,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_lien(a, b); return u3_cqb_lien(a, b);
} }

View File

@ -12,7 +12,7 @@
u3_noun a) u3_noun a)
{ {
if ( 0 == a ) { if ( 0 == a ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3k(u3t(a)); return u3k(u3t(a));
@ -24,8 +24,8 @@
{ {
u3_noun a; u3_noun a;
if ( u3_none == (a = u3_cr_at(u3_cv_sam, cor)) ) { if ( u3_none == (a = u3r_at(u3v_sam, cor)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_need(a); return u3_cqb_need(a);
} }

View File

@ -13,16 +13,16 @@
u3_noun b) u3_noun b)
{ {
if ( 0 == a ) { if ( 0 == a ) {
return u3k(u3_cr_at(u3_cv_sam_3, b)); return u3k(u3r_at(u3v_sam_3, b));
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun gim = u3k(u3h(a)); u3_noun gim = u3k(u3h(a));
u3_noun hur = u3_cqb_reel(u3t(a), b); u3_noun hur = u3_cqb_reel(u3t(a), b);
return u3_cn_slam_on(u3k(b), u3nc(gim, hur)); return u3n_slam_on(u3k(b), u3nc(gim, hur));
} }
} }
u3_noun u3_noun
@ -31,8 +31,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_reel(a, b); return u3_cqb_reel(a, b);
} }

View File

@ -12,19 +12,19 @@
u3_noun b) u3_noun b)
{ {
if ( 0 == a ) { if ( 0 == a ) {
return u3k(u3_cr_at(u3_cv_sam_3, b)); return u3k(u3r_at(u3v_sam_3, b));
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun gim = u3k(u3h(a)); u3_noun gim = u3k(u3h(a));
u3_noun zor = u3k(u3_cr_at(u3_cv_sam_3, b)); u3_noun zor = u3k(u3r_at(u3v_sam_3, b));
u3_noun daz = u3_cn_slam_on(u3k(b), u3nc(gim, zor)); u3_noun daz = u3n_slam_on(u3k(b), u3nc(gim, zor));
u3_noun vel = u3_ci_molt(u3k(b), u3_cv_sam_3, daz, 0); u3_noun vel = u3i_molt(u3k(b), u3v_sam_3, daz, 0);
if ( u3_none == vel ) { if ( u3_none == vel ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun hox = u3_cqb_roll(u3t(a), vel); u3_noun hox = u3_cqb_roll(u3t(a), vel);
@ -38,8 +38,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_roll(a, b); return u3_cqb_roll(a, b);
} }

View File

@ -12,8 +12,8 @@
u3_atom a, u3_atom a,
u3_noun b) u3_noun b)
{ {
if ( !_(u3_ca_is_cat(a)) ) { if ( !_(u3a_is_cat(a)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
u3_noun acc; u3_noun acc;
@ -26,7 +26,7 @@
if ( c3n == u3du(b) ) { if ( c3n == u3du(b) ) {
return u3_nul; return u3_nul;
} }
acc = u3_ci_cell( u3h(b), acc ); acc = u3i_cell( u3h(b), acc );
b = u3t(b); b = u3t(b);
i_w--; i_w--;
} }
@ -41,10 +41,10 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_scag(a, b); return u3_cqb_scag(a, b);
} }

View File

@ -16,9 +16,9 @@
return a; return a;
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun hoz = u3_cn_slam_on(u3k(b), u3k(u3h(a))); u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3_cqb_skim(u3t(a), b); u3_noun vyr = u3_cqb_skim(u3t(a), b);
switch ( hoz ) { switch ( hoz ) {
@ -26,7 +26,7 @@
case c3n: return vyr; case c3n: return vyr;
default: u3z(hoz); default: u3z(hoz);
u3z(vyr); u3z(vyr);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
} }
} }
@ -36,8 +36,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_skim(a, b); return u3_cqb_skim(a, b);
} }

View File

@ -18,7 +18,7 @@
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_none; return u3_none;
} else { } else {
u3_noun hoz = u3_cn_slam_on(u3k(b), u3k(u3h(a))); u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3_cqb_skip(u3t(a), b); u3_noun vyr = u3_cqb_skip(u3t(a), b);
switch ( hoz ) { switch ( hoz ) {
@ -36,7 +36,7 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_none; return u3_none;
} else { } else {
return u3_cqb_skip(a, b); return u3_cqb_skip(a, b);

View File

@ -10,8 +10,8 @@
u3_noun u3_noun
u3_cqb_slag(u3_atom a, u3_noun b) u3_cqb_slag(u3_atom a, u3_noun b)
{ {
if ( !_(u3_ca_is_cat(a)) ) { if ( !_(u3a_is_cat(a)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_w len_w = a; c3_w len_w = a;
@ -31,10 +31,10 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_slag(a, b); return u3_cqb_slag(a, b);
} }

View File

@ -11,21 +11,21 @@
u3_cqb_snag(u3_atom a, u3_cqb_snag(u3_atom a,
u3_noun b) u3_noun b)
{ {
if ( !_(u3_ca_is_cat(a)) ) { if ( !_(u3a_is_cat(a)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_w len_w = a; c3_w len_w = a;
while ( len_w ) { while ( len_w ) {
if ( c3n == u3du(b) ) { if ( c3n == u3du(b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
b = u3t(b); b = u3t(b);
len_w--; len_w--;
} }
if ( c3n == u3du(b) ) { if ( c3n == u3du(b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
return u3k(u3h(b)); return u3k(u3h(b));
} }
@ -35,10 +35,10 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_snag(a, b); return u3_cqb_snag(a, b);
} }

View File

@ -14,7 +14,7 @@
{ {
// must think about // must think about
// //
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
u3_noun u3_noun
u3_cwb_sort( u3_cwb_sort(
@ -22,8 +22,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_sort(a, b); return u3_cqb_sort(a, b);
} }

View File

@ -14,10 +14,10 @@
return a; return a;
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun one = u3_cn_slam_on(u3k(b), u3k(u3h(a))); u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3_cqb_turn(u3t(a), b); u3_noun two = u3_cqb_turn(u3t(a), b);
return u3nc(one, two); return u3nc(one, two);
@ -28,8 +28,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_turn(a, b); return u3_cqb_turn(a, b);
} }

View File

@ -15,7 +15,7 @@
return u3k(b); return u3k(b);
} }
else if ( c3n == u3du(a) ) { else if ( c3n == u3du(a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3nc(u3k(u3h(a)), u3_cqb_weld(u3t(a), b)); return u3nc(u3k(u3h(a)), u3_cqb_weld(u3t(a), b));
@ -26,8 +26,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqb_weld(a, b); return u3_cqb_weld(a, b);
} }

View File

@ -12,14 +12,14 @@
{ {
mpz_t a_mp; mpz_t a_mp;
if ( !_(u3_ca_is_cat(a)) ) { if ( !_(u3a_is_cat(a)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
mpz_init_set_ui(a_mp, 1); mpz_init_set_ui(a_mp, 1);
mpz_mul_2exp(a_mp, a_mp, a); mpz_mul_2exp(a_mp, a_mp, a);
return u3_ci_mp(a_mp); return u3i_mp(a_mp);
} }
} }
u3_noun u3_noun
@ -28,10 +28,10 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) || if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_bex(a); return u3_cqc_bex(a);
} }

View File

@ -11,8 +11,8 @@
u3_cqc_can(u3_atom a, u3_cqc_can(u3_atom a,
u3_noun b) u3_noun b)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
@ -30,14 +30,14 @@
if ( 0 == cab ) { if ( 0 == cab ) {
break; break;
} }
if ( c3n == u3du(cab) ) return u3_cm_bail(c3__fail); if ( c3n == u3du(cab) ) return u3m_bail(c3__fail);
i_cab = u3h(cab); i_cab = u3h(cab);
if ( c3n == u3du(i_cab) ) return u3_cm_bail(c3__fail); if ( c3n == u3du(i_cab) ) return u3m_bail(c3__fail);
pi_cab = u3h(i_cab); pi_cab = u3h(i_cab);
qi_cab = u3t(i_cab); qi_cab = u3t(i_cab);
if ( c3n == u3_ca_is_cat(pi_cab) ) return u3_cm_bail(c3__fail); if ( c3n == u3a_is_cat(pi_cab) ) return u3m_bail(c3__fail);
if ( c3n == u3ud(qi_cab) ) return u3_cm_bail(c3__fail); if ( c3n == u3ud(qi_cab) ) return u3m_bail(c3__fail);
if ( (tot_w + pi_cab) < tot_w ) return u3_cm_bail(c3__fail); if ( (tot_w + pi_cab) < tot_w ) return u3m_bail(c3__fail);
tot_w += pi_cab; tot_w += pi_cab;
cab = u3t(cab); cab = u3t(cab);
@ -45,8 +45,8 @@
if ( 0 == tot_w ) { if ( 0 == tot_w ) {
return 0; return 0;
} }
if ( 0 == (sal_w = u3_ca_slaq(a_g, tot_w)) ) { if ( 0 == (sal_w = u3a_slaq(a_g, tot_w)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
} }
@ -61,12 +61,12 @@
u3_atom pi_cab = u3h(i_cab); u3_atom pi_cab = u3h(i_cab);
u3_atom qi_cab = u3t(i_cab); u3_atom qi_cab = u3t(i_cab);
u3_cr_chop(a_g, 0, pi_cab, pos_w, sal_w, qi_cab); u3r_chop(a_g, 0, pi_cab, pos_w, sal_w, qi_cab);
pos_w += pi_cab; pos_w += pi_cab;
cab = u3t(cab); cab = u3t(cab);
} }
} }
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
u3_noun u3_noun
@ -74,10 +74,10 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqc_can(a, b); return u3_cqc_can(a, b);
} }

View File

@ -11,12 +11,12 @@
u3_cqc_cap( u3_cqc_cap(
u3_atom a) u3_atom a)
{ {
c3_w met_w = u3_cr_met(0, a); c3_w met_w = u3r_met(0, a);
if ( met_w < 2 ) { if ( met_w < 2 ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (1 == u3_cr_bit((met_w - 2), a)) ) { else if ( (1 == u3r_bit((met_w - 2), a)) ) {
return 3; return 3;
} else { } else {
return 2; return 2;
@ -28,10 +28,10 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) || if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_cap(a); return u3_cqc_cap(a);
} }

View File

@ -12,29 +12,29 @@
u3_atom b, u3_atom b,
u3_atom c) u3_atom c)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
c3_w lew_w = u3_cr_met(a_g, b); c3_w lew_w = u3r_met(a_g, b);
c3_w ler_w = u3_cr_met(a_g, c); c3_w ler_w = u3r_met(a_g, c);
c3_w all_w = (lew_w + ler_w); c3_w all_w = (lew_w + ler_w);
if ( 0 == all_w ) { if ( 0 == all_w ) {
return 0; return 0;
} else { } else {
c3_w* sal_w = u3_ca_slaq(a_g, all_w); c3_w* sal_w = u3a_slaq(a_g, all_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
u3_cr_chop(a_g, 0, lew_w, 0, sal_w, b); u3r_chop(a_g, 0, lew_w, 0, sal_w, b);
u3_cr_chop(a_g, 0, ler_w, lew_w, sal_w, c); u3r_chop(a_g, 0, ler_w, lew_w, sal_w, c);
} }
// return u3_ca_moot(sal_w); // return u3a_moot(sal_w);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -44,14 +44,14 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( (c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_6, &b, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0)) || u3v_sam_7, &c, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(c3n == u3ud(c)) ) (c3n == u3ud(c)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_cat(a, b, c); return u3_cqc_cat(a, b, c);
} }

View File

@ -11,28 +11,28 @@
u3_cqc_con(u3_atom a, u3_cqc_con(u3_atom a,
u3_atom b) u3_atom b)
{ {
c3_w lna_w = u3_cr_met(5, a); c3_w lna_w = u3r_met(5, a);
c3_w lnb_w = u3_cr_met(5, b); c3_w lnb_w = u3r_met(5, b);
if ( (lna_w == 0) && (lnb_w == 0) ) { if ( (lna_w == 0) && (lnb_w == 0) ) {
return 0; return 0;
} else { } else {
c3_w len_w = c3_max(lna_w, lnb_w); c3_w len_w = c3_max(lna_w, lnb_w);
c3_w* sal_w = u3_ca_slab(len_w); c3_w* sal_w = u3a_slab(len_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_w i_w; c3_w i_w;
u3_cr_chop(5, 0, lna_w, 0, sal_w, a); u3r_chop(5, 0, lna_w, 0, sal_w, a);
for ( i_w = 0; i_w < lnb_w; i_w++ ) { for ( i_w = 0; i_w < lnb_w; i_w++ ) {
sal_w[i_w] |= u3_cr_word(i_w, b); sal_w[i_w] |= u3r_word(i_w, b);
} }
// return u3_ca_moot(sal_w); // return u3a_moot(sal_w);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -41,11 +41,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_con(a, b); return u3_cqc_con(a, b);
} }

View File

@ -14,13 +14,13 @@
u3_atom c, u3_atom c,
u3_atom d) u3_atom d)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
if ( !_(u3_ca_is_cat(b)) ) { if ( !_(u3a_is_cat(b)) ) {
return 0; return 0;
} }
if ( !_(u3_ca_is_cat(c)) ) { if ( !_(u3a_is_cat(c)) ) {
c = 0x7fffffff; c = 0x7fffffff;
} }
@ -28,7 +28,7 @@
c3_g a_g = a; c3_g a_g = a;
c3_w b_w = b; c3_w b_w = b;
c3_w c_w = c; c3_w c_w = c;
c3_w len_w = u3_cr_met(a_g, d); c3_w len_w = u3r_met(a_g, d);
if ( (0 == c_w) || (b_w >= len_w) ) { if ( (0 == c_w) || (b_w >= len_w) ) {
return 0; return 0;
@ -40,14 +40,14 @@
return u3k(d); return u3k(d);
} }
else { else {
c3_w* sal_w = u3_ca_slaq(a_g, c_w); c3_w* sal_w = u3a_slaq(a_g, c_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
u3_cr_chop(a_g, b_w, c_w, 0, sal_w, d); u3r_chop(a_g, b_w, c_w, 0, sal_w, d);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -57,16 +57,16 @@
{ {
u3_noun a, b, c, d; u3_noun a, b, c, d;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( (c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_12, &b, u3v_sam_12, &b,
u3_cv_sam_13, &c, u3v_sam_13, &c,
u3_cv_sam_7, &d, 0)) || u3v_sam_7, &d, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(c3n == u3ud(c)) || (c3n == u3ud(c)) ||
(c3n == u3ud(d)) ) (c3n == u3ud(d)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_cut(a, b, c, d); return u3_cqc_cut(a, b, c, d);
} }

View File

@ -11,27 +11,27 @@
u3_cqc_dis(u3_atom a, u3_cqc_dis(u3_atom a,
u3_atom b) u3_atom b)
{ {
c3_w lna_w = u3_cr_met(5, a); c3_w lna_w = u3r_met(5, a);
c3_w lnb_w = u3_cr_met(5, b); c3_w lnb_w = u3r_met(5, b);
if ( (lna_w == 0) && (lnb_w == 0) ) { if ( (lna_w == 0) && (lnb_w == 0) ) {
return 0; return 0;
} else { } else {
c3_w len_w = c3_max(lna_w, lnb_w); c3_w len_w = c3_max(lna_w, lnb_w);
c3_w* sal_w = u3_ca_slab(len_w); c3_w* sal_w = u3a_slab(len_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_w i_w; c3_w i_w;
u3_cr_chop(5, 0, lna_w, 0, sal_w, a); u3r_chop(5, 0, lna_w, 0, sal_w, a);
for ( i_w = 0; i_w < len_w; i_w++ ) { for ( i_w = 0; i_w < len_w; i_w++ ) {
sal_w[i_w] &= (i_w >= lnb_w) ? 0 : u3_cr_word(i_w, b); sal_w[i_w] &= (i_w >= lnb_w) ? 0 : u3r_word(i_w, b);
} }
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -40,11 +40,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_dis(a, b); return u3_cqc_dis(a, b);
} }

View File

@ -12,7 +12,7 @@
u3_atom a, u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( c3y == u3_cr_sing(a, b) ) { if ( c3y == u3r_sing(a, b) ) {
return c3y; return c3y;
} }
else { else {
@ -29,7 +29,7 @@
return c3n; return c3n;
} }
else { else {
if ( c3y == u3_cr_sing(u3h(a), u3h(b)) ) { if ( c3y == u3r_sing(u3h(a), u3h(b)) ) {
return u3_cqc_dor(u3t(a), u3t(b)); return u3_cqc_dor(u3t(a), u3t(b));
} }
else return u3_cqc_dor(u3h(a), u3h(b)); else return u3_cqc_dor(u3h(a), u3h(b));
@ -43,8 +43,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_dor(a, b); return u3_cqc_dor(a, b);
} }

View File

@ -13,16 +13,16 @@
u3_atom b, u3_atom b,
u3_atom c) u3_atom c)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else if ( !_(u3_ca_is_cat(b)) ) { else if ( !_(u3a_is_cat(b)) ) {
return u3k(c); return u3k(c);
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
c3_w b_w = b; c3_w b_w = b;
c3_w len_w = u3_cr_met(a_g, c); c3_w len_w = u3r_met(a_g, c);
if ( 0 == b_w ) { if ( 0 == b_w ) {
return 0; return 0;
@ -31,14 +31,14 @@
return u3k(c); return u3k(c);
} }
else { else {
c3_w* sal_w = u3_ca_slaq(a_g, b_w); c3_w* sal_w = u3a_slaq(a_g, b_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
u3_cr_chop(a_g, 0, b_w, 0, sal_w, c); u3r_chop(a_g, 0, b_w, 0, sal_w, c);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -48,14 +48,14 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( (c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_6, &b, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0)) || u3v_sam_7, &c, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(c3n == u3ud(c)) ) (c3n == u3ud(c)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_end(a, b, c); return u3_cqc_end(a, b, c);
} }

View File

@ -11,8 +11,8 @@
u3_cqc_gor(u3_noun a, u3_cqc_gor(u3_noun a,
u3_noun b) u3_noun b)
{ {
c3_w c_w = u3_cr_mug(a); c3_w c_w = u3r_mug(a);
c3_w d_w = u3_cr_mug(b); c3_w d_w = u3r_mug(b);
if ( c_w == d_w ) { if ( c_w == d_w ) {
return u3_cqc_dor(a, b); return u3_cqc_dor(a, b);
@ -24,8 +24,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) ) { if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_gor(a, b); return u3_cqc_gor(a, b);
} }

View File

@ -25,7 +25,7 @@
u3_noun h_a = u3h(a); u3_noun h_a = u3h(a);
u3_noun h_b = u3h(b); u3_noun h_b = u3h(b);
if ( c3y == u3_cr_sing(h_a, h_b) ) { if ( c3y == u3r_sing(h_a, h_b) ) {
return u3_cqc_gor(u3t(a), u3t(b)); return u3_cqc_gor(u3t(a), u3t(b));
} else { } else {
return u3_cqc_gor(h_a, h_b); return u3_cqc_gor(h_a, h_b);
@ -38,8 +38,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) ) { if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_hor(a, b); return u3_cqc_hor(a, b);
} }

View File

@ -10,33 +10,33 @@
u3_noun u3_noun
u3_cqc_lsh(u3_atom a, u3_atom b, u3_atom c) u3_cqc_lsh(u3_atom a, u3_atom b, u3_atom c)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else if ( !_(u3_ca_is_cat(b)) ) { else if ( !_(u3a_is_cat(b)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
c3_w b_w = b; c3_w b_w = b;
c3_w len_w = u3_cr_met(a_g, c); c3_w len_w = u3r_met(a_g, c);
if ( 0 == len_w ) { if ( 0 == len_w ) {
return 0; return 0;
} }
else if ( (b_w + len_w) < len_w ) { else if ( (b_w + len_w) < len_w ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
c3_w* sal_w = u3_ca_slaq(a_g, (b_w + len_w)); c3_w* sal_w = u3a_slaq(a_g, (b_w + len_w));
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
u3_cr_chop(a_g, 0, len_w, b_w, sal_w, c); u3r_chop(a_g, 0, len_w, b_w, sal_w, c);
// return u3_ca_moot(sal_w); // return u3a_moot(sal_w);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -45,14 +45,14 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( (c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_6, &b, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0)) || u3v_sam_7, &c, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(c3n == u3ud(c)) ) (c3n == u3ud(c)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_lsh(a, b, c); return u3_cqc_lsh(a, b, c);
} }

View File

@ -13,9 +13,9 @@
c3_w b_w; c3_w b_w;
u3_atom c, d, e, f; u3_atom c, d, e, f;
b_w = u3_cr_met(0, a); b_w = u3r_met(0, a);
if ( b_w < 2 ) { if ( b_w < 2 ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
c = u3_cqc_bex((b_w - 1)); c = u3_cqc_bex((b_w - 1));
@ -35,10 +35,10 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) || if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_mas(a); return u3_cqc_mas(a);
} }

View File

@ -12,18 +12,18 @@
u3_atom a, u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
if ( 0 == b ) { if ( 0 == b ) {
return 0; return 0;
} else return 1; } else return 1;
} }
else { else {
c3_w met_w = u3_cr_met(a, b); c3_w met_w = u3r_met(a, b);
if ( !_(u3_ca_is_cat(met_w)) ) { if ( !_(u3a_is_cat(met_w)) ) {
return u3_ci_words(1, &met_w); return u3i_words(1, &met_w);
} }
else return u3_cr_met(a, b); else return u3r_met(a, b);
} }
} }
u3_noun u3_noun
@ -32,11 +32,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_met(a, b); return u3_cqc_met(a, b);
} }

View File

@ -11,27 +11,27 @@
u3_cqc_mix(u3_atom a, u3_cqc_mix(u3_atom a,
u3_atom b) u3_atom b)
{ {
c3_w lna_w = u3_cr_met(5, a); c3_w lna_w = u3r_met(5, a);
c3_w lnb_w = u3_cr_met(5, b); c3_w lnb_w = u3r_met(5, b);
if ( (lna_w == 0) && (lnb_w == 0) ) { if ( (lna_w == 0) && (lnb_w == 0) ) {
return 0; return 0;
} else { } else {
c3_w len_w = c3_max(lna_w, lnb_w); c3_w len_w = c3_max(lna_w, lnb_w);
c3_w* sal_w = u3_ca_slab(len_w); c3_w* sal_w = u3a_slab(len_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
c3_w i_w; c3_w i_w;
u3_cr_chop(5, 0, lna_w, 0, sal_w, a); u3r_chop(5, 0, lna_w, 0, sal_w, a);
for ( i_w = 0; i_w < lnb_w; i_w++ ) { for ( i_w = 0; i_w < lnb_w; i_w++ ) {
sal_w[i_w] ^= u3_cr_word(i_w, b); sal_w[i_w] ^= u3r_word(i_w, b);
} }
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -40,11 +40,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_mix(a, b); return u3_cqc_mix(a, b);
} }

View File

@ -12,9 +12,9 @@
{ {
u3_noun sam; u3_noun sam;
if ( u3_none == (sam = u3_cr_at(u3_cv_sam, cor)) ) { if ( u3_none == (sam = u3r_at(u3v_sam, cor)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cr_mug(sam); return u3r_mug(sam);
} }
} }

View File

@ -14,7 +14,7 @@
{ {
u3_atom c, d, e, f, g, h; u3_atom c, d, e, f, g, h;
c = u3_cr_met(0, b); c = u3r_met(0, b);
d = u3_cqa_dec(c); d = u3_cqa_dec(c);
e = u3_cqc_lsh(0, d, 1); e = u3_cqc_lsh(0, d, 1);
f = u3_cqa_sub(b, e); f = u3_cqa_sub(b, e);
@ -35,13 +35,13 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(0 == a) || (0 == a) ||
(0 == b) ) (0 == b) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_peg(a, b); return u3_cqc_peg(a, b);
} }

View File

@ -10,7 +10,7 @@
static u3_noun static u3_noun
_po_find(u3_noun buf, u3_noun a) _po_find(u3_noun buf, u3_noun a)
{ {
if ( !_(u3_ca_is_cat(a)) ) { if ( !_(u3a_is_cat(a)) ) {
return u3_nul; return u3_nul;
} }
else { else {
@ -21,7 +21,7 @@
c3_y byt_y[3]; c3_y byt_y[3];
c3_w but_w; c3_w but_w;
u3_cr_bytes((i_w * 3), 3, byt_y, buf); u3r_bytes((i_w * 3), 3, byt_y, buf);
but_w = (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); but_w = (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16));
if ( but_w == a_w ) { if ( but_w == a_w ) {
@ -38,12 +38,12 @@
{ {
u3_noun x, a, buf; u3_noun x, a, buf;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam, &a, u3_cv_con_sam, &x, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam, &a, u3v_con_sam, &x, 0)) ||
(c3n == u3du(x)) || (c3n == u3du(x)) ||
(c3n == u3ud(buf = u3h(x))) || (c3n == u3ud(buf = u3h(x))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return _po_find(buf, a); return _po_find(buf, a);
} }
@ -54,12 +54,12 @@
{ {
u3_noun x, a, buf; u3_noun x, a, buf;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam, &a, u3_cv_con_sam, &x, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam, &a, u3v_con_sam, &x, 0)) ||
(c3n == u3du(x)) || (c3n == u3du(x)) ||
(c3n == u3ud(buf = u3t(x))) || (c3n == u3ud(buf = u3t(x))) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return _po_find(buf, a); return _po_find(buf, a);
} }
@ -71,18 +71,18 @@
{ {
u3_noun x, a, buf; u3_noun x, a, buf;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam, &a, u3_cv_con_sam, &x, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam, &a, u3v_con_sam, &x, 0)) ||
(c3n == u3du(x)) || (c3n == u3du(x)) ||
(c3n == u3ud(buf = u3h(x))) || (c3n == u3ud(buf = u3h(x))) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(a >= 256) ) (a >= 256) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
c3_y byt_y[3]; c3_y byt_y[3];
u3_cr_bytes((a * 3), 3, byt_y, buf); u3r_bytes((a * 3), 3, byt_y, buf);
return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16));
} }
} }
@ -92,17 +92,17 @@
{ {
u3_noun x, a, buf; u3_noun x, a, buf;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam, &a, u3_cv_con_sam, &x, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam, &a, u3v_con_sam, &x, 0)) ||
(c3n == u3du(x)) || (c3n == u3du(x)) ||
(c3n == u3ud(buf = u3t(x))) || (c3n == u3ud(buf = u3t(x))) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(a >= 256) ) (a >= 256) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
c3_y byt_y[3]; c3_y byt_y[3];
u3_cr_bytes((a * 3), 3, byt_y, buf); u3r_bytes((a * 3), 3, byt_y, buf);
return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16)); return (byt_y[0] | (byt_y[1] << 8) | (byt_y[2] << 16));
} }
} }

View File

@ -11,8 +11,8 @@
u3_cqc_rap(u3_atom a, u3_cqc_rap(u3_atom a,
u3_noun b) u3_noun b)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
@ -32,13 +32,13 @@
break; break;
} }
else if ( c3n == u3du(cab) ) { else if ( c3n == u3du(cab) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3ud(h_cab = u3h(cab)) ) { else if ( c3n == u3ud(h_cab = u3h(cab)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (tot_w + (len_w = u3_cr_met(a_g, h_cab))) < tot_w ) { else if ( (tot_w + (len_w = u3r_met(a_g, h_cab))) < tot_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
tot_w += len_w; tot_w += len_w;
cab = u3t(cab); cab = u3t(cab);
@ -46,8 +46,8 @@
if ( 0 == tot_w ) { if ( 0 == tot_w ) {
return 0; return 0;
} }
if ( 0 == (sal_w = u3_ca_slaq(a_g, tot_w)) ) { if ( 0 == (sal_w = u3a_slaq(a_g, tot_w)) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
} }
@ -59,15 +59,15 @@
while ( 0 != cab ) { while ( 0 != cab ) {
u3_noun h_cab = u3h(cab); u3_noun h_cab = u3h(cab);
c3_w len_w = u3_cr_met(a_g, h_cab); c3_w len_w = u3r_met(a_g, h_cab);
u3_cr_chop(a_g, 0, len_w, pos_w, sal_w, h_cab); u3r_chop(a_g, 0, len_w, pos_w, sal_w, h_cab);
pos_w += len_w; pos_w += len_w;
cab = u3t(cab); cab = u3t(cab);
} }
} }
// return u3_ca_moot(sal_w); // return u3a_moot(sal_w);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
u3_noun u3_noun
@ -75,10 +75,10 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) ) (c3n == u3ud(a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun pro; u3_noun pro;

View File

@ -11,8 +11,8 @@
u3_cqc_rip(u3_atom a, u3_cqc_rip(u3_atom a,
u3_atom b) u3_atom b)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else { else {
u3_noun pir = u3_nul; u3_noun pir = u3_nul;
@ -20,7 +20,7 @@
c3_w i_w; c3_w i_w;
if ( a_g < 5 ) { if ( a_g < 5 ) {
c3_w met_w = u3_cr_met(a_g, b); c3_w met_w = u3r_met(a_g, b);
c3_w mek_w = ((1 << (1 << a_g)) - 1); c3_w mek_w = ((1 << (1 << a_g)) - 1);
for ( i_w = 0; i_w < met_w; i_w++ ) { for ( i_w = 0; i_w < met_w; i_w++ ) {
@ -28,7 +28,7 @@
c3_w bit_w = (pat_w << a_g); c3_w bit_w = (pat_w << a_g);
c3_w wor_w = (bit_w >> 5); c3_w wor_w = (bit_w >> 5);
c3_w sif_w = (bit_w & 31); c3_w sif_w = (bit_w & 31);
c3_w src_w = u3_cr_word(wor_w, b); c3_w src_w = u3r_word(wor_w, b);
c3_w rip_w = ((src_w >> sif_w) & mek_w); c3_w rip_w = ((src_w >> sif_w) & mek_w);
pir = u3nc(rip_w, pir); pir = u3nc(rip_w, pir);
@ -36,8 +36,8 @@
return pir; return pir;
} }
else { else {
c3_w met_w = u3_cr_met(a_g, b); c3_w met_w = u3r_met(a_g, b);
c3_w len_w = u3_cr_met(5, b); c3_w len_w = u3r_met(5, b);
c3_g san_g = (a_g - 5); c3_g san_g = (a_g - 5);
c3_w san_w = 1 << san_g; c3_w san_w = 1 << san_g;
c3_w dif_w = (met_w << san_g) - len_w; c3_w dif_w = (met_w << san_g) - len_w;
@ -47,19 +47,19 @@
c3_w pat_w = (met_w - (i_w + 1)); c3_w pat_w = (met_w - (i_w + 1));
c3_w wut_w = (pat_w << san_g); c3_w wut_w = (pat_w << san_g);
c3_w sap_w = ((0 == i_w) ? tub_w : san_w); c3_w sap_w = ((0 == i_w) ? tub_w : san_w);
c3_w* sal_w = u3_ca_slab(sap_w); c3_w* sal_w = u3a_slab(sap_w);
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
c3_w j_w; c3_w j_w;
u3_atom rip; u3_atom rip;
for ( j_w = 0; j_w < sap_w; j_w++ ) { for ( j_w = 0; j_w < sap_w; j_w++ ) {
sal_w[j_w] = u3_cr_word(wut_w + j_w, b); sal_w[j_w] = u3r_word(wut_w + j_w, b);
} }
rip = u3_ca_malt(sal_w); rip = u3a_malt(sal_w);
pir = u3nc(rip, pir); pir = u3nc(rip, pir);
} }
len_w -= san_w; len_w -= san_w;
@ -73,11 +73,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) || if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) ) (c3n == u3ud(b)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_rip(a, b); return u3_cqc_rip(a, b);
} }

View File

@ -13,30 +13,30 @@
u3_atom b, u3_atom b,
u3_atom c) u3_atom c)
{ {
if ( !_(u3_ca_is_cat(a)) || (a >= 32) ) { if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
else if ( !_(u3_ca_is_cat(b)) ) { else if ( !_(u3a_is_cat(b)) ) {
return 0; return 0;
} }
else { else {
c3_g a_g = a; c3_g a_g = a;
c3_w b_w = b; c3_w b_w = b;
c3_w len_w = u3_cr_met(a_g, c); c3_w len_w = u3r_met(a_g, c);
if ( b_w >= len_w ) { if ( b_w >= len_w ) {
return 0; return 0;
} }
else { else {
c3_w* sal_w = u3_ca_slaq(a_g, (len_w - b_w)); c3_w* sal_w = u3a_slaq(a_g, (len_w - b_w));
if ( 0 == sal_w ) { if ( 0 == sal_w ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} }
u3_cr_chop(a_g, b_w, (len_w - b_w), 0, sal_w, c); u3r_chop(a_g, b_w, (len_w - b_w), 0, sal_w, c);
// return u3_ca_moot(sal_w); // return u3a_moot(sal_w);
return u3_ca_malt(sal_w); return u3a_malt(sal_w);
} }
} }
} }
@ -46,14 +46,14 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, if ( (c3n == u3r_mean(cor, u3v_sam_2, &a,
u3_cv_sam_6, &b, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0)) || u3v_sam_7, &c, 0)) ||
(c3n == u3ud(a)) || (c3n == u3ud(a)) ||
(c3n == u3ud(b)) || (c3n == u3ud(b)) ||
(c3n == u3ud(c)) ) (c3n == u3ud(c)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_rsh(a, b, c); return u3_cqc_rsh(a, b, c);
} }

View File

@ -11,8 +11,8 @@
u3_cqc_vor(u3_atom a, u3_cqc_vor(u3_atom a,
u3_atom b) u3_atom b)
{ {
c3_w c_w = u3_cr_mug(u3_cr_mug(a)); c3_w c_w = u3r_mug(u3r_mug(a));
c3_w d_w = u3_cr_mug(u3_cr_mug(b)); c3_w d_w = u3r_mug(u3r_mug(b));
if ( c_w == d_w ) { if ( c_w == d_w ) {
return u3_cqc_dor(a, b); return u3_cqc_dor(a, b);
@ -24,8 +24,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( (c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0)) ) { if ( (c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqc_vor(a, b); return u3_cqc_vor(a, b);
} }

View File

@ -17,20 +17,20 @@
} }
else { else {
if ( c3n == u3du(b) ) { if ( c3n == u3du(b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun i_b = u3h(b); u3_noun i_b = u3h(b);
u3_noun t_b = u3t(b); u3_noun t_b = u3t(b);
if ( c3n == u3du(i_b) ) { if ( c3n == u3du(i_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun pi_b = u3h(i_b); u3_noun pi_b = u3h(i_b);
u3_noun qi_b = u3t(i_b); u3_noun qi_b = u3t(i_b);
u3_noun c; u3_noun c;
if ( u3_none == (c = u3_cqdb_put(a, pi_b, qi_b)) ) { if ( u3_none == (c = u3_cqdb_put(a, pi_b, qi_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun d = u3_cqdb_gas(c, t_b); u3_noun d = u3_cqdb_gas(c, t_b);
@ -47,8 +47,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_gas(a, b); return u3_cqdb_gas(a, b);
} }
@ -60,7 +60,7 @@
u3z(a); u3z(b); u3z(a); u3z(b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -17,13 +17,13 @@
u3_noun l_a, n_a, r_a; u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a; u3_noun pn_a, qn_a;
if ( (c3n == u3_cr_trel(a, &n_a, &l_a, &r_a)) || if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3_cr_cell(n_a, &pn_a, &qn_a) ) ) (c3n == u3r_cell(n_a, &pn_a, &qn_a) ) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( (c3y == u3_cr_sing(b, pn_a)) ) { if ( (c3y == u3r_sing(b, pn_a)) ) {
return u3nc(u3_nul, u3k(qn_a)); return u3nc(u3_nul, u3k(qn_a));
} }
else { else {
@ -41,8 +41,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_get(a, b); return u3_cqdb_get(a, b);
} }
@ -53,7 +53,7 @@
u3_noun c = u3_cqdb_get(a, b); u3_noun c = u3_cqdb_get(a, b);
u3z(a); u3z(b); u3z(a); u3z(b);
if ( c3n == u3_cr_du(c) ) { if ( c3n == u3r_du(c) ) {
u3z(c); u3z(c);
return u3_none; return u3_none;
} else { } else {
@ -69,7 +69,7 @@
u3_weak c = u3_ckdb_get(a, b); u3_weak c = u3_ckdb_get(a, b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -19,13 +19,13 @@
u3_noun l_a, n_a, r_a; u3_noun l_a, n_a, r_a;
u3_noun pn_a, qn_a; u3_noun pn_a, qn_a;
if ( (c3n == u3_cr_trel(a, &n_a, &l_a, &r_a)) || if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3_cr_cell(n_a, &pn_a, &qn_a)) ) (c3n == u3r_cell(n_a, &pn_a, &qn_a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( (c3y == u3_cr_sing(b, pn_a)) ) { if ( (c3y == u3r_sing(b, pn_a)) ) {
return c3y; return c3y;
} }
else { else {
@ -43,8 +43,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_has(a, b); return u3_cqdb_has(a, b);
} }
@ -56,7 +56,7 @@
u3z(a); u3z(b); u3z(a); u3z(b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -22,26 +22,26 @@
u3_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a; 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; u3_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) { else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(n_a, &p_n_a, &q_n_a) ) { else if ( c3n == u3r_cell(n_a, &p_n_a, &q_n_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(n_b, &p_n_b, &q_n_b) ) { else if ( c3n == u3r_cell(n_b, &p_n_b, &q_n_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cqc_vor(p_n_a, p_n_b) ) { else if ( c3y == u3_cqc_vor(p_n_a, p_n_b) ) {
if ( c3y == u3_cr_sing(p_n_a, p_n_b) ) { if ( c3y == u3r_sing(p_n_a, p_n_b) ) {
return u3nt( return u3nt(
u3k(n_b), u3k(n_b),
@ -75,7 +75,7 @@
u3k(l_b))); u3k(l_b)));
} }
} }
else if ( c3y == u3_cr_sing(p_n_b, p_n_a) ) { else if ( c3y == u3r_sing(p_n_b, p_n_a) ) {
return u3nt( return u3nt(
u3k(n_b), u3k(n_b),
@ -116,8 +116,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_int(a, b); return u3_cqdb_int(a, b);
} }

View File

@ -24,13 +24,13 @@
u3_noun l_a, n_a, r_a, pn_a, qn_a; u3_noun l_a, n_a, r_a, pn_a, qn_a;
u3_noun d, l_d, n_d, r_d; u3_noun d, l_d, n_d, r_d;
if ( (c3n == u3_cr_trel(a, &n_a, &l_a, &r_a)) || if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ||
(c3n == u3_cr_cell(n_a, &pn_a, &qn_a)) ) (c3n == u3r_cell(n_a, &pn_a, &qn_a)) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(pn_a, b) ) { else if ( c3y == u3r_sing(pn_a, b) ) {
if ( c3y == u3_cr_sing(qn_a, c) ) { if ( c3y == u3r_sing(qn_a, c) ) {
return u3k(a); return u3k(a);
} else { } else {
return u3nt return u3nt
@ -49,7 +49,7 @@
u3k(r_a)); u3k(r_a));
} }
else { else {
u3_cr_trel(d, &n_d, &l_d, &r_d); u3r_trel(d, &n_d, &l_d, &r_d);
{ {
u3_noun e = u3nt u3_noun e = u3nt
(u3k(n_d), (u3k(n_d),
@ -73,7 +73,7 @@
d); d);
} }
else { else {
u3_cr_trel(d, &n_d, &l_d, &r_d); u3r_trel(d, &n_d, &l_d, &r_d);
{ {
u3_noun e = u3nt u3_noun e = u3nt
(u3k(n_d), (u3k(n_d),
@ -97,10 +97,10 @@
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &b, if ( c3n == u3r_mean(cor, u3v_sam_2, &b,
u3_cv_sam_3, &c, u3v_sam_3, &c,
u3_cv_con_sam, &a, 0) ) { u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_put(a, b, c); return u3_cqdb_put(a, b, c);
} }

View File

@ -22,26 +22,26 @@
u3_noun l_a, n_a, r_a, lr_a, p_n_a, q_n_a; 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; u3_noun l_b, n_b, r_b, lr_b, p_n_b, q_n_b;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) { else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(n_a, &p_n_a, &q_n_a)) ) { else if ( (c3n == u3r_cell(n_a, &p_n_a, &q_n_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(n_b, &p_n_b, &q_n_b)) ) { else if ( (c3n == u3r_cell(n_b, &p_n_b, &q_n_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cqc_vor(p_n_a, p_n_b) ) { else if ( c3y == u3_cqc_vor(p_n_a, p_n_b) ) {
if ( c3y == u3_cr_sing(p_n_a, p_n_b) ) { if ( c3y == u3r_sing(p_n_a, p_n_b) ) {
return u3nt(u3k(n_b), return u3nt(u3k(n_b),
u3_cqdb_uni( u3_cqdb_uni(
u3k(l_a), u3k(l_b)), u3k(l_a), u3k(l_b)),
@ -77,7 +77,7 @@
u3k(l_b)); u3k(l_b));
} }
} }
else if ( c3y == u3_cr_sing(p_n_b, p_n_a) ) { else if ( c3y == u3r_sing(p_n_b, p_n_a) ) {
return u3nt( return u3nt(
u3k(n_b), u3k(n_b),
@ -120,8 +120,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdb_uni(a, b); return u3_cqdb_uni(a, b);
} }

View File

@ -17,14 +17,14 @@
} }
else { else {
if ( c3n == u3du(b) ) { if ( c3n == u3du(b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun i_b = u3h(b); u3_noun i_b = u3h(b);
u3_noun t_b = u3t(b); u3_noun t_b = u3t(b);
u3_noun c; u3_noun c;
if ( u3_none == (c = u3_cqdi_put(a, i_b)) ) { if ( u3_none == (c = u3_cqdi_put(a, i_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
u3_noun d = u3_cqdi_gas(c, t_b); u3_noun d = u3_cqdi_gas(c, t_b);
@ -40,8 +40,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_gas(a, b); return u3_cqdi_gas(a, b);
} }
@ -53,7 +53,7 @@
u3z(a); u3z(b); u3z(a); u3z(b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -16,11 +16,11 @@
else { else {
u3_noun l_a, n_a, r_a; u3_noun l_a, n_a, r_a;
if ( (c3n == u3_cr_mean(a, 2, &n_a, 6, &l_a, 7, &r_a, 0)) ) { if ( (c3n == u3r_mean(a, 2, &n_a, 6, &l_a, 7, &r_a, 0)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( (c3y == u3_cr_sing(b, n_a)) ) { if ( (c3y == u3r_sing(b, n_a)) ) {
return c3y; return c3y;
} }
else { else {
@ -37,8 +37,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_has(a, b); return u3_cqdi_has(a, b);
} }
@ -50,7 +50,7 @@
u3z(a); u3z(b); u3z(a); u3z(b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -23,11 +23,11 @@
u3_noun l_b, n_b, r_b, lr_b; u3_noun l_b, n_b, r_b, lr_b;
u3_noun c; u3_noun c;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) { else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( c3y == u3_cqc_vor(n_b, n_a) ) { if ( c3y == u3_cqc_vor(n_b, n_a) ) {
@ -35,13 +35,13 @@
c = n_a; n_a = n_b; n_b = c; c = n_a; n_a = n_b; n_b = c;
c = lr_a; lr_a = lr_b; lr_b = c; c = lr_a; lr_a = lr_b; lr_b = c;
} }
if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(n_a, n_b) ) { else if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_a), return u3nt(u3k(n_a),
u3_cqdi_int(l_a, l_b), u3_cqdi_int(l_a, l_b),
u3_cqdi_int(r_a, r_b)); u3_cqdi_int(r_a, r_b));
@ -79,8 +79,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_int(a, b); return u3_cqdi_int(a, b);
} }

View File

@ -21,11 +21,11 @@
u3_noun l_b, n_b, r_b, lr_b; u3_noun l_b, n_b, r_b, lr_b;
u3_noun c; u3_noun c;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) { else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( c3y == u3_cqc_vor(n_b, n_a) ) { if ( c3y == u3_cqc_vor(n_b, n_a) ) {
@ -33,13 +33,13 @@
c = n_a; n_a = n_b; n_b = c; c = n_a; n_a = n_b; n_b = c;
c = lr_a; lr_a = lr_b; lr_b = c; c = lr_a; lr_a = lr_b; lr_b = c;
} }
if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(n_a, n_b) ) { else if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_a), return u3nt(u3k(n_a),
u3_cqdi_mer(l_a, l_b), u3_cqdi_mer(l_a, l_b),
u3_cqdi_mer(r_a, r_b)); u3_cqdi_mer(r_a, r_b));
@ -79,8 +79,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3_cqdi_mer(a, b); return u3_cqdi_mer(a, b);

View File

@ -19,14 +19,14 @@
u3_noun l_a, n_a, r_a, lr_a; // XX copy tree boilerplate to other pt4 u3_noun l_a, n_a, r_a, lr_a; // XX copy tree boilerplate to other pt4
u3_noun c, l_c, n_c, r_c; u3_noun c, l_c, n_c, r_c;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(n_a, b) ) { else if ( c3y == u3r_sing(n_a, b) ) {
return u3k(a); return u3k(a);
} }
else if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( c3y == u3_cqc_hor(b, n_a) ) { if ( c3y == u3_cqc_hor(b, n_a) ) {
@ -38,7 +38,7 @@
u3k(r_a)); u3k(r_a));
} }
else { else {
u3_cr_trel(c, &n_c, &l_c, &r_c); u3r_trel(c, &n_c, &l_c, &r_c);
{ {
u3_noun d = u3nt u3_noun d = u3nt
(u3k(n_c), (u3k(n_c),
@ -62,7 +62,7 @@
c); c);
} }
else { else {
u3_cr_trel(c, &n_c, &l_c, &r_c); u3r_trel(c, &n_c, &l_c, &r_c);
{ {
u3_noun d = u3nt u3_noun d = u3nt
(u3k(n_c), (u3k(n_c),
@ -86,8 +86,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_put(a, b); return u3_cqdi_put(a, b);
} }

View File

@ -17,9 +17,9 @@
} else { } else {
u3_noun l_a, n_a, r_a; u3_noun l_a, n_a, r_a;
if ( (c3n == u3_cr_trel(a, &n_a, &l_a, &r_a)) ) { if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a)) ) {
u3z(b); u3z(b);
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return _tap_in return _tap_in
(r_a, (r_a,
@ -42,8 +42,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_tap(a, b); return u3_cqdi_tap(a, b);
} }
@ -55,7 +55,7 @@
u3z(a); u3z(b); u3z(a); u3z(b);
if ( u3_none == c ) { if ( u3_none == c ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else return c; else return c;
} }

View File

@ -22,21 +22,21 @@
u3_noun l_a, n_a, r_a, lr_a; u3_noun l_a, n_a, r_a, lr_a;
u3_noun l_b, n_b, r_b, lr_b; u3_noun l_b, n_b, r_b, lr_b;
if ( (c3n == u3_cr_cell(a, &n_a, &lr_a)) ) { if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( (c3n == u3_cr_cell(b, &n_b, &lr_b)) ) { else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
if ( c3y == u3_cqc_vor(n_a, n_b) ) { if ( c3y == u3_cqc_vor(n_a, n_b) ) {
if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(n_a, n_b) ) { else if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt( return u3nt(
u3k(n_b), u3k(n_b),
@ -72,13 +72,13 @@
u3k(l_b)); u3k(l_b));
} }
} }
else if ( c3n == u3_cr_cell(lr_b, &l_b, &r_b) ) { else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3n == u3_cr_cell(lr_a, &l_a, &r_a) ) { else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else if ( c3y == u3_cr_sing(n_b, n_a) ) { else if ( c3y == u3r_sing(n_b, n_a) ) {
return u3nt( return u3nt(
u3k(n_b), u3k(n_b),
@ -122,8 +122,8 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &b, u3_cv_con_sam, &a, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &b, u3v_con_sam, &a, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} else { } else {
return u3_cqdi_uni(a, b); return u3_cqdi_uni(a, b);
} }

View File

@ -24,30 +24,30 @@
AES_KEY key_u; AES_KEY key_u;
#endif #endif
c3_assert(u3_cr_met(3, a) <= 32); c3_assert(u3r_met(3, a) <= 32);
c3_assert(u3_cr_met(3, b) <= 16); c3_assert(u3r_met(3, b) <= 16);
u3_cr_bytes(0, 32, a_y, a); u3r_bytes(0, 32, a_y, a);
u3_cr_bytes(0, 16, b_y, b); u3r_bytes(0, 16, b_y, b);
#if defined(U3_OS_osx) #if defined(U3_OS_osx)
if ( kCCSuccess != CCCrypt(kCCEncrypt, kCCAlgorithmAES128, if ( kCCSuccess != CCCrypt(kCCEncrypt, kCCAlgorithmAES128,
kCCOptionECBMode, a_y, kCCKeySizeAES256, 0, b_y, kCCOptionECBMode, a_y, kCCKeySizeAES256, 0, b_y,
16, b_y, 16, &siz_i) ) 16, b_y, 16, &siz_i) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else c3_assert(16 == siz_i); else c3_assert(16 == siz_i);
#else #else
if ( 0 != AES_set_encrypt_key(a_y, 256, &key_u) ) { if ( 0 != AES_set_encrypt_key(a_y, 256, &key_u) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
AES_encrypt(b_y, b_y, &key_u); AES_encrypt(b_y, b_y, &key_u);
} }
#endif #endif
return u3_ci_bytes(16, b_y); return u3i_bytes(16, b_y);
} }
u3_noun u3_noun
@ -55,11 +55,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) || if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ||
c3n == u3ud(a) || c3n == u3ud(a) ||
c3n == u3ud(b) ) c3n == u3ud(b) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3_cqea_en(a, b); return u3_cqea_en(a, b);
@ -77,30 +77,30 @@
AES_KEY key_u; AES_KEY key_u;
#endif #endif
c3_assert(u3_cr_met(3, a) <= 32); c3_assert(u3r_met(3, a) <= 32);
c3_assert(u3_cr_met(3, b) <= 16); c3_assert(u3r_met(3, b) <= 16);
u3_cr_bytes(0, 32, a_y, a); u3r_bytes(0, 32, a_y, a);
u3_cr_bytes(0, 16, b_y, b); u3r_bytes(0, 16, b_y, b);
#if defined(U3_OS_osx) #if defined(U3_OS_osx)
if ( kCCSuccess != CCCrypt(kCCDecrypt, kCCAlgorithmAES128, if ( kCCSuccess != CCCrypt(kCCDecrypt, kCCAlgorithmAES128,
kCCOptionECBMode, a_y, kCCKeySizeAES256, 0, b_y, kCCOptionECBMode, a_y, kCCKeySizeAES256, 0, b_y,
16, b_y, 16, &siz_i) ) 16, b_y, 16, &siz_i) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else c3_assert(16 == siz_i); else c3_assert(16 == siz_i);
#else #else
if ( 0 != AES_set_decrypt_key(a_y, 256, &key_u) ) { if ( 0 != AES_set_decrypt_key(a_y, 256, &key_u) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
AES_decrypt(b_y, b_y, &key_u); AES_decrypt(b_y, b_y, &key_u);
} }
#endif #endif
return u3_ci_bytes(16, b_y); return u3i_bytes(16, b_y);
} }
u3_noun u3_noun
@ -108,11 +108,11 @@
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) || if ( c3n == u3r_mean(cor, u3v_sam_2, &a, u3v_sam_3, &b, 0) ||
c3n == u3ud(a) || c3n == u3ud(a) ||
c3n == u3ud(b) ) c3n == u3ud(b) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3_cqea_de(a, b); return u3_cqea_de(a, b);

View File

@ -6,7 +6,7 @@
static u3_noun static u3_noun
_cue_in(u3p(u3_ch_root) har_p, _cue_in(u3p(u3h_root) har_p,
u3_atom a, u3_atom a,
u3_atom b) u3_atom b)
{ {
@ -19,7 +19,7 @@
p = u3_cqa_inc(u3k(u3h(c))); p = u3_cqa_inc(u3k(u3h(c)));
q = u3k(u3t(c)); q = u3k(u3t(c));
u3_ch_put(har_p, u3k(b), u3k(q)); u3h_put(har_p, u3k(b), u3k(q));
u3z(c); u3z(c);
u3z(x); u3z(x);
@ -41,17 +41,17 @@
p = u3_cqa_add(2, y); p = u3_cqa_add(2, y);
q = w; q = w;
u3_ch_put(har_p, u3k(b), u3k(q)); u3h_put(har_p, u3k(b), u3k(q));
u3z(u); u3z(v); u3z(x); u3z(y); u3z(u); u3z(v); u3z(x); u3z(y);
} }
else { else {
u3_noun d = u3_cqe_rub(c, a); u3_noun d = u3_cqe_rub(c, a);
u3_noun x = u3_ch_get(har_p, u3k(u3t(d))); u3_noun x = u3h_get(har_p, u3k(u3t(d)));
p = u3_cqa_add(2, u3h(d)); p = u3_cqa_add(2, u3h(d));
if ( u3_none == x ) { if ( u3_none == x ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
q = x; q = x;
u3z(d); u3z(d);
@ -65,12 +65,12 @@
u3_noun u3_noun
u3_cqe_cue(u3_atom a) u3_cqe_cue(u3_atom a)
{ {
u3p(u3_ch_root) har_p = u3_ch_new(); u3p(u3h_root) har_p = u3h_new();
u3_noun x = _cue_in(har_p, a, 0); u3_noun x = _cue_in(har_p, a, 0);
u3_noun y = u3k(u3h(u3t(x))); u3_noun y = u3k(u3h(u3t(x)));
u3_ch_free(har_p); u3h_free(har_p);
u3z(x); u3z(x);
return y; return y;
@ -80,8 +80,8 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) ) { if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqe_cue(a); return u3_cqe_cue(a);
} }

View File

@ -16,19 +16,19 @@
c3_y sec_y[64]; c3_y sec_y[64];
c3_y sed_y[32]; c3_y sed_y[32];
c3_w met_w; c3_w met_w;
u3_noun a = u3_cr_at(u3_cv_sam, cor); u3_noun a = u3r_at(u3v_sam, cor);
if ( (u3_none == a) || (c3n == u3ud(a)) ) { if ( (u3_none == a) || (c3n == u3ud(a)) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
met_w = u3_cr_met(3, a); met_w = u3r_met(3, a);
if ( met_w > 32 ) { if ( met_w > 32 ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
memset(sed_y, 0, 32); memset(sed_y, 0, 32);
u3_cr_bytes(0, met_w, sed_y, a); u3r_bytes(0, met_w, sed_y, a);
ed25519_create_keypair(pub_y, sec_y, sed_y); ed25519_create_keypair(pub_y, sec_y, sed_y);
return u3_ci_bytes(32, pub_y); return u3i_bytes(32, pub_y);
} }

View File

@ -17,8 +17,8 @@
c3_y pub_y[64]; c3_y pub_y[64];
c3_y sec_y[64]; c3_y sec_y[64];
c3_w mesm_w = u3_cr_met(3, a); c3_w mesm_w = u3r_met(3, a);
c3_w mess_w = u3_cr_met(3, b); c3_w mess_w = u3r_met(3, b);
c3_y* mes_y = 0; c3_y* mes_y = 0;
@ -29,22 +29,22 @@
mes_y = malloc(mesm_w); mes_y = malloc(mesm_w);
u3_cr_bytes(0, mesm_w, mes_y, a); u3r_bytes(0, mesm_w, mes_y, a);
u3_cr_bytes(0, mess_w, sed_y, b); u3r_bytes(0, mess_w, sed_y, b);
ed25519_create_keypair(pub_y, sec_y, sed_y); ed25519_create_keypair(pub_y, sec_y, sed_y);
ed25519_sign(sig_y, mes_y, mesm_w, pub_y, sec_y); ed25519_sign(sig_y, mes_y, mesm_w, pub_y, sec_y);
free(mes_y); free(mes_y);
return u3_ci_bytes(64, sig_y); return u3i_bytes(64, sig_y);
} }
u3_noun u3_noun
u3_cwee_sign(u3_noun cor) u3_cwee_sign(u3_noun cor)
{ {
u3_noun a, b; u3_noun a, b;
if ( c3n == u3_cr_mean(cor, if ( c3n == u3r_mean(cor,
u3_cv_sam_2, &a, u3_cv_sam_3, &b, 0) ) { u3v_sam_2, &a, u3v_sam_3, &b, 0) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return _cqee_sign(a, b); return _cqee_sign(a, b);
} }

View File

@ -17,16 +17,16 @@
c3_w ret; c3_w ret;
c3_y* mes_y; c3_y* mes_y;
c3_w mesm_w = u3_cr_met(3, m); c3_w mesm_w = u3r_met(3, m);
memset(sig_y, 0, 64); memset(sig_y, 0, 64);
memset(pub_y, 0, 32); memset(pub_y, 0, 32);
mes_y = c3_malloc(mesm_w); mes_y = c3_malloc(mesm_w);
u3_cr_bytes(0, 64, sig_y, s); u3r_bytes(0, 64, sig_y, s);
u3_cr_bytes(0, 32, pub_y, pk); u3r_bytes(0, 32, pub_y, pk);
u3_cr_bytes(0, mesm_w, mes_y, m); u3r_bytes(0, mesm_w, mes_y, m);
ret = ed25519_verify(sig_y, mes_y, mesm_w, pub_y) == 1 ? c3y : c3n; ret = ed25519_verify(sig_y, mes_y, mesm_w, pub_y) == 1 ? c3y : c3n;
free(mes_y); free(mes_y);
@ -37,10 +37,10 @@
u3_cwee_veri(u3_noun cor) u3_cwee_veri(u3_noun cor)
{ {
u3_noun a, b, c; u3_noun a, b, c;
if ( c3n == u3_cr_mean(cor, if ( c3n == u3r_mean(cor,
u3_cv_sam_2, &a, u3_cv_sam_6, &b, u3v_sam_2, &a, u3v_sam_6, &b,
u3_cv_sam_7, &c, 0) ) { u3v_sam_7, &c, 0) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return _cqee_veri(a, b, c); return _cqee_veri(a, b, c);
} }

View File

@ -8,10 +8,10 @@
/* functions /* functions
*/ */
static u3_noun static u3_noun
_jam_in(u3p(u3_ch_root) har_p, u3_atom, u3_atom, u3_noun); _jam_in(u3p(u3h_root) har_p, u3_atom, u3_atom, u3_noun);
static u3_noun static u3_noun
_jam_in_pair(u3p(u3_ch_root) har_p, _jam_in_pair(u3p(u3h_root) har_p,
u3_atom h_a, u3_atom h_a,
u3_atom t_a, u3_atom t_a,
u3_atom b, u3_atom b,
@ -23,13 +23,13 @@
u3_noun p_d, q_d, r_d; u3_noun p_d, q_d, r_d;
u3_noun r; u3_noun r;
u3_cr_trel(d, &p_d, &q_d, &r_d); u3r_trel(d, &p_d, &q_d, &r_d);
{ {
u3_noun y = u3_cqa_add(x, p_d); u3_noun y = u3_cqa_add(x, p_d);
u3_noun e = _jam_in(har_p, t_a, y, q_d); u3_noun e = _jam_in(har_p, t_a, y, q_d);
u3_noun p_e, q_e, r_e; u3_noun p_e, q_e, r_e;
u3_cr_trel(e, &p_e, &q_e, &r_e); u3r_trel(e, &p_e, &q_e, &r_e);
{ {
u3_noun z = u3_cqa_add(p_d, p_e); u3_noun z = u3_cqa_add(p_d, p_e);
@ -48,7 +48,7 @@
} }
static u3_noun static u3_noun
_jam_in_flat(u3p(u3_ch_root) har_p, _jam_in_flat(u3p(u3h_root) har_p,
u3_atom a, u3_atom a,
u3_noun l) u3_noun l)
{ {
@ -63,7 +63,7 @@
} }
static u3_noun static u3_noun
_jam_in_ptr(u3p(u3_ch_root) har_p, _jam_in_ptr(u3p(u3h_root) har_p,
u3_atom u_c, u3_atom u_c,
u3_noun l) u3_noun l)
{ {
@ -80,16 +80,16 @@
} }
static u3_noun static u3_noun
_jam_in(u3p(u3_ch_root) har_p, _jam_in(u3p(u3h_root) har_p,
u3_noun a, u3_noun a,
u3_atom b, u3_atom b,
u3_noun l) u3_noun l)
{ {
u3_noun c = u3_ch_get(har_p, a); u3_noun c = u3h_get(har_p, a);
u3_noun x; u3_noun x;
if ( u3_none == c ) { if ( u3_none == c ) {
u3_ch_put(har_p, a, u3k(b)); u3h_put(har_p, a, u3k(b));
if ( c3y == u3ud(a) ) { if ( c3y == u3ud(a) ) {
x = _jam_in_flat(har_p, a, l); x = _jam_in_flat(har_p, a, l);
@ -98,7 +98,7 @@
} }
} }
else { else {
if ( c3y == u3ud(a) && u3_cr_met(0, a) <= u3_cr_met(0, c) ) { if ( c3y == u3ud(a) && u3r_met(0, a) <= u3r_met(0, c) ) {
x = _jam_in_flat(har_p, a, l); x = _jam_in_flat(har_p, a, l);
} }
else { else {
@ -111,7 +111,7 @@
u3_noun u3_noun
u3_cqe_jam(u3_atom a) u3_cqe_jam(u3_atom a)
{ {
u3p(u3_ch_root) har_p = u3_ch_new(); u3p(u3h_root) har_p = u3h_new();
u3_noun x = _jam_in(har_p, a, 0, u3_nul); u3_noun x = _jam_in(har_p, a, 0, u3_nul);
u3_noun q = u3_cqb_flop(u3h(u3t(x))); u3_noun q = u3_cqb_flop(u3h(u3t(x)));
@ -119,7 +119,7 @@
u3z(x); u3z(x);
u3z(q); u3z(q);
u3_ch_free(har_p); u3h_free(har_p);
return r; return r;
} }
u3_noun u3_noun
@ -127,8 +127,8 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) ) { if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqe_jam(a); return u3_cqe_jam(a);
} }

View File

@ -8,7 +8,7 @@
u3_noun u3_noun
u3_cqe_lore(u3_atom lub) u3_cqe_lore(u3_atom lub)
{ {
c3_w len_w = u3_cr_met(3, lub); c3_w len_w = u3r_met(3, lub);
c3_w pos_w = 0; c3_w pos_w = 0;
u3_noun tez = u3_nul; u3_noun tez = u3_nul;
@ -22,7 +22,7 @@
c3_y byt_y; c3_y byt_y;
while ( 1 ) { while ( 1 ) {
byt_y = u3_cr_byte(pos_w + meg_w, lub); byt_y = u3r_byte(pos_w + meg_w, lub);
if ( (10 == byt_y) || (0 == byt_y) ) { if ( (10 == byt_y) || (0 == byt_y) ) {
break; break;
@ -30,14 +30,14 @@
} }
if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) { if ((byt_y == 0) && ((pos_w + meg_w + 1) < len_w)) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
{ {
c3_y* byts_y = alloca(meg_w); c3_y* byts_y = alloca(meg_w);
u3_cr_bytes(pos_w, meg_w, byts_y, lub); u3r_bytes(pos_w, meg_w, byts_y, lub);
tez = u3nc(u3_ci_bytes(meg_w, byts_y), tez); tez = u3nc(u3i_bytes(meg_w, byts_y), tez);
pos_w += (meg_w + 1); pos_w += (meg_w + 1);
} }
} }
@ -49,10 +49,10 @@
{ {
u3_noun lub; u3_noun lub;
if ( (u3_none == (lub = u3_cr_at(u3_cv_sam, cor))) || if ( (u3_none == (lub = u3r_at(u3v_sam, cor))) ||
(c3n == u3ud(lub)) ) (c3n == u3ud(lub)) )
{ {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqe_lore(lub); return u3_cqe_lore(lub);
} }

View File

@ -42,7 +42,7 @@
if ( u3_nul == kad ) { if ( u3_nul == kad ) {
return u3_nul; return u3_nul;
} else { } else {
return u3nc(u3k(loc_u->hev[u3_cr_word(0, u3h(kad))]), return u3nc(u3k(loc_u->hev[u3r_word(0, u3h(kad))]),
_lext(loc_u, u3t(kad))); _lext(loc_u, u3t(kad)));
} }
} }
@ -96,7 +96,7 @@
u3_noun teg; u3_noun teg;
hav = u3_ckdb_get(u3k(loc_u->sev), u3k(how)); hav = u3_ckdb_get(u3k(loc_u->sev), u3k(how));
teg = u3nc(u3_ci_words(1, &i_w), teg = u3nc(u3i_words(1, &i_w),
(hav == u3_none) ? u3_nul : hav); (hav == u3_none) ? u3_nul : hav);
loc_u->sev = u3_ckdb_put(loc_u->sev, u3k(how), teg); loc_u->sev = u3_ckdb_put(loc_u->sev, u3k(how), teg);
} }
@ -112,7 +112,7 @@
{ {
u3_noun kad; u3_noun kad;
kad = u3nc(u3_ci_words(1, &goy_w), kad = u3nc(u3i_words(1, &goy_w),
(inx_w == 0) ? u3_nul (inx_w == 0) ? u3_nul
: u3k(loc_u->kad[inx_w - 1])); : u3k(loc_u->kad[inx_w - 1]));
if ( loc_u->kct_w == inx_w ) { if ( loc_u->kct_w == inx_w ) {
@ -133,7 +133,7 @@
{ {
return __ return __
( (loc_u->kct_w == inx_w) || ( (loc_u->kct_w == inx_w) ||
(u3_cr_word(0, u3h(loc_u->kad[inx_w])) > goy_w) ); (u3r_word(0, u3h(loc_u->kad[inx_w])) > goy_w) );
} }
// extend fits bottom // extend fits bottom
@ -145,7 +145,7 @@
{ {
return __ return __
( (0 == inx_w) || ( (0 == inx_w) ||
(u3_cr_word(0, u3h(loc_u->kad[inx_w - 1])) < goy_w) ); (u3r_word(0, u3h(loc_u->kad[inx_w - 1])) < goy_w) );
} }
#if 0 #if 0
@ -220,7 +220,7 @@
} }
else { else {
u3_noun i_gay = u3h(gay); u3_noun i_gay = u3h(gay);
c3_w goy_w = u3_cr_word(0, i_gay); c3_w goy_w = u3r_word(0, i_gay);
u3_noun bik; u3_noun bik;
bik = _bink(loc_u, &inx_w, loc_u->kct_w, goy_w); bik = _bink(loc_u, &inx_w, loc_u->kct_w, goy_w);
@ -286,12 +286,12 @@
{ {
u3_noun hel, hev; u3_noun hel, hev;
if ( (u3_none == (hel = u3_cr_at(u3_cv_sam_2, cor))) || if ( (u3_none == (hel = u3r_at(u3v_sam_2, cor))) ||
(u3_none == (hev = u3_cr_at(u3_cv_sam_3, cor))) || (u3_none == (hev = u3r_at(u3v_sam_3, cor))) ||
(c3n == _listp(hel)) || (c3n == _listp(hel)) ||
(c3n == _listp(hev)) ) (c3n == _listp(hev)) )
{ {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqe_loss(hel, hev); return u3_cqe_loss(hel, hev);
} }

View File

@ -45,8 +45,8 @@
{ {
u3_noun a; u3_noun a;
if ( (u3_none == (a = u3_cr_at(u3_cv_sam, cor))) ) { if ( (u3_none == (a = u3r_at(u3v_sam, cor))) ) {
return u3_cm_bail(c3__fail); return u3m_bail(c3__fail);
} else { } else {
return u3_cqe_mat(a); return u3_cqe_mat(a);
} }

View File

@ -10,14 +10,14 @@
{ {
u3_noun bus, fol, fly; u3_noun bus, fol, fly;
if ( c3n == u3_cr_mean(cor, u3_cv_sam_4, &bus, if ( c3n == u3r_mean(cor, u3v_sam_4, &bus,
u3_cv_sam_5, &fol, u3v_sam_5, &fol,
u3_cv_sam_3, &fly, u3v_sam_3, &fly,
0) ) 0) )
{ {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
return u3_cn_nock_in(u3k(fly), u3k(bus), u3k(fol)); return u3n_nock_in(u3k(fly), u3k(bus), u3k(fol));
} }
} }

View File

@ -9,16 +9,16 @@
{ {
u3_noun tap; u3_noun tap;
if ( c3n == u3_cr_mean(cor, u3_cv_sam, &tap, 0) ) { if ( c3n == u3r_mean(cor, u3v_sam, &tap, 0) ) {
return u3_cm_bail(c3__exit); return u3m_bail(c3__exit);
} }
else { else {
u3_noun hok = u3_cj_hook(u3k(cor), "mute"); u3_noun hok = u3j_hook(u3k(cor), "mute");
/* this takes advantage of the fact that mute's result, at the typeless /* this takes advantage of the fact that mute's result, at the typeless
* C/Nock level, is identical to what a typed mule would produce, * C/Nock level, is identical to what a typed mule would produce,
* without running the formula twice. * without running the formula twice.
*/ */
return u3_cn_slam_on(hok, u3k(tap)); return u3n_slam_on(hok, u3k(tap));
} }
} }

Some files were not shown because too many files have changed in this diff Show More