mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-25 07:52:59 +03:00
Trailing whitespace cleanup, C level
This commit is contained in:
parent
c0acbd1b39
commit
ba71f7ca11
2
f/dash.c
2
f/dash.c
@ -242,7 +242,7 @@ _ds_chip(u2_wire wir_r,
|
||||
}
|
||||
}
|
||||
|
||||
/* u2_ds_wipe():
|
||||
/* u2_ds_wipe():
|
||||
**
|
||||
** Clear dashboard.
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@
|
||||
# include "f/nock.h"
|
||||
# include "f/funj.h"
|
||||
# include "f/unix.h"
|
||||
# include "f/hevn.h"
|
||||
# include "f/hevn.h"
|
||||
# include "f/arvo.h"
|
||||
|
||||
/** coal: common methods for dealing with nouns.
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/** Functions.
|
||||
**/
|
||||
/* c3_comd_init():
|
||||
/* c3_comd_init():
|
||||
**
|
||||
** Initialize the readline console. Return the history filename.
|
||||
*/
|
||||
@ -18,5 +18,5 @@
|
||||
** Returns 0 iff the console has exited.
|
||||
*/
|
||||
c3_c* // produce
|
||||
c3_comd_line(const c3_c *fel_c,
|
||||
c3_comd_line(const c3_c *fel_c,
|
||||
const c3_c *prm_c); // retain
|
||||
|
@ -23,7 +23,7 @@
|
||||
# include <unistd.h>
|
||||
# include <stdint.h>
|
||||
# include <assert.h>
|
||||
# include <byteswap.h>
|
||||
# include <byteswap.h>
|
||||
# include <setjmp.h>
|
||||
# include <stdio.h>
|
||||
# include <signal.h>
|
||||
@ -40,8 +40,8 @@
|
||||
# include <assert.h>
|
||||
# include <setjmp.h>
|
||||
# include <signal.h>
|
||||
# include <machine/endian.h>
|
||||
# include <machine/byte_order.h>
|
||||
# include <machine/endian.h>
|
||||
# include <machine/byte_order.h>
|
||||
# include <stdio.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/resource.h>
|
||||
|
@ -28,9 +28,9 @@
|
||||
# define c3_and(x, y) ((x) && (y))
|
||||
# define c3_or(x, y) ((x) || (y))
|
||||
|
||||
/* Deprecated integers.
|
||||
/* Deprecated integers.
|
||||
*/
|
||||
typedef char c3_c; // does not match int8_t or uint8_t
|
||||
typedef int c3_i; // int - really bad
|
||||
typedef int c3_i; // int - really bad
|
||||
typedef uintptr_t c3_p; // pointer-length uint - really really bad
|
||||
typedef intptr_t c3_ps; // pointer-length int - really really bad
|
||||
|
@ -28,8 +28,8 @@
|
||||
|
||||
# define u2_kite_tax(kit_r) *u2_at(kit_r, u2_loom_kite, tax)
|
||||
# define u2_kite_don(kit_r) *u2_at(kit_r, u2_loom_kite, don)
|
||||
# define u2_kite_par_r(kit_r) *u2_at(kit_r, u2_loom_kite, par_r)
|
||||
# define u2_kite_buf_r(kit_r) u2_aftr(kit_r, u2_loom_kite, buf_f)
|
||||
# define u2_kite_par_r(kit_r) *u2_at(kit_r, u2_loom_kite, par_r)
|
||||
# define u2_kite_buf_r(kit_r) u2_aftr(kit_r, u2_loom_kite, buf_f)
|
||||
|
||||
|
||||
/** Functions.
|
||||
@ -38,7 +38,7 @@
|
||||
**/
|
||||
/* u2_bl_bail(): bail out.
|
||||
**
|
||||
** Bail codes:
|
||||
** Bail codes:
|
||||
**
|
||||
** c3__exit for normal exit with correct trace
|
||||
** c3__fail for abnormal failure without assumptions
|
||||
@ -111,7 +111,7 @@
|
||||
** Factor `a` as a cell `[b c]`.
|
||||
*/
|
||||
void
|
||||
u2_bi_cell(u2_wire wir_r,
|
||||
u2_bi_cell(u2_wire wir_r,
|
||||
u2_noun a,
|
||||
u2_noun* b,
|
||||
u2_noun* c);
|
||||
@ -121,7 +121,7 @@
|
||||
** Factor `a` as a quadruple `[b c d e]`.
|
||||
*/
|
||||
void
|
||||
u2_bi_qual(u2_wire wir_r,
|
||||
u2_bi_qual(u2_wire wir_r,
|
||||
u2_noun a,
|
||||
u2_noun* b,
|
||||
u2_noun* c,
|
||||
@ -179,10 +179,10 @@
|
||||
|
||||
/** Atom access.
|
||||
**/
|
||||
/* u2_bi_met():
|
||||
/* u2_bi_met():
|
||||
**
|
||||
** Return the size of (b) in bits, rounded up to
|
||||
** (1 << a_y).
|
||||
** (1 << a_y).
|
||||
**
|
||||
** For example, (a_y == 3) returns the size in bytes.
|
||||
*/
|
||||
@ -199,7 +199,7 @@
|
||||
u2_bi_bit(u2_wire wir_r,
|
||||
c3_w a_w,
|
||||
u2_noun b);
|
||||
|
||||
|
||||
/* u2_bi_byte():
|
||||
**
|
||||
** Return byte (a_w) of (b).
|
||||
@ -208,7 +208,7 @@
|
||||
u2_bi_byte(u2_wire wir_r,
|
||||
c3_w a_w,
|
||||
u2_noun b);
|
||||
|
||||
|
||||
/* u2_bi_bytes():
|
||||
**
|
||||
** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c).
|
||||
@ -291,11 +291,11 @@
|
||||
**
|
||||
** Create an atomic string from a list of bytes.
|
||||
*/
|
||||
u2_noun
|
||||
u2_noun
|
||||
u2_bn_tape(u2_wire wir_r,
|
||||
u2_list lit);
|
||||
|
||||
/* u2_bn_cell():
|
||||
/* u2_bn_cell():
|
||||
**
|
||||
** Produce the cell [a b].
|
||||
*/
|
||||
@ -337,13 +337,13 @@
|
||||
*/
|
||||
u2_noun
|
||||
u2_bn_list(u2_wire wir_r, ...);
|
||||
|
||||
|
||||
/* u2_bn_nock():
|
||||
**
|
||||
** Nock or bail.
|
||||
*/
|
||||
u2_noun // transfer
|
||||
u2_bn_nock(u2_wire wir_r,
|
||||
u2_bn_nock(u2_wire wir_r,
|
||||
u2_noun bus, // retain
|
||||
u2_noun fol); // retain
|
||||
|
||||
@ -355,7 +355,7 @@
|
||||
u2_bn_mp(u2_wire wir_r,
|
||||
mpz_t a_mp);
|
||||
|
||||
/* u2_bn_qual():
|
||||
/* u2_bn_qual():
|
||||
**
|
||||
** Produce the quadruple [a b c d].
|
||||
*/
|
||||
@ -367,7 +367,7 @@
|
||||
u2_noun d);
|
||||
# define u2_bq(wir_r, a, b, c, d) u2_bn_qual(wir_r, a, b, c, d)
|
||||
|
||||
/* u2_bn_quil():
|
||||
/* u2_bn_quil():
|
||||
**
|
||||
** Produce the quintuple [a b c d].
|
||||
*/
|
||||
@ -380,7 +380,7 @@
|
||||
u2_noun e);
|
||||
# define u2_bu(wir_r, a, b, c, d, e) u2_bn_quil(wir_r, a, b, c, d, e)
|
||||
|
||||
/* u2_bn_trel():
|
||||
/* u2_bn_trel():
|
||||
**
|
||||
** Produce the triple [a b c].
|
||||
*/
|
||||
@ -409,7 +409,7 @@
|
||||
u2_bn_molt(u2_wire wir_r,
|
||||
u2_noun som, // retain
|
||||
...); // retain
|
||||
|
||||
|
||||
/* u2_bn_molf():
|
||||
**
|
||||
** As u2_bn_molt(), with argument pointer.
|
||||
@ -426,9 +426,9 @@
|
||||
u2_noun
|
||||
u2_bn_mang(u2_wire wir_r,
|
||||
u2_noun cor,
|
||||
...); // nouns
|
||||
...); // nouns
|
||||
|
||||
/* u2_bn_mong():
|
||||
/* u2_bn_mong():
|
||||
**
|
||||
** Call by gate and sample (new convention).
|
||||
** Caller retains `gat`, transfers `sam`.
|
||||
@ -441,7 +441,7 @@
|
||||
/* u2_bn_hook():
|
||||
**
|
||||
** Execute hook from core.
|
||||
*/
|
||||
*/
|
||||
u2_noun // transfer
|
||||
u2_bn_hook(u2_wire wir_r,
|
||||
u2_noun cor, // retain
|
||||
|
@ -7,7 +7,7 @@
|
||||
/* u2_loom_benx: tracing, profiling, debugging
|
||||
*/
|
||||
typedef struct _u2_loom_benx {
|
||||
/* Source position debug stack:
|
||||
/* Source position debug stack:
|
||||
**
|
||||
** *(list ~[* [@ @] [@ @]])
|
||||
*/
|
||||
@ -15,7 +15,7 @@
|
||||
|
||||
/* Manual context debug stack:
|
||||
**
|
||||
** *(list %{nap})
|
||||
** *(list %{nap})
|
||||
*/
|
||||
u2_weak zof; // on shed
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
u2_bean
|
||||
u2_bx_post(u2_ray wir_r,
|
||||
u2_noun* zat,
|
||||
u2_noun* zof,
|
||||
u2_noun* zof,
|
||||
c3_d* sap_d,
|
||||
c3_d* cop_d,
|
||||
c3_d* det_d,
|
||||
@ -130,13 +130,13 @@
|
||||
|
||||
/* u2_bx_copy(): note `cop` copied words.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_bx_copy(u2_ray wir_r,
|
||||
c3_w cop_w);
|
||||
|
||||
/* u2_bx_dent(): note 'det' identicals.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_bx_dent(u2_ray wir_r,
|
||||
c3_w det_w);
|
||||
|
||||
@ -144,8 +144,8 @@
|
||||
*/
|
||||
void
|
||||
u2_bx_shed(u2_ray wir_r,
|
||||
c3_ws wad_ws);
|
||||
|
||||
c3_ws wad_ws);
|
||||
|
||||
/* u2_bx_bask(): note `wad` allocated/freed words in basket.
|
||||
*/
|
||||
void
|
||||
@ -159,7 +159,7 @@
|
||||
|
||||
/* u2_bx_rise(): go shallower (return) in the C stack.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_bx_rise(u2_ray wir_r);
|
||||
|
||||
/* u2_bx_used(): report a user count.
|
||||
|
@ -5,7 +5,7 @@
|
||||
/** Hash-table design:
|
||||
***
|
||||
*** The cash system is a 16-way hash tree designed to
|
||||
*** scale smoothly, remaining small for small usage
|
||||
*** scale smoothly, remaining small for small usage
|
||||
*** and fast for big usage. It is also salted for use
|
||||
*** of multiple associations in the same table.
|
||||
***
|
||||
@ -14,11 +14,11 @@
|
||||
*** sample list. Matches are in every case within
|
||||
*** the salt.
|
||||
***
|
||||
*** All the nouns in the sample list are equal, but
|
||||
*** All the nouns in the sample list are equal, but
|
||||
*** duplicate. Comparing duplicates is expensive, so
|
||||
*** the hash-table stores every duplicate it finds.
|
||||
***
|
||||
*** The search key is the mug of the salt, XORed
|
||||
*** The search key is the mug of the salt, XORed
|
||||
*** with the mug of the sample. [XX - This sacrifices
|
||||
*** efficiency to internal convenience and should
|
||||
*** be replaced with direct salt.]
|
||||
@ -32,7 +32,7 @@
|
||||
*** all improbable, revert to linear search. 16 collisions
|
||||
*** on the same 31-bit key will produce storage failure.
|
||||
***
|
||||
*** Future revisions should add a reclamation mode based on
|
||||
*** Future revisions should add a reclamation mode based on
|
||||
*** the "clock algorithm" (a variant on LRU). The clock
|
||||
*** rotates around search-key space. Entries are reclaimed
|
||||
*** if they are clocked out and either key or value has a
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
/** Tunable constants.
|
||||
**/
|
||||
/* A 16-way subtable with remaining keyspace switches up to laminar
|
||||
/* A 16-way subtable with remaining keyspace switches up to laminar
|
||||
** mode when it exceeds `cash_hi` recursively counted entries, and
|
||||
** reverts to collision mode when it falls back below `cash_lo`.
|
||||
*/
|
||||
@ -150,7 +150,7 @@
|
||||
*/
|
||||
u2_ray // produce
|
||||
u2_cs_make(u2_ray ral_r);
|
||||
|
||||
|
||||
/* u2_cs_find():
|
||||
**
|
||||
** Find `sam` for `sel`, or return `u2_none`.
|
||||
|
@ -50,7 +50,7 @@
|
||||
u2_weak
|
||||
u2_ch_find(u2_ray cad_r,
|
||||
u2_noun nam);
|
||||
|
||||
|
||||
/* u2_ch_find_cell():
|
||||
**
|
||||
** Find value for `[hed tal]` in `cad`, or return `u2_none`.
|
||||
@ -68,7 +68,7 @@
|
||||
u2_ch_find_mixt(u2_ray cad_r,
|
||||
const c3_c* hed_c,
|
||||
u2_noun tal);
|
||||
|
||||
|
||||
/* u2_ch_save():
|
||||
**
|
||||
** Save `val` under `nam` in `cad`, allocating in `ral`.
|
||||
|
108
include/f/coal.h
108
include/f/coal.h
@ -7,14 +7,14 @@
|
||||
*** Generally modeled on stage 223, but ideally isolated from it.
|
||||
*** Currently depends for implementation on direct-linked jets.
|
||||
***
|
||||
*** Functions of the same name and tier may vary subtly from
|
||||
*** Functions of the same name and tier may vary subtly from
|
||||
*** kernel semantics. Be wary and read the header comment.
|
||||
***
|
||||
*** Most coal functions depend on u2_Wire, a thread-local global,
|
||||
*** which addresses all memory and other thread state. This in
|
||||
*** turn depends on u2_System.
|
||||
**/
|
||||
|
||||
|
||||
/** Globals.
|
||||
**/
|
||||
c3_global u2_ray u2_Wire; // __thread or equivalent
|
||||
@ -41,9 +41,9 @@
|
||||
# define u2z(som) u2_cz(som)
|
||||
|
||||
|
||||
/** u2_cx*: crash-only core traversal.
|
||||
/** u2_cx*: crash-only core traversal.
|
||||
***
|
||||
*** unless otherwise noted, u2_cx callers *retain* ownership of
|
||||
*** unless otherwise noted, u2_cx callers *retain* ownership of
|
||||
*** all argument nouns and pointers, and *preserve* ownership of
|
||||
*** all results.
|
||||
***
|
||||
@ -59,7 +59,7 @@
|
||||
#else
|
||||
/* u2_cx_h (u2h): head.
|
||||
*/
|
||||
u2_noun
|
||||
u2_noun
|
||||
u2_cx_h(u2_noun som);
|
||||
|
||||
/* u2_cx_t (u2t): tail.
|
||||
@ -101,12 +101,12 @@
|
||||
u2_noun* c,
|
||||
u2_noun* d,
|
||||
u2_noun* e);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/** u2_cr*: crash-free core traversal.
|
||||
***
|
||||
*** unless otherwise noted, u2_cr callers *retain* ownership of
|
||||
*** unless otherwise noted, u2_cr callers *retain* ownership of
|
||||
*** all argument nouns and pointers, and *preserve* ownership of
|
||||
*** all results.
|
||||
***
|
||||
@ -149,7 +149,7 @@
|
||||
# define u2_cr_pqrs(a, b, c, d, e, f) u2_as_pqrs(a, b, c, d, e, f)
|
||||
# define u2_cr_pqrs(a, b, c, d, e, f) u2_as_pqrs(a, b, c, d, e, f)
|
||||
# define u2_cr_met(a_y, b) u2_met(a_y, b)
|
||||
# define u2_cr_bit(a_w, b) u2_bit(a_w, b)
|
||||
# define u2_cr_bit(a_w, b) u2_bit(a_w, b)
|
||||
# define u2_cr_byte(a_w, b) u2_byte(a_w, b)
|
||||
# define u2_cr_bytes(a_w, b_w, c_y, d) u2_bytes(a_w, b_w, c_y, d)
|
||||
# define u2_cr_chop(m, f, w, t, d, s) u2_chop(m, f, w, t, d, s)
|
||||
@ -171,7 +171,7 @@
|
||||
/* u2_cr_at(): fragment `a` of `b`, or none.
|
||||
*/
|
||||
u2_weak
|
||||
u2_cr_at(u2_atom a,
|
||||
u2_cr_at(u2_atom a,
|
||||
u2_weak b);
|
||||
|
||||
/* u2_cr_mean():
|
||||
@ -189,7 +189,7 @@
|
||||
*/
|
||||
c3_w
|
||||
u2_cr_mug(u2_noun a);
|
||||
|
||||
|
||||
/* u2_cr_mug_string():
|
||||
**
|
||||
** Compute the mug of `a`, LSB first.
|
||||
@ -441,10 +441,10 @@
|
||||
u2_noun* e,
|
||||
u2_noun* f);
|
||||
|
||||
/* u2_cr_met():
|
||||
/* u2_cr_met():
|
||||
**
|
||||
** Return the size of (b) in bits, rounded up to
|
||||
** (1 << a_y).
|
||||
** (1 << a_y).
|
||||
**
|
||||
** For example, (a_y == 3) returns the size in bytes.
|
||||
*/
|
||||
@ -459,7 +459,7 @@
|
||||
c3_b
|
||||
u2_cr_bit(c3_w a_w,
|
||||
u2_atom b);
|
||||
|
||||
|
||||
/* u2_cr_byte():
|
||||
**
|
||||
** Return byte (a_w) of (b).
|
||||
@ -467,7 +467,7 @@
|
||||
c3_y
|
||||
u2_cr_byte(c3_w a_w,
|
||||
u2_atom b);
|
||||
|
||||
|
||||
/* u2_cr_bytes():
|
||||
**
|
||||
** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c).
|
||||
@ -521,12 +521,12 @@
|
||||
|
||||
/* u2_cr_string(): `a`, a text atom, as malloced C string.
|
||||
*/
|
||||
c3_c*
|
||||
c3_c*
|
||||
u2_cr_string(u2_atom a);
|
||||
|
||||
/* u2_cr_tape(): `a`, a list of bytes, as malloced C string.
|
||||
*/
|
||||
c3_y*
|
||||
c3_y*
|
||||
u2_cr_tape(u2_noun a);
|
||||
|
||||
|
||||
@ -607,7 +607,7 @@
|
||||
**
|
||||
** Create an atomic string from a list of bytes.
|
||||
*/
|
||||
u2_noun
|
||||
u2_noun
|
||||
u2_ci_duck(u2_noun a);
|
||||
|
||||
/* u2_ci_decimal():
|
||||
@ -655,7 +655,7 @@
|
||||
/* u2_cf_flat_save(): save `som` as `mod` at `pas`.
|
||||
*/
|
||||
u2_bean
|
||||
u2_cf_flat_save(u2_noun mod,
|
||||
u2_cf_flat_save(u2_noun mod,
|
||||
u2_noun pas,
|
||||
u2_noun som);
|
||||
|
||||
@ -672,16 +672,16 @@
|
||||
|
||||
/* u2_cf_list(): list all the files in directory `pas`. List of cask.
|
||||
*/
|
||||
u2_noun
|
||||
u2_noun
|
||||
u2_cf_list(u2_noun pas);
|
||||
|
||||
/* u2_cf_path(): assemble local path with noun thap and ext.
|
||||
*/
|
||||
u2_noun
|
||||
u2_cf_path(c3_c* top_c,
|
||||
c3_c* ext_c,
|
||||
u2_cf_path(c3_c* top_c,
|
||||
c3_c* ext_c,
|
||||
u2_noun tah);
|
||||
|
||||
|
||||
|
||||
/** u2_cn_*: natural constructors.
|
||||
***
|
||||
@ -746,14 +746,14 @@
|
||||
u2_noun
|
||||
u2_cn_moch(u2_noun bus,
|
||||
u2_noun fol);
|
||||
|
||||
/** u2_cs_*: general-purpose internal hash tables
|
||||
|
||||
/** u2_cs_*: general-purpose internal hash tables
|
||||
**/
|
||||
|
||||
|
||||
/** u2_cg_*: garbage collection (exception cleanup only)
|
||||
**/
|
||||
|
||||
|
||||
|
||||
/** u2_cc_*: memoization / caching
|
||||
**/
|
||||
@ -761,18 +761,18 @@
|
||||
**
|
||||
** Cache search for function (0 means nock) and sample.
|
||||
*/
|
||||
u2_weak
|
||||
u2_weak
|
||||
u2_cc_find(u2_mote fun_m,
|
||||
u2_noun sam);
|
||||
u2_noun sam);
|
||||
|
||||
/* u2_cc_save():
|
||||
**
|
||||
** Cache store for function (0 means nock), sample and product.
|
||||
*/
|
||||
u2_weak
|
||||
u2_cc_save(u2_mote fun_m,
|
||||
u2_noun sam,
|
||||
u2_noun pro);
|
||||
u2_weak
|
||||
u2_cc_save(u2_mote fun_m,
|
||||
u2_noun sam,
|
||||
u2_noun pro);
|
||||
|
||||
/* u2_cc_uniq():
|
||||
**
|
||||
@ -788,28 +788,28 @@
|
||||
u2_weak
|
||||
u2_cc_find_cell(u2_mote, u2_noun, u2_noun);
|
||||
|
||||
u2_weak
|
||||
u2_cc_find_trel(u2_mote, u2_noun, u2_noun, u2_noun);
|
||||
u2_weak
|
||||
u2_cc_find_trel(u2_mote, u2_noun, u2_noun, u2_noun);
|
||||
|
||||
u2_weak
|
||||
u2_cc_find_qual(u2_mote, u2_noun, u2_noun, u2_noun, u2_noun);
|
||||
u2_weak
|
||||
u2_cc_find_qual(u2_mote, u2_noun, u2_noun, u2_noun, u2_noun);
|
||||
|
||||
/* u2_cc_save_cell(): as u2_cc_save(), for `sam=[a b]`.
|
||||
** u2_cc_save_trel(): as u2_cc_save(), for `sam=[a b c]`.
|
||||
** u2_cc_save_qual(): as u2_cc_save(), for `sam=[a b c d]`.
|
||||
*/
|
||||
u2_weak
|
||||
u2_cc_save_cell(u2_mote, u2_noun, u2_noun, u2_noun);
|
||||
u2_weak
|
||||
u2_cc_save_cell(u2_mote, u2_noun, u2_noun, u2_noun);
|
||||
|
||||
u2_weak
|
||||
u2_cc_save_trel(u2_mote, u2_noun, u2_noun, u2_noun, u2_noun);
|
||||
u2_weak
|
||||
u2_cc_save_trel(u2_mote, u2_noun, u2_noun, u2_noun, u2_noun);
|
||||
|
||||
u2_weak
|
||||
u2_cc_save_qual(u2_ray, u2_mote, u2_noun,
|
||||
u2_noun,
|
||||
u2_noun,
|
||||
u2_noun,
|
||||
u2_noun);
|
||||
u2_weak
|
||||
u2_cc_save_qual(u2_ray, u2_mote, u2_noun,
|
||||
u2_noun,
|
||||
u2_noun,
|
||||
u2_noun,
|
||||
u2_noun);
|
||||
|
||||
/** u2_cw: exporting, printing, saving or publishing nouns.
|
||||
**/
|
||||
@ -824,7 +824,7 @@
|
||||
u2_noun
|
||||
u2_ch_molt(u2_noun som,
|
||||
...);
|
||||
|
||||
|
||||
/* u2_ch_molf():
|
||||
**
|
||||
** As u2_ch_molt(), with argument pointer.
|
||||
@ -833,7 +833,7 @@
|
||||
u2_ch_molf(u2_noun som,
|
||||
va_list vap);
|
||||
|
||||
/* u2_ch_mong():
|
||||
/* u2_ch_mong():
|
||||
**
|
||||
** Call a function by gate and sample.
|
||||
*/
|
||||
@ -844,7 +844,7 @@
|
||||
/* u2_ch_hook():
|
||||
**
|
||||
** Execute hook from core.
|
||||
*/
|
||||
*/
|
||||
u2_noun
|
||||
u2_ch_hook(u2_noun cor,
|
||||
const c3_c* tam_c);
|
||||
@ -899,7 +899,7 @@
|
||||
*/
|
||||
void
|
||||
u2_cm_poll();
|
||||
|
||||
|
||||
/* u2_cm_trip(): descend into a memory region.
|
||||
**
|
||||
** Memory allocated in the heap above is senior & frozen.
|
||||
@ -930,7 +930,7 @@
|
||||
u2_cm_ruby(u2_noun som);
|
||||
|
||||
/* u2_cm_bail(): bail out to the local trap. Does not return.
|
||||
**
|
||||
**
|
||||
** Bail structure:
|
||||
**
|
||||
** %exit
|
||||
@ -940,7 +940,7 @@
|
||||
** [%need p=*(list path)]
|
||||
**
|
||||
** c3__exit for normal exit
|
||||
** c3__fail for abnormal failure
|
||||
** c3__fail for abnormal failure
|
||||
**
|
||||
** When in doubt, fail.
|
||||
*/
|
||||
@ -1079,7 +1079,7 @@
|
||||
|
||||
/* u2_cp: profiling and debugging.
|
||||
**
|
||||
** Profiling information is automatically cleared on each
|
||||
** Profiling information is automatically cleared on each
|
||||
*/
|
||||
/* u2_cm_slab(): produce profiling record.
|
||||
*/
|
||||
@ -1142,12 +1142,12 @@
|
||||
*/
|
||||
u2_weak
|
||||
u2_ckd_by_get(u2_noun a, u2_noun b);
|
||||
|
||||
|
||||
/* u2_ckd_by_got(): map get for key `b` in map `a` with fail.
|
||||
*/
|
||||
u2_noun
|
||||
u2_ckd_by_got(u2_noun a, u2_noun b);
|
||||
|
||||
|
||||
/* u2_ckd_by_put(): map put for key `b`, value `c` in map `a`.
|
||||
*/
|
||||
u2_weak
|
||||
|
@ -38,7 +38,7 @@
|
||||
u2_ds_find(u2_wire wir_r,
|
||||
u2_noun cor); // retain
|
||||
|
||||
/* u2_ds_mine():
|
||||
/* u2_ds_mine():
|
||||
**
|
||||
** Register and/or replace core.
|
||||
*/
|
||||
@ -56,7 +56,7 @@
|
||||
u2_noun cor, // retain
|
||||
const c3_c* tam_c); // retain
|
||||
|
||||
/* u2_ds_wipe():
|
||||
/* u2_ds_wipe():
|
||||
**
|
||||
** Clear dashboard.
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@
|
||||
typedef u2_noun u2_menu;
|
||||
typedef u2_noun u2_plan;
|
||||
typedef u2_noun u2_plot;
|
||||
typedef u2_noun u2_prop;
|
||||
typedef u2_noun u2_prop;
|
||||
typedef u2_noun u2_rack;
|
||||
typedef u2_noun u2_rung;
|
||||
typedef u2_noun u2_rope;
|
||||
@ -29,7 +29,7 @@
|
||||
**/
|
||||
/** Miscellaneous operators - all old.
|
||||
**/
|
||||
/* u2_fj_op_add():
|
||||
/* u2_fj_op_add():
|
||||
**
|
||||
** Produce the sum of (a) and (b).
|
||||
*/
|
||||
@ -88,7 +88,7 @@
|
||||
u2_atom
|
||||
u2_fj_op_log(u2_wire wir_r,
|
||||
u2_atom atom);
|
||||
|
||||
|
||||
/* u2_fj_op_lsh():
|
||||
**
|
||||
** Produce (b << a).
|
||||
@ -184,10 +184,10 @@
|
||||
u2_fj_pool_add(u2_wire wir_r,
|
||||
u2_noun pig,
|
||||
u2_pool pool_sub);
|
||||
|
||||
|
||||
/* u2_fj_pool_list():
|
||||
**
|
||||
** Convert (pool) to a pseudo-randomly sorted list,
|
||||
** Convert (pool) to a pseudo-randomly sorted list,
|
||||
** prepending to (list).
|
||||
*/
|
||||
u2_list
|
||||
@ -210,7 +210,7 @@
|
||||
** Return path to node of (pig) in (pool), under (axe); or 0.
|
||||
*/
|
||||
u2_atom
|
||||
u2_fj_pool_at(u2_wire wir_r,
|
||||
u2_fj_pool_at(u2_wire wir_r,
|
||||
u2_noun pig_in,
|
||||
u2_atom axe,
|
||||
u2_pool pool);
|
||||
@ -232,7 +232,7 @@
|
||||
u2_fj_book_in(u2_noun tag_in,
|
||||
u2_book book);
|
||||
|
||||
/* u2_fj_book_get():
|
||||
/* u2_fj_book_get():
|
||||
**
|
||||
** Produce the dog in (book) matching (tag_get), or u2_none.
|
||||
*/
|
||||
@ -263,7 +263,7 @@
|
||||
|
||||
/* u2_fj_book_list():
|
||||
**
|
||||
** Convert (book) to a pseudo-randomly sorted list of (tag dog)
|
||||
** Convert (book) to a pseudo-randomly sorted list of (tag dog)
|
||||
** cells, prepending to (list).
|
||||
*/
|
||||
u2_list
|
||||
@ -273,7 +273,7 @@
|
||||
|
||||
/** Parsing.
|
||||
**/
|
||||
/* u2_fj_watt():
|
||||
/* u2_fj_watt():
|
||||
**
|
||||
** Convert `zar`, a text atom, to a gene.
|
||||
*/
|
||||
|
@ -102,13 +102,13 @@
|
||||
# define j2_pb(a, b, p) _j2_qp(p, _j2_ab(a, b))
|
||||
# define j2_pc(a, b, c, p) _j2_qp(p, _j2_abc(a, b, c))
|
||||
# define j2_pd(a, b, c, d, p) _j2_qp(p, _j2_abcd(a, b, c, d))
|
||||
# define j2_pe(a, b, c, d, e, p) _j2_qp(p, _j2_abcde(a, b, c, d, e))
|
||||
# define j2_pe(a, b, c, d, e, p) _j2_qp(p, _j2_abcde(a, b, c, d, e))
|
||||
|
||||
# define j2_pac(a, p) _j2_qpc(p, _j2_a(a))
|
||||
# define j2_pbc(a, b, p) _j2_qpc(p, _j2_ab(a, b))
|
||||
# define j2_pcc(a, b, c, p) _j2_qpc(p, _j2_abc(a, b, c))
|
||||
# define j2_pdc(a, b, c, d, p) _j2_qpc(p, _j2_abcd(a, b, c, d))
|
||||
# define j2_pec(a, b, c, d, e, p) _j2_qpc(p, _j2_abcde(a, b, c, d, e))
|
||||
# define j2_pec(a, b, c, d, e, p) _j2_qpc(p, _j2_abcde(a, b, c, d, e))
|
||||
|
||||
/** Types.
|
||||
**/
|
||||
@ -156,7 +156,7 @@
|
||||
**
|
||||
** c3__lite // does not bail
|
||||
** c3__hevy // may bail
|
||||
*/
|
||||
*/
|
||||
c3_m vok_m;
|
||||
|
||||
/* C function, on core. Declared.
|
||||
@ -194,7 +194,7 @@
|
||||
/* Control string - computed from seals.
|
||||
*/
|
||||
const c3_c* cos_c;
|
||||
|
||||
|
||||
/* Function/formula jet array. Null `fcs` terminates.
|
||||
*/
|
||||
u2_ho_jet *fan_j;
|
||||
@ -234,14 +234,14 @@
|
||||
|
||||
/** Functions.
|
||||
**/
|
||||
/* u2_ho_push():
|
||||
/* u2_ho_push():
|
||||
**
|
||||
** Push a driver hangar (corresponding to a jet shed).
|
||||
*/
|
||||
void
|
||||
u2_ho_push(void);
|
||||
|
||||
/* u2_ho_popp():
|
||||
/* u2_ho_popp():
|
||||
**
|
||||
** Pop a driver hangar.
|
||||
*/
|
||||
@ -260,7 +260,7 @@
|
||||
c3_c* // transfer
|
||||
u2_ho_cstring(u2_noun xip); // retain
|
||||
|
||||
/* u2_ho_warn():
|
||||
/* u2_ho_warn():
|
||||
**
|
||||
** Report a warning at file and line. This is assumed
|
||||
** to have no semantic effect and negligible cost.
|
||||
|
@ -83,7 +83,7 @@
|
||||
(LoomFrame == LoomFrameMax ? (LoomStop = 1) : LoomFrame++)
|
||||
# define LoomRise \
|
||||
(LoomFrame--)
|
||||
|
||||
|
||||
// # define LoomFold
|
||||
|
||||
/** Data types.
|
||||
@ -152,7 +152,7 @@
|
||||
u2_ray hed_r;
|
||||
u2_ray tel_r;
|
||||
} u2_loom_cell;
|
||||
|
||||
|
||||
/** Basic macros.
|
||||
**/
|
||||
/** Bitfield unpacking. See above.
|
||||
@ -181,7 +181,7 @@
|
||||
|
||||
# define u2_fly_is_atom(a) \
|
||||
(u2_fly_is_cat(a) || u2_dog_is_pug(a))
|
||||
|
||||
|
||||
|
||||
/** Bitfield packing. See above.
|
||||
**/
|
||||
@ -241,12 +241,12 @@
|
||||
((ray) + \
|
||||
( ((c3_w *)&((type *)0)->field) - \
|
||||
((c3_w *)0) ) \
|
||||
)
|
||||
)
|
||||
# define u2_fore(ray, type, field) \
|
||||
((ray - 1) - \
|
||||
( ((c3_w *)&((type *)0)->field) - \
|
||||
((c3_w *)0) ) \
|
||||
)
|
||||
)
|
||||
|
||||
# define u2_at(ray, type, field) \
|
||||
u2_at_ray(u2_aftr(ray, type, field))
|
||||
@ -525,7 +525,7 @@
|
||||
#if 0
|
||||
u2_bean
|
||||
u2_dust(u2_noun a)
|
||||
#else
|
||||
#else
|
||||
# define u2_dust(a) \
|
||||
(u2_fly_is_atom(a) ? u2_no : u2_yes)
|
||||
#endif
|
||||
@ -553,7 +553,7 @@
|
||||
*/
|
||||
c3_w
|
||||
u2_mug(u2_noun a);
|
||||
|
||||
|
||||
/* u2_mug_string():
|
||||
**
|
||||
** Compute the mug of `a`, LSB first.
|
||||
@ -730,7 +730,7 @@
|
||||
#if 0
|
||||
u2_bean
|
||||
u2_stud(u2_noun a)
|
||||
#else
|
||||
#else
|
||||
# define u2_stud(a) \
|
||||
(u2_fly_is_atom(a) ? u2_yes : u2_no)
|
||||
#endif
|
||||
@ -871,10 +871,10 @@
|
||||
|
||||
/** Atom access.
|
||||
**/
|
||||
/* u2_met():
|
||||
/* u2_met():
|
||||
**
|
||||
** Return the size of (b) in bits, rounded up to
|
||||
** (1 << a_y).
|
||||
** (1 << a_y).
|
||||
**
|
||||
** For example, (a_y == 3) returns the size in bytes.
|
||||
*/
|
||||
@ -889,7 +889,7 @@
|
||||
c3_b
|
||||
u2_bit(c3_w a_w,
|
||||
u2_atom b);
|
||||
|
||||
|
||||
/* u2_byte():
|
||||
**
|
||||
** Return byte (a_w) of (b).
|
||||
@ -897,7 +897,7 @@
|
||||
c3_y
|
||||
u2_byte(c3_w a_w,
|
||||
u2_atom b);
|
||||
|
||||
|
||||
/* u2_bytes():
|
||||
**
|
||||
** Copy bytes (a_w) through (a_w + b_w - 1) from (d) to (c).
|
||||
|
@ -70,10 +70,10 @@
|
||||
|
||||
# define u2_plow_(wir_r, pat) \
|
||||
*u2_at(u2_wire_plo_r(wir_r), u2_loom_plow, pat)
|
||||
|
||||
|
||||
/** Functions.
|
||||
**/
|
||||
/* u2_pl_boot():
|
||||
/* u2_pl_boot():
|
||||
**
|
||||
** Initialize plow support context.
|
||||
*/
|
||||
|
@ -224,7 +224,7 @@
|
||||
void
|
||||
u2_rl_ok(u2_ray ral_r,
|
||||
u2_noun som); // retain
|
||||
|
||||
|
||||
/* u2_rl_junior():
|
||||
**
|
||||
** Yes iff `dus` is junior in `ral` - ie, must be copied
|
||||
@ -251,7 +251,7 @@
|
||||
/* u2_rl_leap_part():
|
||||
**
|
||||
** Reverse and split rail, inserting partition of size `num/dem`
|
||||
** plus `tip`.
|
||||
** plus `tip`.
|
||||
**
|
||||
** Returns partition rail, `aux_r`.
|
||||
*/
|
||||
@ -293,7 +293,7 @@
|
||||
c3_w
|
||||
u2_rl_gc_mark(u2_ray ral_r);
|
||||
|
||||
/* u2_rl_gc_sweep():
|
||||
/* u2_rl_gc_sweep():
|
||||
**
|
||||
** Sweep memory, freeing unused blocks. Match live, save leaked.
|
||||
*/
|
||||
@ -450,7 +450,7 @@
|
||||
c3_w a_w,
|
||||
const c3_y* b_y);
|
||||
|
||||
/* u2_rl_cell():
|
||||
/* u2_rl_cell():
|
||||
**
|
||||
** Produce the cell `[a b]`.
|
||||
*/
|
||||
@ -489,7 +489,7 @@
|
||||
u2_rl_molt(u2_rail ral_r,
|
||||
u2_weak som, // retain
|
||||
...); // transfer
|
||||
|
||||
|
||||
/* u2_rl_molv():
|
||||
**
|
||||
** As u2_rl_molt(), by argument pointer.
|
||||
@ -621,19 +621,19 @@
|
||||
** Extend as needed...
|
||||
*/
|
||||
u2_weak // transfer
|
||||
u2_rl_find_cell(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_find_cell(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun); // retain
|
||||
u2_weak // transfer
|
||||
u2_rl_find_trel(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_find_trel(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun); // retain
|
||||
u2_weak // transfer
|
||||
u2_rl_find_qual(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_find_qual(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun); // retain
|
||||
u2_weak // transfer
|
||||
u2_rl_find_quil(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_find_quil(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
@ -647,25 +647,25 @@
|
||||
** Extended
|
||||
*/
|
||||
u2_weak // transfer
|
||||
u2_rl_save_cell(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_save_cell(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun); // transfer
|
||||
|
||||
u2_weak // transfer
|
||||
u2_rl_save_trel(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_save_trel(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun); // transfer
|
||||
|
||||
u2_weak // transfer
|
||||
u2_rl_save_qual(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_save_qual(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun); // transfer
|
||||
|
||||
u2_weak // transfer
|
||||
u2_rl_save_quil(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_rl_save_quil(u2_ray, u2_mote, u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
u2_noun, // retain
|
||||
|
@ -52,20 +52,20 @@
|
||||
|
||||
/** Functions.
|
||||
**/
|
||||
/* u2_sh_init():
|
||||
/* u2_sh_init():
|
||||
**
|
||||
** Initialize shed, with parent if any.
|
||||
*/
|
||||
void
|
||||
u2_sh_init(u2_wire wir_r);
|
||||
|
||||
|
||||
/* u2_sh_find(): find chip by core, or none. Includes validate.
|
||||
*/
|
||||
u2_weak // senior
|
||||
u2_sh_find(u2_wire wir_r,
|
||||
u2_noun cor); // retain
|
||||
|
||||
/* u2_sh_mine():
|
||||
/* u2_sh_mine():
|
||||
**
|
||||
** Register and/or replace core.
|
||||
*/
|
||||
|
@ -74,7 +74,7 @@
|
||||
/* Number of samples in interpreted code.
|
||||
*/
|
||||
c3_d erp_d;
|
||||
} wer;
|
||||
} wer;
|
||||
|
||||
/* Profiling.
|
||||
*/
|
||||
@ -163,7 +163,7 @@
|
||||
/* u2_tx_done(): produce a profile slab to render. Close tracing.
|
||||
**
|
||||
** type:
|
||||
*/
|
||||
*/
|
||||
u2_noun // produce
|
||||
u2_tx_done(u2_ray wir_r);
|
||||
|
||||
@ -221,24 +221,24 @@
|
||||
*/
|
||||
# define u2_tx_add_mem(ral_r, det_ws) \
|
||||
( (0 == ral_r) ? u2_tx_add_men(ral_r, det_ws) \
|
||||
: u2_tx_add_bek(0, det_ws)
|
||||
: u2_tx_add_bek(0, det_ws)
|
||||
|
||||
/* u2_tx_did_act(): record user actions.
|
||||
*/
|
||||
void
|
||||
u2_tx_did_act(u2_ray wir_r,
|
||||
void
|
||||
u2_tx_did_act(u2_ray wir_r,
|
||||
u2_noun did); // retain
|
||||
|
||||
/* u2_tx_sys_bit(): set system bit, returning old value.
|
||||
*/
|
||||
u2_bean
|
||||
u2_tx_sys_bit(u2_ray wir_r,
|
||||
u2_tx_sys_bit(u2_ray wir_r,
|
||||
u2_bean val);
|
||||
|
||||
/* u2_tx_glu_bit(): set glue bit within system bit.
|
||||
*/
|
||||
u2_bean
|
||||
u2_tx_glu_bit(u2_ray wir_r,
|
||||
u2_tx_glu_bit(u2_ray wir_r,
|
||||
u2_bean val);
|
||||
/** Tasks.
|
||||
**/
|
||||
@ -247,7 +247,7 @@
|
||||
** u2_yes iff the task is not already in the stack.
|
||||
*/
|
||||
u2_bean
|
||||
u2_tx_task_in(u2_ray wir_r,
|
||||
u2_tx_task_in(u2_ray wir_r,
|
||||
u2_noun tak); // retain
|
||||
|
||||
/* u2_tx_task_out(): leave a task for profiling purposes.
|
||||
|
@ -26,7 +26,7 @@
|
||||
const c3_c* src_c,
|
||||
const c3_c* dat_c,
|
||||
const c3_c* oxt_c,
|
||||
u2_life nex_l);
|
||||
u2_life nex_l);
|
||||
|
||||
/* u2_ux_live(): load/reload a monitored source; u2_yes for change.
|
||||
*/
|
||||
|
@ -49,7 +49,7 @@
|
||||
} u2_loom_wire;
|
||||
|
||||
# define u2_wire_bas_r(wir_r) *u2_at(wir_r, u2_loom_wire, bas_r)
|
||||
# define u2_wire_des_r(wir_r) u2_aftr(wir_r, u2_loom_wire, des_s)
|
||||
# define u2_wire_des_r(wir_r) u2_aftr(wir_r, u2_loom_wire, des_s)
|
||||
# define u2_wire_kit_r(wir_r) *u2_at(wir_r, u2_loom_wire, kit_r)
|
||||
# define u2_wire_bex_r(wir_r) *u2_at(wir_r, u2_loom_wire, bex_r)
|
||||
# define u2_wire_rac_r(wir_r) *u2_at(wir_r, u2_loom_wire, rac_r)
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
# define FirstKernel 164
|
||||
# define DefaultKernel 164
|
||||
|
||||
|
||||
#define RECK
|
||||
|
||||
/** Data types.
|
||||
@ -26,7 +26,7 @@
|
||||
/* u2_hbod: http body block. Also used for responses.
|
||||
*/
|
||||
typedef struct _u2_hbod {
|
||||
struct _u2_hbod* nex_u;
|
||||
struct _u2_hbod* nex_u;
|
||||
c3_w len_w;
|
||||
c3_y hun_y[0];
|
||||
} u2_hbod;
|
||||
@ -34,7 +34,7 @@
|
||||
/* u2_hrat: http parser state.
|
||||
*/
|
||||
typedef enum {
|
||||
u2_hreq_non,
|
||||
u2_hreq_non,
|
||||
u2_hreq_nam,
|
||||
u2_hreq_val
|
||||
} u2_hrat;
|
||||
@ -58,7 +58,7 @@
|
||||
u2_hmet_nop, // virtual method
|
||||
u2_hmet_other // ie, unsupported
|
||||
} u2_hmet;
|
||||
|
||||
|
||||
/* u2_hreq: incoming http request.
|
||||
*/
|
||||
typedef struct _u2_hreq {
|
||||
@ -70,7 +70,7 @@
|
||||
c3_c* url_c; // url
|
||||
u2_bean liv; // keepalive
|
||||
u2_bean end; // all responses added
|
||||
u2_hhed* hed_u; // headers
|
||||
u2_hhed* hed_u; // headers
|
||||
u2_hbod* bod_u; // body parts (exit)
|
||||
u2_hbod* dob_u; // body parts (entry)
|
||||
struct _u2_hreq* nex_u; // next in request queue
|
||||
@ -94,7 +94,7 @@
|
||||
uv_tcp_t wax_u; // event handler state
|
||||
c3_w coq_l; // connection number
|
||||
c3_w seq_l; // next request number
|
||||
struct _u2_http* htp_u; // backlink to server
|
||||
struct _u2_http* htp_u; // backlink to server
|
||||
struct _u2_hcon* nex_u; // next in server's list
|
||||
struct _u2_hreq* ruc_u; // request under construction
|
||||
struct _u2_hreq* req_u; // exit of request queue
|
||||
@ -118,7 +118,7 @@
|
||||
u2_hrat rat_e; // parser state
|
||||
void* par_u; // struct http_parser *
|
||||
c3_w sas_w; // status code
|
||||
u2_hhed* hed_u; // headers
|
||||
u2_hhed* hed_u; // headers
|
||||
u2_hbod* bod_u; // exit of body queue
|
||||
u2_hbod* dob_u; // entry of body queue
|
||||
} u2_cres;
|
||||
@ -143,7 +143,7 @@
|
||||
*/
|
||||
typedef struct _u2_ccon { // client connection
|
||||
uv_tcp_t wax_u; // i/o handler state
|
||||
uv_connect_t cot_u; // connection handler state
|
||||
uv_connect_t cot_u; // connection handler state
|
||||
uv_getaddrinfo_t adr_u; // resolver state
|
||||
u2_csat sat_e; // connection state
|
||||
c3_c* hot_c; // hostname
|
||||
@ -205,7 +205,7 @@
|
||||
/* u2_ubuf: unix tty i/o buffer.
|
||||
*/
|
||||
typedef struct _u2_ubuf {
|
||||
struct _u2_ubuf* nex_u;
|
||||
struct _u2_ubuf* nex_u;
|
||||
c3_w len_w;
|
||||
c3_y hun_y[0]; // bytes to send
|
||||
} u2_ubuf;
|
||||
@ -225,7 +225,7 @@
|
||||
} mir;
|
||||
|
||||
struct { // escape code control
|
||||
u2_bean ape; // escape received
|
||||
u2_bean ape; // escape received
|
||||
u2_bean bra; // bracket or O received
|
||||
} esc;
|
||||
|
||||
@ -282,7 +282,7 @@
|
||||
*/
|
||||
typedef struct _u2_unod {
|
||||
uv_fs_event_t was_u; // stat watcher
|
||||
u2_bean dir; // always
|
||||
u2_bean dir; // always
|
||||
u2_bean dry; // ie, unmodified
|
||||
c3_c* pax_c; // absolute path
|
||||
struct _u2_udir* par_u; // in directory
|
||||
@ -330,7 +330,7 @@
|
||||
struct _u2_usig* nex_u;
|
||||
} u2_usig;
|
||||
|
||||
/* u2_unix: clay support system, also
|
||||
/* u2_unix: clay support system, also
|
||||
*/
|
||||
typedef struct _u2_unix {
|
||||
uv_timer_t tim_u; // clay timer
|
||||
@ -352,14 +352,14 @@
|
||||
typedef struct {
|
||||
struct {
|
||||
const c3_y* kcuu1_y; // key_up
|
||||
const c3_y* kcud1_y; // key_down
|
||||
const c3_y* kcud1_y; // key_down
|
||||
const c3_y* kcub1_y; // key_back
|
||||
const c3_y* kcuf1_y; // key_forward
|
||||
c3_w max_w; // maximum input sequence length
|
||||
} inn;
|
||||
struct {
|
||||
const c3_y* clear_y; // clear_screen
|
||||
const c3_y* el_y; // clr_bol clear to beginning
|
||||
const c3_y* el_y; // clr_bol clear to beginning
|
||||
// const c3_y* el1_y; // clr_eol clear to end
|
||||
const c3_y* ed_y; // clear to end of screen
|
||||
const c3_y* bel_y; // bel sound bell
|
||||
@ -368,7 +368,7 @@
|
||||
const c3_y* cuu1_y; // parm_up
|
||||
const c3_y* cud1_y; // parm_down
|
||||
// const c3_y* cub_y; // parm_left_cursor #num
|
||||
// const c3_y* cuf_y; // parm_right_cursor #num
|
||||
// const c3_y* cuf_y; // parm_right_cursor #num
|
||||
} out;
|
||||
} u2_utfo;
|
||||
|
||||
@ -492,7 +492,7 @@
|
||||
typedef struct _u2_opts {
|
||||
c3_c* cpu_c;
|
||||
c3_c* imp_c;
|
||||
c3_c* hom_c;
|
||||
c3_c* hom_c;
|
||||
c3_c* nam_c;
|
||||
c3_c* raf_c;
|
||||
c3_w kno_w;
|
||||
@ -524,7 +524,7 @@
|
||||
uv_loop_t* lup_u; // libuv event loop
|
||||
u2_http* htp_u; // http servers
|
||||
u2_cttp ctp_u; // http clients
|
||||
u2_utty* uty_u; // all terminals
|
||||
u2_utty* uty_u; // all terminals
|
||||
u2_utty* tem_u; // main terminal (1)
|
||||
u2_ames sam_u; // packet interface
|
||||
u2_save sav_u; // autosave
|
||||
@ -578,14 +578,14 @@
|
||||
** platform OS will not ignore them, of course, so they must be detected
|
||||
** and counteracted. Perhaps this phenomenon will soon find an endpoint.
|
||||
*/
|
||||
/* u2_time_sec_in(): urbit seconds from unix time.
|
||||
/* u2_time_sec_in(): urbit seconds from unix time.
|
||||
**
|
||||
** Adjust (externally) for future leap secs!
|
||||
*/
|
||||
c3_d
|
||||
u2_time_sec_in(c3_w unx_w);
|
||||
|
||||
/* u2_time_sec_out(): unix time from urbit seconds.
|
||||
/* u2_time_sec_out(): unix time from urbit seconds.
|
||||
**
|
||||
** Adjust (externally) for future leap secs!
|
||||
*/
|
||||
@ -660,7 +660,7 @@
|
||||
u2_noun
|
||||
u2_walk(u2_reck* rec_u, const c3_c* dir_c, u2_noun old);
|
||||
|
||||
/* u2_path(): C unix path in computer for file or directory.
|
||||
/* u2_path(): C unix path in computer for file or directory.
|
||||
*/
|
||||
c3_c*
|
||||
u2_path(u2_bean fyl, u2_noun pax);
|
||||
@ -727,9 +727,9 @@
|
||||
/* u2_reck_http_request(): hear http request on channel.
|
||||
*/
|
||||
void
|
||||
u2_reck_http_request(u2_reck* rec_u,
|
||||
u2_reck_http_request(u2_reck* rec_u,
|
||||
u2_bean sec,
|
||||
u2_noun pox,
|
||||
u2_noun pox,
|
||||
u2_noun req);
|
||||
|
||||
/* u2_reck_http_respond(): apply http response.
|
||||
@ -759,7 +759,7 @@
|
||||
|
||||
/* u2_reck_keep(): measure timer.
|
||||
*/
|
||||
u2_noun
|
||||
u2_noun
|
||||
u2_reck_keep(u2_reck* rec_u, u2_noun hap);
|
||||
|
||||
/* u2_reck_pike(): poke with floating core.
|
||||
@ -791,7 +791,7 @@
|
||||
*/
|
||||
void
|
||||
u2_reck_time(u2_reck* rec_u);
|
||||
|
||||
|
||||
/* u2_reck_wind(): set the reck time artificially.
|
||||
*/
|
||||
void
|
||||
@ -902,7 +902,7 @@
|
||||
*/
|
||||
void
|
||||
u2_term_ef_ctlc(void);
|
||||
|
||||
|
||||
/* u2_term_ef_bake(): initial effects for new server.
|
||||
*/
|
||||
void
|
||||
@ -916,19 +916,19 @@
|
||||
|
||||
/* u2_term_io_init(): initialize terminal I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_term_io_init(void);
|
||||
|
||||
/* u2_term_io_exit(): terminate terminal I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_term_io_exit(void);
|
||||
|
||||
/* u2_term_io_poll(): update terminal IO state.
|
||||
*/
|
||||
void
|
||||
u2_term_io_poll(void);
|
||||
|
||||
|
||||
/* u2_term_io_hija(): hijack console for cooked print.
|
||||
*/
|
||||
FILE*
|
||||
@ -957,7 +957,7 @@
|
||||
|
||||
/* u2_ames_io_init(): initialize ames I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_ames_io_init(void);
|
||||
|
||||
/* u2_ames_io_talk(): bring up listener.
|
||||
@ -967,7 +967,7 @@
|
||||
|
||||
/* u2_ames_io_exit(): terminate ames I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_ames_io_exit(void);
|
||||
|
||||
/* u2_ames_io_poll(): update ames IO state.
|
||||
@ -984,12 +984,12 @@
|
||||
|
||||
/* u2_save_io_init(): initialize autosave.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_save_io_init(void);
|
||||
|
||||
/* u2_save_io_exit(): terminate autosave.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_save_io_exit(void);
|
||||
|
||||
/* u2_save_io_poll(): update autosave state.
|
||||
@ -999,7 +999,7 @@
|
||||
|
||||
/** Storage, new school.
|
||||
**/
|
||||
/* u2_unix_ef_hold():
|
||||
/* u2_unix_ef_hold():
|
||||
*/
|
||||
void
|
||||
u2_unix_ef_hold();
|
||||
@ -1028,7 +1028,7 @@
|
||||
|
||||
/* u2_unix_io_init(): initialize storage.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_unix_io_init(void);
|
||||
|
||||
/* u2_unix_io_talk(): start listening for fs events.
|
||||
@ -1038,7 +1038,7 @@
|
||||
|
||||
/* u2_unix_io_exit(): terminate storage.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_unix_io_exit(void);
|
||||
|
||||
/* u2_unix_io_poll(): update storage state.
|
||||
@ -1051,12 +1051,12 @@
|
||||
**/
|
||||
/* u2_batz_io_init(): initialize batz timer.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_batz_io_init(void);
|
||||
|
||||
/* u2_batz_io_exit(): terminate timer.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_batz_io_exit(void);
|
||||
|
||||
/* u2_batz_io_poll(): update batz IO state.
|
||||
@ -1067,7 +1067,7 @@
|
||||
|
||||
/** HTTP server.
|
||||
**/
|
||||
/* u2_http_ef_thou(): send %thou effect to http.
|
||||
/* u2_http_ef_thou(): send %thou effect to http.
|
||||
*/
|
||||
void
|
||||
u2_http_ef_thou(c3_l coq_l,
|
||||
@ -1087,7 +1087,7 @@
|
||||
|
||||
/* u2_http_io_init(): initialize http I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_http_io_init(void);
|
||||
|
||||
/* u2_http_io_talk(): start http listener.
|
||||
@ -1097,7 +1097,7 @@
|
||||
|
||||
/* u2_http_io_exit(): terminate http I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_http_io_exit(void);
|
||||
|
||||
/* u2_http_io_poll(): update http IO state.
|
||||
@ -1199,12 +1199,12 @@
|
||||
|
||||
/* u2_cttp_io_init(): initialize cttp I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_cttp_io_init(void);
|
||||
|
||||
/* u2_cttp_io_exit(): terminate cttp I/O.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u2_cttp_io_exit(void);
|
||||
|
||||
/* u2_cttp_io_poll(): update cttp IO state.
|
||||
|
68
v/cttp.c
68
v/cttp.c
@ -23,7 +23,7 @@
|
||||
#include "all.h"
|
||||
#include "v/vere.h"
|
||||
|
||||
/* Forward declarations.
|
||||
/* Forward declarations.
|
||||
*/
|
||||
static void _cttp_ccon_kick(u2_ccon* coc_u);
|
||||
static void _cttp_ccon_fill(u2_ccon* coc_u);
|
||||
@ -180,7 +180,7 @@ _cttp_heds_math(u2_hhed* hed_u, u2_noun mah)
|
||||
{
|
||||
if ( u2_nul == mah ) {
|
||||
return hed_u;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u2_noun n_mah = u2h(mah);
|
||||
u2_noun pn_mah = u2h(n_mah);
|
||||
@ -332,7 +332,7 @@ _cttp_mcut_pfix(c3_c* buf_c, c3_w len_w, u2_noun hat)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* _cttp_mcut_pork(): measure/cut path/extension.
|
||||
/* _cttp_mcut_pork(): measure/cut path/extension.
|
||||
*/
|
||||
static c3_w
|
||||
_cttp_mcut_pork(c3_c* buf_c, c3_w len_w, u2_noun pok)
|
||||
@ -383,7 +383,7 @@ _cttp_mcut_url(c3_c* buf_c, c3_w len_w, u2_noun pul)
|
||||
{
|
||||
u2_noun q_pul = u2h(u2t(pul));
|
||||
u2_noun r_pul = u2t(u2t(pul));
|
||||
|
||||
|
||||
// len_w = _cttp_mcut_pfix(buf_c, len_w, u2k(p_pul));
|
||||
len_w = _cttp_mcut_char(buf_c, len_w, '/');
|
||||
len_w = _cttp_mcut_pork(buf_c, len_w, u2k(q_pul));
|
||||
@ -658,37 +658,37 @@ _cttp_cres_start(u2_creq* ceq_u)
|
||||
|
||||
/* _cttp_ccon_wax(): connection from wax_u.
|
||||
*/
|
||||
static u2_ccon*
|
||||
static u2_ccon*
|
||||
_cttp_ccon_wax(uv_tcp_t* wax_u)
|
||||
{
|
||||
u2_ccon* coc_u = 0;
|
||||
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)wax_u) -
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)wax_u) -
|
||||
(((c3_y *)(void *)&(coc_u->wax_u)) - ((c3_y *)(void *)(coc_u))) );
|
||||
}
|
||||
|
||||
/* _cttp_ccon_cot(): connection from cot_u.
|
||||
*/
|
||||
static u2_ccon*
|
||||
static u2_ccon*
|
||||
_cttp_ccon_cot(uv_connect_t* cot_u)
|
||||
{
|
||||
u2_ccon* coc_u = 0;
|
||||
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)cot_u) -
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)cot_u) -
|
||||
(((c3_y *)(void *)&(coc_u->cot_u)) - ((c3_y *)(void *)(coc_u))) );
|
||||
}
|
||||
|
||||
/* _cttp_ccon_adr(): connection from adr_u.
|
||||
*/
|
||||
static u2_ccon*
|
||||
static u2_ccon*
|
||||
_cttp_ccon_adr(uv_getaddrinfo_t* adr_u)
|
||||
{
|
||||
u2_ccon* coc_u = 0;
|
||||
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)adr_u) -
|
||||
return (u2_ccon*)(void *)
|
||||
( ((c3_y *)(void *)adr_u) -
|
||||
(((c3_y *)(void *)&(coc_u->adr_u)) - ((c3_y *)(void *)(coc_u))) );
|
||||
}
|
||||
|
||||
@ -708,7 +708,7 @@ _cttp_ccon_waste(u2_ccon* coc_u, c3_c* msg_c)
|
||||
}
|
||||
_cttp_creq_free(ceq_u);
|
||||
}
|
||||
|
||||
|
||||
free(coc_u->hot_c);
|
||||
_cttp_bods_free(coc_u->rub_u);
|
||||
|
||||
@ -756,14 +756,14 @@ _cttp_ccon_reboot(u2_ccon* coc_u)
|
||||
_cttp_ccon_waste(coc_u, "could not resolve address");
|
||||
break;
|
||||
}
|
||||
case u2_csat_addr: {
|
||||
case u2_csat_addr: {
|
||||
/* Got an address but not a connection. Waste it.
|
||||
*/
|
||||
_cttp_ccon_waste(coc_u, "connection failed");
|
||||
break;
|
||||
}
|
||||
case u2_csat_live: {
|
||||
/* We had a connection but it broke. Either there are no
|
||||
/* We had a connection but it broke. Either there are no
|
||||
** living requests, in which case waste; otherwise reset.
|
||||
*/
|
||||
if ( 0 == coc_u->ceq_u ) {
|
||||
@ -844,14 +844,14 @@ _cttp_ccon_kick_resolve(u2_ccon* coc_u)
|
||||
|
||||
c3_assert(u2_csat_dead == coc_u->sat_e);
|
||||
|
||||
snprintf(por_c, 7, "%d", 65535 & coc_u->por_s);
|
||||
snprintf(por_c, 7, "%d", 65535 & coc_u->por_s);
|
||||
memset(&hin_u, 0, sizeof(struct addrinfo));
|
||||
hin_u.ai_family = PF_INET;
|
||||
hin_u.ai_socktype = SOCK_STREAM;
|
||||
hin_u.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
if ( 0 != uv_getaddrinfo(u2L, &coc_u->adr_u,
|
||||
_cttp_ccon_kick_resolve_cb,
|
||||
if ( 0 != uv_getaddrinfo(u2L, &coc_u->adr_u,
|
||||
_cttp_ccon_kick_resolve_cb,
|
||||
coc_u->hot_c, por_c, &hin_u) )
|
||||
{
|
||||
_cttp_ccon_fail(coc_u, u2_yes);
|
||||
@ -894,9 +894,9 @@ _cttp_ccon_kick_connect(u2_ccon* coc_u)
|
||||
add_u.sin_port = htons(coc_u->por_s);
|
||||
add_u.sin_addr.s_addr = htonl(coc_u->ipf_w);
|
||||
|
||||
if ( 0 != uv_tcp_connect(&coc_u->cot_u,
|
||||
&coc_u->wax_u,
|
||||
add_u,
|
||||
if ( 0 != uv_tcp_connect(&coc_u->cot_u,
|
||||
&coc_u->wax_u,
|
||||
add_u,
|
||||
_cttp_ccon_kick_connect_cb) )
|
||||
{
|
||||
_cttp_ccon_fail(coc_u, u2_yes);
|
||||
@ -1052,10 +1052,10 @@ _cttp_ccon_kick(u2_ccon* coc_u)
|
||||
default: c3_assert(0);
|
||||
|
||||
case u2_csat_dead: {
|
||||
_cttp_ccon_kick_resolve(coc_u);
|
||||
_cttp_ccon_kick_resolve(coc_u);
|
||||
break;
|
||||
}
|
||||
case u2_csat_addr: {
|
||||
case u2_csat_addr: {
|
||||
_cttp_ccon_kick_connect(coc_u);
|
||||
break;
|
||||
}
|
||||
@ -1090,7 +1090,7 @@ _cttp_ccon_new(u2_bean sec, c3_s por_s, c3_c* hot_c)
|
||||
if ( u2_Host.ctp_u.coc_u ) {
|
||||
coc_u->nex_u = u2_Host.ctp_u.coc_u;
|
||||
u2_Host.ctp_u.coc_u->pre_u = coc_u;
|
||||
}
|
||||
}
|
||||
u2_Host.ctp_u.coc_u = coc_u;
|
||||
|
||||
return coc_u;
|
||||
@ -1136,7 +1136,7 @@ _cttp_creq_new(c3_l num_l, u2_noun hes)
|
||||
u2_noun pul = u2h(hes);
|
||||
u2_noun hat = u2h(pul);
|
||||
u2_noun sec = u2h(hat);
|
||||
u2_noun pus = u2h(u2t(hat));
|
||||
u2_noun pus = u2h(u2t(hat));
|
||||
u2_noun hot = u2t(u2t(hat));
|
||||
u2_noun moh = u2t(hes);
|
||||
u2_noun meh = u2h(moh);
|
||||
@ -1171,7 +1171,7 @@ _cttp_creq_new(c3_l num_l, u2_noun hes)
|
||||
u2z(hes);
|
||||
return ceq_u;
|
||||
}
|
||||
|
||||
|
||||
/* _cttp_ccon_fire_body(): attach body to request buffers.
|
||||
*/
|
||||
static void
|
||||
@ -1188,7 +1188,7 @@ _cttp_ccon_fire_body(u2_ccon* coc_u, u2_hbod *rub_u)
|
||||
|
||||
/* _cttp_ccon_fire_str(): attach string to request buffers.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_cttp_ccon_fire_str(u2_ccon* coc_u, const c3_c* str_c)
|
||||
{
|
||||
_cttp_ccon_fire_body(coc_u, _cttp_bod(strlen(str_c), (const c3_y*)str_c));
|
||||
@ -1210,7 +1210,7 @@ _cttp_ccon_fire_heds(u2_ccon* coc_u,
|
||||
*/
|
||||
static void
|
||||
_cttp_ccon_fire(u2_ccon* coc_u, u2_creq* ceq_u)
|
||||
{
|
||||
{
|
||||
switch ( ceq_u->met_e ) {
|
||||
default: c3_assert(0);
|
||||
|
||||
@ -1254,14 +1254,14 @@ _cttp_ccon_fill(u2_ccon* coc_u)
|
||||
while ( ceq_u ) {
|
||||
//
|
||||
// Fun POST handling. To minimize the likelihood that
|
||||
// a connection accident will disrupt a POST (it can't
|
||||
// a connection accident will disrupt a POST (it can't
|
||||
// be utterly ruled out, because POST sucks), we ensure
|
||||
// that there is always some request queued above the
|
||||
// POST. To do this, we always throw in a NOP before XX should
|
||||
// the POST. But if there is actually something real
|
||||
// before the POST, we don't need it.
|
||||
//
|
||||
// So before a POST, there is always a sequence of
|
||||
//
|
||||
// So before a POST, there is always a sequence of
|
||||
// idempotent requests, or if nothing else NOT, whose
|
||||
// completion directly triggers the POST. This way,
|
||||
// it's very unlikely for idling to break a POST.
|
||||
@ -1299,14 +1299,14 @@ _cttp_ccon_send(u2_ccon* coc_u, u2_creq* ceq_u)
|
||||
coc_u->qec_u->nex_u = ceq_u;
|
||||
coc_u->qec_u = ceq_u;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* u2_cttp_ef_thus(): send %thus effect (outgoing request) to cttp.
|
||||
*/
|
||||
void
|
||||
u2_cttp_ef_thus(c3_l num_l,
|
||||
u2_noun cuq)
|
||||
{
|
||||
{
|
||||
if ( u2_nul == cuq ) {
|
||||
uL(fprintf(uH, "thus: cancel?\n"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user