mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-15 13:17:41 +03:00
Merge branch 'newbreach' of github.com:urbit/urbit into newbreach
Conflicts: urb/zod/arvo/hoon.hoon
This commit is contained in:
commit
81d5e748f9
2
.gitignore
vendored
2
.gitignore
vendored
@ -4,3 +4,5 @@
|
||||
/urb/*/
|
||||
!/urb/zod/
|
||||
/outside/re2/obj
|
||||
/inst
|
||||
/vere.pkg
|
||||
|
28
Makefile
28
Makefile
@ -35,8 +35,6 @@ CC=gcc
|
||||
CXX=g++
|
||||
CXXFLAGS=$(CFLAGS)
|
||||
CLD=g++ -O -g -L/usr/local/lib -L/opt/local/lib
|
||||
YACC=bison -v -b$(GENERATED)/y
|
||||
LEX=lex
|
||||
|
||||
ifeq ($(OS),osx)
|
||||
CLDOSFLAGS=-bind_at_load
|
||||
@ -50,7 +48,11 @@ ifeq ($(OS),bsd)
|
||||
OSLIBS=-lpthread -lncurses -lkvm
|
||||
endif
|
||||
|
||||
ifeq ($(STATIC),yes)
|
||||
LIBS=-lssl -lcrypto -lncurses /usr/local/lib/libsigsegv.a /usr/local/lib/libgmp.a $(OSLIBS)
|
||||
else
|
||||
LIBS=-lssl -lcrypto -lgmp -lncurses -lsigsegv $(OSLIBS)
|
||||
endif
|
||||
|
||||
INCLUDE=include
|
||||
MDEFINES=-DU2_OS_$(OS) -DU2_OS_ENDIAN_$(ENDIAN) -D U2_LIB=\"$(LIB)\"
|
||||
@ -69,12 +71,6 @@ CFLAGS= -O -g \
|
||||
|
||||
CWFLAGS=-Wall
|
||||
|
||||
.y.o:
|
||||
mkdir -p $(GENERATED)
|
||||
$(YACC) $<
|
||||
$(CC) -c $(CFLAGS) -o $@ $(GENERATED)/y.tab.c
|
||||
$(RM) $(GENERATED)/y.tab.c
|
||||
|
||||
.c.o:
|
||||
$(CC) -c $(CWFLAGS) $(CFLAGS) -o $@ $<
|
||||
|
||||
@ -170,6 +166,7 @@ J164_5_OFILES=\
|
||||
gen164/5/jam.o \
|
||||
gen164/5/mat.o \
|
||||
gen164/5/mink.o \
|
||||
gen164/5/mule.o \
|
||||
gen164/5/parse.o \
|
||||
gen164/5/repg.o \
|
||||
gen164/5/rexp.o \
|
||||
@ -285,6 +282,7 @@ LIBUV=outside/libuv/libuv.a
|
||||
LIBRE2=outside/re2/obj/libre2.a
|
||||
|
||||
LIBED25519=outside/ed25519/ed25519.a
|
||||
|
||||
BPT_O=outside/bpt/bitmapped_patricia_tree.o
|
||||
|
||||
all: $(BIN)/vere
|
||||
@ -316,11 +314,21 @@ tags:
|
||||
etags:
|
||||
etags -f .etags $$(find -name '*.c' -or -name '*.h')
|
||||
|
||||
osxpackage:
|
||||
$(RM) -r inst
|
||||
$(MAKE) distclean
|
||||
$(MAKE) $(BIN)/vere LIB=/usr/local/lib/urb STATIC=yes
|
||||
mkdir -p inst/usr/local/lib/urb inst/usr/local/bin
|
||||
cp $(BIN)/vere inst/usr/local/bin
|
||||
cp urb/urbit.pill inst/usr/local/lib/urb
|
||||
cp -R urb/zod inst/usr/local/lib/urb
|
||||
pkgbuild --root inst --identifier org.urbit.vere --version 0.2 vere.pkg
|
||||
|
||||
clean:
|
||||
$(RM) $(VERE_OFILES) $(BIN)/vere
|
||||
$(RM) $(VERE_OFILES) $(BIN)/vere vere.pkg
|
||||
|
||||
distclean: clean
|
||||
$(MAKE) -C outside/libuv clean
|
||||
$(MAKE) -C outside/re2 clean
|
||||
$(MAKE) -C outside/ed25519 clean
|
||||
rm $(BPT_O)
|
||||
$(RM) $(BPT_O)
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
p = j2_mbc(Pt1, inc)(wir_r, u2_h(c));
|
||||
q = u2_rx(wir_r, u2_t(c));
|
||||
u2_na_put(T_r, b, q);
|
||||
u2_na_put(T_r, b, (void*)(c3_p)q);
|
||||
|
||||
u2_rz(wir_r, c);
|
||||
u2_rz(wir_r, x);
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
p = j2_mbc(Pt1, add)(wir_r, _2, y);
|
||||
q = w;
|
||||
u2_na_put(T_r, b, q);
|
||||
u2_na_put(T_r, b, (void*)(c3_p)q);
|
||||
|
||||
u2_rz(wir_r, u); u2_rz(wir_r, v); u2_rz(wir_r, x); u2_rz(wir_r, y);
|
||||
}
|
||||
|
@ -101,7 +101,7 @@
|
||||
u2_noun x;
|
||||
|
||||
if ( u2_none == c ) {
|
||||
u2_na_put(T_m, a, b);
|
||||
u2_na_put(T_m, a, (void*)(c3_p)b);
|
||||
|
||||
if ( u2_yes == u2_stud(a) ) {
|
||||
x = _jam_in_flat(wir_r, a, l);
|
||||
|
33
gen164/5/mule.c
Normal file
33
gen164/5/mule.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* j/5/mink.c
|
||||
**
|
||||
** This file is in the public domain.
|
||||
*/
|
||||
#include "all.h"
|
||||
#include "../pit.h"
|
||||
|
||||
u2_weak // produce
|
||||
j2_mb(Pt5, mule)(u2_wire wir_r,
|
||||
u2_noun cor) // retain
|
||||
{
|
||||
u2_noun tap;
|
||||
|
||||
if ( u2_no == u2_mean(cor, u2_cv_sam, &tap, 0) ) {
|
||||
return u2_bl_bail(wir_r, c3__exit);
|
||||
}
|
||||
else {
|
||||
u2_noun hok = u2_bn_hook(wir_r, cor, "mute");
|
||||
/* 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,
|
||||
* without running the formula twice.
|
||||
*/
|
||||
return u2_bn_mong(wir_r, hok, u2k(tap));;
|
||||
}
|
||||
}
|
||||
|
||||
/* structures
|
||||
*/
|
||||
u2_ho_jet
|
||||
j2_mbj(Pt5, mule)[] = {
|
||||
{ ".2", c3__lite, j2_mb(Pt5, mule), Tier5, u2_none, u2_none },
|
||||
{ }
|
||||
};
|
@ -81,6 +81,7 @@
|
||||
extern u2_ho_jet j2_mbj(Pt5, cue)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, mat)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, mink)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, mule)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, jam)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, loss)[];
|
||||
extern u2_ho_jet j2_mbj(Pt5, lore)[];
|
||||
@ -231,6 +232,7 @@
|
||||
{ j2_sb(Pt5, mask), 0, j2_mbd(Pt5, mask), 0, u2_none },
|
||||
{ j2_sb(Pt5, mat), j2_mbj(Pt5, mat), 0, 0, u2_none },
|
||||
{ j2_sb(Pt5, mink), j2_mbj(Pt5, mink), 0, 0, u2_none },
|
||||
{ j2_sb(Pt5, mule), j2_mbj(Pt5, mule), 0, 0, u2_none },
|
||||
{ j2_sb(Pt5, og), 0, j2_mbd(Pt5, og), 0, u2_none },
|
||||
{ j2_sb(Pt5, pfix), j2_mbj(Pt5, pfix), 0, 0, u2_none },
|
||||
{ j2_sb(Pt5, plug), j2_mbj(Pt5, plug), 0, 0, u2_none },
|
||||
|
@ -31,15 +31,6 @@
|
||||
u2_weak bus, // transfer
|
||||
u2_weak fol); // retain
|
||||
|
||||
/* u2_nk_mung():
|
||||
**
|
||||
** Compute `(nock gat(-< sam) +.gat)` - old calling convention.
|
||||
*/
|
||||
u2_weak // transfer
|
||||
u2_nk_mung(u2_wire wir_r,
|
||||
u2_weak gat, // retain
|
||||
u2_weak sam); // transfer
|
||||
|
||||
/* u2_nk_mong():
|
||||
**
|
||||
** Compute `(nock gat(-> sam) +.gat)` - new calling convention.
|
||||
|
25
v/cttp.c
25
v/cttp.c
@ -104,7 +104,7 @@ _cttp_heds_to_list(u2_hhed* hed_u)
|
||||
static void
|
||||
_cttp_heds_free(u2_hhed* hed_u)
|
||||
{
|
||||
if ( hed_u ) {
|
||||
while ( hed_u ) {
|
||||
u2_hhed* nex_u = hed_u->nex_u;
|
||||
|
||||
if ( hed_u->nam_c ) free(hed_u->nam_c);
|
||||
@ -120,7 +120,7 @@ _cttp_heds_free(u2_hhed* hed_u)
|
||||
static void
|
||||
_cttp_bods_free(u2_hbod* bod_u)
|
||||
{
|
||||
if ( bod_u ) {
|
||||
while ( bod_u ) {
|
||||
u2_hbod* nex_u = bod_u->nex_u;
|
||||
|
||||
free(bod_u);
|
||||
@ -370,19 +370,17 @@ _cttp_mcut_quay(c3_c* buf_c, c3_w len_w, u2_noun quy)
|
||||
return len_w;
|
||||
}
|
||||
else {
|
||||
u2_noun n_quy = u2h(quy);
|
||||
u2_noun pn_quy = u2h(n_quy);
|
||||
u2_noun qn_quy = u2t(n_quy);
|
||||
u2_noun l_quy = u2h(u2t(quy));
|
||||
u2_noun r_quy = u2t(u2t(quy));
|
||||
u2_noun i_quy = u2h(quy);
|
||||
u2_noun pi_quy = u2h(i_quy);
|
||||
u2_noun qi_quy = u2t(i_quy);
|
||||
u2_noun t_quy = u2t(quy);
|
||||
|
||||
len_w = _cttp_mcut_char(buf_c, len_w, '&');
|
||||
len_w = _cttp_mcut_span(buf_c, len_w, u2k(pn_quy));
|
||||
len_w = _cttp_mcut_span(buf_c, len_w, u2k(pi_quy));
|
||||
len_w = _cttp_mcut_char(buf_c, len_w, '=');
|
||||
len_w = _cttp_mcut_span(buf_c, len_w, u2k(qn_quy));
|
||||
len_w = _cttp_mcut_span(buf_c, len_w, u2k(qi_quy));
|
||||
|
||||
len_w = _cttp_mcut_quay(buf_c, len_w, u2k(l_quy));
|
||||
len_w = _cttp_mcut_quay(buf_c, len_w, u2k(r_quy));
|
||||
len_w = _cttp_mcut_quay(buf_c, len_w, u2k(t_quy));
|
||||
}
|
||||
u2z(quy);
|
||||
return len_w;
|
||||
@ -738,7 +736,10 @@ _cttp_ccon_waste(u2_ccon* coc_u, c3_c* msg_c)
|
||||
coc_u->nex_u->pre_u = coc_u->pre_u;
|
||||
}
|
||||
if ( coc_u->ssl.ssl_u ) {
|
||||
SSL_free(coc_u->ssl.ssl_u);
|
||||
SSL_free(coc_u->ssl.ssl_u);
|
||||
coc_u->ssl.ssl_u = 0;
|
||||
coc_u->ssl.rio_u = 0;
|
||||
coc_u->ssl.wio_u = 0;
|
||||
}
|
||||
free(coc_u);
|
||||
}
|
||||
|
172
v/unix.c
172
v/unix.c
@ -13,7 +13,6 @@
|
||||
#include <dirent.h>
|
||||
#include <stdint.h>
|
||||
#include <uv.h>
|
||||
#include <curses.h>
|
||||
#include <termios.h>
|
||||
#include <term.h>
|
||||
#include <errno.h>
|
||||
@ -139,7 +138,7 @@ u2_unix_acquire(c3_c* pax_c)
|
||||
#elif defined(U2_OS_bsd)
|
||||
fsync(fid_i);
|
||||
#else
|
||||
#error "port: datasync"
|
||||
# error "port: datasync"
|
||||
#endif
|
||||
}
|
||||
fclose(loq_u);
|
||||
@ -602,13 +601,13 @@ _unix_save(c3_c* pax_c, u2_atom oat)
|
||||
u2z(oat);
|
||||
|
||||
rit_w = write(fid_i, oat_y, fln_w);
|
||||
close(fid_i);
|
||||
free(oat_y);
|
||||
|
||||
if ( rit_w != fln_w ) {
|
||||
uL(fprintf(uH, "%s: %s\n", pax_c, strerror(errno)));
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
close(fid_i);
|
||||
free(oat_y);
|
||||
}
|
||||
|
||||
/* _unix_file_load(): load a file by watcher.
|
||||
@ -635,6 +634,25 @@ _unix_dir_name(u2_udir* dir_u)
|
||||
: u2_ci_string(pax_c);
|
||||
}
|
||||
|
||||
/* _unix_file_tame(): file name/extension for toplevel.
|
||||
*/
|
||||
static u2_noun
|
||||
_unix_file_tame(u2_ufil* fil_u)
|
||||
{
|
||||
c3_c* fas_c = strrchr(fil_u->pax_c, '/');
|
||||
c3_c* pax_c = fil_u->pax_c + (fas_c-fil_u->pax_c) + 1;
|
||||
|
||||
if ( !fil_u->dot_c ) {
|
||||
return u2_none;
|
||||
}
|
||||
else {
|
||||
c3_c* ext_c = fil_u->dot_c + 1;
|
||||
c3_w nam_w = fil_u->dot_c - pax_c;
|
||||
|
||||
return u2nc(u2_ci_bytes(nam_w, (c3_y*)pax_c),
|
||||
u2_ci_string(ext_c));
|
||||
}
|
||||
}
|
||||
|
||||
/* _unix_file_name(): file name/extension.
|
||||
*/
|
||||
@ -655,6 +673,65 @@ _unix_file_name(u2_ufil* fil_u)
|
||||
}
|
||||
}
|
||||
|
||||
/* _unix_dir_ankh_file(): process a file for ankh.
|
||||
*/
|
||||
static u2_noun
|
||||
_unix_dir_ankh_file(u2_noun pam, u2_noun wib, u2_noun baw, u2_noun woz)
|
||||
{
|
||||
u2_weak ole;
|
||||
if ( u2_no == u2du(wib) ) {
|
||||
ole = u2_ckd_by_get(u2k(pam), u2k(wib));
|
||||
|
||||
if ( u2_none == ole ) {
|
||||
ole = u2_do("cosh", u2nt(0, woz, u2_nul));
|
||||
} else {
|
||||
u2_noun elo;
|
||||
|
||||
elo = u2_do("cosh", u2nt(0, woz, u2k(u2t(u2t(ole)))));
|
||||
u2z(ole);
|
||||
|
||||
ole = elo;
|
||||
}
|
||||
pam = u2_ckd_by_put(pam, wib, ole);
|
||||
}
|
||||
else {
|
||||
u2_noun fid = u2h(wib);
|
||||
u2_noun har = u2t(wib);
|
||||
|
||||
ole = u2_ckd_by_get(u2k(pam), u2k(fid));
|
||||
|
||||
if ( u2_none == ole ) {
|
||||
ole = u2nt
|
||||
(0, u2_nul, u2_ckd_by_put(u2_nul,
|
||||
u2k(har),
|
||||
u2_do("cosh", u2nt(0, woz, u2_nul))));
|
||||
ole = u2_do("cosh", ole);
|
||||
}
|
||||
else {
|
||||
u2_noun roo = u2t(u2t(ole));
|
||||
u2_weak tup = u2_ckd_by_get(u2k(roo), u2k(har));
|
||||
u2_noun oor, elo;
|
||||
|
||||
if ( u2_none == tup ) {
|
||||
tup = u2_do("cosh", u2nt(0, woz, u2_nul));
|
||||
} else {
|
||||
u2_noun upt;
|
||||
|
||||
upt = u2_do("cosh", u2nt(0, woz, u2k(u2t(u2t(tup)))));
|
||||
u2z(tup);
|
||||
|
||||
tup = upt;
|
||||
}
|
||||
oor = u2_ckd_by_put(u2k(roo), u2k(har), tup);
|
||||
elo = u2_do("cosh", u2nt(0, u2k(u2h(u2t(ole))), oor));
|
||||
|
||||
u2z(ole); ole = elo;
|
||||
}
|
||||
pam = u2_ckd_by_put(pam, u2k(fid), ole);
|
||||
u2z(wib);
|
||||
}
|
||||
return pam;
|
||||
}
|
||||
/* _unix_dir_ankh(): resolve directory to new style ankh.
|
||||
*/
|
||||
static u2_noun
|
||||
@ -674,63 +751,29 @@ _unix_dir_ankh(u2_udir* dir_u)
|
||||
}
|
||||
}
|
||||
|
||||
if ( !dir_u->par_u->par_u ) { // toplevel
|
||||
for ( fil_u = dir_u->par_u->fil_u; fil_u; fil_u = fil_u->nex_u ) {
|
||||
// uL(fprintf(uH, "top %s\n", fil_u->pax_c));
|
||||
u2_noun wib = _unix_file_tame(fil_u);
|
||||
if ( u2_none == wib ) continue;
|
||||
u2_noun dur = _unix_dir_name(dir_u);
|
||||
if ( u2_no == u2_sing(dur, u2h(wib)) ) { // wrong desk
|
||||
u2z(wib); u2z(dur);
|
||||
continue;
|
||||
}
|
||||
u2_noun baw = _unix_file_load(fil_u);
|
||||
u2_noun woz = u2nt(u2_nul, u2_do("sham", u2k(baw)), baw);
|
||||
u2z(dur);
|
||||
pam = _unix_dir_ankh_file(pam, u2k(u2t(wib)), baw, woz);
|
||||
u2z(wib);
|
||||
}
|
||||
}
|
||||
|
||||
for ( fil_u = dir_u->fil_u; fil_u; fil_u = fil_u->nex_u ) {
|
||||
u2_noun wib = _unix_file_name(fil_u);
|
||||
u2_noun baw = _unix_file_load(fil_u);
|
||||
u2_noun woz = u2nt(u2_nul, u2_do("sham", u2k(baw)), baw);
|
||||
u2_weak ole;
|
||||
|
||||
if ( u2_no == u2du(wib) ) {
|
||||
ole = u2_ckd_by_get(u2k(pam), u2k(wib));
|
||||
|
||||
if ( u2_none == ole ) {
|
||||
ole = u2_do("cosh", u2nt(0, woz, u2_nul));
|
||||
} else {
|
||||
u2_noun elo;
|
||||
|
||||
elo = u2_do("cosh", u2nt(0, woz, u2k(u2t(u2t(ole)))));
|
||||
u2z(ole);
|
||||
|
||||
ole = elo;
|
||||
}
|
||||
pam = u2_ckd_by_put(pam, wib, ole);
|
||||
}
|
||||
else {
|
||||
u2_noun fid = u2h(wib);
|
||||
u2_noun har = u2t(wib);
|
||||
|
||||
ole = u2_ckd_by_get(u2k(pam), u2k(fid));
|
||||
|
||||
if ( u2_none == ole ) {
|
||||
ole = u2nt
|
||||
(0, u2_nul, u2_ckd_by_put(u2_nul,
|
||||
u2k(har),
|
||||
u2_do("cosh", u2nt(0, woz, u2_nul))));
|
||||
ole = u2_do("cosh", ole);
|
||||
}
|
||||
else {
|
||||
u2_noun roo = u2t(u2t(ole));
|
||||
u2_weak tup = u2_ckd_by_get(u2k(roo), u2k(har));
|
||||
u2_noun oor, elo;
|
||||
|
||||
if ( u2_none == tup ) {
|
||||
tup = u2_do("cosh", u2nt(0, woz, u2_nul));
|
||||
} else {
|
||||
u2_noun upt;
|
||||
|
||||
upt = u2_do("cosh", u2nt(0, woz, u2k(u2t(u2t(tup)))));
|
||||
u2z(tup);
|
||||
|
||||
tup = upt;
|
||||
}
|
||||
oor = u2_ckd_by_put(u2k(roo), u2k(har), tup);
|
||||
elo = u2_do("cosh", u2nt(0, u2k(u2h(u2t(ole))), oor));
|
||||
|
||||
u2z(ole); ole = elo;
|
||||
}
|
||||
pam = u2_ckd_by_put(pam, u2k(fid), ole);
|
||||
u2z(wib);
|
||||
}
|
||||
pam = _unix_dir_ankh_file(pam, wib, baw, woz);
|
||||
}
|
||||
return u2_do("cosh", u2nt(0, u2_nul, pam));
|
||||
}
|
||||
@ -990,10 +1033,17 @@ _unix_desk_sync_tofu(u2_udir* dir_u,
|
||||
static void
|
||||
_unix_desk_sync_tako(u2_udir* dir_u, u2_noun pax, u2_noun mis)
|
||||
{
|
||||
if ( (u2_no == u2du(pax)) || u2_no == u2du(u2t(pax)) ) {
|
||||
c3_assert(0);
|
||||
if ( (u2_no == u2du(pax)) ) {
|
||||
c3_assert(!"tack");
|
||||
}
|
||||
else if ( u2_no == u2du(u2t(pax)) ) { // at toplevel
|
||||
u2_noun i_pax = u2h(pax);
|
||||
u2_noun t_pax = u2t(pax);
|
||||
c3_c* par_u = strrchr(dir_u->pax_c, '/') + 1;
|
||||
u2_noun pem = u2_ci_string(par_u);
|
||||
c3_assert( u2_nul == t_pax ); // XX ugly, wrong
|
||||
|
||||
u2z(pax); u2z(mis);
|
||||
_unix_desk_sync_tofu(dir_u->par_u, pem, u2k(i_pax), mis);
|
||||
}
|
||||
else {
|
||||
u2_noun i_pax = u2h(pax);
|
||||
|
Loading…
Reference in New Issue
Block a user