chiark / gitweb /
@@@ man wip
[mLib] / test / tvec-output.c
index 5210d11e25b1b63305a3d4c3b359bd8100a9229b..cacd94cdbd24d50c5a25938a4c9afe8da96d0a00 100644 (file)
@@ -416,38 +416,6 @@ static int layout_string(struct layout *lyt, const char *p, size_t sz)
 #undef PUT_CHAR
 #undef SAVE_PFXTAIL
 
 #undef PUT_CHAR
 #undef SAVE_PFXTAIL
 
-/*----- Skeleton ----------------------------------------------------------*/
-/*
-static void ..._bsession(struct tvec_output *o, struct tvec_state *tv)
-static int ..._esession(struct tvec_output *o)
-static void ..._bgroup(struct tvec_output *o)
-static void ..._skipgroup(struct tvec_output *o,
-                         const char *excuse, va_list *ap)
-static void ..._egroup(struct tvec_output *o)
-static void ..._btest(struct tvec_output *o)
-static void ..._skip(struct tvec_output *o, const char *excuse, va_list *ap)
-static void ..._fail(struct tvec_output *o, const char *detail, va_list *ap)
-static void ..._dumpreg(struct tvec_output *o, unsigned disp,
-                       union tvec_regval *rv, const struct tvec_regdef *rd)
-static void ..._etest(struct tvec_output *o, unsigned outcome)
-static void ..._bbench(struct tvec_output *o,
-                      const char *ident, unsigned unit)
-static void ..._ebench(struct tvec_output *o,
-                      const char *ident, unsigned unit,
-                      const struct tvec_timing *t)
-static void ..._error(struct tvec_output *o, const char *msg, va_list *ap)
-static void ..._notice(struct tvec_output *o, const char *msg, va_list *ap)
-static void ..._destroy(struct tvec_output *o)
-
-static const struct tvec_outops ..._ops = {
-  ..._bsession, ..._esession,
-  ..._bgroup, ..._egroup, ..._skip,
-  ..._btest, ..._skip, ..._fail, ..._dumpreg, ..._etest,
-  ..._bbench, ..._ebench,
-  ..._error, ..._notice,
-  ..._destroy
-};
-*/
 /*----- Human-readable output ---------------------------------------------*/
 
 /* Attributes for colour output.  This should be done better, but @terminfo@
 /*----- Human-readable output ---------------------------------------------*/
 
 /* Attributes for colour output.  This should be done better, but @terminfo@
@@ -705,7 +673,8 @@ static int human_nwritef(void *go, size_t maxsz, const char *p, ...)
   va_start(ap, p);
   n = gprintf_memputf(&h->outbuf, &h->outsz, maxsz, p, ap);
   va_end(ap);
   va_start(ap, p);
   n = gprintf_memputf(&h->outbuf, &h->outsz, maxsz, p, ap);
   va_end(ap);
-  return (layout_string(&h->lyt, h->outbuf, n));
+  if (layout_string(&h->lyt, h->outbuf, n)) return (-1);
+  return (n);
 }
 
 static const struct gprintf_ops human_printops =
 }
 
 static const struct gprintf_ops human_printops =
@@ -1305,10 +1274,20 @@ struct tap_output {
  */
 
 static int tap_writech(void *go, int ch)
  */
 
 static int tap_writech(void *go, int ch)
-  { struct tap_output *t = go; return (layout_char(&t->lyt, ch)); }
+{
+  struct tap_output *t = go;
+
+  if (layout_char(&t->lyt, ch)) return (-1);
+  else return (1);
+}
 
 static int tap_writem(void *go, const char *p, size_t sz)
 
 static int tap_writem(void *go, const char *p, size_t sz)
-  { struct tap_output *t = go; return (layout_string(&t->lyt, p, sz)); }
+{
+  struct tap_output *t = go;
+
+  if (layout_string(&t->lyt, p, sz)) return (-1);
+  else return (sz);
+}
 
 static int tap_nwritef(void *go, size_t maxsz, const char *p, ...)
 {
 
 static int tap_nwritef(void *go, size_t maxsz, const char *p, ...)
 {
@@ -1319,7 +1298,8 @@ static int tap_nwritef(void *go, size_t maxsz, const char *p, ...)
   va_start(ap, p);
   n = gprintf_memputf(&t->outbuf, &t->outsz, maxsz, p, ap);
   va_end(ap);
   va_start(ap, p);
   n = gprintf_memputf(&t->outbuf, &t->outsz, maxsz, p, ap);
   va_end(ap);
-  return (layout_string(&t->lyt, t->outbuf, n));
+  if (layout_string(&t->lyt, t->outbuf, n)) return (-1);
+  return (n);
 }
 
 static const struct gprintf_ops tap_printops =
 }
 
 static const struct gprintf_ops tap_printops =