Merge remote-tracking branches 'frodwith/wyt' and 'frodwith/uni' into maint-0.4

Jets for +-wyt:in and +-uni:in
This commit is contained in:
Raymond Pasco 2016-12-12 11:05:05 -08:00
commit 14ab369cb9
8 changed files with 130 additions and 108 deletions

View File

@ -2,36 +2,34 @@
Thank you for your interest in contributing to urbit. Thank you for your interest in contributing to urbit.
## Development practice ## Fake `~zod`s
You may have an identity on the live network, but doing all your You may have an identity on the live network, but doing all your
development on the live network would be cumbersome and unnecessary. development on the live network would be cumbersome and unnecessary.
Standard practice in urbit development is to work on a fake `~zod`. A Standard practice in urbit development is to work on a fake `~zod`. A
fake `~zod` will get its initial files from the `arvo/` directory rather fake `~zod` will get its initial files from a directory you specify
than trying to sync them over the network, which is invaluable for rather than trying to sync them over the network, which is invaluable
working in Hoon. Also, a fake `~zod` or any fake urbit instances you for working in Hoon. Also, a fake `~zod` or any fake urbit instances you
start do not talk to the live network, but to a fake network that exists start do not talk to the live network, but to a fake network that exists
only on your computer. only on your computer.
First, you'll want to get an `arvo/` directory. Arvo is kept in its own First, you'll want to check out the Arvo repository. Arvo is kept in its
repository, and changes more rapidly than the main C project does. own repository, and changes more rapidly than the main C project does.
From inside your `urbit` directory, do:
git clone https://github.com/urbit/arvo git clone https://github.com/urbit/arvo
The arvo repository can live safely inside the main urbit repository, The arvo repository can live safely inside the main urbit repository if
since it's listed in .gitignore. However, vere will try to find the you want, since it's listed in .gitignore. However, vere will use the
arvo directory in the current directory when starting a fake `~zod`. path you specify on the command line with the `-A` option.
To start a fake `~zod`, the command is: To start a fake `~zod`, the command is:
bin/urbit -F -I zod -c [pier directory] $ urbit -c -F -I zod -A [arvo checkout] [pier directory]
To resume one that was already created, just as on the live network, To resume one that was already created, just as on the live network,
remove `-c` (but leave the rest of the options there). `-F` uses the remove `-c` and `-A [arvo checkout]` (but leave the rest of the options
fake network, and `-I` starts an "imperial" instance - that is, an 8-bit there). `-F` uses the fake network, and `-I` starts an "imperial"
galaxy. instance - that is, an 8-bit galaxy.
## Kernel development ## Kernel development
@ -72,16 +70,16 @@ This is good practice for any project that uses git. You will pull
upstream branches from urbit/urbit and push to your personal urbit fork upstream branches from urbit/urbit and push to your personal urbit fork
by default. by default.
Next, check out `master`, which is the mainline development branch, and Next, start a new branch to do your work on. For `urbit`, please use the
base a new branch on it to do your work on: latest tagged release as your starting point. For other repositories,
anywhere pointed to by `master` is alright to start from.
git checkout master git checkout -b [branch name] [starting point]
git checkout -b [branch name]
Now you are free to do your work on this branch. When finished, you may Now you are free to do your work on this branch. When finished, you may
want to clean up your commits: want to clean up your commits:
git rebase -i master git rebase -i [starting point]
Then you can push to your public fork with `git push` and make a pull Then you can push to your public fork with `git push` and make a pull
request via the GitHub UI. request via the GitHub UI.
@ -119,10 +117,10 @@ less obvious stylistic rules are:
## The kernel and pills ## The kernel and pills
urbit bootstraps itself using a binary blob called `urbit.pill`. You urbit bootstraps itself using a binary blob called `urbit.pill`. You
probably remember fetching it from `bootstrap.urbit.org` before your probably remember it being fetched from `bootstrap.urbit.org` before
first boot. This is just the compiled version of the kernel, which you your first boot. This is just the compiled version of the kernel, which
can find in the `arvo/arvo/` directory - `hoon.hoon`, `zuse.hoon`, and you can find in the `arvo/arvo/` directory - `hoon.hoon`, `zuse.hoon`,
so on. and so on.
The procedure for creating `urbit.pill` is often called "soliding". It The procedure for creating `urbit.pill` is often called "soliding". It
is somewhat similar to `|reset`, but instead of replacing your running is somewhat similar to `|reset`, but instead of replacing your running
@ -183,9 +181,10 @@ eager to have outside contributions on. Check here first!
## Staying in touch ## Staying in touch
The urbit developers communicate on urbit itself. Joining the The urbit developers communicate on urbit itself. Joining the
`~dozbud/urbit-meta` channel on `talk` is highly recommended. `urbit-meta` channel on `talk` is highly recommended, as is reading the
Subscribing to `urbit-dev` on Google Groups is also recommended, since forums at [http://urbit.org/fora](http://urbit.org/fora). Subscribing to
this is where continuity breach notifications are sent. `urbit-dev` on Google Groups is also recommended, since this is where
continuity breach notifications are sent.
Pull requests in non-GitHub forms can go to Raymond Pasco Pull requests in non-GitHub forms can go to Raymond Pasco
([ray@the.ug](mailto:ray@the.ug)). Questions or other communications ([ray@the.ug](mailto:ray@the.ug)). Questions or other communications

View File

@ -256,6 +256,7 @@ J_D_OFILES=\
jets/d/in_put.o \ jets/d/in_put.o \
jets/d/in_tap.o \ jets/d/in_tap.o \
jets/d/in_uni.o \ jets/d/in_uni.o \
jets/d/in_wyt.o \
jets/d/in_bif.o \ jets/d/in_bif.o \
jets/d/in_dif.o \ jets/d/in_dif.o \
jets/d/by_gas.o \ jets/d/by_gas.o \

View File

@ -90,6 +90,7 @@
u3_noun u3qdi_put(u3_noun, u3_noun); u3_noun u3qdi_put(u3_noun, u3_noun);
u3_noun u3qdi_tap(u3_noun, u3_noun); u3_noun u3qdi_tap(u3_noun, u3_noun);
u3_noun u3qdi_uni(u3_noun, u3_noun); u3_noun u3qdi_uni(u3_noun, u3_noun);
u3_noun u3qdi_wyt(u3_noun);
/** Tier 5. /** Tier 5.
**/ **/

View File

@ -95,6 +95,7 @@
u3_noun u3wdi_put(u3_noun); u3_noun u3wdi_put(u3_noun);
u3_noun u3wdi_tap(u3_noun); u3_noun u3wdi_tap(u3_noun);
u3_noun u3wdi_uni(u3_noun); u3_noun u3wdi_uni(u3_noun);
u3_noun u3wdi_wyt(u3_noun);
/** Tier 5. /** Tier 5.
**/ **/

View File

@ -3,6 +3,68 @@
*/ */
#include "all.h" #include "all.h"
/* internal functions
*/
static u3_noun
_in_uni(u3_noun a, u3_noun b)
{
u3_noun n_a, l_a, r_a,
n_b, l_b, r_b,
neb, sub, naw, pro;
if ( u3_nul == a ) {
return u3k(b);
}
else if ( u3_nul == b ) {
return u3k(a);
}
else if ( (c3n == u3r_trel(a, &n_a, &l_a, &r_a))
|| (c3n == u3r_trel(b, &n_b, &l_b, &r_b)) )
{
return u3m_bail(c3__exit);
}
else if ( c3n == u3qc_vor(n_a, n_b) ) {
if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b));
}
else if ( c3y == u3qc_hor(n_a, n_b) ) {
naw = u3nt(u3k(n_a), u3k(l_a), u3_nul);
sub = _in_uni(naw, l_b);
neb = u3nt(u3k(n_b), sub, u3k(r_b));
pro = _in_uni(r_a, neb);
u3z(naw); u3z(neb);
return pro;
}
else {
naw = u3nt(u3k(n_a), u3_nul, u3k(r_a));
sub = _in_uni(naw, r_b);
neb = u3nt(u3k(n_b), u3k(l_b), sub);
pro = _in_uni(l_a, neb);
u3z(naw); u3z(neb);
return pro;
}
}
else if ( c3y == u3r_sing(n_b, n_a) ) {
return u3nt(u3k(n_b), _in_uni(l_a, l_b), _in_uni(r_a, r_b));
}
else if ( c3y == u3qc_hor(n_b, n_a) ) {
neb = u3nt(u3k(n_b), u3k(l_b), u3_nul);
sub = _in_uni(l_a, neb);
naw = u3nt(u3k(n_a), sub, u3k(r_a));
pro = _in_uni(naw, r_b);
u3z(neb); u3z(naw);
return pro;
}
else {
neb = u3nt(u3k(n_b), u3_nul, u3k(r_b));
sub = _in_uni(r_a, neb);
naw = u3nt(u3k(n_a), u3k(l_a), sub);
pro = _in_uni(naw, l_b);
u3z(neb); u3z(naw);
return pro;
}
}
/* functions /* functions
*/ */
@ -21,86 +83,11 @@
u3qdi_uni(u3_noun a, u3qdi_uni(u3_noun a,
u3_noun b) u3_noun b)
{ {
if ( u3_nul == a ) { if ( c3y == u3r_sing(a, b) ) {
return u3k(b);
}
else if ( u3_nul == b ) {
return u3k(a); return u3k(a);
} }
else { else {
u3_noun l_a, n_a, r_a, lr_a; return _in_uni(a, b);
u3_noun l_b, n_b, r_b, lr_b;
if ( (c3n == u3r_cell(a, &n_a, &lr_a)) ) {
return u3m_bail(c3__exit);
}
else if ( (c3n == u3r_cell(b, &n_b, &lr_b)) ) {
return u3m_bail(c3__exit);
}
else {
if ( c3y == u3qc_vor(n_a, n_b) ) {
if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(n_a, n_b) ) {
return u3nt(u3k(n_b),
u3kdi_uni(u3k(l_a), u3k(l_b)),
u3kdi_uni(u3k(r_a), u3k(r_b)));
}
else if ( c3y == u3qc_hor(n_b, n_a) ) {
return u3kdi_uni(u3nt(u3k(n_a),
u3kdi_uni(u3k(l_a),
u3nt(u3k(n_b),
u3k(l_b),
u3_nul)),
u3k(r_a)),
u3k(r_b));
}
else {
return u3kdi_uni(u3nt(u3k(n_a),
u3k(l_a),
u3kdi_uni(u3k(r_a),
u3nt(u3k(n_b),
u3_nul,
u3k(r_b)))),
u3k(l_b));
}
}
else {
if ( c3n == u3r_cell(lr_b, &l_b, &r_b) ) {
return u3m_bail(c3__exit);
}
else if ( c3n == u3r_cell(lr_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else if ( c3y == u3r_sing(n_b, n_a) ) {
return u3nt(u3k(n_b),
u3kdi_uni(u3k(l_a), u3k(l_b)),
u3kdi_uni(u3k(r_a), u3k(r_b)));
}
else if ( c3y == u3qc_hor(n_a, n_b) ) {
return u3kdi_uni(u3k(r_a),
u3nt(u3k(n_b),
u3kdi_uni(u3nt(u3k(n_a),
u3k(l_a),
u3_nul),
u3k(l_b)),
u3k(r_b)));
}
else {
return u3kdi_uni(u3k(l_a),
u3nt(u3k(n_b),
u3k(l_b),
u3kdi_uni(u3nt(u3k(n_a),
u3_nul,
u3k(r_a)),
u3k(r_b))));
}
}
}
} }
} }
u3_noun u3_noun

30
jets/d/in_wyt.c Normal file
View File

@ -0,0 +1,30 @@
/* jets/d/in_wyt.c
**
*/
#include "all.h"
/* functions
*/
u3_noun u3wdi_wyt(u3_noun cor)
{
u3_noun a;
if ( c3n == u3r_mean(cor, u3x_con_2, &a, 0) ) {
return u3m_bail(c3__exit);
} else {
return u3qdi_wyt(a);
}
}
u3_noun u3qdi_wyt(u3_noun a)
{
u3_noun n_a, l_a, r_a;
if ( u3_nul == a ) {
return 0;
}
else if ( c3n == u3r_trel(a, &n_a, &l_a, &r_a) ) {
return u3m_bail(c3__exit);
}
else {
return u3i_vint(u3ka_add(u3qdi_wyt(l_a), u3qdi_wyt(r_a)));
}
}

View File

@ -106,7 +106,8 @@ static u3j_harm _mood__hoon__in_mer_a[] = {{".2", u3wdi_mer}, {}};
// static u3j_harm _mood__hoon__in_int_a[] = {{".2", u3wdi_int}, {}}; // static u3j_harm _mood__hoon__in_int_a[] = {{".2", u3wdi_int}, {}};
static u3j_harm _mood__hoon__in_put_a[] = {{".2", u3wdi_put}, {}}; static u3j_harm _mood__hoon__in_put_a[] = {{".2", u3wdi_put}, {}};
static u3j_harm _mood__hoon__in_tap_a[] = {{".2", u3wdi_tap}, {}}; static u3j_harm _mood__hoon__in_tap_a[] = {{".2", u3wdi_tap}, {}};
// static u3j_harm _mood__hoon__in_uni_a[] = {{".2", u3wdi_uni}, {}}; static u3j_harm _mood__hoon__in_wyt_a[] = {{".2", u3wdi_wyt}, {}};
static u3j_harm _mood__hoon__in_uni_a[] = {{".2", u3wdi_uni}, {}};
static u3j_core _mood__hoon__in_d[] = static u3j_core _mood__hoon__in_d[] =
{ { "bif", _mood__hoon__in_bif_a }, { { "bif", _mood__hoon__in_bif_a },
{ "dif", _mood__hoon__in_dif_a }, { "dif", _mood__hoon__in_dif_a },
@ -116,7 +117,8 @@ static u3j_core _mood__hoon__in_d[] =
// { "int", _mood__hoon__in_int_a }, // { "int", _mood__hoon__in_int_a },
{ "put", _mood__hoon__in_put_a }, { "put", _mood__hoon__in_put_a },
{ "tap", _mood__hoon__in_tap_a }, { "tap", _mood__hoon__in_tap_a },
// { "uni", _mood__hoon__in_uni_a }, { "wyt", _mood__hoon__in_wyt_a },
{ "uni", _mood__hoon__in_uni_a },
{} {}
}; };

View File

@ -95,11 +95,12 @@ _ames_czar(c3_y imp_y, c3_s* por_s)
} }
if ( (AF_INET == rai_u->ai_family) ) { if ( (AF_INET == rai_u->ai_family) ) {
struct sockaddr_in* add_u = (struct sockaddr_in *)rai_u->ai_addr; struct sockaddr_in* add_u = (struct sockaddr_in *)rai_u->ai_addr;
c3_w old_w = sam_u->imp_w[imp_y];
sam_u->imp_w[imp_y] = ntohl(add_u->sin_addr.s_addr); sam_u->imp_w[imp_y] = ntohl(add_u->sin_addr.s_addr);
sam_u->imp_t[imp_y] = now; sam_u->imp_t[imp_y] = now;
#if 1 #if 1
{ if ( sam_u->imp_w[imp_y] != old_w ) {
u3_noun wad = u3i_words(1, &sam_u->imp_w[imp_y]); u3_noun wad = u3i_words(1, &sam_u->imp_w[imp_y]);
u3_noun nam = u3dc("scot", c3__if, wad); u3_noun nam = u3dc("scot", c3__if, wad);
c3_c* nam_c = u3r_string(nam); c3_c* nam_c = u3r_string(nam);