mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 18:01:32 +03:00
jets: (scow %ud ...) is jetted, along with its +scot equivalent.
This commit is contained in:
parent
799c7e2ba3
commit
8e975917e8
@ -125,6 +125,8 @@
|
||||
u3_noun u3we_rexp(u3_noun);
|
||||
u3_noun u3we_trip(u3_noun);
|
||||
|
||||
u3_noun u3we_scow(u3_noun);
|
||||
u3_noun u3we_scot(u3_noun);
|
||||
u3_noun u3we_slaw(u3_noun);
|
||||
|
||||
u3_noun u3we_pfix(u3_noun);
|
||||
|
80
pkg/urbit/jets/e/scow.c
Normal file
80
pkg/urbit/jets/e/scow.c
Normal file
@ -0,0 +1,80 @@
|
||||
/* j/3/scow.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
u3_noun
|
||||
_print_ud(u3_atom ud)
|
||||
{
|
||||
// number of characters printed "between" periods.
|
||||
int between = 0;
|
||||
u3_atom list = 0;
|
||||
|
||||
do {
|
||||
if (between == 3) {
|
||||
list = u3nc('.', list);
|
||||
between = 0;
|
||||
}
|
||||
list = u3nc(u3qa_add(u3qa_mod(u3k(ud), 10), '0'), list);
|
||||
between++;
|
||||
ud = u3qa_div(ud, 10);
|
||||
} while (c3n == u3r_sing(ud, 0));
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
//
|
||||
u3_noun
|
||||
u3we_scow(u3_noun cor)
|
||||
{
|
||||
u3_noun mod;
|
||||
u3_noun atom;
|
||||
|
||||
if (c3n == u3r_mean(cor, u3x_sam_2, &mod,
|
||||
u3x_sam_3, &atom, 0) ||
|
||||
!_(u3a_is_cat(mod))) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
switch (mod) {
|
||||
/* case c3__da: */
|
||||
/* return _parse_da(cor, txt); */
|
||||
|
||||
/* case 'p': */
|
||||
/* return _parse_p(txt); */
|
||||
|
||||
case c3__ud:
|
||||
return _print_ud(atom);
|
||||
|
||||
/* // %ta is used once in link.hoon. don't bother. */
|
||||
|
||||
/* case c3__tas: */
|
||||
/* return _parse_tas(txt); */
|
||||
|
||||
default:
|
||||
return u3_none;
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3we_scot(u3_noun cor)
|
||||
{
|
||||
u3_noun mod;
|
||||
u3_noun atom;
|
||||
|
||||
if (c3n == u3r_mean(cor, u3x_sam_2, &mod,
|
||||
u3x_sam_3, &atom, 0) ||
|
||||
!_(u3a_is_cat(mod))) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
switch (mod) {
|
||||
case c3__ud:
|
||||
return u3qc_rap(3, _print_ud(atom));
|
||||
|
||||
default:
|
||||
return u3_none;
|
||||
}
|
||||
}
|
@ -608,6 +608,8 @@ static c3_c* _141_qua_trip_ha[] = {
|
||||
};
|
||||
|
||||
static u3j_harm _141_qua_slaw_a[] = {{".2", u3we_slaw}, {}};
|
||||
static u3j_harm _141_qua_scot_a[] = {{".2", u3we_scot}, {}};
|
||||
static u3j_harm _141_qua_scow_a[] = {{".2", u3we_scow}, {}};
|
||||
|
||||
|
||||
static u3j_harm _141_qua__po_ind_a[] = {{".2", u3wcp_ind}, {}};
|
||||
@ -887,6 +889,8 @@ static u3j_core _141_qua_d[] =
|
||||
{ "mink", 7, _141_qua_mink_a, 0, _141_qua_mink_ha },
|
||||
{ "mule", 7, _141_qua_mule_a, 0, _141_qua_mule_ha },
|
||||
|
||||
{ "scot", 7, _141_qua_scot_a, 0, 0 },
|
||||
{ "scow", 7, _141_qua_scow_a, 0, 0 },
|
||||
{ "slaw", 7, _141_qua_slaw_a, 0, 0 },
|
||||
{}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user