adds -S to skip battery hashes

This commit is contained in:
Joe Bryan 2018-10-01 19:56:14 -04:00
parent 8d9f2fac89
commit b1f8b79992
4 changed files with 47 additions and 26 deletions

View File

@ -24,7 +24,8 @@
u3o_check_fatal = 0x8, // check: unrecoverable
u3o_verbose = 0x10, // be remarkably wordy
u3o_dryrun = 0x20, // don't touch checkpoint
u3o_quiet = 0x40 // disable ~&
u3o_quiet = 0x40, // disable ~&
u3o_hashless = 0x80 // disable hashboard
};
/** Globals.

View File

@ -504,6 +504,7 @@
c3_o fak; // -F, fake carrier
c3_o fog; // -X, skip last event
c3_o gab; // -g, run with garbage collector
c3_o has; // -S, Skip battery hashes
c3_o git; // -s, pill url from arvo git hash
c3_o mem; // -M, memory madness
c3_o net; // -N, remote networking in -F mode

View File

@ -104,6 +104,10 @@ c3_w* u3qe_jam_buf(u3_noun, c3_w* bit_w);
static u3_noun
_cj_bash(u3_noun bat)
{
if ( u3C.wag_w & u3o_hashless ) {
return u3_nul;
}
u3_weak pro;
u3a_road* rod_u = u3R;
while ( 1 ) {
@ -648,16 +652,19 @@ _cj_spot(u3_noun cor, u3_weak* bas)
if ( u3_none == *bas ) {
*bas = _cj_bash(u3h(cor));
}
u3_weak act = _cj_spot_hot(cor, *bas, &loc);
if ( u3_none != act ) {
reg = _cj_gust(reg, _cj_loc_axe(loc), _cj_loc_pel(loc), u3k(loc));
u3h_put(u3R->jed.cod_p, u3h(cor), u3nc(u3k(*bas), u3k(reg)));
/* caution: could overwrites old value, debug batteries etc.
** old value contains old _cj_jit (from different
** battery). if we change jit to (map battery *),
** will need to merge with that map here.
*/
u3h_put(u3R->jed.war_p, loc, act);
if ( !(u3C.wag_w & u3o_hashless) ) {
u3_weak act = _cj_spot_hot(cor, *bas, &loc);
if ( u3_none != act ) {
reg = _cj_gust(reg, _cj_loc_axe(loc), _cj_loc_pel(loc), u3k(loc));
u3h_put(u3R->jed.cod_p, u3h(cor), u3nc(u3k(*bas), u3k(reg)));
/* caution: could overwrites old value, debug batteries etc.
** old value contains old _cj_jit (from different
** battery). if we change jit to (map battery *),
** will need to merge with that map here.
*/
u3h_put(u3R->jed.war_p, loc, act);
}
}
}
if ( u3_none != bak ) {
@ -1774,22 +1781,26 @@ _cj_mine(u3_noun cey, u3_noun cor, u3_noun bas)
u3m_p("new jet", bal);
fprintf(stderr, " bat %x, jax %d\r\n", u3r_mug(bat), jax_l);
#endif
if ( jax_l ) {
c3_y dig_y[32];
c3_w i_w;
u3_noun i = bal;
fprintf(stderr, "hot jet: ");
while ( i != u3_nul ) {
_cj_print_tas(stderr, u3h(i));
i = u3t(i);
if ( !(u3C.wag_w & u3o_hashless) ) {
if ( jax_l ) {
c3_y dig_y[32];
c3_w i_w;
u3_noun i = bal;
fprintf(stderr, "hot jet: ");
while ( i != u3_nul ) {
_cj_print_tas(stderr, u3h(i));
i = u3t(i);
}
fprintf(stderr, "\r\n axe %d, jax %d,\r\n bash ", axe, jax_l);
u3r_bytes(0, 32, dig_y, bas);
for ( i_w = 32; i_w > 0; ) {
fprintf(stderr, "%02x", dig_y[--i_w]);
}
fprintf(stderr, "\r\n");
}
fprintf(stderr, "\r\n axe %d, jax %d,\r\n bash ", axe, jax_l);
u3r_bytes(0, 32, dig_y, bas);
for ( i_w = 32; i_w > 0; ) {
fprintf(stderr, "%02x", dig_y[--i_w]);
}
fprintf(stderr, "\r\n");
}
hap = _cj_warm_hump(jax_l, u3t(u3t(loc)));
act = u3nq(jax_l, hap, bal, _cj_jit(jax_l, bat));
u3h_put(u3R->jed.cod_p, bat, u3nc(u3k(bas), reg));

View File

@ -81,6 +81,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.fog = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
u3_Host.ops_u.has = c3n;
u3_Host.ops_u.net = c3n;
u3_Host.ops_u.mem = c3n;
u3_Host.ops_u.nuu = c3n;
@ -91,7 +92,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"G:B:A:H:I:w:u:t:f:k:l:n:p:r:NabcdgqsvxFMPDXR")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"G:B:A:H:I:w:u:t:f:k:l:n:p:r:NabcdgqsvxFMPDXRS")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
@ -186,6 +187,7 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'q': { u3_Host.ops_u.qui = c3y; break; }
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case 's': { u3_Host.ops_u.git = c3y; break; }
case 'S': { u3_Host.ops_u.has = c3y; break; }
case '?': default: {
return c3n;
}
@ -596,6 +598,12 @@ main(c3_i argc,
if ( _(u3_Host.ops_u.dry) ) {
u3C.wag_w |= u3o_dryrun;
}
/* Set hashboard flag
*/
if ( _(u3_Host.ops_u.has) ) {
u3C.wag_w |= u3o_hashless;
}
}
u3m_boot(u3_Host.ops_u.nuu,
u3_Host.ops_u.gab,