2014-09-04 07:44:53 +04:00
|
|
|
/* include/g/m.h
|
|
|
|
**
|
|
|
|
** This file is in the public domain.
|
|
|
|
*/
|
|
|
|
/** System management.
|
|
|
|
**/
|
2014-09-23 21:11:59 +04:00
|
|
|
/* u3_cm_boot(): set up top-level road.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-24 11:38:37 +04:00
|
|
|
u3_cm_boot(c3_o nuu_o);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_trap(): setjmp within road.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
#if 0
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_bean
|
|
|
|
u3_cm_trap(void);
|
2014-09-04 07:44:53 +04:00
|
|
|
#else
|
2014-09-06 00:13:24 +04:00
|
|
|
# define u3_cm_trap() (u3_noun)(setjmp(u3R->esc.buf))
|
2014-09-04 07:44:53 +04:00
|
|
|
#endif
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_bail(): bail out. Does not return.
|
2014-09-04 07:44:53 +04:00
|
|
|
**
|
|
|
|
** Bail motes:
|
|
|
|
**
|
|
|
|
** %exit :: semantic failure
|
|
|
|
** %evil :: bad crypto
|
|
|
|
** %intr :: interrupt
|
|
|
|
** %fail :: execution failure
|
|
|
|
** %foul :: assert failure
|
|
|
|
** %need :: network block
|
|
|
|
** %meme :: out of memory
|
|
|
|
*/
|
|
|
|
c3_i
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_bail(c3_m how_m);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_dump(): dump the current road to stderr.
|
2014-09-05 23:55:16 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_dump(void);
|
2014-09-05 23:55:16 +04:00
|
|
|
|
2014-09-10 20:06:30 +04:00
|
|
|
/* u3_cm_file(): load file, as atom, or bail.
|
|
|
|
*/
|
2014-09-10 20:45:39 +04:00
|
|
|
u3_noun
|
2014-09-10 20:06:30 +04:00
|
|
|
u3_cm_file(c3_c* pas_c);
|
|
|
|
|
2014-09-07 04:09:29 +04:00
|
|
|
/* u3_cm_clear(): clear all allocated data in road.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_cm_clear(void);
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_error(): bail out with %exit, ct_pushing error.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
c3_i
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_error(c3_c* str_c);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_grab(): garbage-collect memory. Asserts u3R == u3H.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_grab(void);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_check(): checkpoint memory to file. Asserts u3R == u3H.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_check(void);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_fall(): return to parent road.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_fall(void);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-10-01 10:34:30 +04:00
|
|
|
/* u3_cm_leap(): in u3R, create a new road within the existing one.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-10-01 10:34:30 +04:00
|
|
|
u3_cm_leap(c3_w pad_w);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-15 05:45:49 +04:00
|
|
|
/* u3_cm_wash(): wash all lazy mugs. RETAIN.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_cm_wash(u3_noun som);
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_golf(): record cap length for u3_flog().
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
c3_w
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_golf(void);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_flog(): pop the cap.
|
2014-09-04 07:44:53 +04:00
|
|
|
**
|
|
|
|
** A common sequence for inner allocation is:
|
|
|
|
**
|
2014-09-06 00:13:24 +04:00
|
|
|
** c3_w gof_w = u3_cm_golf();
|
|
|
|
** u3_cm_leap();
|
2014-09-04 07:44:53 +04:00
|
|
|
** // allocate some inner stuff...
|
2014-09-06 00:13:24 +04:00
|
|
|
** u3_cm_fall();
|
2014-09-04 07:44:53 +04:00
|
|
|
** // inner stuff is still valid, but on cap
|
2014-09-06 00:13:24 +04:00
|
|
|
** u3_cm_flog(gof_w);
|
2014-09-04 07:44:53 +04:00
|
|
|
**
|
2014-09-06 00:13:24 +04:00
|
|
|
** u3_cm_flog(0) simply clears the cap.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_flog(c3_w gof_w);
|
2014-09-04 07:44:53 +04:00
|
|
|
|
2014-09-10 20:45:39 +04:00
|
|
|
/* u3_cm_soft(): system soft wrapper. unifies unix and nock errors.
|
2014-09-10 20:06:30 +04:00
|
|
|
**
|
|
|
|
** Produces [%$ result] or [%error (list tank)].
|
|
|
|
*/
|
2014-09-10 20:45:39 +04:00
|
|
|
u3_noun
|
|
|
|
u3_cm_soft(c3_w sec_w, u3_funk fun_f, u3_noun arg);
|
2014-09-10 20:06:30 +04:00
|
|
|
|
2014-10-01 10:34:30 +04:00
|
|
|
/* u3_cm_soft_top(): top-level safety wrapper.
|
|
|
|
*/
|
|
|
|
u3_noun
|
|
|
|
u3_cm_soft_top(c3_w pad_w,
|
|
|
|
u3_funk fun_f,
|
|
|
|
u3_noun arg);
|
|
|
|
|
|
|
|
/* u3_cm_soft_run(): descend into virtualization context.
|
|
|
|
*/
|
|
|
|
u3_noun
|
|
|
|
u3_cm_soft_run(u3_noun fly,
|
|
|
|
u3_funq fun_f,
|
|
|
|
u3_noun aga,
|
|
|
|
u3_noun agb);
|
|
|
|
|
|
|
|
/* u3_cm_soft_esc(): namespace lookup. Produces direct result.
|
|
|
|
*/
|
|
|
|
u3_noun
|
|
|
|
u3_cm_soft_esc(u3_noun sam);
|
|
|
|
|
2014-09-06 00:13:24 +04:00
|
|
|
/* u3_cm_water(): produce high and low watermarks. Asserts u3R == u3H.
|
2014-09-04 07:44:53 +04:00
|
|
|
*/
|
|
|
|
void
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_cm_water(c3_w *low_w, c3_w *hig_w);
|
2014-09-12 04:41:26 +04:00
|
|
|
|
|
|
|
/* u3_cm_pretty(): dumb prettyprint to string. RETAIN.
|
|
|
|
*/
|
|
|
|
c3_c*
|
|
|
|
u3_cm_pretty(u3_noun som);
|
|
|
|
|
|
|
|
/* u3_cm_p(): dumb print with caption. RETAIN.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_cm_p(const c3_c* cap_c, u3_noun som);
|
2014-09-27 04:27:35 +04:00
|
|
|
|
|
|
|
/* u3_cm_tape(): dump a tape to stdout.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_cm_tape(u3_noun tep);
|
|
|
|
|
|
|
|
/* u3_cm_wall(): dump a wall to stdout.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
u3_cm_wall(u3_noun wol);
|