urbit/include/noun/nock.h

124 lines
3.3 KiB
C
Raw Normal View History

2014-11-08 01:54:59 +03:00
/* i/n/n.h
2014-09-04 07:44:53 +04:00
**
** This file is in the public domain.
*/
/** Data structures.
***
**/
2018-04-30 23:32:39 +03:00
/* u3n_memo: %memo hint space
*/
typedef struct {
c3_l sip_l;
u3_noun key;
} u3n_memo;
2018-04-30 23:32:39 +03:00
/* u3n_prog: program compiled from nock
*/
typedef struct _u3n_prog {
struct {
2018-04-30 23:32:39 +03:00
c3_o own_o; // program owns ops_y?
c3_w len_w; // length of bytecode (bytes)
c3_y* ops_y; // actual array of bytes
} byc_u; // bytecode
struct {
2018-04-30 23:32:39 +03:00
c3_w len_w; // number of literals
u3_noun* non; // array of literals
} lit_u; // literals
struct {
2018-04-30 23:32:39 +03:00
c3_w len_w; // number of memo slots
u3n_memo* sot_u; // array of memo slots
} mem_u; // memo slot data
struct {
2018-04-30 23:32:39 +03:00
c3_w len_w; // number of calls sites
u3j_site* sit_u; // array of sites
} cal_u; // call site data
struct {
2018-04-30 23:32:39 +03:00
c3_w len_w; // number of registration sites
u3j_rite* rit_u; // array of sites
} reg_u; // registration site data
} u3n_prog;
2014-11-06 03:02:36 +03:00
/** Functions.
**/
2014-11-06 03:20:01 +03:00
/* u3n_nock_on(): produce .*(bus fol).
2014-11-06 03:02:36 +03:00
*/
u3_noun
2014-11-06 03:20:01 +03:00
u3n_nock_on(u3_noun bus, u3_noun fol);
2014-11-06 03:02:36 +03:00
2018-05-26 04:17:19 +03:00
/* u3n_find(): return prog for given formula,
* split by key (u3_nul for none). RETAIN.
*/
2018-04-30 21:02:48 +03:00
u3p(u3n_prog)
u3n_find(u3_noun key, u3_noun fol);
/* u3n_burn(): execute u3n_prog with bus as subject.
*/
u3_noun
2018-04-30 20:56:19 +03:00
u3n_burn(u3p(u3n_prog) pog_p, u3_noun bus);
2014-11-06 03:20:01 +03:00
/* u3n_slam_on(): produce (gat sam).
2014-11-06 03:02:36 +03:00
*/
u3_noun
2014-11-06 03:20:01 +03:00
u3n_slam_on(u3_noun gat, u3_noun sam);
2014-11-06 03:02:36 +03:00
2014-11-06 03:20:01 +03:00
/* u3n_kick_on(): fire `gat` without changing the sample.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2014-11-06 03:20:01 +03:00
u3n_kick_on(u3_noun gat);
2014-11-06 03:02:36 +03:00
2016-02-02 22:52:10 +03:00
/* u3n_nock_in(): produce .*(bus fol), as ++toon, in namespace.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2016-02-02 22:52:10 +03:00
u3n_nock_in(u3_noun fly, u3_noun bus, u3_noun fol);
2014-11-06 03:02:36 +03:00
2016-02-02 22:52:10 +03:00
/* u3n_nock_it(): produce .*(bus fol), as ++toon, in namespace.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2016-02-02 22:52:10 +03:00
u3n_nock_it(u3_noun sea, u3_noun bus, u3_noun fol);
2014-11-06 03:02:36 +03:00
2016-02-04 00:33:43 +03:00
/* u3n_nock_et(): produce .*(bus fol), as ++toon, in namespace.
*/
u3_noun
u3n_nock_et(u3_noun gul, u3_noun bus, u3_noun fol);
2016-02-02 22:52:10 +03:00
/* u3n_slam_in(): produce (gat sam), as ++toon, in namespace.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2016-02-02 22:52:10 +03:00
u3n_slam_in(u3_noun fly, u3_noun gat, u3_noun sam);
2014-11-06 03:02:36 +03:00
2016-02-02 22:52:10 +03:00
/* u3n_slam_it(): produce (gat sam), as ++toon, in namespace.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2016-02-02 22:52:10 +03:00
u3n_slam_it(u3_noun sea, u3_noun gat, u3_noun sam);
2014-11-06 03:02:36 +03:00
2016-02-04 00:33:43 +03:00
/* u3n_slam_et(): produce (gat sam), as ++toon, in namespace.
*/
u3_noun
u3n_slam_it(u3_noun gul, u3_noun gat, u3_noun sam);
2014-11-06 03:20:01 +03:00
/* u3n_nock_an(): as slam_in(), but with empty fly.
2014-11-06 03:02:36 +03:00
*/
u3_noun
2014-11-06 03:20:01 +03:00
u3n_nock_an(u3_noun bus, u3_noun fol);
2018-02-05 21:27:39 +03:00
2018-04-30 21:39:33 +03:00
/* u3n_reap(): promote bytecode state.
2018-02-05 21:27:39 +03:00
*/
2018-04-18 22:19:56 +03:00
void
2018-04-30 21:39:33 +03:00
u3n_reap(u3p(u3h_root) har_p);
2018-04-30 21:39:33 +03:00
/* u3n_mark(): mark bytecode cache.
*/
2018-04-18 22:19:56 +03:00
c3_w
2018-04-30 21:39:33 +03:00
u3n_mark(void);
2018-03-12 20:58:41 +03:00
2018-04-30 21:39:33 +03:00
/* u3n_free(): free bytecode cache.
2018-03-12 20:58:41 +03:00
*/
2018-04-18 22:19:56 +03:00
void
2018-04-30 21:39:33 +03:00
u3n_free(void);
2018-04-18 22:19:56 +03:00
/* u3n_ream(): refresh after restoring from checkpoint.
*/
void
u3n_ream(void);