void crono_print (const crono_t *cr) { printf ("start "); tv_print (&cr->cr_start); printf (" elapsed "); tv_print (&cr->cr_elapsed); }
void tmout_print (timeout_t handle) { struct timeout *tmout; assert (is_valid_handle (handle)); tmout = &(table_[handle]); printf ("at "); crono_print (&(tmout->to_crono)); printf (" max "); tv_print (&(tmout->to_maxval)); }
/* * Print a type. * The occurs check for mu-types makes this quadratic, but I can't * think of anything better (and maybe it's not too bad). */ local void pr_c_ty_value(FILE *f, Cell *type, int context) { Op *op; int prec; Bool is_mu; DefType *tcons; Cell *targ; type = deref(type); is_mu = type->c_class == C_VOID || occurs(type, type); prec = is_mu ? PREC_MU : n_ty_precedence(type); if (prec < context) (void)fprintf(f, "("); if (is_mu) { var_count++; type->c_varno = var_count; (void)fprintf(f, "%s ", n_mu); tv_print(f, (Natural)(type->c_varno - 1)); (void)fprintf(f, " %s ", n_gives); } switch (type->c_class) { case C_TVAR: if (type->c_varno == 0) { var_count++; type->c_varno = var_count; } tv_print(f, (Natural)(type->c_varno - 1)); when C_VOID: tv_print(f, (Natural)(type->c_varno - 1)); when C_TCONS: ASSERT( type->c_abbr->c_class == C_TSUB ); tcons = type->c_abbr->c_tcons; targ = type->c_abbr->c_targ; ASSERT( tcons->dt_arity == 0 || targ->c_class == C_TLIST ); /* mark it as a VAR in case we encounter it recursively */ type->c_class = C_TVAR; if (tcons->dt_arity == 2 && tcons->dt_tupled && (op = op_lookup(tcons->dt_name)) != NULL) { /* infix */ pr_c_ty_value(f, targ->c_head, LeftPrec(op)); (void)fprintf(f, " %s ", tcons->dt_name); pr_c_ty_value(f, targ->c_tail->c_head, RightPrec(op)); } else if (tcons->dt_tupled) { (void)fprintf(f, "%s (", tcons->dt_name); pr_c_ty_value(f, targ->c_head, PREC_BODY); for (targ = targ->c_head; targ != NOCELL; targ = targ->c_tail) { ASSERT( targ->c_class == C_TLIST ); (void)fprintf(f, ", "); pr_c_ty_value(f, targ->c_head, PREC_BODY); } (void)fprintf(f, ")"); } else { (void)fprintf(f, "%s", tcons->dt_name); for ( ; targ != NOCELL; targ = targ->c_tail) { ASSERT( targ->c_class == C_TLIST ); (void)fprintf(f, " "); pr_c_ty_value(f, targ->c_head, PREC_ARG); } } type->c_class = C_TCONS; otherwise: NOT_REACHED; } if (prec < context) (void)fprintf(f, ")"); }
void bulb_print(char *dest, tv_t tv) { if (tv < 0120) sprintf(dest, "%2i'", BULB_MN(tv)); else tv_print(dest, BULB_TV(tv)); }