Moar ghetto.

This commit is contained in:
C. Guy Yarvin 2016-08-04 10:59:59 -07:00
parent 74be202fd6
commit 0f6e59d8a0
5 changed files with 65 additions and 9 deletions

View File

@ -963,6 +963,7 @@
# define c3__sgts c3_s4('s','g','t','s')
# define c3__sgwt c3_s4('s','g','w','t')
# define c3__sgzp c3_s4('s','g','z','p')
# define c3__shiv c3_s4('s','h','i','v')
# define c3__show c3_s4('s','h','o','w')
# define c3__shud c3_s4('s','h','u','d')
# define c3__shut c3_s4('s','h','u','t')

View File

@ -69,6 +69,11 @@
void
u3t_slog(u3_noun hod);
/* u3t_shiv(): atom-only print.
*/
void
u3t_shiv(u3_noun hod);
/* u3t_heck(): profile point.
*/
void

View File

@ -93,6 +93,14 @@ _n_hint(u3_noun zep,
return _n_nock_on(bus, nex);
}
case c3__shiv: {
u3t_off(noc_o);
u3t_shiv(hod);
u3t_on(noc_o);
return _n_nock_on(bus, nex);
}
case c3__germ: {
u3_noun pro = _n_nock_on(bus, nex);

View File

@ -38,32 +38,54 @@ u3t_drop(void)
extern void
u3_lo_tank(c3_l tab_l, u3_noun tac);
/* u3t_slog(): print directly.
#ifdef GHETTO
/* _t_ghetto(): ghetto timelapse.
*/
void
u3t_slog(u3_noun hod)
_t_ghetto(void)
{
#ifdef GHETTO
static int old;
static struct timeval b4, f2, d0;
static c3_d b4_d;
c3_w ms_w;
if ( old ) {
gettimeofday(&f2, 0);
timersub(&f2, &b4, &d0);
ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000);
if (ms_w > 10) {
printf("%6d.%02dms ", ms_w, (int) (d0.tv_usec % 1000) / 10);
if (ms_w > 1) {
#if 0
printf("%6d.%02dms: %9d ",
ms_w, (int) (d0.tv_usec % 1000) / 10,
((int) (u3R->pro.nox_d - b4_d)));
#else
printf("%6d.%02dms ",
ms_w, (int) (d0.tv_usec % 1000) / 10);
#endif
gettimeofday(&b4, 0);
b4_d = u3R->pro.nox_d;
}
else {
printf(" ");
}
}
else gettimeofday(&b4, 0);
else {
gettimeofday(&b4, 0);
b4_d = u3R->pro.nox_d;
}
old = 1;
}
#endif
/* u3t_slog(): print directly.
*/
void
u3t_slog(u3_noun hod)
{
#ifdef GHETTO
_t_ghetto();
#endif
if ( c3y == u3du(hod) ) {
u3_noun pri = u3h(hod);
@ -77,6 +99,24 @@ u3t_slog(u3_noun hod)
u3z(hod);
}
/* u3t_shiv(): quick print.
*/
void
u3t_shiv(u3_noun hod)
{
#ifdef GHETTO
_t_ghetto();
#endif
if ( c3n == u3ud(hod) ) {
}
else {
c3_c *str_c = u3r_string(hod);
printf("%s\r\n", str_c);
free(str_c);
}
}
/* u3t_heck(): profile point.
*/
void

View File

@ -1566,9 +1566,11 @@ _raft_punk(u3_noun ovo)
#ifdef GHETTO
struct timeval b4, f2, d0;
gettimeofday(&b4, 0);
#if 0
if( c3__belt != u3h(u3t(ovo)) ){
uL(fprintf(uH, "%%soft %s\n", txt_c));
uL(fprintf(uH, ":%s\n", txt_c));
}
#endif
#endif
gon = u3m_soft(sec_w, u3v_poke, u3k(ovo));
@ -1582,7 +1584,7 @@ _raft_punk(u3_noun ovo)
ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000);
clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow
if(c3__belt != u3h(u3t(ovo)) || clr_w != 2){
uL(fprintf(uH, "\x1b[3%dm%%punk %s %4d.%02dms\x1b[0m\n",
uL(fprintf(uH, "\x1b[3%dm%%%s %4d.%02dms\x1b[0m\n",
clr_w, txt_c, ms_w, (int) (d0.tv_usec % 1000) / 10));
}
free(txt_c);