reindented everything according to .indent.pro
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 23 May 2007 21:33:45 +0000 (21:33 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 23 May 2007 21:33:45 +0000 (21:33 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@1078 a5681a0c-68f1-0310-ab6d-d61299d08faa

58 files changed:
src/.indent.pro
src/art_rgba_svp.c
src/art_rgba_svp.h
src/fnv.h
src/gdpng.c
src/hash_32.c
src/parsetime.c
src/pngsize.c
src/rrd.h
src/rrd_afm.c
src/rrd_afm.h
src/rrd_afm_data.c
src/rrd_afm_data.h
src/rrd_cgi.c
src/rrd_create.c
src/rrd_diff.c
src/rrd_dump.c
src/rrd_error.c
src/rrd_fetch.c
src/rrd_first.c
src/rrd_format.c
src/rrd_format.h
src/rrd_getopt.c
src/rrd_getopt.h
src/rrd_getopt1.c
src/rrd_gfx.c
src/rrd_gfx.h
src/rrd_graph.c
src/rrd_graph.h
src/rrd_graph_helper.c
src/rrd_hw.c
src/rrd_hw.h
src/rrd_info.c
src/rrd_is_thread_safe.h
src/rrd_last.c
src/rrd_lastupdate.c
src/rrd_nan_inf.c
src/rrd_nan_inf.h
src/rrd_not_thread_safe.c
src/rrd_open.c
src/rrd_resize.c
src/rrd_restore.c
src/rrd_rpncalc.c
src/rrd_rpncalc.h
src/rrd_stat.c
src/rrd_thread_safe.c
src/rrd_thread_safe_nt.c
src/rrd_tool.c
src/rrd_tool.h
src/rrd_tune.c
src/rrd_update.c
src/rrd_version.c
src/rrd_xport.c
src/rrd_xport.h
src/rrdupdate.c
src/strftime.c
src/strftime.h
src/win32comp.c

index 66f8e13..4ba2c34 100644 (file)
@@ -1,6 +1,7 @@
 --blank-lines-after-declarations
 --blank-lines-after-procedures
 --break-before-boolean-operator
+--break-function-decl-args
 --no-blank-lines-after-commas
 --braces-on-if-line
 --braces-on-struct-decl-line
@@ -13,7 +14,7 @@
 --else-endif-column33
 --space-after-cast
 --line-comments-indentation0
---declaration-indentation1
+--declaration-indentation10
 --dont-format-first-column-comments
 --dont-format-comments
 --honour-newlines
@@ -32,3 +33,8 @@
 --case-brace-indentation0
 --leave-preprocessor-space
 --no-tabs
+-T rrd_t
+-T info_t
+-T time_t
+-T off_t
+
index 25083d7..1cb96a6 100644 (file)
 #include "art_rgba_svp.h"
 #include "unused.h"
 
-static void art_rgba_fill_run (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int n);
-static void art_rgba_run_alpha (art_u8 * linebuf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n);
+static void art_rgba_fill_run(
+    art_u8 * linebuf,
+    art_u8 r,
+    art_u8 g,
+    art_u8 b,
+    int n);
+static void art_rgba_run_alpha(
+    art_u8 * linebuf,
+    art_u8 r,
+    art_u8 g,
+    art_u8 b,
+    int alpha,
+    int n);
 
 typedef struct _ArtRgbaSVPAlphaData ArtRgbaSVPAlphaData;
 
 struct _ArtRgbaSVPAlphaData {
-  int alphatab[256];
-  art_u8 r, g, b, alpha;
-  art_u8 *buf;
-  int rowstride;
-  int libart_x0, libart_x1;
+    int       alphatab[256];
+    art_u8    r, g, b, alpha;
+    art_u8   *buf;
+    int       rowstride;
+    int       libart_x0, libart_x1;
 };
 
-static void
-art_rgba_svp_alpha_callback (void *callback_data, int UNUSED(y),
-                           int start, ArtSVPRenderAAStep *steps, int n_steps)
+static void art_rgba_svp_alpha_callback(
+    void *callback_data,
+    int UNUSED(y),
+    int start,
+    ArtSVPRenderAAStep * steps,
+    int n_steps)
 {
-  ArtRgbaSVPAlphaData *data = callback_data;
-  art_u8 *linebuf;
-  int run_x0, run_x1;
-  art_u32 running_sum = start;
-  int libart_x0, libart_x1;
-  int k;
-  art_u8 r, g, b;
-  int *alphatab;
-  int alpha;
-
-  linebuf = data->buf;
-  libart_x0 = data->libart_x0;
-  libart_x1 = data->libart_x1;
-
-  r = data->r;
-  g = data->g;
-  b = data->b;
-  alphatab = data->alphatab;
-
-  if (n_steps > 0)
-    {
-      run_x1 = steps[0].x;
-      if (run_x1 > libart_x0)
-       {
-         alpha = (running_sum >> 16) & 0xff;
-         if (alpha)
-           art_rgba_run_alpha (linebuf,
-                              r, g, b, alphatab[alpha],
-                              run_x1 - libart_x0);
-       }
-
-      /* render the steps into tmpbuf */
-      for (k = 0; k < n_steps - 1; k++)
-       {
-         running_sum += steps[k].delta;
-         run_x0 = run_x1;
-         run_x1 = steps[k + 1].x;
-         if (run_x1 > run_x0)
-           {
-             alpha = (running_sum >> 16) & 0xff;
-             if (alpha)
-               art_rgba_run_alpha (linebuf + (run_x0 - libart_x0) * 4,
-                                  r, g, b, alphatab[alpha],
-                                  run_x1 - run_x0);
-           }
-       }
-      running_sum += steps[k].delta;
-      if (libart_x1 > run_x1)
-       {
-         alpha = (running_sum >> 16) & 0xff;
-         if (alpha)
-           art_rgba_run_alpha (linebuf + (run_x1 - libart_x0) * 4,
-                              r, g, b, alphatab[alpha],
-                              libart_x1 - run_x1);
-       }
-    }
-  else
-    {
-      alpha = (running_sum >> 16) & 0xff;
-      if (alpha)
-       art_rgba_run_alpha (linebuf,
-                          r, g, b, alphatab[alpha],
-                          libart_x1 - libart_x0);
+    ArtRgbaSVPAlphaData *data = callback_data;
+    art_u8   *linebuf;
+    int       run_x0, run_x1;
+    art_u32   running_sum = start;
+    int       libart_x0, libart_x1;
+    int       k;
+    art_u8    r, g, b;
+    int      *alphatab;
+    int       alpha;
+
+    linebuf = data->buf;
+    libart_x0 = data->libart_x0;
+    libart_x1 = data->libart_x1;
+
+    r = data->r;
+    g = data->g;
+    b = data->b;
+    alphatab = data->alphatab;
+
+    if (n_steps > 0) {
+        run_x1 = steps[0].x;
+        if (run_x1 > libart_x0) {
+            alpha = (running_sum >> 16) & 0xff;
+            if (alpha)
+                art_rgba_run_alpha(linebuf,
+                                   r, g, b, alphatab[alpha],
+                                   run_x1 - libart_x0);
+        }
+
+        /* render the steps into tmpbuf */
+        for (k = 0; k < n_steps - 1; k++) {
+            running_sum += steps[k].delta;
+            run_x0 = run_x1;
+            run_x1 = steps[k + 1].x;
+            if (run_x1 > run_x0) {
+                alpha = (running_sum >> 16) & 0xff;
+                if (alpha)
+                    art_rgba_run_alpha(linebuf + (run_x0 - libart_x0) * 4,
+                                       r, g, b, alphatab[alpha],
+                                       run_x1 - run_x0);
+            }
+        }
+        running_sum += steps[k].delta;
+        if (libart_x1 > run_x1) {
+            alpha = (running_sum >> 16) & 0xff;
+            if (alpha)
+                art_rgba_run_alpha(linebuf + (run_x1 - libart_x0) * 4,
+                                   r, g, b, alphatab[alpha],
+                                   libart_x1 - run_x1);
+        }
+    } else {
+        alpha = (running_sum >> 16) & 0xff;
+        if (alpha)
+            art_rgba_run_alpha(linebuf,
+                               r, g, b, alphatab[alpha],
+                               libart_x1 - libart_x0);
     }
 
-  data->buf += data->rowstride;
+    data->buf += data->rowstride;
 }
 
-static void
-art_rgba_svp_alpha_opaque_callback (void *callback_data, int UNUSED(y),
-                                  int start,
-                                  ArtSVPRenderAAStep *steps, int n_steps)
+static void art_rgba_svp_alpha_opaque_callback(
+    void *callback_data,
+    int UNUSED(y),
+    int start,
+    ArtSVPRenderAAStep * steps,
+    int n_steps)
 {
-  ArtRgbaSVPAlphaData *data = callback_data;
-  art_u8 *linebuf;
-  int run_x0, run_x1;
-  art_u32 running_sum = start;
-  int libart_x0, libart_x1;
-  int k;
-  art_u8 r, g, b;
-  int *alphatab;
-  int alpha;
-
-  linebuf = data->buf;
-  libart_x0 = data->libart_x0;
-  libart_x1 = data->libart_x1;
-
-  r = data->r;
-  g = data->g;
-  b = data->b;
-  alphatab = data->alphatab;
-
-  if (n_steps > 0)
-    {
-      run_x1 = steps[0].x;
-      if (run_x1 > libart_x0)
-       {
-         alpha = running_sum >> 16;
-         if (alpha)
-           {
-             if (alpha >= 255)
-               art_rgba_fill_run (linebuf,
-                                 r, g, b,
-                                 run_x1 - libart_x0);
-             else
-               art_rgba_run_alpha (linebuf,
-                                  r, g, b, alphatab[alpha],
-                                  run_x1 - libart_x0);
-           }
-       }
-
-      /* render the steps into tmpbuf */
-      for (k = 0; k < n_steps - 1; k++)
-       {
-         running_sum += steps[k].delta;
-         run_x0 = run_x1;
-         run_x1 = steps[k + 1].x;
-         if (run_x1 > run_x0)
-           {
-             alpha = running_sum >> 16;
-             if (alpha)
-               {
-                 if (alpha >= 255)
-                   art_rgba_fill_run (linebuf + (run_x0 - libart_x0) * 4,
-                                     r, g, b,
-                                     run_x1 - run_x0);
-                 else
-                   art_rgba_run_alpha (linebuf + (run_x0 - libart_x0) * 4,
-                                      r, g, b, alphatab[alpha],
-                                      run_x1 - run_x0);
-               }
-           }
-       }
-      running_sum += steps[k].delta;
-      if (libart_x1 > run_x1)
-       {
-         alpha = running_sum >> 16;
-         if (alpha)
-           {
-             if (alpha >= 255)
-               art_rgba_fill_run (linebuf + (run_x1 - libart_x0) * 4,
-                                 r, g, b,
-                                 libart_x1 - run_x1);
-             else
-               art_rgba_run_alpha (linebuf + (run_x1 - libart_x0) * 4,
-                                  r, g, b, alphatab[alpha],
-                                  libart_x1 - run_x1);
-           }
-       }
-    }
-  else
-    {
-      alpha = running_sum >> 16;
-      if (alpha)
-       {
-         if (alpha >= 255)
-           art_rgba_fill_run (linebuf,
-                             r, g, b,
-                             libart_x1 - libart_x0);
-         else
-           art_rgba_run_alpha (linebuf,
-                              r, g, b, alphatab[alpha],
-                              libart_x1 - libart_x0);
-       }
+    ArtRgbaSVPAlphaData *data = callback_data;
+    art_u8   *linebuf;
+    int       run_x0, run_x1;
+    art_u32   running_sum = start;
+    int       libart_x0, libart_x1;
+    int       k;
+    art_u8    r, g, b;
+    int      *alphatab;
+    int       alpha;
+
+    linebuf = data->buf;
+    libart_x0 = data->libart_x0;
+    libart_x1 = data->libart_x1;
+
+    r = data->r;
+    g = data->g;
+    b = data->b;
+    alphatab = data->alphatab;
+
+    if (n_steps > 0) {
+        run_x1 = steps[0].x;
+        if (run_x1 > libart_x0) {
+            alpha = running_sum >> 16;
+            if (alpha) {
+                if (alpha >= 255)
+                    art_rgba_fill_run(linebuf, r, g, b, run_x1 - libart_x0);
+                else
+                    art_rgba_run_alpha(linebuf,
+                                       r, g, b, alphatab[alpha],
+                                       run_x1 - libart_x0);
+            }
+        }
+
+        /* render the steps into tmpbuf */
+        for (k = 0; k < n_steps - 1; k++) {
+            running_sum += steps[k].delta;
+            run_x0 = run_x1;
+            run_x1 = steps[k + 1].x;
+            if (run_x1 > run_x0) {
+                alpha = running_sum >> 16;
+                if (alpha) {
+                    if (alpha >= 255)
+                        art_rgba_fill_run(linebuf + (run_x0 - libart_x0) * 4,
+                                          r, g, b, run_x1 - run_x0);
+                    else
+                        art_rgba_run_alpha(linebuf + (run_x0 - libart_x0) * 4,
+                                           r, g, b, alphatab[alpha],
+                                           run_x1 - run_x0);
+                }
+            }
+        }
+        running_sum += steps[k].delta;
+        if (libart_x1 > run_x1) {
+            alpha = running_sum >> 16;
+            if (alpha) {
+                if (alpha >= 255)
+                    art_rgba_fill_run(linebuf + (run_x1 - libart_x0) * 4,
+                                      r, g, b, libart_x1 - run_x1);
+                else
+                    art_rgba_run_alpha(linebuf + (run_x1 - libart_x0) * 4,
+                                       r, g, b, alphatab[alpha],
+                                       libart_x1 - run_x1);
+            }
+        }
+    } else {
+        alpha = running_sum >> 16;
+        if (alpha) {
+            if (alpha >= 255)
+                art_rgba_fill_run(linebuf, r, g, b, libart_x1 - libart_x0);
+            else
+                art_rgba_run_alpha(linebuf,
+                                   r, g, b, alphatab[alpha],
+                                   libart_x1 - libart_x0);
+        }
     }
 
-  data->buf += data->rowstride;
+    data->buf += data->rowstride;
 }
 
 /**
@@ -249,85 +241,96 @@ art_rgba_svp_alpha_opaque_callback (void *callback_data, int UNUSED(y),
  * according to the rule in @alphagamma, or default to linear if
  * @alphagamma is NULL.
  **/
-void
-gnome_print_art_rgba_svp_alpha (const ArtSVP *svp,
-                               int libart_x0, int libart_y0, int libart_x1, int libart_y1,
-                               art_u32 rgba,
-                               art_u8 *buf, int rowstride,
-                               ArtAlphaGamma UNUSED(*alphagamma))
+void gnome_print_art_rgba_svp_alpha(
+    const ArtSVP * svp,
+    int libart_x0,
+    int libart_y0,
+    int libart_x1,
+    int libart_y1,
+    art_u32 rgba,
+    art_u8 * buf,
+    int rowstride,
+    ArtAlphaGamma UNUSED(*alphagamma))
 {
-  ArtRgbaSVPAlphaData data;
-  int r, g, b, alpha;
-  int i;
-  int a, da;
-
-  r = rgba >> 24;
-  g = (rgba >> 16) & 0xff;
-  b = (rgba >> 8) & 0xff;
-  alpha = rgba & 0xff;
-
-  data.r = r;
-  data.g = g;
-  data.b = b;
-  data.alpha = alpha;
-
-  a = 0x8000;
-  da = (alpha * 66051 + 0x80) >> 8; /* 66051 equals 2 ^ 32 / (255 * 255) */
-
-  for (i = 0; i < 256; i++)
-    {
-      data.alphatab[i] = a >> 16;
-      a += da;
+    ArtRgbaSVPAlphaData data;
+    int       r, g, b, alpha;
+    int       i;
+    int       a, da;
+
+    r = rgba >> 24;
+    g = (rgba >> 16) & 0xff;
+    b = (rgba >> 8) & 0xff;
+    alpha = rgba & 0xff;
+
+    data.r = r;
+    data.g = g;
+    data.b = b;
+    data.alpha = alpha;
+
+    a = 0x8000;
+    da = (alpha * 66051 + 0x80) >> 8;   /* 66051 equals 2 ^ 32 / (255 * 255) */
+
+    for (i = 0; i < 256; i++) {
+        data.alphatab[i] = a >> 16;
+        a += da;
     }
 
-  data.buf = buf;
-  data.rowstride = rowstride;
-  data.libart_x0 = libart_x0;
-  data.libart_x1 = libart_x1;
-  if (alpha == 255)
-    art_svp_render_aa (svp, libart_x0, libart_y0, libart_x1, libart_y1, art_rgba_svp_alpha_opaque_callback,
-                      &data);
-  else
-    art_svp_render_aa (svp, libart_x0, libart_y0, libart_x1, libart_y1, art_rgba_svp_alpha_callback, &data);
+    data.buf = buf;
+    data.rowstride = rowstride;
+    data.libart_x0 = libart_x0;
+    data.libart_x1 = libart_x1;
+    if (alpha == 255)
+        art_svp_render_aa(svp, libart_x0, libart_y0, libart_x1, libart_y1,
+                          art_rgba_svp_alpha_opaque_callback, &data);
+    else
+        art_svp_render_aa(svp, libart_x0, libart_y0, libart_x1, libart_y1,
+                          art_rgba_svp_alpha_callback, &data);
 }
 
-static void
-art_rgba_fill_run (art_u8 * buf, art_u8 r, art_u8 g, art_u8 b, int n)
+static void art_rgba_fill_run(
+    art_u8 * buf,
+    art_u8 r,
+    art_u8 g,
+    art_u8 b,
+    int n)
 {
-       int i;
-
-       for (i = 0; i < n; i++) {
-               * buf++ = r;
-               * buf++ = g;
-               * buf++ = b;
-               * buf++ = 255;
-       }
+    int       i;
+
+    for (i = 0; i < n; i++) {
+        *buf++ = r;
+        *buf++ = g;
+        *buf++ = b;
+        *buf++ = 255;
+    }
 }
 
 /* fixme: this */
 
-static void
-art_rgba_run_alpha (art_u8 * buf, art_u8 r, art_u8 g, art_u8 b, int alpha, int n)
+static void art_rgba_run_alpha(
+    art_u8 * buf,
+    art_u8 r,
+    art_u8 g,
+    art_u8 b,
+    int alpha,
+    int n)
 {
-       int i;
-       int br, bg, bb, ba;
-       int cr, cg, cb;
-
-       for (i = 0; i < n; i++) {
-               br = * (buf + 0);
-               bg = * (buf + 1);
-               bb = * (buf + 2);
-               ba = * (buf + 3);
-
-               cr = (br * ba + 0x80) >> 8;
-               cg = (bg * ba + 0x80) >> 8;
-               cb = (bb * ba + 0x80) >> 8;
-
-               * buf++ = cr + (((r - cr) * alpha + 0x80) >> 8);
-               * buf++ = cg + (((g - cg) * alpha + 0x80) >> 8);
-               * buf++ = cb + (((b - cb) * alpha + 0x80) >> 8);
-               * buf++ = ba + (((255 - ba) * alpha + 0x80) >> 8);
-       }
+    int       i;
+    int       br, bg, bb, ba;
+    int       cr, cg, cb;
+
+    for (i = 0; i < n; i++) {
+        br = *(buf + 0);
+        bg = *(buf + 1);
+        bb = *(buf + 2);
+        ba = *(buf + 3);
+
+        cr = (br * ba + 0x80) >> 8;
+        cg = (bg * ba + 0x80) >> 8;
+        cb = (bb * ba + 0x80) >> 8;
+
+        *buf++ = cr + (((r - cr) * alpha + 0x80) >> 8);
+        *buf++ = cg + (((g - cg) * alpha + 0x80) >> 8);
+        *buf++ = cb + (((b - cb) * alpha + 0x80) >> 8);
+        *buf++ = ba + (((255 - ba) * alpha + 0x80) >> 8);
+    }
 }
-
-
index 4cac175..406cced 100644 (file)
@@ -7,11 +7,15 @@
 #include <libart_lgpl/art_svp.h>
 #include <libart_lgpl/art_uta.h>
 
-void
-gnome_print_art_rgba_svp_alpha (const ArtSVP *svp,
-                               int x0, int y0, int x1, int y1,
-                               art_u32 rgba,
-                               art_u8 *buf, int rowstride,
-                               ArtAlphaGamma *alphagamma);
+void      gnome_print_art_rgba_svp_alpha(
+    const ArtSVP * svp,
+    int x0,
+    int y0,
+    int x1,
+    int y1,
+    art_u32 rgba,
+    art_u8 * buf,
+    int rowstride,
+    ArtAlphaGamma * alphagamma);
 
-#endif /* SP_ART_RGBA_SVP_H */
+#endif                          /* SP_ART_RGBA_SVP_H */
index e69f9ce..eaea66b 100644 (file)
--- a/src/fnv.h
+++ b/src/fnv.h
@@ -99,10 +99,16 @@ typedef unsigned long Fnv32_t;
  */
 #define FNV1_32_INIT ((Fnv32_t)0x811c9dc5)
 
-Fnv32_t fnv_32_buf(const void *, size_t, Fnv32_t);
+Fnv32_t   fnv_32_buf(
+    const void *,
+    size_t,
+    Fnv32_t);
 
-Fnv32_t fnv_32_str(const char *, Fnv32_t );
+Fnv32_t   fnv_32_str(
+    const char *,
+    Fnv32_t);
 
-unsigned long FnvHash(const char *);
+unsigned long FnvHash(
+    const char *);
 
-#endif /* __FNV_H__ */
+#endif                          /* __FNV_H__ */
index 99e7db6..6b50166 100644 (file)
@@ -9,54 +9,56 @@
 #include <stdlib.h>
 
 typedef struct _jmpbuf_wrapper {
-  jmp_buf jmpbuf;
+    jmp_buf   jmpbuf;
 } jmpbuf_wrapper;
 
 static jmpbuf_wrapper gdPngJmpbufStruct;
 
-void gdImagePng(gdImagePtr im, FILE *out)
+void gdImagePng(
+    gdImagePtr im,
+    FILE * out)
 {
-    int i;
+    int       i;
     png_colorp palette;
-    png_structp png_write_ptr = 
-       png_create_write_struct(PNG_LIBPNG_VER_STRING, 
-                               (png_voidp)NULL,
-                               /* we would need to point to error handlers
-                                  here to do it properly */
-                               (png_error_ptr)NULL, (png_error_ptr)NULL);
+    png_structp png_write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+                                                        (png_voidp) NULL,
+                                                        /* we would need to point to error handlers
+                                                           here to do it properly */
+                                                        (png_error_ptr) NULL,
+                                                        (png_error_ptr) NULL);
     png_infop info_ptr = png_create_info_struct(png_write_ptr);
 
     if (setjmp(gdPngJmpbufStruct.jmpbuf)) {
-      png_destroy_write_struct(&png_write_ptr, &info_ptr);
-      return;
+        png_destroy_write_struct(&png_write_ptr, &info_ptr);
+        return;
     }
 
-    palette = (png_colorp)png_malloc (png_write_ptr,
-                                     im->colorsTotal*sizeof(png_color));
-    if (palette == NULL){
-      png_destroy_write_struct(&png_write_ptr, &info_ptr);
-      return;
+    palette = (png_colorp) png_malloc(png_write_ptr,
+                                      im->colorsTotal * sizeof(png_color));
+    if (palette == NULL) {
+        png_destroy_write_struct(&png_write_ptr, &info_ptr);
+        return;
     }
-    
-    
+
+
     png_init_io(png_write_ptr, out);
     png_set_write_status_fn(png_write_ptr, NULL);
-    png_set_IHDR(png_write_ptr,info_ptr,
-                im->sx,im->sy,im->colorsTotal > 16 ? 8:4,
-                PNG_COLOR_TYPE_PALETTE,
-                im->interlace ? PNG_INTERLACE_ADAM7: PNG_INTERLACE_NONE ,
-                PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
-    for(i=0;i<im->colorsTotal;i++){
-       palette[i].red = im->red[i];
-       palette[i].green = im->green[i];
-       palette[i].blue = im->blue[i];
+    png_set_IHDR(png_write_ptr, info_ptr,
+                 im->sx, im->sy, im->colorsTotal > 16 ? 8 : 4,
+                 PNG_COLOR_TYPE_PALETTE,
+                 im->interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE,
+                 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+    for (i = 0; i < im->colorsTotal; i++) {
+        palette[i].red = im->red[i];
+        palette[i].green = im->green[i];
+        palette[i].blue = im->blue[i];
     }
     png_set_PLTE(png_write_ptr, info_ptr, palette, im->colorsTotal);
 
     /* choose between speed (1) and space (9) optimisation */
     /* we want to be fast ... */
-    png_set_compression_level(png_write_ptr,1);
-    png_set_filter(png_write_ptr,PNG_FILTER_TYPE_BASE,PNG_NO_FILTERS);
+    png_set_compression_level(png_write_ptr, 1);
+    png_set_filter(png_write_ptr, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS);
     /* store file info */
     png_write_info(png_write_ptr, info_ptr);
     png_set_packing(png_write_ptr);
@@ -65,7 +67,3 @@ void gdImagePng(gdImagePtr im, FILE *out)
     png_free(png_write_ptr, palette);
     png_destroy_write_struct(&png_write_ptr, &info_ptr);
 }
-
-
-
-
index d7edbee..0473696 100644 (file)
@@ -65,7 +65,7 @@
 /* 
  * 32 bit magic FNV-0 and FNV-1 prime 
  */
-#define FNV_32_PRIME ((Fnv32_t)0x01000193)     
+#define FNV_32_PRIME ((Fnv32_t)0x01000193)
 
 
 /*
  * NOTE: To use the recommended 32 bit FNV-1 hash, use FNV1_32_INIT as the hval
  *      argument on the first call to either fnv_32_buf() or fnv_32_str().
  */
-Fnv32_t
-fnv_32_buf(const void *buf, size_t len, Fnv32_t hval)
+Fnv32_t fnv_32_buf(
+    const void *buf,
+    size_t len,
+    Fnv32_t hval)
 {
-    const unsigned char *bp = (const unsigned char *)buf;      /* start of buffer */
-    const unsigned char *be = bp + len;                /* beyond end of buffer */
+    const unsigned char *bp = (const unsigned char *) buf;  /* start of buffer */
+    const unsigned char *be = bp + len; /* beyond end of buffer */
 
     /*
      * FNV-1 hash each octet in the buffer
      */
     while (bp < be) {
 
-       /* multiply by the 32 bit FNV magic prime mod 2^64 */
-       hval *= FNV_32_PRIME;
+        /* multiply by the 32 bit FNV magic prime mod 2^64 */
+        hval *= FNV_32_PRIME;
 
-       /* xor the bottom with the current octet */
-       hval ^= (Fnv32_t)*bp++;
+        /* xor the bottom with the current octet */
+        hval ^= (Fnv32_t) * bp++;
     }
 
     /* return our new hash value */
@@ -124,21 +126,22 @@ fnv_32_buf(const void *buf, size_t len, Fnv32_t hval)
  * NOTE: To use the recommended 32 bit FNV-1 hash, use FNV1_32_INIT as the hval
  *      argument on the first call to either fnv_32_buf() or fnv_32_str().
  */
-Fnv32_t
-fnv_32_str(const char *str, Fnv32_t hval)
+Fnv32_t fnv_32_str(
+    const char *str,
+    Fnv32_t hval)
 {
-    const unsigned char *s = (const unsigned char *)str;       /* unsigned string */
+    const unsigned char *s = (const unsigned char *) str;   /* unsigned string */
 
     /*
      * FNV-1 hash each octet in the buffer
      */
     while (*s) {
 
-       /* multiply by the 32 bit FNV magic prime mod 2^64 */
-       hval *= FNV_32_PRIME;
+        /* multiply by the 32 bit FNV magic prime mod 2^64 */
+        hval *= FNV_32_PRIME;
 
-       /* xor the bottom with the current octet */
-       hval ^= (Fnv32_t)*s++;
+        /* xor the bottom with the current octet */
+        hval ^= (Fnv32_t) * s++;
     }
 
     /* return our new hash value */
@@ -146,7 +149,8 @@ fnv_32_str(const char *str, Fnv32_t hval)
 }
 
 /* a wrapper function for fnv_32_str */
-unsigned long FnvHash(const char *str)
+unsigned long FnvHash(
+    const char *str)
 {
-  return fnv_32_str(str,FNV1_32_INIT);
+    return fnv_32_str(str, FNV1_32_INIT);
 }
index 919dd50..508546a 100644 (file)
 
 /* Structures and unions */
 
-enum { /* symbols */
+enum {                  /* symbols */
     MIDNIGHT, NOON, TEATIME,
     PM, AM, YESTERDAY, TODAY, TOMORROW, NOW, START, END,
     SECONDS, MINUTES, HOURS, DAYS, WEEKS, MONTHS, YEARS,
@@ -128,7 +128,7 @@ enum {      /* symbols */
     JAN, FEB, MAR, APR, MAY, JUN,
     JUL, AUG, SEP, OCT, NOV, DEC,
     SUN, MON, TUE, WED, THU, FRI, SAT
-    };
+};
 
 /* the below is for plus_minus() */
 #define PREVIOUS_OP    (-1)
@@ -136,94 +136,94 @@ enum {    /* symbols */
 /* parse translation table - table driven parsers can be your FRIEND!
  */
 struct SpecialToken {
-    char *name;        /* token name */
-    int value; /* token id */
+    char     *name;     /* token name */
+    int       value;    /* token id */
 };
 static struct SpecialToken VariousWords[] = {
-    { "midnight", MIDNIGHT },  /* 00:00:00 of today or tomorrow */
-    { "noon", NOON },          /* 12:00:00 of today or tomorrow */
-    { "teatime", TEATIME },    /* 16:00:00 of today or tomorrow */
-    { "am", AM },              /* morning times for 0-12 clock */
-    { "pm", PM },              /* evening times for 0-12 clock */
-    { "tomorrow", TOMORROW },
-    { "yesterday", YESTERDAY },
-    { "today", TODAY },
-    { "now", NOW },
-    { "n", NOW },
-    { "start", START },
-    { "s", START },    
-    { "end", END },
-    { "e", END },
-
-    { "jan", JAN },
-    { "feb", FEB },
-    { "mar", MAR },
-    { "apr", APR },
-    { "may", MAY },
-    { "jun", JUN },
-    { "jul", JUL },
-    { "aug", AUG },
-    { "sep", SEP },
-    { "oct", OCT },
-    { "nov", NOV },
-    { "dec", DEC },
-    { "january", JAN },
-    { "february", FEB },
-    { "march", MAR },
-    { "april", APR },
-    { "may", MAY },
-    { "june", JUN },
-    { "july", JUL },
-    { "august", AUG },
-    { "september", SEP },
-    { "october", OCT },
-    { "november", NOV },
-    { "december", DEC },
-    { "sunday", SUN },
-    { "sun", SUN },
-    { "monday", MON },
-    { "mon", MON },
-    { "tuesday", TUE },
-    { "tue", TUE },
-    { "wednesday", WED },
-    { "wed", WED },
-    { "thursday", THU },
-    { "thu", THU },
-    { "friday", FRI },
-    { "fri", FRI },
-    { "saturday", SAT },
-    { "sat", SAT },
-    { NULL, 0 }                        /*** SENTINEL ***/
+    {"midnight", MIDNIGHT}, /* 00:00:00 of today or tomorrow */
+    {"noon", NOON},     /* 12:00:00 of today or tomorrow */
+    {"teatime", TEATIME},   /* 16:00:00 of today or tomorrow */
+    {"am", AM},         /* morning times for 0-12 clock */
+    {"pm", PM},         /* evening times for 0-12 clock */
+    {"tomorrow", TOMORROW},
+    {"yesterday", YESTERDAY},
+    {"today", TODAY},
+    {"now", NOW},
+    {"n", NOW},
+    {"start", START},
+    {"s", START},
+    {"end", END},
+    {"e", END},
+
+    {"jan", JAN},
+    {"feb", FEB},
+    {"mar", MAR},
+    {"apr", APR},
+    {"may", MAY},
+    {"jun", JUN},
+    {"jul", JUL},
+    {"aug", AUG},
+    {"sep", SEP},
+    {"oct", OCT},
+    {"nov", NOV},
+    {"dec", DEC},
+    {"january", JAN},
+    {"february", FEB},
+    {"march", MAR},
+    {"april", APR},
+    {"may", MAY},
+    {"june", JUN},
+    {"july", JUL},
+    {"august", AUG},
+    {"september", SEP},
+    {"october", OCT},
+    {"november", NOV},
+    {"december", DEC},
+    {"sunday", SUN},
+    {"sun", SUN},
+    {"monday", MON},
+    {"mon", MON},
+    {"tuesday", TUE},
+    {"tue", TUE},
+    {"wednesday", WED},
+    {"wed", WED},
+    {"thursday", THU},
+    {"thu", THU},
+    {"friday", FRI},
+    {"fri", FRI},
+    {"saturday", SAT},
+    {"sat", SAT},
+    {NULL, 0}           /*** SENTINEL ***/
 };
 
 static struct SpecialToken TimeMultipliers[] = {
-    { "second", SECONDS },     /* seconds multiplier */
-    { "seconds", SECONDS },    /* (pluralized) */
-    { "sec", SECONDS },                /* (generic) */
-    { "s", SECONDS },          /* (short generic) */
-    { "minute", MINUTES },     /* minutes multiplier */
-    { "minutes", MINUTES },    /* (pluralized) */
-    { "min", MINUTES },                /* (generic) */
-    { "m", MONTHS_MINUTES },   /* (short generic) */
-    { "hour", HOURS },         /* hours ... */
-    { "hours", HOURS },                /* (pluralized) */
-    { "hr", HOURS },           /* (generic) */
-    { "h", HOURS },            /* (short generic) */
-    { "day", DAYS },           /* days ... */
-    { "days", DAYS },          /* (pluralized) */
-    { "d", DAYS },             /* (short generic) */
-    { "week", WEEKS },         /* week ... */
-    { "weeks", WEEKS },                /* (pluralized) */
-    { "wk", WEEKS },           /* (generic) */
-    { "w", WEEKS },            /* (short generic) */
-    { "month", MONTHS },       /* week ... */
-    { "months", MONTHS },      /* (pluralized) */
-    { "mon", MONTHS },         /* (generic) */
-    { "year", YEARS },         /* year ... */
-    { "years", YEARS },                /* (pluralized) */
-    { "yr", YEARS },           /* (generic) */
-    { "y", YEARS },            /* (short generic) */
-    { NULL, 0 }                        /*** SENTINEL ***/
+    {"second", SECONDS},    /* seconds multiplier */
+    {"seconds", SECONDS},   /* (pluralized) */
+    {"sec", SECONDS},   /* (generic) */
+    {"s", SECONDS},     /* (short generic) */
+    {"minute", MINUTES},    /* minutes multiplier */
+    {"minutes", MINUTES},   /* (pluralized) */
+    {"min", MINUTES},   /* (generic) */
+    {"m", MONTHS_MINUTES},  /* (short generic) */
+    {"hour", HOURS},    /* hours ... */
+    {"hours", HOURS},   /* (pluralized) */
+    {"hr", HOURS},      /* (generic) */
+    {"h", HOURS},       /* (short generic) */
+    {"day", DAYS},      /* days ... */
+    {"days", DAYS},     /* (pluralized) */
+    {"d", DAYS},        /* (short generic) */
+    {"week", WEEKS},    /* week ... */
+    {"weeks", WEEKS},   /* (pluralized) */
+    {"wk", WEEKS},      /* (generic) */
+    {"w", WEEKS},       /* (short generic) */
+    {"month", MONTHS},  /* week ... */
+    {"months", MONTHS}, /* (pluralized) */
+    {"mon", MONTHS},    /* (generic) */
+    {"year", YEARS},    /* year ... */
+    {"years", YEARS},   /* (pluralized) */
+    {"yr", YEARS},      /* (generic) */
+    {"y", YEARS},       /* (short generic) */
+    {NULL, 0}           /*** SENTINEL ***/
 };
 
 /* File scope variables */
@@ -234,24 +234,25 @@ static struct SpecialToken TimeMultipliers[] = {
  */
 static struct SpecialToken *Specials;
 
-static const char **scp;       /* scanner - pointer at arglist */
-static char scc;       /* scanner - count of remaining arguments */
-static const char *sct;        /* scanner - next char pointer in current argument */
-static int need;       /* scanner - need to advance to next argument */
+static const char **scp;    /* scanner - pointer at arglist */
+static char scc;        /* scanner - count of remaining arguments */
+static const char *sct; /* scanner - next char pointer in current argument */
+static int need;        /* scanner - need to advance to next argument */
 
-static char *sc_token=NULL;    /* scanner - token buffer */
+static char *sc_token = NULL;   /* scanner - token buffer */
 static size_t sc_len;   /* scanner - length of token buffer */
-static int sc_tokid;   /* scanner - token id */
+static int sc_tokid;    /* scanner - token id */
 
 /* Local functions */
-static void EnsureMemFree (void);
+static void EnsureMemFree(
+    void);
 
-static void EnsureMemFree (void)
+static void EnsureMemFree(
+    void)
 {
-  if( sc_token )
-    {
-    free(sc_token);
-    sc_token = NULL;
+    if (sc_token) {
+        free(sc_token);
+        sc_token = NULL;
     }
 }
 
@@ -293,178 +294,189 @@ static void EnsureMemFree (void)
  * the most appropriate use for these is inside panic(...) 
  */
 #define MAX_ERR_MSG_LEN        1024
-static char errmsg[ MAX_ERR_MSG_LEN ];
+static char errmsg[MAX_ERR_MSG_LEN];
 
-static char *
-ve ( char *fmt, va_list ap )
+static char *ve(
+    char *fmt,
+    va_list ap)
 {
 #ifdef HAVE_VSNPRINTF
-  vsnprintf( errmsg, MAX_ERR_MSG_LEN, fmt, ap );
+    vsnprintf(errmsg, MAX_ERR_MSG_LEN, fmt, ap);
 #else
-  vsprintf( errmsg, fmt, ap );
+    vsprintf(errmsg, fmt, ap);
 #endif
-  EnsureMemFree();
-  return( errmsg );
+    EnsureMemFree();
+    return (errmsg);
 }
 
-static char *
-e ( char *fmt, ... )
+static char *e(
+    char *fmt,
+    ...)
 {
-  char *err;
-  va_list ap;
-  va_start( ap, fmt );
-  err = ve( fmt, ap );
-  va_end( ap );
-  return( err );
+    char     *err;
+    va_list   ap;
+
+    va_start(ap, fmt);
+    err = ve(fmt, ap);
+    va_end(ap);
+    return (err);
 }
 
 /* Compare S1 and S2, ignoring case, returning less than, equal to or
    greater than zero if S1 is lexicographically less than,
    equal to or greater than S2.  -- copied from GNU libc*/
-static int
-mystrcasecmp (s1, s2)
-     const char *s1;
-     const char *s2;
+static int mystrcasecmp(
+    s1,
+    s2)
+    const char *s1;
+    const char *s2;
 {
-  const unsigned char *p1 = (const unsigned char *) s1;
-  const unsigned char *p2 = (const unsigned char *) s2;
-  unsigned char c1, c2;
+    const unsigned char *p1 = (const unsigned char *) s1;
+    const unsigned char *p2 = (const unsigned char *) s2;
+    unsigned char c1, c2;
 
-  if (p1 == p2)
-    return 0;
+    if (p1 == p2)
+        return 0;
 
-  do
-    {
-      c1 = tolower (*p1++);
-      c2 = tolower (*p2++);
-      if (c1 == '\0')
-       break;
+    do {
+        c1 = tolower(*p1++);
+        c2 = tolower(*p2++);
+        if (c1 == '\0')
+            break;
     }
-  while (c1 == c2);
+    while (c1 == c2);
 
-  return c1 - c2;
+    return c1 - c2;
 }
 
 /*
  * parse a token, checking if it's something special to us
  */
-static int
-parse_token(char *arg)
+static int parse_token(
+    char *arg)
 {
-    int i;
+    int       i;
 
-    for (i=0; Specials[i].name != NULL; i++)
-       if (mystrcasecmp(Specials[i].name, arg) == 0)
-           return sc_tokid = Specials[i].value;
+    for (i = 0; Specials[i].name != NULL; i++)
+        if (mystrcasecmp(Specials[i].name, arg) == 0)
+            return sc_tokid = Specials[i].value;
 
     /* not special - must be some random id */
     return sc_tokid = ID;
-} /* parse_token */
+}                       /* parse_token */
 
 
 
 /*
  * init_scanner() sets up the scanner to eat arguments
  */
-static char *
-init_scanner(int argc, const char **argv)
+static char *init_scanner(
+    int argc,
+    const char **argv)
 {
     scp = argv;
     scc = argc;
     need = 1;
     sc_len = 1;
     while (argc-- > 0)
-       sc_len += strlen(*argv++);
+        sc_len += strlen(*argv++);
 
-    sc_token = (char *) malloc(sc_len*sizeof(char));
-    if( sc_token == NULL )
-      return "Failed to allocate memory";
+    sc_token = (char *) malloc(sc_len * sizeof(char));
+    if (sc_token == NULL)
+        return "Failed to allocate memory";
     return TIME_OK;
-} /* init_scanner */
+}                       /* init_scanner */
 
 /*
  * token() fetches a token from the input stream
  */
-static int
-token()
+static int token(
+    )
 {
-    int idx;
+    int       idx;
 
     while (1) {
-       memset(sc_token, '\0', sc_len);
-       sc_tokid = EOF;
-       idx = 0;
-
-       /* if we need to read another argument, walk along the argument list;
-        * when we fall off the arglist, we'll just return EOF forever
-        */
-       if (need) {
-           if (scc < 1)
-               return sc_tokid;
-           sct = *scp;
-           scp++;
-           scc--;
-           need = 0;
-       }
-       /* eat whitespace now - if we walk off the end of the argument,
-        * we'll continue, which puts us up at the top of the while loop
-        * to fetch the next argument in
-        */
-       while (isspace((unsigned char)*sct) || *sct == '_' || *sct == ',' )
-           ++sct;
-       if (!*sct) {
-           need = 1;
-           continue;
-       }
-
-       /* preserve the first character of the new token
-        */
-       sc_token[0] = *sct++;
-
-       /* then see what it is
-        */
-       if (isdigit((unsigned char)(sc_token[0]))) {
-           while (isdigit((unsigned char)(*sct)))
-               sc_token[++idx] = *sct++;
-           sc_token[++idx] = '\0';
-           return sc_tokid = NUMBER;
-       }
-       else if (isalpha((unsigned char)(sc_token[0]))) {
-           while (isalpha((unsigned char)(*sct)))
-               sc_token[++idx] = *sct++;
-           sc_token[++idx] = '\0';
-           return parse_token(sc_token);
-       }
-       else switch(sc_token[0]) {
-           case ':': return sc_tokid = COLON;
-           case '.': return sc_tokid = DOT;
-           case '+': return sc_tokid = PLUS;
-           case '-': return sc_tokid = MINUS;
-           case '/': return sc_tokid = SLASH;
-       default:
-        /*OK, we did not make it ... */
-           sct--;
-           return sc_tokid = EOF;
-       }
-    } /* while (1) */
-} /* token */
+        memset(sc_token, '\0', sc_len);
+        sc_tokid = EOF;
+        idx = 0;
+
+        /* if we need to read another argument, walk along the argument list;
+         * when we fall off the arglist, we'll just return EOF forever
+         */
+        if (need) {
+            if (scc < 1)
+                return sc_tokid;
+            sct = *scp;
+            scp++;
+            scc--;
+            need = 0;
+        }
+        /* eat whitespace now - if we walk off the end of the argument,
+         * we'll continue, which puts us up at the top of the while loop
+         * to fetch the next argument in
+         */
+        while (isspace((unsigned char) *sct) || *sct == '_' || *sct == ',')
+            ++sct;
+        if (!*sct) {
+            need = 1;
+            continue;
+        }
+
+        /* preserve the first character of the new token
+         */
+        sc_token[0] = *sct++;
+
+        /* then see what it is
+         */
+        if (isdigit((unsigned char) (sc_token[0]))) {
+            while (isdigit((unsigned char) (*sct)))
+                sc_token[++idx] = *sct++;
+            sc_token[++idx] = '\0';
+            return sc_tokid = NUMBER;
+        } else if (isalpha((unsigned char) (sc_token[0]))) {
+            while (isalpha((unsigned char) (*sct)))
+                sc_token[++idx] = *sct++;
+            sc_token[++idx] = '\0';
+            return parse_token(sc_token);
+        } else
+            switch (sc_token[0]) {
+            case ':':
+                return sc_tokid = COLON;
+            case '.':
+                return sc_tokid = DOT;
+            case '+':
+                return sc_tokid = PLUS;
+            case '-':
+                return sc_tokid = MINUS;
+            case '/':
+                return sc_tokid = SLASH;
+            default:
+                /*OK, we did not make it ... */
+                sct--;
+                return sc_tokid = EOF;
+            }
+    }                   /* while (1) */
+}                       /* token */
 
 
 /* 
  * expect2() gets a token and complains if it's not the token we want
  */
-static char *
-expect2(int desired, char *complain_fmt, ...)
+static char *expect2(
+    int desired,
+    char *complain_fmt,
+    ...)
 {
-    va_list ap;
-    va_start( ap, complain_fmt );
+    va_list   ap;
+
+    va_start(ap, complain_fmt);
     if (token() != desired) {
-       panic(ve( complain_fmt, ap ));
+        panic(ve(complain_fmt, ap));
     }
-    va_end( ap );
+    va_end(ap);
     return TIME_OK;
-    
-} /* expect2 */
+
+}                       /* expect2 */
 
 
 /*
@@ -472,303 +484,327 @@ expect2(int desired, char *complain_fmt, ...)
  *              for the OFFSET-SPEC.
  *              It also applies those m-guessing heuristics.
  */
-static char *
-plus_minus(struct rrd_time_value *ptv, int doop)
+static char *plus_minus(
+    struct rrd_time_value *ptv,
+    int doop)
 {
     static int op = PLUS;
     static int prev_multiplier = -1;
-    int delta;
-
-    if( doop >= 0 ) 
-      {
-      op = doop;
-      try(expect2(NUMBER,"There should be number after '%c'", op == PLUS ? '+' : '-'));
-      prev_multiplier = -1; /* reset months-minutes guessing mechanics */
-      }
+    int       delta;
+
+    if (doop >= 0) {
+        op = doop;
+        try(expect2
+            (NUMBER, "There should be number after '%c'",
+             op == PLUS ? '+' : '-'));
+        prev_multiplier = -1;   /* reset months-minutes guessing mechanics */
+    }
     /* if doop is < 0 then we repeat the previous op
      * with the prefetched number */
 
     delta = atoi(sc_token);
 
-    if( token() == MONTHS_MINUTES )
-      {
-      /* hard job to guess what does that -5m means: -5mon or -5min? */
-      switch(prev_multiplier)
-       {
+    if (token() == MONTHS_MINUTES) {
+        /* hard job to guess what does that -5m means: -5mon or -5min? */
+        switch (prev_multiplier) {
         case DAYS:
         case WEEKS:
         case MONTHS:
         case YEARS:
-             sc_tokid = MONTHS;
-            break;
+            sc_tokid = MONTHS;
+            break;
 
         case SECONDS:
         case MINUTES:
         case HOURS:
-            sc_tokid = MINUTES;
-            break;
+            sc_tokid = MINUTES;
+            break;
 
         default:
-             if( delta < 6 ) /* it may be some other value but in the context
-                              * of RRD who needs less than 6 min deltas? */
-               sc_tokid = MONTHS;
-             else
-              sc_tokid = MINUTES;
+            if (delta < 6)  /* it may be some other value but in the context
+                             * of RRD who needs less than 6 min deltas? */
+                sc_tokid = MONTHS;
+            else
+                sc_tokid = MINUTES;
         }
-      }
+    }
     prev_multiplier = sc_tokid;
     switch (sc_tokid) {
     case YEARS:
-           ptv->tm.tm_year += (op == PLUS) ? delta : -delta;
-           return TIME_OK;
+        ptv->tm.tm_year += (op == PLUS) ? delta : -delta;
+        return TIME_OK;
     case MONTHS:
-           ptv->tm.tm_mon += (op == PLUS) ? delta : -delta;
-           return TIME_OK;
+        ptv->tm.tm_mon += (op == PLUS) ? delta : -delta;
+        return TIME_OK;
     case WEEKS:
-           delta *= 7;
-           /* FALLTHRU */
+        delta *= 7;
+        /* FALLTHRU */
     case DAYS:
-           ptv->tm.tm_mday += (op == PLUS) ? delta : -delta;
-           return TIME_OK;
+        ptv->tm.tm_mday += (op == PLUS) ? delta : -delta;
+        return TIME_OK;
     case HOURS:
-           ptv->offset += (op == PLUS) ? delta*60*60 : -delta*60*60;
-           return TIME_OK;
+        ptv->offset += (op == PLUS) ? delta * 60 * 60 : -delta * 60 * 60;
+        return TIME_OK;
     case MINUTES:
-           ptv->offset += (op == PLUS) ? delta*60 : -delta*60;
-           return TIME_OK;
+        ptv->offset += (op == PLUS) ? delta * 60 : -delta * 60;
+        return TIME_OK;
     case SECONDS:
-           ptv->offset += (op == PLUS) ? delta : -delta;
-           return TIME_OK;
-    default: /*default unit is seconds */
-       ptv->offset += (op == PLUS) ? delta : -delta;
-       return TIME_OK;
+        ptv->offset += (op == PLUS) ? delta : -delta;
+        return TIME_OK;
+    default:           /*default unit is seconds */
+        ptv->offset += (op == PLUS) ? delta : -delta;
+        return TIME_OK;
     }
     panic(e("well-known time unit expected after %d", delta));
     /* NORETURN */
-    return TIME_OK; /* to make compiler happy :) */
-} /* plus_minus */
+    return TIME_OK;     /* to make compiler happy :) */
+}                       /* plus_minus */
 
 
 /*
  * tod() computes the time of day (TIME-OF-DAY-SPEC)
  */
-static char *
-tod(struct rrd_time_value *ptv)
+static char *tod(
+    struct rrd_time_value *ptv)
 {
-    int hour, minute = 0;
-    int tlen;
+    int       hour, minute = 0;
+    int       tlen;
+
     /* save token status in  case we must abort */
-    int scc_sv = scc; 
-    const char *sct_sv = sct; 
-    int sc_tokid_sv = sc_tokid;
+    int       scc_sv = scc;
+    const char *sct_sv = sct;
+    int       sc_tokid_sv = sc_tokid;
 
     tlen = strlen(sc_token);
-    
+
     /* first pick out the time of day - we assume a HH (COLON|DOT) MM time
-     */    
+     */
     if (tlen > 2) {
-      return TIME_OK;
+        return TIME_OK;
     }
-    
+
     hour = atoi(sc_token);
 
     token();
     if (sc_tokid == SLASH || sc_tokid == DOT) {
-      /* guess we are looking at a date */
-      scc = scc_sv;
-      sct = sct_sv;
-      sc_tokid = sc_tokid_sv;
-      sprintf (sc_token,"%d", hour);
-      return TIME_OK;
+        /* guess we are looking at a date */
+        scc = scc_sv;
+        sct = sct_sv;
+        sc_tokid = sc_tokid_sv;
+        sprintf(sc_token, "%d", hour);
+        return TIME_OK;
     }
-    if (sc_tokid == COLON ) {
-       try(expect2(NUMBER,
-            "Parsing HH:MM syntax, expecting MM as number, got none"));
-       minute = atoi(sc_token);
-       if (minute > 59) {
-           panic(e("parsing HH:MM syntax, got MM = %d (>59!)", minute ));
-       }
-       token();
+    if (sc_tokid == COLON) {
+        try(expect2(NUMBER,
+                    "Parsing HH:MM syntax, expecting MM as number, got none"));
+        minute = atoi(sc_token);
+        if (minute > 59) {
+            panic(e("parsing HH:MM syntax, got MM = %d (>59!)", minute));
+        }
+        token();
     }
 
     /* check if an AM or PM specifier was given
      */
     if (sc_tokid == AM || sc_tokid == PM) {
-       if (hour > 12) {
-           panic(e("there cannot be more than 12 AM or PM hours"));
-       }
-       if (sc_tokid == PM) {
-           if (hour != 12)     /* 12:xx PM is 12:xx, not 24:xx */
-                       hour += 12;
-       } else {
-           if (hour == 12)     /* 12:xx AM is 00:xx, not 12:xx */
-                       hour = 0;
-       }
-       token();
-    } 
-    else if (hour > 23) {
-      /* guess it was not a time then ... */
-      scc = scc_sv;
-      sct = sct_sv;
-      sc_tokid = sc_tokid_sv;
-      sprintf (sc_token,"%d", hour);
-      return TIME_OK;
+        if (hour > 12) {
+            panic(e("there cannot be more than 12 AM or PM hours"));
+        }
+        if (sc_tokid == PM) {
+            if (hour != 12) /* 12:xx PM is 12:xx, not 24:xx */
+                hour += 12;
+        } else {
+            if (hour == 12) /* 12:xx AM is 00:xx, not 12:xx */
+                hour = 0;
+        }
+        token();
+    } else if (hour > 23) {
+        /* guess it was not a time then ... */
+        scc = scc_sv;
+        sct = sct_sv;
+        sc_tokid = sc_tokid_sv;
+        sprintf(sc_token, "%d", hour);
+        return TIME_OK;
     }
     ptv->tm.tm_hour = hour;
     ptv->tm.tm_min = minute;
     ptv->tm.tm_sec = 0;
     if (ptv->tm.tm_hour == 24) {
-       ptv->tm.tm_hour = 0;
-       ptv->tm.tm_mday++;
+        ptv->tm.tm_hour = 0;
+        ptv->tm.tm_mday++;
     }
-  return TIME_OK;
-} /* tod */
+    return TIME_OK;
+}                       /* tod */
 
 
 /*
  * assign_date() assigns a date, adjusting year as appropriate
  */
-static char *
-assign_date(struct rrd_time_value *ptv, long mday, long mon, long year)
+static char *assign_date(
+    struct rrd_time_value *ptv,
+    long mday,
+    long mon,
+    long year)
 {
     if (year > 138) {
-       if (year > 1970)
-           year -= 1900;
-       else {
-           panic(e("invalid year %d (should be either 00-99 or >1900)",
+        if (year > 1970)
+            year -= 1900;
+        else {
+            panic(e("invalid year %d (should be either 00-99 or >1900)",
                     year));
-       }
-    } else if( year >= 0 && year < 38 ) {
-       year += 100;         /* Allow year 2000-2037 to be specified as   */
-    }                       /* 00-37 until the problem of 2038 year will */
-                            /* arise for unices with 32-bit time_t :)    */
+        }
+    } else if (year >= 0 && year < 38) {
+        year += 100;    /* Allow year 2000-2037 to be specified as   */
+    }
+    /* 00-37 until the problem of 2038 year will */
+    /* arise for unices with 32-bit time_t :)    */
     if (year < 70) {
-      panic(e("won't handle dates before epoch (01/01/1970), sorry"));
+        panic(e("won't handle dates before epoch (01/01/1970), sorry"));
     }
 
     ptv->tm.tm_mday = mday;
     ptv->tm.tm_mon = mon;
     ptv->tm.tm_year = year;
-  return TIME_OK;
-} /* assign_date */
+    return TIME_OK;
+}                       /* assign_date */
 
 
 /* 
  * day() picks apart DAY-SPEC-[12]
  */
-static char *
-day(struct rrd_time_value *ptv)
+static char *day(
+    struct rrd_time_value *ptv)
 {
-    /* using time_t seems to help portability with 64bit oses */    
-    time_t mday=0, wday, mon, year = ptv->tm.tm_year;
-    int tlen;
+    /* using time_t seems to help portability with 64bit oses */
+    time_t    mday = 0, wday, mon, year = ptv->tm.tm_year;
+    int       tlen;
 
     switch (sc_tokid) {
     case YESTERDAY:
-           ptv->tm.tm_mday--;
-           /* FALLTRHU */
-    case TODAY:        /* force ourselves to stay in today - no further processing */
-           token();
-           break;
+        ptv->tm.tm_mday--;
+        /* FALLTRHU */
+    case TODAY:        /* force ourselves to stay in today - no further processing */
+        token();
+        break;
     case TOMORROW:
-           ptv->tm.tm_mday++;
-           token();
-           break;
-
-    case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
-    case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
-           /* do month mday [year]
-            */
-           mon = (sc_tokid-JAN);
-           try(expect2(NUMBER,
-               "the day of the month should follow month name"));
-           mday = atol(sc_token);
-           if (token() == NUMBER) {
-               year = atol(sc_token);
-               token();
-           }
-           else
-               year = ptv->tm.tm_year;
-           try(assign_date(ptv, mday, mon, year));
-           break;
-
-    case SUN: case MON: case TUE:
-    case WED: case THU: case FRI:
+        ptv->tm.tm_mday++;
+        token();
+        break;
+
+    case JAN:
+    case FEB:
+    case MAR:
+    case APR:
+    case MAY:
+    case JUN:
+    case JUL:
+    case AUG:
+    case SEP:
+    case OCT:
+    case NOV:
+    case DEC:
+        /* do month mday [year]
+         */
+        mon = (sc_tokid - JAN);
+        try(expect2(NUMBER, "the day of the month should follow month name"));
+        mday = atol(sc_token);
+        if (token() == NUMBER) {
+            year = atol(sc_token);
+            token();
+        } else
+            year = ptv->tm.tm_year;
+        try(assign_date(ptv, mday, mon, year));
+        break;
+
+    case SUN:
+    case MON:
+    case TUE:
+    case WED:
+    case THU:
+    case FRI:
     case SAT:
-           /* do a particular day of the week
-            */
-           wday = (sc_tokid-SUN);
-           ptv->tm.tm_mday += (wday - ptv->tm.tm_wday);
+        /* do a particular day of the week
+         */
+        wday = (sc_tokid - SUN);
+        ptv->tm.tm_mday += (wday - ptv->tm.tm_wday);
+        token();
+        break;
+        /*
+           mday = ptv->tm.tm_mday;
+           mday += (wday - ptv->tm.tm_wday);
+           ptv->tm.tm_wday = wday;
+
+           try(assign_date(ptv, mday, ptv->tm.tm_mon, ptv->tm.tm_year));
+           break;
+         */
+
+    case NUMBER:
+        /* get numeric <sec since 1970>, MM/DD/[YY]YY, or DD.MM.[YY]YY
+         */
+        tlen = strlen(sc_token);
+        mon = atol(sc_token);
+        if (mon > 10 * 365 * 24 * 60 * 60) {
+            ptv->tm = *localtime(&mon);
+            token();
+            break;
+        }
+
+        if (mon > 19700101 && mon < 24000101) { /*works between 1900 and 2400 */
+            char      cmon[3], cmday[3], cyear[5];
+
+            strncpy(cyear, sc_token, 4);
+            cyear[4] = '\0';
+            year = atol(cyear);
+            strncpy(cmon, &(sc_token[4]), 2);
+            cmon[2] = '\0';
+            mon = atol(cmon);
+            strncpy(cmday, &(sc_token[6]), 2);
+            cmday[2] = '\0';
+            mday = atol(cmday);
+            token();
+        } else {
             token();
-           break;
-           /*
-           mday = ptv->tm.tm_mday;
-           mday += (wday - ptv->tm.tm_wday);
-           ptv->tm.tm_wday = wday;
 
-           try(assign_date(ptv, mday, ptv->tm.tm_mon, ptv->tm.tm_year));
-           break;
-           */
+            if (mon <= 31 && (sc_tokid == SLASH || sc_tokid == DOT)) {
+                int       sep;
+
+                sep = sc_tokid;
+                try(expect2(NUMBER, "there should be %s number after '%c'",
+                            sep == DOT ? "month" : "day",
+                            sep == DOT ? '.' : '/'));
+                mday = atol(sc_token);
+                if (token() == sep) {
+                    try(expect2
+                        (NUMBER, "there should be year number after '%c'",
+                         sep == DOT ? '.' : '/'));
+                    year = atol(sc_token);
+                    token();
+                }
+
+                /* flip months and days for European timing
+                 */
+                if (sep == DOT) {
+                    long      x = mday;
+
+                    mday = mon;
+                    mon = x;
+                }
+            }
+        }
 
-    case NUMBER:
-           /* get numeric <sec since 1970>, MM/DD/[YY]YY, or DD.MM.[YY]YY
-            */
-           tlen = strlen(sc_token);
-           mon = atol(sc_token);
-            if (mon > 10*365*24*60*60) {
-               ptv->tm=*localtime(&mon);
-               token();
-               break;
-           }
-
-           if (mon > 19700101 && mon < 24000101){ /*works between 1900 and 2400 */
-               char  cmon[3],cmday[3],cyear[5];
-               strncpy(cyear,sc_token,4);cyear[4]='\0';              
-               year = atol(cyear);           
-               strncpy(cmon,&(sc_token[4]),2);cmon[2]='\0';
-               mon = atol(cmon);
-               strncpy(cmday,&(sc_token[6]),2);cmday[2]='\0';
-               mday = atol(cmday);
-               token();
-           } else { 
-             token();
-             
-             if (mon <= 31 && (sc_tokid == SLASH || sc_tokid == DOT)) {
-               int sep;                    
-               sep = sc_tokid;
-               try(expect2(NUMBER,"there should be %s number after '%c'",
-                          sep == DOT ? "month" : "day", sep == DOT ? '.' : '/'));
-               mday = atol(sc_token);
-               if (token() == sep) {
-                 try(expect2(NUMBER,"there should be year number after '%c'",
-                            sep == DOT ? '.' : '/'));
-                 year = atol(sc_token);
-                 token();
-               }
-               
-               /* flip months and days for European timing
-                */
-               if (sep == DOT) {
-                 long x = mday;
-                 mday = mon;
-                 mon = x;
-               }
-             }
-           }
-
-           mon--;
-           if(mon < 0 || mon > 11 ) {
-               panic(e("did you really mean month %d?", mon+1));
-           }
-           if(mday < 1 || mday > 31) {
-               panic(e("I'm afraid that %d is not a valid day of the month",
-                       mday));
-           }      
-           try(assign_date(ptv, mday, mon, year));
-           break;
-    } /* case */
+        mon--;
+        if (mon < 0 || mon > 11) {
+            panic(e("did you really mean month %d?", mon + 1));
+        }
+        if (mday < 1 || mday > 31) {
+            panic(e("I'm afraid that %d is not a valid day of the month",
+                    mday));
+        }
+        try(assign_date(ptv, mday, mon, year));
+        break;
+    }                   /* case */
     return TIME_OK;
-} /* month */
+}                       /* month */
 
 
 /* Global functions */
@@ -783,199 +819,209 @@ day(struct rrd_time_value *ptv)
  * mktime() The return value is either TIME_OK (aka NULL) or
  * the pointer to the error message in the case of problems
  */
-char *
-parsetime(const char *tspec, struct rrd_time_value *ptv)
+char     *parsetime(
+    const char *tspec,
+    struct rrd_time_value *ptv)
 {
-    time_t now = time(NULL);
-    int hr = 0;
+    time_t    now = time(NULL);
+    int       hr = 0;
+
     /* this MUST be initialized to zero for midnight/noon/teatime */
 
-    Specials = VariousWords; /* initialize special words context */
+    Specials = VariousWords;    /* initialize special words context */
 
-    try(init_scanner( 1, &tspec ));
+    try(init_scanner(1, &tspec));
 
     /* establish the default time reference */
     ptv->type = ABSOLUTE_TIME;
     ptv->offset = 0;
     ptv->tm = *localtime(&now);
-    ptv->tm.tm_isdst = -1; /* mk time can figure this out for us ... */
+    ptv->tm.tm_isdst = -1;  /* mk time can figure this out for us ... */
 
     token();
     switch (sc_tokid) {
     case PLUS:
     case MINUS:
-           break; /* jump to OFFSET-SPEC part */
+        break;          /* jump to OFFSET-SPEC part */
 
     case START:
-           ptv->type = RELATIVE_TO_START_TIME;
-           goto KeepItRelative;
+        ptv->type = RELATIVE_TO_START_TIME;
+        goto KeepItRelative;
     case END:
-           ptv->type = RELATIVE_TO_END_TIME;
-        KeepItRelative:
-           ptv->tm.tm_sec  = 0;
-           ptv->tm.tm_min  = 0;
-           ptv->tm.tm_hour = 0;
-           ptv->tm.tm_mday = 0;
-           ptv->tm.tm_mon  = 0;
-           ptv->tm.tm_year = 0;
-           /* FALLTHRU */
+        ptv->type = RELATIVE_TO_END_TIME;
+      KeepItRelative:
+        ptv->tm.tm_sec = 0;
+        ptv->tm.tm_min = 0;
+        ptv->tm.tm_hour = 0;
+        ptv->tm.tm_mday = 0;
+        ptv->tm.tm_mon = 0;
+        ptv->tm.tm_year = 0;
+        /* FALLTHRU */
     case NOW:
-           {
-           int time_reference = sc_tokid;
-           token();
-           if( sc_tokid == PLUS || sc_tokid == MINUS )
-             break;
-           if( time_reference != NOW ) {
-             panic(e("'start' or 'end' MUST be followed by +|- offset"));
-           }
-           else
-             if( sc_tokid != EOF ) {
-               panic(e("if 'now' is followed by a token it must be +|- offset"));      
-             }
-           };
-           break;
-
-    /* Only absolute time specifications below */
+    {
+        int       time_reference = sc_tokid;
+
+        token();
+        if (sc_tokid == PLUS || sc_tokid == MINUS)
+            break;
+        if (time_reference != NOW) {
+            panic(e("'start' or 'end' MUST be followed by +|- offset"));
+        } else if (sc_tokid != EOF) {
+            panic(e("if 'now' is followed by a token it must be +|- offset"));
+        }
+    };
+        break;
+
+        /* Only absolute time specifications below */
     case NUMBER:
-           {
-             long hour_sv = ptv->tm.tm_hour;
-             long year_sv = ptv->tm.tm_year;
-              ptv->tm.tm_hour = 30;
-              ptv->tm.tm_year = 30000;
-             try(tod(ptv))
-             try(day(ptv))
-             if ( ptv->tm.tm_hour == 30 &&  ptv->tm.tm_year != 30000 ){
-               try(tod(ptv))
-              }
-             if ( ptv->tm.tm_hour == 30 ){
-               ptv->tm.tm_hour = hour_sv;
-              }
-             if ( ptv->tm.tm_year == 30000 ){
-               ptv->tm.tm_year = year_sv;
-              }
-           };      
+    {
+        long      hour_sv = ptv->tm.tm_hour;
+        long      year_sv = ptv->tm.tm_year;
+
+        ptv->tm.tm_hour = 30;
+        ptv->tm.tm_year = 30000;
+        try(tod(ptv))
+            try(day(ptv))
+            if (ptv->tm.tm_hour == 30 && ptv->tm.tm_year != 30000) {
+            try(tod(ptv))
+        }
+        if (ptv->tm.tm_hour == 30) {
+            ptv->tm.tm_hour = hour_sv;
+        }
+        if (ptv->tm.tm_year == 30000) {
+            ptv->tm.tm_year = year_sv;
+        }
+    };
+        break;
+        /* fix month parsing */
+    case JAN:
+    case FEB:
+    case MAR:
+    case APR:
+    case MAY:
+    case JUN:
+    case JUL:
+    case AUG:
+    case SEP:
+    case OCT:
+    case NOV:
+    case DEC:
+        try(day(ptv));
+        if (sc_tokid != NUMBER)
+            break;
+        try(tod(ptv))
             break;
-    /* fix month parsing */
-    case JAN: case FEB: case MAR: case APR: case MAY: case JUN:
-    case JUL: case AUG: case SEP: case OCT: case NOV: case DEC:
-            try(day(ptv));
-           if (sc_tokid != NUMBER) break;
-           try(tod(ptv))
-           break;
-
-           /* evil coding for TEATIME|NOON|MIDNIGHT - we've initialized
-            * hr to zero up above, then fall into this case in such a
-            * way so we add +12 +4 hours to it for teatime, +12 hours
-            * to it for noon, and nothing at all for midnight, then
-            * set our rettime to that hour before leaping into the
-            * month scanner
-            */
+
+        /* evil coding for TEATIME|NOON|MIDNIGHT - we've initialized
+         * hr to zero up above, then fall into this case in such a
+         * way so we add +12 +4 hours to it for teatime, +12 hours
+         * to it for noon, and nothing at all for midnight, then
+         * set our rettime to that hour before leaping into the
+         * month scanner
+         */
     case TEATIME:
-           hr += 4;
-           /* FALLTHRU */
+        hr += 4;
+        /* FALLTHRU */
     case NOON:
-           hr += 12;
-           /* FALLTHRU */
+        hr += 12;
+        /* FALLTHRU */
     case MIDNIGHT:
-            /* if (ptv->tm.tm_hour >= hr) {
-               ptv->tm.tm_mday++;
-               ptv->tm.tm_wday++;
-           } */ /* shifting does not makes sense here ... noon is noon */ 
-           ptv->tm.tm_hour = hr;
-           ptv->tm.tm_min = 0;
-           ptv->tm.tm_sec = 0;
-           token();
-           try(day(ptv));
-           break;
+        /* if (ptv->tm.tm_hour >= hr) {
+           ptv->tm.tm_mday++;
+           ptv->tm.tm_wday++;
+           } *//* shifting does not makes sense here ... noon is noon */
+        ptv->tm.tm_hour = hr;
+        ptv->tm.tm_min = 0;
+        ptv->tm.tm_sec = 0;
+        token();
+        try(day(ptv));
+        break;
     default:
-           panic(e("unparsable time: %s%s",sc_token,sct));
-           break;
-    } /* ugly case statement */
+        panic(e("unparsable time: %s%s", sc_token, sct));
+        break;
+    }                   /* ugly case statement */
 
     /*
      * the OFFSET-SPEC part
      *
      * (NOTE, the sc_tokid was prefetched for us by the previous code)
      */
-    if( sc_tokid == PLUS || sc_tokid == MINUS ) {
-       Specials = TimeMultipliers; /* switch special words context */
-       while( sc_tokid == PLUS || sc_tokid == MINUS ||
-                              sc_tokid == NUMBER ) {
-           if( sc_tokid == NUMBER ) {
-               try(plus_minus(ptv, PREVIOUS_OP ));
-           } else
-               try(plus_minus(ptv, sc_tokid));
-           token(); /* We will get EOF eventually but that's OK, since
-                           token() will return us as many EOFs as needed */
-       }
+    if (sc_tokid == PLUS || sc_tokid == MINUS) {
+        Specials = TimeMultipliers; /* switch special words context */
+        while (sc_tokid == PLUS || sc_tokid == MINUS || sc_tokid == NUMBER) {
+            if (sc_tokid == NUMBER) {
+                try(plus_minus(ptv, PREVIOUS_OP));
+            } else
+                try(plus_minus(ptv, sc_tokid));
+            token();    /* We will get EOF eventually but that's OK, since
+                           token() will return us as many EOFs as needed */
+        }
     }
 
     /* now we should be at EOF */
-    if( sc_tokid != EOF ) {
-      panic(e("unparsable trailing text: '...%s%s'", sc_token, sct));
+    if (sc_tokid != EOF) {
+        panic(e("unparsable trailing text: '...%s%s'", sc_token, sct));
     }
 
-    ptv->tm.tm_isdst = -1; /* for mktime to guess DST status */
-    if( ptv->type == ABSOLUTE_TIME )
-      if( mktime( &ptv->tm ) == -1 ) { /* normalize & check */
-        /* can happen for "nonexistent" times, e.g. around 3am */
-       /* when winter -> summer time correction eats a hour */
-        panic(e("the specified time is incorrect (out of range?)"));
-      }
+    ptv->tm.tm_isdst = -1;  /* for mktime to guess DST status */
+    if (ptv->type == ABSOLUTE_TIME)
+        if (mktime(&ptv->tm) == -1) {   /* normalize & check */
+            /* can happen for "nonexistent" times, e.g. around 3am */
+            /* when winter -> summer time correction eats a hour */
+            panic(e("the specified time is incorrect (out of range?)"));
+        }
     EnsureMemFree();
     return TIME_OK;
-} /* parsetime */
-
-
-int proc_start_end (struct rrd_time_value *start_tv, 
-                   struct rrd_time_value *end_tv, 
-                   time_t *start, 
-                   time_t *end){
-    if (start_tv->type == RELATIVE_TO_END_TIME  && /* same as the line above */
-       end_tv->type == RELATIVE_TO_START_TIME) {
-       rrd_set_error("the start and end times cannot be specified "
-                     "relative to each other");
-       return -1;
+}                       /* parsetime */
+
+
+int proc_start_end(
+    struct rrd_time_value *start_tv,
+    struct rrd_time_value *end_tv,
+    time_t *start,
+    time_t *end)
+{
+    if (start_tv->type == RELATIVE_TO_END_TIME &&   /* same as the line above */
+        end_tv->type == RELATIVE_TO_START_TIME) {
+        rrd_set_error("the start and end times cannot be specified "
+                      "relative to each other");
+        return -1;
     }
 
     if (start_tv->type == RELATIVE_TO_START_TIME) {
-       rrd_set_error("the start time cannot be specified relative to itself");
-       return -1;
+        rrd_set_error
+            ("the start time cannot be specified relative to itself");
+        return -1;
     }
 
     if (end_tv->type == RELATIVE_TO_END_TIME) {
-       rrd_set_error("the end time cannot be specified relative to itself");
-       return -1;
+        rrd_set_error("the end time cannot be specified relative to itself");
+        return -1;
     }
 
-    if( start_tv->type == RELATIVE_TO_END_TIME) {
-       struct tm tmtmp;
-       *end = mktime(&(end_tv->tm)) + end_tv->offset;    
-       tmtmp = *localtime(end); /* reinit end including offset */
-       tmtmp.tm_mday += start_tv->tm.tm_mday;
-       tmtmp.tm_mon += start_tv->tm.tm_mon;
-       tmtmp.tm_year += start_tv->tm.tm_year;  
-       *start = mktime(&tmtmp) + start_tv->offset;
+    if (start_tv->type == RELATIVE_TO_END_TIME) {
+        struct tm tmtmp;
+
+        *end = mktime(&(end_tv->tm)) + end_tv->offset;
+        tmtmp = *localtime(end);    /* reinit end including offset */
+        tmtmp.tm_mday += start_tv->tm.tm_mday;
+        tmtmp.tm_mon += start_tv->tm.tm_mon;
+        tmtmp.tm_year += start_tv->tm.tm_year;
+        *start = mktime(&tmtmp) + start_tv->offset;
     } else {
-       *start = mktime(&(start_tv->tm)) + start_tv->offset;
+        *start = mktime(&(start_tv->tm)) + start_tv->offset;
     }
     if (end_tv->type == RELATIVE_TO_START_TIME) {
-       struct tm tmtmp;
-       *start = mktime(&(start_tv->tm)) + start_tv->offset;
-       tmtmp = *localtime(start);
-       tmtmp.tm_mday += end_tv->tm.tm_mday;
-       tmtmp.tm_mon += end_tv->tm.tm_mon;
-       tmtmp.tm_year += end_tv->tm.tm_year;    
-       *end = mktime(&tmtmp) + end_tv->offset;
+        struct tm tmtmp;
+
+        *start = mktime(&(start_tv->tm)) + start_tv->offset;
+        tmtmp = *localtime(start);
+        tmtmp.tm_mday += end_tv->tm.tm_mday;
+        tmtmp.tm_mon += end_tv->tm.tm_mon;
+        tmtmp.tm_year += end_tv->tm.tm_year;
+        *end = mktime(&tmtmp) + end_tv->offset;
     } else {
-       *end = mktime(&(end_tv->tm)) + end_tv->offset;
-    }    
+        *end = mktime(&(end_tv->tm)) + end_tv->offset;
+    }
     return 0;
-} /* proc_start_end */
-
-
-
-
-
-
-
+}                       /* proc_start_end */
index 78d0950..18e89c5 100644 (file)
@@ -7,20 +7,22 @@
 #include <png.h>
 #include "rrd_tool.h"
 
-int
-PngSize(FILE *fd, long *width, long *height)
+int PngSize(
+    FILE * fd,
+    long *width,
+    long *height)
 {
-  png_structp png_read_ptr = 
-    png_create_read_struct(PNG_LIBPNG_VER_STRING, 
-                          (png_voidp)NULL,
-                               /* we would need to point to error handlers
-                                  here to do it properly */
-                          (png_error_ptr)NULL, (png_error_ptr)NULL);
-    
-  png_infop info_ptr = png_create_info_struct(png_read_ptr);
-
-  (*width)=0;
-  (*height)=0;
+    png_structp png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
+                                                      (png_voidp) NULL,
+                                                      /* we would need to point to error handlers
+                                                         here to do it properly */
+                                                      (png_error_ptr) NULL,
+                                                      (png_error_ptr) NULL);
+
+    png_infop info_ptr = png_create_info_struct(png_read_ptr);
+
+    (*width) = 0;
+    (*height) = 0;
 
 /* this is to make compile on aix work since they seem to define jmpbuf
    to be _jmpbuf which breaks compilation */
@@ -29,22 +31,19 @@ PngSize(FILE *fd, long *width, long *height)
 #undef jmpbuf
 #endif
 
-  if (setjmp(png_read_ptr->jmpbuf)){
-    png_destroy_read_struct(&png_read_ptr, &info_ptr, (png_infopp)NULL);
-    return 0;
-  }
-
-  png_init_io(png_read_ptr,fd);
-  png_read_info(png_read_ptr, info_ptr);
-  (*width)=png_get_image_width(png_read_ptr, info_ptr);
-  (*height)=png_get_image_height(png_read_ptr, info_ptr);
-  
-  png_destroy_read_struct(&png_read_ptr, &info_ptr, NULL);
-  if (*width >0 && *height >0) 
-    return 1;
-  else
-    return 0;
+    if (setjmp(png_read_ptr->jmpbuf)) {
+        png_destroy_read_struct(&png_read_ptr, &info_ptr, (png_infopp) NULL);
+        return 0;
+    }
+
+    png_init_io(png_read_ptr, fd);
+    png_read_info(png_read_ptr, info_ptr);
+    (*width) = png_get_image_width(png_read_ptr, info_ptr);
+    (*height) = png_get_image_height(png_read_ptr, info_ptr);
+
+    png_destroy_read_struct(&png_read_ptr, &info_ptr, NULL);
+    if (*width > 0 && *height > 0)
+        return 1;
+    else
+        return 0;
 }
-
-
-
index ce712d5..1b79af3 100644 (file)
--- a/src/rrd.h
+++ b/src/rrd.h
  *
  *****************************************************************************/
 #ifdef  __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 #ifndef _RRDLIB_H
 #define _RRDLIB_H
 
-#include <sys/types.h> /* for off_t */
-#include <unistd.h> /* for off_t */
+#include <sys/types.h>  /* for off_t */
+#include <unistd.h>     /* for off_t */
 #include <time.h>
-#include <stdio.h> /* for FILE */
+#include <stdio.h>      /* for FILE */
 
 /* Transplanted from rrd_format.h */
-typedef double       rrd_value_t;         /* the data storage type is
-                                           * double */
+    typedef double rrd_value_t; /* the data storage type is
+                                 * double */
 /* END rrd_format.h */
 
 /* information about an rrd file */
-typedef struct rrd_file_t {
-       int   fd;         /* file descriptor if this rrd file */
-       char* file_start; /* start address of an open rrd file */
-       off_t header_len; /* length of the header of this rrd file */
-       off_t file_len;   /* total size of the rrd file */
-       off_t pos;        /* current pos in file */
-} rrd_file_t;
+    typedef struct rrd_file_t {
+        int       fd;   /* file descriptor if this rrd file */
+        char     *file_start;   /* start address of an open rrd file */
+        off_t     header_len;   /* length of the header of this rrd file */
+        off_t     file_len; /* total size of the rrd file */
+        off_t     pos;  /* current pos in file */
+    } rrd_file_t;
 
 /* main function blocks */
-int    rrd_create(int, char **);
-int    rrd_update(int, char **);
-int    rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *);
-int    rrd_fetch(int, char **, time_t *, time_t *, unsigned long *,
-                unsigned long *, char ***, rrd_value_t **);
-int    rrd_restore(int, char **);
-int    rrd_dump(int, char **);
-int    rrd_tune(int, char **);
-time_t rrd_last(int, char **);
-time_t rrd_first(int, char **);
-int    rrd_resize(int, char **);
-char * rrd_strversion(void);
-double rrd_version(void);
-int    rrd_xport(int, char **, int *, time_t *, time_t *,
-                unsigned long *, unsigned long *,
-                char ***, rrd_value_t **);
+    int       rrd_create(
+    int,
+    char **);
+    int       rrd_update(
+    int,
+    char **);
+    int       rrd_graph(
+    int,
+    char **,
+    char ***,
+    int *,
+    int *,
+    FILE *,
+    double *,
+    double *);
+    int       rrd_fetch(
+    int,
+    char **,
+    time_t *,
+    time_t *,
+    unsigned long *,
+    unsigned long *,
+    char ***,
+    rrd_value_t **);
+    int       rrd_restore(
+    int,
+    char **);
+    int       rrd_dump(
+    int,
+    char **);
+    int       rrd_tune(
+    int,
+    char **);
+    time_t    rrd_last(
+    int,
+    char **);
+    time_t    rrd_first(
+    int,
+    char **);
+    int       rrd_resize(
+    int,
+    char **);
+    char     *rrd_strversion(
+    void);
+    double    rrd_version(
+    void);
+    int       rrd_xport(
+    int,
+    char **,
+    int *,
+    time_t *,
+    time_t *,
+    unsigned long *,
+    unsigned long *,
+    char ***,
+    rrd_value_t **);
 
 /* thread-safe (hopefully) */
-int    rrd_create_r(const char *filename,
-                   unsigned long pdp_step, time_t last_up,
-                   int argc, const char **argv);
+    int       rrd_create_r(
+    const char *filename,
+    unsigned long pdp_step,
+    time_t last_up,
+    int argc,
+    const char **argv);
 /* NOTE: rrd_update_r are only thread-safe if no at-style time
    specifications get used!!! */
 
-int    rrd_update_r(const char *filename, const char *_template,
-                   int argc, const char **argv);
-int    rrd_fetch_r(const char *filename, const char* cf,
-                   time_t *start, time_t *end,
-                   unsigned long *step,
-                   unsigned long *ds_cnt,
-                   char        ***ds_namv,
-                   rrd_value_t **data);
-int    rrd_dump_r(const char *filename, char *outname);
-time_t rrd_last_r(const char *filename);
-time_t rrd_first_r(const char *filename, int rraindex);
+    int       rrd_update_r(
+    const char *filename,
+    const char *_template,
+    int argc,
+    const char **argv);
+    int       rrd_fetch_r(
+    const char *filename,
+    const char *cf,
+    time_t *start,
+    time_t *end,
+    unsigned long *step,
+    unsigned long *ds_cnt,
+    char ***ds_namv,
+    rrd_value_t ** data);
+    int       rrd_dump_r(
+    const char *filename,
+    char *outname);
+    time_t    rrd_last_r(
+    const char *filename);
+    time_t    rrd_first_r(
+    const char *filename,
+    int rraindex);
 
 /* Transplanted from parsetime.h */
-typedef enum {
+    typedef enum {
         ABSOLUTE_TIME,
-        RELATIVE_TO_START_TIME, 
+        RELATIVE_TO_START_TIME,
         RELATIVE_TO_END_TIME
-} timetype;
+    } timetype;
 
 #define TIME_OK NULL
 
-struct rrd_time_value {
-  timetype type;
-  long offset;
-  struct tm tm;
-};
+    struct rrd_time_value {
+        timetype  type;
+        long      offset;
+        struct tm tm;
+    };
 
-char *parsetime(const char *spec, struct rrd_time_value *ptv);
+    char     *parsetime(
+    const char *spec,
+    struct rrd_time_value *ptv);
 /* END parsetime.h */
 
-struct rrd_context {
-    int len;
-    int errlen;
-    char *lib_errstr;
-    char *rrd_error;
-};
+    struct rrd_context {
+        int       len;
+        int       errlen;
+        char     *lib_errstr;
+        char     *rrd_error;
+    };
 
 /* returns the current per-thread rrd_context */
-struct rrd_context *rrd_get_context(void);
+    struct rrd_context *rrd_get_context(
+    void);
 
 
-int proc_start_end (struct rrd_time_value *,  struct rrd_time_value *, time_t *, time_t *);
+    int       proc_start_end(
+    struct rrd_time_value *,
+    struct rrd_time_value *,
+    time_t *,
+    time_t *);
 
 /* HELPER FUNCTIONS */
-void rrd_set_error(char *,...);
-void rrd_clear_error(void);
-int  rrd_test_error(void);
-char *rrd_get_error(void);
+    void      rrd_set_error(
+    char *,
+    ...);
+    void      rrd_clear_error(
+    void);
+    int       rrd_test_error(
+    void);
+    char     *rrd_get_error(
+    void);
 
 /** MULTITHREADED HELPER FUNCTIONS */
-struct rrd_context *rrd_new_context(void);
-void   rrd_free_context (struct rrd_context *buf);
+    struct rrd_context *rrd_new_context(
+    void);
+    void      rrd_free_context(
+    struct rrd_context *buf);
 
 /* void   rrd_set_error_r  (struct rrd_context *, char *, ...); */
 /* void   rrd_clear_error_r(struct rrd_context *); */
 /* int    rrd_test_error_r (struct rrd_context *); */
 /* char  *rrd_get_error_r  (struct rrd_context *); */
 
-int  LockRRD(int in_file);
+    int       LockRRD(
+    int in_file);
 
-#endif /* _RRDLIB_H */
+#endif                  /* _RRDLIB_H */
 
 #ifdef  __cplusplus
 }
index c42e6fe..3c53fdd 100644 (file)
@@ -30,7 +30,7 @@
 # define DLOG(x) fprintf x
 #else
 # define DEBUG 0
-# define DLOG(x) 
+# define DLOG(x)
 #endif
 
 /* Adobe SVG View and Batik 1.1.1 can't handle ligatures.
@@ -45,117 +45,136 @@ static const char *last_unknown_font = NULL;
 #define is_font(p, name) \
   (!strcmp(p->postscript_name, name) || !strcmp(p->fullname, name))
 
-static const afm_fontinfo *afm_searchfont(const char *name)
+static const afm_fontinfo *afm_searchfont(
+    const char *name)
 {
-  int i;
-  const afm_fontinfo *p = afm_last_used_font;
-  if (p && is_font(p, name))
-    return p;
-  p = afm_fontinfolist;
-  for (i = 0; i < afm_fontinfo_count; i++, p++) {
-    if (is_font(p, name)) {
-      afm_last_used_font = p;
-      return p;
+    int       i;
+    const afm_fontinfo *p = afm_last_used_font;
+
+    if (p && is_font(p, name))
+        return p;
+    p = afm_fontinfolist;
+    for (i = 0; i < afm_fontinfo_count; i++, p++) {
+        if (is_font(p, name)) {
+            afm_last_used_font = p;
+            return p;
+        }
     }
-  }
-  return NULL;
+    return NULL;
 }
 
 
 /* returns always a font, never NULL.
    The rest of the code depends on the result never being NULL.
    See rrd_afm.h */
-static const afm_fontinfo *afm_findfont(const char *name)
+static const afm_fontinfo *afm_findfont(
+    const char *name)
 {
-  const afm_fontinfo *p = afm_searchfont(name);
-  if (p)
-    return p;
-  if (!last_unknown_font || strcmp(name, last_unknown_font)) {
-         fprintf(stderr, "Can't find font '%s'\n", name);
-         last_unknown_font = name;
-  }
-  p = afm_searchfont(RRD_AFM_DEFAULT_FONT);
-  if (p)
-    return p;
-  return afm_fontinfolist; /* anything, just anything. */
+    const afm_fontinfo *p = afm_searchfont(name);
+
+    if (p)
+        return p;
+    if (!last_unknown_font || strcmp(name, last_unknown_font)) {
+        fprintf(stderr, "Can't find font '%s'\n", name);
+        last_unknown_font = name;
+    }
+    p = afm_searchfont(RRD_AFM_DEFAULT_FONT);
+    if (p)
+        return p;
+    return afm_fontinfolist;    /* anything, just anything. */
 }
 
-const char *afm_get_font_postscript_name(const char* font)
+const char *afm_get_font_postscript_name(
+    const char *font)
 {
-  const afm_fontinfo *p = afm_findfont(font);
-  return p->postscript_name;
+    const afm_fontinfo *p = afm_findfont(font);
+
+    return p->postscript_name;
 }
 
-const char *afm_get_font_name(const char* font)
+const char *afm_get_font_name(
+    const char *font)
 {
-  const afm_fontinfo *p = afm_findfont(font);
-  return p->fullname;
+    const afm_fontinfo *p = afm_findfont(font);
+
+    return p->fullname;
 }
 
-double afm_get_ascender(const char* font, double size)
+double afm_get_ascender(
+    const char *font,
+    double size)
 {
-  const afm_fontinfo *p = afm_findfont(font);
-  return size * p->ascender / 1000.0;
+    const afm_fontinfo *p = afm_findfont(font);
+
+    return size * p->ascender / 1000.0;
 }
 
-double afm_get_descender(const char* font, double size)
+double afm_get_descender(
+    const char *font,
+    double size)
 {
-  const afm_fontinfo *p = afm_findfont(font);
-  return size * p->descender / 1000.0;
+    const afm_fontinfo *p = afm_findfont(font);
+
+    return size * p->descender / 1000.0;
 }
 
-static int afm_find_char_index(const afm_fontinfo *fontinfo,
+static int afm_find_char_index(
+    const afm_fontinfo * fontinfo,
     afm_cunicode ch1)
 {
-  int idx = ch1 - 32;
-  afm_cuint16 *indexP;
-  int numIndexChars, i;
-  if (idx <= 0)
-    return 0;
-  if (idx <= 126 - 32)
-    return idx;
-  indexP = fontinfo->highchars_index;
-  if (indexP == 0)
-    return 0;
-  numIndexChars = fontinfo->highchars_count;
-  DLOG((stderr, " find highbit, num = %d\n", numIndexChars));
-  if (ch1 >= 161 && ch1 <= 255) {
-    idx = ch1 - 161;
-    DLOG((stderr, "  161, idx = %d -> %d\n", idx, indexP[idx]));
-    if (idx < numIndexChars && indexP[idx] == ch1) {
-      idx += 127 - 32;
-      DLOG((stderr, "  161-guessed ok to %d\n", idx));
-      return idx;
+    int       idx = ch1 - 32;
+    afm_cuint16 *indexP;
+    int       numIndexChars, i;
+
+    if (idx <= 0)
+        return 0;
+    if (idx <= 126 - 32)
+        return idx;
+    indexP = fontinfo->highchars_index;
+    if (indexP == 0)
+        return 0;
+    numIndexChars = fontinfo->highchars_count;
+    DLOG((stderr, " find highbit, num = %d\n", numIndexChars));
+    if (ch1 >= 161 && ch1 <= 255) {
+        idx = ch1 - 161;
+        DLOG((stderr, "  161, idx = %d -> %d\n", idx, indexP[idx]));
+        if (idx < numIndexChars && indexP[idx] == ch1) {
+            idx += 127 - 32;
+            DLOG((stderr, "  161-guessed ok to %d\n", idx));
+            return idx;
+        }
     }
-  }
-  for (i = 0; i < numIndexChars; i++) {
-    DLOG((stderr, "    compares to %d -> %d\n", indexP[i], i));
-    if (indexP[i] == ch1)
-      return i + 127 - 32;
-  }
-  DLOG((stderr, "Did not find %d in highchars_index ??\n", ch1));
-  return 0;
+    for (i = 0; i < numIndexChars; i++) {
+        DLOG((stderr, "    compares to %d -> %d\n", indexP[i], i));
+        if (indexP[i] == ch1)
+            return i + 127 - 32;
+    }
+    DLOG((stderr, "Did not find %d in highchars_index ??\n", ch1));
+    return 0;
 }
 
 #if ENABLE_LIGATURES
-static afm_cunicode afm_find_combined_ligature(const afm_fontinfo *fontinfo,
-    afm_cunicode ch1, afm_cunicode ch2)
+static afm_cunicode afm_find_combined_ligature(
+    const afm_fontinfo * fontinfo,
+    afm_cunicode ch1,
+    afm_cunicode ch2)
 {
-  afm_cunicode *p = fontinfo->ligatures;
-  int num = fontinfo->ligatures_count;
-  int i;
-  if (!num)
-    return 0;
-  DLOG((stderr, " find-lig, num = %d\n", num));
-  for (i = 0; i < num; i++, p += 3) {
-    DLOG((stderr, "    lig: %d + %d -> %d (%c %c %c)\n",
-        p[0], p[1], p[2], p[0], p[1], p[2]));
-    if (ch1 == *p && ch2 == p[1]) {
-      DLOG((stderr, "   matches.\n"));
-      return p[2];
+    afm_cunicode *p = fontinfo->ligatures;
+    int       num = fontinfo->ligatures_count;
+    int       i;
+
+    if (!num)
+        return 0;
+    DLOG((stderr, " find-lig, num = %d\n", num));
+    for (i = 0; i < num; i++, p += 3) {
+        DLOG((stderr, "    lig: %d + %d -> %d (%c %c %c)\n",
+              p[0], p[1], p[2], p[0], p[1], p[2]));
+        if (ch1 == *p && ch2 == p[1]) {
+            DLOG((stderr, "   matches.\n"));
+            return p[2];
+        }
     }
-  }
-  return 0;
+    return 0;
 }
 #endif
 
@@ -168,43 +187,52 @@ static afm_cunicode afm_find_combined_ligature(const afm_fontinfo *fontinfo,
   }
 
 
-static long afm_find_kern(const afm_fontinfo *fontinfo,
-    int kern_idx, afm_cunicode ch2)
+static long afm_find_kern(
+    const afm_fontinfo * fontinfo,
+    int kern_idx,
+    afm_cunicode ch2)
 {
-  afm_cuint8 *p8 = fontinfo->kerning_data + kern_idx;
-  int num;
-  READ_ESCAPED(p8, num);
-  DLOG((stderr, " find kern, num pairs = %d\n", num));
-  while (num > 0) {
-    afm_unicode ch;
-    READ_ESCAPED(p8, ch);
-    DLOG((stderr, "     pair-char = %d\n", ch));
-    if (ch == ch2) {
-      DLOG((stderr, " got kern = %d\n", *(afm_csint8*)p8));
-      return *(afm_csint8*)p8;
+    afm_cuint8 *p8 = fontinfo->kerning_data + kern_idx;
+    int       num;
+
+    READ_ESCAPED(p8, num);
+    DLOG((stderr, " find kern, num pairs = %d\n", num));
+    while (num > 0) {
+        afm_unicode ch;
+
+        READ_ESCAPED(p8, ch);
+        DLOG((stderr, "     pair-char = %d\n", ch));
+        if (ch == ch2) {
+            DLOG((stderr, " got kern = %d\n", *(afm_csint8 *) p8));
+            return *(afm_csint8 *) p8;
+        }
+        p8++;
+        num--;
     }
-    p8++;
-    num--;
-  }
-  return 0;
+    return 0;
 }
 
 /* measure width of a text string */
-double afm_get_text_width( double start, const char* font, double size,
-          double tabwidth, const char* text)
+double afm_get_text_width(
+    double start,
+    const char *font,
+    double size,
+    double tabwidth,
+    const char *text)
 {
-#ifdef HAVE_MBSTOWCS     
-    size_t clen = strlen(text) + 1;
-    wchar_t *cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */
-    int text_count = mbstowcs(cstr, text, clen);
-    double w;
+#ifdef HAVE_MBSTOWCS
+    size_t    clen = strlen(text) + 1;
+    wchar_t  *cstr = malloc(sizeof(wchar_t) * clen);    /* yes we are allocating probably too much here, I know */
+    int       text_count = mbstowcs(cstr, text, clen);
+    double    w;
+
     if (text_count == -1)
-           text_count = mbstowcs(cstr, "Enc-Err", 6);
+        text_count = mbstowcs(cstr, "Enc-Err", 6);
 #ifdef __APPLE__
-       while (text_count > 0) {
-               text_count--;
-               cstr[text_count] = afm_fix_osx_charset(cstr[text_count]); /* unsafe macro */
-       }
+    while (text_count > 0) {
+        text_count--;
+        cstr[text_count] = afm_fix_osx_charset(cstr[text_count]);   /* unsafe macro */
+    }
 #endif
     w = afm_get_text_width_wide(start, font, size, tabwidth, cstr);
     free(cstr);
@@ -214,74 +242,83 @@ double afm_get_text_width( double start, const char* font, double size,
 #endif
 }
 
-double afm_get_text_width_wide( double UNUSED(start), const char* font, double size,
-          double UNUSED(tabwidth), const afm_char* text)
+double afm_get_text_width_wide(
+    double UNUSED(start),
+    const char *font,
+    double size,
+    double UNUSED(tabwidth),
+    const afm_char * text)
 {
-  const afm_fontinfo *fontinfo = afm_findfont(font);
-  long width = 0;
-  double widthf;
-  const afm_char *up = text;
-  DLOG((stderr, "================= %s\n", text));
-  if (fontinfo == NULL) {
-      while (*up)
-         up++;
-    return size * (up - text);
-  }
-  while (1) {
-    afm_unicode ch1, ch2;
-    int idx1, kern_idx;
-    if ((ch1 = *up) == 0)
-        break;
-    ch2 = *++up;
-    DLOG((stderr, "------------- Loop: %d + %d (%c%c)   at %d\n",
-          ch1, ch2, ch1, ch2 ? ch2 : ' ',
-         (up - (const unsigned char*)text) - 1));
-    idx1 = afm_find_char_index(fontinfo, ch1);
-    DLOG((stderr, "  idx1 = %d\n", idx1));
-#if ENABLE_LIGATURES
-    if (ch2) {
-      int ch1_new = afm_find_combined_ligature(fontinfo, ch1, ch2);
-      DLOG((stderr, "  lig-ch = %d\n", ch1_new));
-      if (ch1_new) {
-        ch1 = ch1_new;
-        idx1 = afm_find_char_index(fontinfo, ch1);
-        ch2 = *++up;
-        DLOG((stderr, "  -> idx1 = %d, ch2 = %d (%c)\n", 
-            idx1, ch2, ch2 ? ch2 : ' '));
-      }
+    const afm_fontinfo *fontinfo = afm_findfont(font);
+    long      width = 0;
+    double    widthf;
+    const afm_char *up = text;
+
+    DLOG((stderr, "================= %s\n", text));
+    if (fontinfo == NULL) {
+        while (*up)
+            up++;
+        return size * (up - text);
     }
+    while (1) {
+        afm_unicode ch1, ch2;
+        int       idx1, kern_idx;
+
+        if ((ch1 = *up) == 0)
+            break;
+        ch2 = *++up;
+        DLOG((stderr, "------------- Loop: %d + %d (%c%c)   at %d\n",
+              ch1, ch2, ch1, ch2 ? ch2 : ' ',
+              (up - (const unsigned char *) text) - 1));
+        idx1 = afm_find_char_index(fontinfo, ch1);
+        DLOG((stderr, "  idx1 = %d\n", idx1));
+#if ENABLE_LIGATURES
+        if (ch2) {
+            int       ch1_new =
+                afm_find_combined_ligature(fontinfo, ch1, ch2);
+
+            DLOG((stderr, "  lig-ch = %d\n", ch1_new));
+            if (ch1_new) {
+                ch1 = ch1_new;
+                idx1 = afm_find_char_index(fontinfo, ch1);
+                ch2 = *++up;
+                DLOG((stderr, "  -> idx1 = %d, ch2 = %d (%c)\n",
+                      idx1, ch2, ch2 ? ch2 : ' '));
+            }
+        }
 #endif
-    width += fontinfo->widths[idx1];
-    DLOG((stderr, "Plain width of %d = %d\n", ch1, fontinfo->widths[idx1]));
-    if (fontinfo->kerning_index && ch2) {
-      kern_idx = fontinfo->kerning_index[idx1];
-      DLOG((stderr, "    kern_idx = %d\n", kern_idx));
-      if (kern_idx > 0)
-        width += afm_find_kern(fontinfo, kern_idx, ch2);
+        width += fontinfo->widths[idx1];
+        DLOG((stderr, "Plain width of %d = %d\n", ch1,
+              fontinfo->widths[idx1]));
+        if (fontinfo->kerning_index && ch2) {
+            kern_idx = fontinfo->kerning_index[idx1];
+            DLOG((stderr, "    kern_idx = %d\n", kern_idx));
+            if (kern_idx > 0)
+                width += afm_find_kern(fontinfo, kern_idx, ch2);
+        }
     }
-  }
-  widthf = (width * 6 / 1000.0) * size;
-  DLOG((stderr, "Returns %ld (%ld) -> %f\n", width, width * 6, widthf));
-  return widthf;
+    widthf = (width * 6 / 1000.0) * size;
+    DLOG((stderr, "Returns %ld (%ld) -> %f\n", width, width * 6, widthf));
+    return widthf;
 }
 
 #ifdef __APPLE__
 const unsigned char afm_mac2iso[128] = {
-  '\xC4', '\xC5', '\xC7', '\xC9', '\xD1', '\xD6', '\xDC', '\xE1', /* 80 */
-  '\xE0', '\xE2', '\xE4', '\xE3', '\xE5', '\xE7', '\xE9', '\xE8', /* 88 */
-  '\xEA', '\xEB', '\xED', '\xEC', '\xEE', '\xEF', '\xF1', '\xF3', /* 90 */
-  '\xF2', '\xF4', '\xF6', '\xF5', '\xFA', '\xF9', '\xFB', '\xFC', /* 98 */
-  '\xDD', '\xB0', '\xA2', '\xA3', '\xA7', ' ',    '\xB6', '\xDF', /* A0 */
-  '\xAE', '\xA9', ' ',    '\xB4', '\xA8', ' ',    '\xC6', '\xD8', /* A8 */
-  ' ',    '\xB1', '\xBE', ' ',    '\xA5', '\xB5', ' ',    ' ',    /* B0 */
-  '\xBD', '\xBC', ' ',    '\xAA', '\xBA', ' ',    '\xE6', '\xF8', /* B8 */
-  '\xBF', '\xA1', '\xAC', ' ',    ' ',    ' ',    ' ',    '\xAB', /* C0 */
-  '\xBB', ' ',    '\xA0', '\xC0', '\xC3', '\xD5', ' ',    '\xA6', /* C8 */
-  '\xAD', ' ',    '"',    '"',    '\'',   '\'',   '\xF7', '\xD7', /* D0 */
-  '\xFF', ' ',    ' ',    '\xA4', '\xD0', '\xF0', '\xDE', '\xFE', /* D8 */
-  '\xFD', '\xB7', ' ',    ' ',    ' ',    '\xC2', '\xCA', '\xC1', /* E0 */
-  '\xCB', '\xC8', '\xCD', '\xCE', '\xCF', '\xCC', '\xD3', '\xD4', /* E8 */
-  ' ',    '\xD2', '\xDA', '\xDB', '\xD9', ' ',    ' ',    ' ',    /* F0 */
-  '\xAF', ' ',    ' ',    ' ',    '\xB8', ' ',    ' ',    ' ',    /* F8 */
+    '\xC4', '\xC5', '\xC7', '\xC9', '\xD1', '\xD6', '\xDC', '\xE1', /* 80 */
+    '\xE0', '\xE2', '\xE4', '\xE3', '\xE5', '\xE7', '\xE9', '\xE8', /* 88 */
+    '\xEA', '\xEB', '\xED', '\xEC', '\xEE', '\xEF', '\xF1', '\xF3', /* 90 */
+    '\xF2', '\xF4', '\xF6', '\xF5', '\xFA', '\xF9', '\xFB', '\xFC', /* 98 */
+    '\xDD', '\xB0', '\xA2', '\xA3', '\xA7', ' ', '\xB6', '\xDF',    /* A0 */
+    '\xAE', '\xA9', ' ', '\xB4', '\xA8', ' ', '\xC6', '\xD8',   /* A8 */
+    ' ', '\xB1', '\xBE', ' ', '\xA5', '\xB5', ' ', ' ', /* B0 */
+    '\xBD', '\xBC', ' ', '\xAA', '\xBA', ' ', '\xE6', '\xF8',   /* B8 */
+    '\xBF', '\xA1', '\xAC', ' ', ' ', ' ', ' ', '\xAB', /* C0 */
+    '\xBB', ' ', '\xA0', '\xC0', '\xC3', '\xD5', ' ', '\xA6',   /* C8 */
+    '\xAD', ' ', '"', '"', '\'', '\'', '\xF7', '\xD7',  /* D0 */
+    '\xFF', ' ', ' ', '\xA4', '\xD0', '\xF0', '\xDE', '\xFE',   /* D8 */
+    '\xFD', '\xB7', ' ', ' ', ' ', '\xC2', '\xCA', '\xC1',  /* E0 */
+    '\xCB', '\xC8', '\xCD', '\xCE', '\xCF', '\xCC', '\xD3', '\xD4', /* E8 */
+    ' ', '\xD2', '\xDA', '\xDB', '\xD9', ' ', ' ', ' ', /* F0 */
+    '\xAF', ' ', ' ', ' ', '\xB8', ' ', ' ', ' ',   /* F8 */
 };
 #endif
index 20350ff..e333cbf 100644 (file)
@@ -8,7 +8,7 @@
 #define RRD_AFM_H
 
 #include <stdlib.h>
+
 #ifdef HAVE_MBSTOWCS
 #define afm_char wchar_t
 #else
 
 /* measure width of a text string */
 /* fontname can be full name or postscript name */
-double afm_get_text_width( double start, const char* font, double size,
-                           double tabwidth, const char* text);
-double afm_get_text_width_wide( double start, const char* font, double size,
-                           double tabwidth, const afm_char* text);
+double    afm_get_text_width(
+    double start,
+    const char *font,
+    double size,
+    double tabwidth,
+    const char *text);
+double    afm_get_text_width_wide(
+    double start,
+    const char *font,
+    double size,
+    double tabwidth,
+    const afm_char * text);
 
-double afm_get_ascender(const char* font, double size);
-double afm_get_descender(const char* font, double size);
+double    afm_get_ascender(
+    const char *font,
+    double size);
+double    afm_get_descender(
+    const char *font,
+    double size);
 
 /* get postscript name from fullname or postscript name */
-const char *afm_get_font_postscript_name ( const char* font);
-const char *afm_get_font_name(const char* font);
+const char *afm_get_font_postscript_name(
+    const char *font);
+const char *afm_get_font_name(
+    const char *font);
 
 /* cc -E -dM /dev/null */
 #ifdef __APPLE__
 /* need charset conversion from macintosh to unicode. */
 extern const unsigned char afm_mac2iso[128];
+
 #define afm_fix_osx_charset(c) \
        ( (c) >= 128 && (c) <= 255 ? afm_mac2iso[(c) - 128] : (c))
 #else
index fccf586..c922163 100644 (file)
 /* FontName: Courier */
 /* FullName: Courier */
 /* FamilyName: Courier */
-static afm_cuint8 afm_Courier_widths[] = { /* 315 */
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100
+static afm_cuint8 afm_Courier_widths[] = {  /* 315 */
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
 };
-static afm_cuint16 afm_Courier_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Courier_highchars_index[] = {    /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
 static afm_cunicode afm_Courier_ligatures[] = { /* 3 */
-  102,105,64257
+    102, 105, 64257
 };
 
 
@@ -66,46 +99,79 @@ static afm_cunicode afm_Courier_ligatures[] = { /* 3 */
 /* FullName: Courier Bold */
 /* FamilyName: Courier */
 static afm_cuint8 afm_Courier_Bold_widths[] = { /* 315 */
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
 };
-static afm_cuint16 afm_Courier_Bold_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Courier_Bold_highchars_index[] = {   /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Courier_Bold_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Courier_Bold_ligatures[] = {    /* 3 */
+    102, 105, 64257
 };
 
 
@@ -113,47 +179,80 @@ static afm_cunicode afm_Courier_Bold_ligatures[] = { /* 3 */
 /* FontName: Courier-BoldOblique */
 /* FullName: Courier Bold Oblique */
 /* FamilyName: Courier */
-static afm_cuint8 afm_Courier_BoldOblique_widths[] = { /* 315 */
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100
+static afm_cuint8 afm_Courier_BoldOblique_widths[] = {  /* 315 */
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
 };
-static afm_cuint16 afm_Courier_BoldOblique_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Courier_BoldOblique_highchars_index[] = {    /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
 static afm_cunicode afm_Courier_BoldOblique_ligatures[] = { /* 3 */
-  102,105,64257
+    102, 105, 64257
 };
 
 
@@ -161,47 +260,80 @@ static afm_cunicode afm_Courier_BoldOblique_ligatures[] = { /* 3 */
 /* FontName: Courier-Oblique */
 /* FullName: Courier Oblique */
 /* FamilyName: Courier */
-static afm_cuint8 afm_Courier_Oblique_widths[] = { /* 315 */
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
-  100,100,100,100,100,100,100,100,100,100,100
+static afm_cuint8 afm_Courier_Oblique_widths[] = {  /* 315 */
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
+    100,
+    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100
 };
-static afm_cuint16 afm_Courier_Oblique_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Courier_Oblique_highchars_index[] = {    /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
 static afm_cunicode afm_Courier_Oblique_ligatures[] = { /* 3 */
-  102,105,64257
+    102, 105, 64257
 };
 
 
@@ -209,408 +341,796 @@ static afm_cunicode afm_Courier_Oblique_ligatures[] = { /* 3 */
 /* FontName: Helvetica */
 /* FullName: Helvetica */
 /* FamilyName: Helvetica */
-static afm_cuint8 afm_Helvetica_widths[] = { /* 315 */
-  46,46,59,93,93,148,111,32,56,56,65,97,46,56,46,46,93,93,93,93,93,
-  93,93,93,93,93,46,46,97,97,97,93,169,111,111,120,120,111,102,130,
-  120,46,83,111,93,139,120,130,111,130,120,111,102,120,111,157,111,
-  111,102,46,46,46,78,93,56,93,93,83,93,93,46,93,93,37,37,83,37,139,
-  93,93,93,93,56,83,46,93,83,120,83,83,83,56,43,56,97,56,93,93,93,
-  93,43,93,56,123,62,93,97,123,56,67,97,56,56,56,93,90,46,56,56,61,
-  93,139,139,139,102,111,111,111,111,111,111,167,120,111,111,111,111,
-  46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,120,120,111,
-  111,102,93,93,93,93,93,93,148,83,93,93,93,93,46,46,46,46,93,93,93,
-  93,93,93,93,97,102,93,93,93,93,83,93,83,111,93,111,93,111,93,120,
-  83,120,83,120,107,120,93,111,93,111,93,111,93,111,93,130,93,130,
-  93,46,46,46,37,46,46,111,83,93,37,93,37,93,50,93,37,120,93,120,93,
-  120,93,130,93,130,93,167,157,120,56,120,56,120,56,111,83,111,83,
-  111,83,102,46,102,53,120,93,120,93,120,93,120,93,111,102,83,102,
-  83,102,83,93,111,83,56,56,56,56,56,56,56,56,93,167,37,37,37,56,56,
-  56,93,93,58,167,167,56,56,28,93,167,79,102,100,97,76,92,92,92,79,
-  42,83,83
+static afm_cuint8 afm_Helvetica_widths[] = {    /* 315 */
+    46, 46, 59, 93, 93, 148, 111, 32, 56, 56, 65, 97, 46, 56, 46, 46, 93, 93,
+    93, 93, 93,
+    93, 93, 93, 93, 93, 46, 46, 97, 97, 97, 93, 169, 111, 111, 120, 120, 111,
+    102, 130,
+    120, 46, 83, 111, 93, 139, 120, 130, 111, 130, 120, 111, 102, 120, 111,
+    157, 111,
+    111, 102, 46, 46, 46, 78, 93, 56, 93, 93, 83, 93, 93, 46, 93, 93, 37, 37,
+    83, 37, 139,
+    93, 93, 93, 93, 56, 83, 46, 93, 83, 120, 83, 83, 83, 56, 43, 56, 97, 56,
+    93, 93, 93,
+    93, 43, 93, 56, 123, 62, 93, 97, 123, 56, 67, 97, 56, 56, 56, 93, 90, 46,
+    56, 56, 61,
+    93, 139, 139, 139, 102, 111, 111, 111, 111, 111, 111, 167, 120, 111, 111,
+    111, 111,
+    46, 46, 46, 46, 120, 120, 130, 130, 130, 130, 130, 97, 130, 120, 120, 120,
+    120, 111,
+    111, 102, 93, 93, 93, 93, 93, 93, 148, 83, 93, 93, 93, 93, 46, 46, 46, 46,
+    93, 93, 93,
+    93, 93, 93, 93, 97, 102, 93, 93, 93, 93, 83, 93, 83, 111, 93, 111, 93,
+    111, 93, 120,
+    83, 120, 83, 120, 107, 120, 93, 111, 93, 111, 93, 111, 93, 111, 93, 130,
+    93, 130,
+    93, 46, 46, 46, 37, 46, 46, 111, 83, 93, 37, 93, 37, 93, 50, 93, 37, 120,
+    93, 120, 93,
+    120, 93, 130, 93, 130, 93, 167, 157, 120, 56, 120, 56, 120, 56, 111, 83,
+    111, 83,
+    111, 83, 102, 46, 102, 53, 120, 93, 120, 93, 120, 93, 120, 93, 111, 102,
+    83, 102,
+    83, 102, 83, 93, 111, 83, 56, 56, 56, 56, 56, 56, 56, 56, 93, 167, 37, 37,
+    37, 56, 56,
+    56, 93, 93, 58, 167, 167, 56, 56, 28, 93, 167, 79, 102, 100, 97, 76, 92,
+    92, 92, 79,
+    42, 83, 83
 };
 static afm_sint16 afm_Helvetica_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,29,0,38,0,0,0,0,0,0,0,0,0,0,0,49,52,0,0,
-  0,0,0,55,170,197,202,0,241,0,0,0,345,418,510,0,0,545,594,687,710,
-  772,777,938,966,1115,0,1259,0,0,0,0,0,0,0,1407,1419,1468,0,1476,
-  1494,1575,1587,0,0,1595,0,1638,1668,1700,1718,0,1730,1847,0,0,1854,
-  1924,1994,2017,2087,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,2130,2245,2360,2475,2590,2705,0,2820,0,0,
-  0,0,0,0,0,0,0,0,2825,2874,2923,2972,3021,0,3070,3119,3147,3175,3203,
-  3231,0,0,3379,3391,3403,3415,3427,3439,0,3451,3459,3477,3495,3513,
-  0,0,0,0,0,3531,3563,3581,3599,3617,3635,0,3653,0,0,0,0,3882,0,3952,
-  4022,4137,4149,4264,4276,4391,4403,4408,4416,4421,4429,0,4468,0,
-  0,4507,0,4525,0,4543,0,4561,0,4579,0,4591,0,0,0,0,0,0,4603,4695,
-  4738,0,4773,0,4808,0,4843,0,0,4878,0,4910,0,4942,4974,5023,5041,
-  5090,0,0,5108,5170,5287,5349,5466,5528,5645,5650,5657,5662,5669,
-  5674,5681,0,5842,0,6003,0,6031,0,6059,0,6087,0,6115,0,6263,0,6306,
-  0,6349,0,6392,6397,0,0,0,0,0,0,0,0,0,0,6404,6409,0,0,6447,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 49, 52, 0, 0,
+    0, 0, 0, 55, 170, 197, 202, 0, 241, 0, 0, 0, 345, 418, 510, 0, 0, 545,
+    594, 687, 710,
+    772, 777, 938, 966, 1115, 0, 1259, 0, 0, 0, 0, 0, 0, 0, 1407, 1419, 1468,
+    0, 1476,
+    1494, 1575, 1587, 0, 0, 1595, 0, 1638, 1668, 1700, 1718, 0, 1730, 1847, 0,
+    0, 1854,
+    1924, 1994, 2017, 2087, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2130, 2245, 2360, 2475, 2590, 2705, 0,
+    2820, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 2825, 2874, 2923, 2972, 3021, 0, 3070, 3119, 3147,
+    3175, 3203,
+    3231, 0, 0, 3379, 3391, 3403, 3415, 3427, 3439, 0, 3451, 3459, 3477, 3495,
+    3513,
+    0, 0, 0, 0, 0, 3531, 3563, 3581, 3599, 3617, 3635, 0, 3653, 0, 0, 0, 0,
+    3882, 0, 3952,
+    4022, 4137, 4149, 4264, 4276, 4391, 4403, 4408, 4416, 4421, 4429, 0, 4468,
+    0,
+    0, 4507, 0, 4525, 0, 4543, 0, 4561, 0, 4579, 0, 4591, 0, 0, 0, 0, 0, 0,
+    4603, 4695,
+    4738, 0, 4773, 0, 4808, 0, 4843, 0, 0, 4878, 0, 4910, 0, 4942, 4974, 5023,
+    5041,
+    5090, 0, 0, 5108, 5170, 5287, 5349, 5466, 5528, 5645, 5650, 5657, 5662,
+    5669,
+    5674, 5681, 0, 5842, 0, 6003, 0, 6031, 0, 6059, 0, 6087, 0, 6115, 0, 6263,
+    0, 6306,
+    0, 6349, 0, 6392, 6397, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6404, 6409, 0, 0,
+    6447, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static afm_cuint8 afm_Helvetica_kerning_data[] = { /* 6450 */
-  42,11,85,249,87,249,88,250,90,242,222,242,0,100,249,0,102,249,0,
-  122,242,1,32,24,247,1,32,28,252,3,1,32,25,240,1,32,29,240,4,33,247,
-  1,32,25,240,1,32,29,240,2,33,249,2,33,249,49,68,252,72,252,80,252,
-  82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,
-  122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,252,
-  218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,252,
-  253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,
-  252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,
-  113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,12,45,
-  254,47,254,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,
-  255,0,114,255,0,116,255,3,45,252,47,252,18,45,245,47,245,66,250,
-  87,245,88,250,90,242,193,250,194,250,195,250,196,250,197,250,198,
-  250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,45,45,232,47,232,66,
-  244,98,249,102,252,112,252,115,249,193,244,194,244,195,244,196,244,
-  197,244,198,244,225,249,226,249,227,249,228,249,229,249,230,249,
-  233,252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,
-  247,252,249,252,0,2,244,0,3,249,0,4,244,0,5,249,0,6,244,0,7,249,
-  0,21,252,0,25,252,0,27,252,0,29,252,0,79,252,0,83,252,0,87,249,0,
-  89,249,0,91,249,32,45,252,47,252,66,254,98,254,118,254,193,254,194,
-  254,195,254,196,254,197,254,198,254,225,254,226,254,227,254,228,
-  254,229,254,230,254,250,254,251,254,252,254,253,254,0,2,254,0,3,
-  254,0,4,254,0,5,254,0,6,254,0,7,254,0,109,254,0,113,254,0,115,254,
-  0,117,254,40,80,249,102,250,112,250,118,252,122,249,211,249,212,
-  249,213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,
-  250,243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,
-  252,252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,
-  29,250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,
-  115,252,0,117,252,14,85,239,87,239,88,245,90,234,122,252,222,234,
-  254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,
-  234,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
-  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
-  254,0,6,254,0,100,250,0,102,250,0,122,245,41,45,227,47,227,66,237,
-  98,250,102,249,112,249,193,237,194,237,195,237,196,237,197,237,198,
-  237,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
-  249,235,249,236,249,243,249,244,249,245,249,246,249,247,249,249,
-  249,0,2,237,0,3,250,0,4,237,0,5,250,0,6,237,0,7,250,0,21,249,0,25,
-  249,0,27,249,0,29,249,0,79,249,0,83,249,10,86,255,218,255,219,255,
-  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,254,
-  85,252,86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,
-  215,254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,
-  0,82,254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
-  250,0,122,249,3,45,254,47,254,70,45,237,46,234,47,237,59,254,60,
-  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
-  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
-  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
-  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
-  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
-  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
-  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
-  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
-  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,236,46,244,
-  47,236,59,250,60,250,66,244,72,250,80,250,98,245,102,244,112,244,
-  118,245,193,244,194,244,195,244,196,244,197,244,198,244,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,245,226,245,227,245,
-  228,245,229,245,230,245,233,244,234,244,235,244,236,244,243,244,
-  244,244,245,244,246,244,247,244,249,244,250,245,251,245,252,245,
-  253,245,0,2,244,0,3,245,0,4,244,0,5,245,0,6,244,0,7,245,0,21,244,
-  0,25,244,0,27,244,0,29,244,0,32,250,0,36,250,0,78,250,0,79,244,0,
-  82,250,0,83,244,0,109,245,0,113,245,0,115,245,0,117,245,63,45,244,
-  46,250,47,244,66,249,80,254,98,250,102,252,112,252,118,252,122,254,
-  193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,254,
-  213,254,214,254,215,254,217,254,225,250,226,250,227,250,228,250,
-  229,250,230,250,233,252,234,252,235,252,236,252,243,252,244,252,
-  245,252,246,252,247,252,249,252,250,252,251,252,252,252,253,252,
-  254,254,0,1,254,0,2,249,0,3,250,0,4,249,0,5,250,0,6,249,0,7,250,
-  0,21,252,0,25,252,0,27,252,0,29,252,0,78,254,0,79,252,0,82,254,0,
-  83,252,0,109,252,0,113,252,0,115,252,0,117,252,65,45,234,46,234,
-  47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,112,234,
-  118,239,193,239,194,239,195,239,196,239,197,239,198,239,211,243,
-  212,243,213,243,214,243,215,243,217,243,225,234,226,234,227,234,
-  228,234,229,234,230,234,233,234,234,234,235,234,236,234,238,254,
-  243,234,244,234,245,234,246,234,247,234,249,234,250,239,251,239,
-  252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,0,7,234,
-  0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,79,234,0,
-  82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,6,119,254,
-  120,254,122,252,254,252,0,1,252,21,45,250,47,250,99,255,109,254,
-  118,254,119,254,122,254,250,254,251,254,252,254,253,254,254,254,
-  0,1,254,0,60,254,0,62,254,0,68,254,0,109,254,0,113,254,0,115,254,
-  0,117,254,4,45,254,108,254,0,57,254,9,45,254,47,254,119,252,120,
-  254,121,252,122,254,254,254,0,1,254,34,45,252,47,252,98,252,102,
-  252,112,252,225,252,226,252,227,252,228,252,229,252,230,252,233,
-  252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,247,
-  252,249,252,0,3,252,0,5,252,0,7,252,0,21,252,0,25,252,0,27,252,0,
-  29,252,0,51,252,0,79,252,0,83,252,1,32,25,8,1,32,29,10,5,115,255,
-  0,87,255,0,89,255,0,91,255,4,122,252,254,252,0,1,252,19,102,254,
-  112,254,233,254,234,254,235,254,236,254,243,254,244,254,245,254,
-  246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,
-  254,0,83,254,13,118,255,122,254,250,255,251,255,252,255,253,255,
-  254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,
-  119,254,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
-  0,109,255,0,113,255,0,115,255,0,117,255,9,45,250,47,250,119,254,
-  120,254,121,252,122,252,254,252,0,1,252,6,45,251,47,251,122,252,
-  254,252,0,1,252,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,
-  3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,
-  255,228,255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,
-  251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,
-  3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,
-  3,0,113,3,0,115,3,0,117,3,4,45,254,47,254,120,252,31,45,244,47,244,
-  98,253,102,253,112,253,225,253,226,253,227,253,228,253,229,253,230,
-  253,233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,
-  253,247,253,249,253,0,3,253,0,5,253,0,7,253,0,21,253,0,25,253,0,
-  27,253,0,29,253,0,79,253,0,83,253,31,45,247,47,247,98,254,102,255,
-  112,255,225,254,226,254,227,254,228,254,229,254,230,254,233,255,
-  234,255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,
-  249,255,0,3,254,0,5,254,0,7,254,0,21,255,0,25,255,0,27,255,0,29,
-  255,0,79,255,0,83,255,10,102,252,233,252,234,252,235,252,236,252,
-  0,21,252,0,25,252,0,27,252,0,29,252,31,45,240,47,240,98,254,102,
-  254,112,254,225,254,226,254,227,254,228,254,229,254,230,254,233,
-  254,234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,
-  254,249,254,0,3,254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,
-  29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,234,254,235,
-  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,
-  254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,68,252,72,252,
-  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
-  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
-  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
-  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
-  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
-  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
-  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
-  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
-  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
-  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,240,49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,
-  88,249,90,240,118,252,119,250,120,250,122,250,200,252,211,252,212,
-  252,213,252,214,252,215,252,217,252,218,249,219,249,220,249,221,
-  249,222,240,250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,
-  252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,
-  237,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,240,49,68,252,72,252,80,252,82,252,85,
-  237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,122,250,
-  200,252,211,252,212,252,213,252,214,252,215,252,217,252,218,249,
-  219,249,220,249,221,249,222,240,250,252,251,252,252,252,253,252,
-  254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,
-  252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,113,252,
-  0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,49,68,252,72,252,
-  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
-  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
-  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
-  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
-  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
-  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
-  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
-  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
-  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
-  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,240,3,45,252,47,252,22,45,250,47,250,66,254,85,250,87,
-  249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,
-  198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,
-  245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
-  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
-  254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,254,
-  85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,
-  197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,
-  250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,
-  90,245,193,254,194,254,195,254,196,254,197,254,198,254,222,245,0,
-  2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,
-  250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,
-  254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,
-  250,0,102,250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,
-  252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,198,254,
-  222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,13,
-  45,250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,
-  250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,
-  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,
-  250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
-  0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,
-  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,234,
-  46,234,47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,
-  112,234,118,239,193,239,194,239,195,239,196,239,197,239,198,239,
-  211,243,212,243,213,243,214,243,215,243,217,243,225,234,226,234,
-  227,234,228,245,229,234,230,234,233,234,234,234,235,234,236,234,
-  238,254,243,234,244,234,245,234,246,234,247,234,249,234,250,239,
-  251,239,252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,
-  0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,
-  79,245,0,82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,
-  6,119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,
-  252,254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,6,
-  119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,252,
-  254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,4,45,254,
-  108,254,0,57,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,14,118,255,119,254,122,254,250,255,251,255,252,255,
-  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  95,45,241,47,241,98,248,99,248,100,248,101,248,102,248,103,248,104,
-  248,105,248,106,248,107,248,108,248,109,248,110,248,111,248,112,
-  248,113,248,114,248,115,248,116,248,117,248,118,248,119,245,120,
-  245,121,243,122,245,123,248,225,248,226,248,227,248,228,248,229,
-  248,230,248,232,248,233,248,234,248,235,248,236,248,237,248,238,
-  248,239,248,240,248,242,248,243,248,244,248,245,248,246,248,247,
-  248,249,248,250,248,251,248,252,248,253,248,254,245,0,1,245,0,3,
-  248,0,5,248,0,7,248,0,9,248,0,15,248,0,19,248,0,21,248,0,25,248,
-  0,27,248,0,29,248,0,33,248,0,37,248,0,45,248,0,49,248,0,57,248,0,
-  60,248,0,62,248,0,68,248,0,70,248,0,72,248,0,74,248,0,79,248,0,83,
-  248,0,87,248,0,89,248,0,91,248,0,93,248,0,97,248,0,99,248,0,101,
-  248,0,109,248,0,113,248,0,115,248,0,117,248,0,124,248,0,126,248,
-  0,128,248,1,2,25,248,31,45,240,47,240,98,254,102,254,112,254,225,
-  254,226,254,227,254,228,254,229,254,230,254,233,254,234,254,235,
-  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,3,
-  254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,
-  0,83,254,31,45,240,47,240,98,254,102,254,112,254,225,254,226,254,
-  227,254,228,254,229,254,230,254,233,254,234,254,235,254,236,254,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,3,254,0,5,254,
-  0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,
-  68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,
-  252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,214,
-  252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,250,
-  252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,
-  252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,
-  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
-  0,122,240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,
-  252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,
-  250,120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,
-  252,217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,
-  252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,
-  36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,252,80,
-  252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,
-  250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,
-  252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,
-  252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,
-  78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,
-  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,6,119,
-  254,120,254,122,252,254,252,0,1,252,3,45,252,47,252,4,45,254,108,
-  254,0,57,254,3,45,252,47,252,4,45,254,108,254,0,57,254,18,45,245,
-  47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,250,
-  197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,18,45,
-  245,47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,
-  250,197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,5,
-  115,255,0,87,255,0,89,255,0,91,255,5,115,255,0,87,255,0,89,255,0,
-  91,255,40,80,249,102,250,112,250,118,252,122,249,211,249,212,249,
-  213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,250,
-  243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,252,
-  252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,29,
-  250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,115,
-  252,0,117,252,19,102,254,112,254,233,254,234,254,235,254,236,254,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,254,
-  0,27,254,0,29,254,0,79,254,0,83,254,14,85,239,87,239,88,245,90,234,
-  122,252,222,234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,
-  32,25,230,1,32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,
-  234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,
-  32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,234,254,252,
-  0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,
-  85,239,87,239,88,245,90,234,122,252,222,234,254,252,0,1,252,0,100,
-  239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,118,255,119,254,
-  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
-  0,113,255,0,115,255,0,117,255,14,118,255,119,254,122,254,250,255,
-  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
-  255,0,117,255,14,118,255,119,254,122,254,250,255,251,255,252,255,
-  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
-  22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,
-  194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,
-  0,6,254,0,100,250,0,102,250,0,122,245,9,45,250,47,250,119,254,120,
-  254,121,252,122,252,254,252,0,1,252,22,45,250,47,250,66,254,85,250,
-  87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,
-  254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,
-  0,122,245,9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,
-  0,1,252,27,80,254,85,252,86,250,87,249,88,252,90,249,211,254,212,
-  254,213,254,214,254,215,254,217,254,218,250,219,250,220,250,221,
-  250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,250,0,112,
-  250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,5,60,5,98,
-  255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,
-  225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,3,239,
-  3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,
-  0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,
-  0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,27,80,254,85,252,
-  86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,215,
-  254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,0,82,
-  254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,
-  0,122,249,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,3,110,
-  4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,255,228,
-  255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,251,3,252,
-  3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,
-  0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,3,0,113,
-  3,0,115,3,0,117,3,27,80,254,85,252,86,250,87,249,88,252,90,249,211,
-  254,212,254,213,254,214,254,215,254,217,254,218,250,219,250,220,
-  250,221,250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,
-  250,0,112,250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,
-  5,60,5,98,255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,
-  5,122,5,225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,
-  3,239,3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,
-  0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,
-  0,72,4,0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,3,45,254,47,
-  254,4,45,254,47,254,120,252,3,45,254,47,254,4,45,254,47,254,120,
-  252,3,45,254,47,254,4,45,254,47,254,120,252,70,45,237,46,234,47,
-  237,59,254,60,254,66,237,80,250,98,237,102,237,112,237,115,237,118,
-  237,120,237,122,237,193,237,194,237,195,237,196,237,197,237,198,
-  237,211,250,212,250,213,250,214,250,215,250,217,250,225,237,226,
-  237,227,237,228,247,229,237,230,237,233,247,234,237,235,237,236,
-  237,243,237,244,237,245,237,246,247,247,237,249,237,250,237,251,
-  237,252,237,253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,
-  247,0,6,237,0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,
-  0,79,247,0,82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,
-  0,113,237,0,115,237,0,117,237,70,45,237,46,234,47,237,59,254,60,
-  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
-  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
-  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
-  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
-  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
-  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
-  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
-  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
-  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,
-  66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,
-  4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,195,250,196,
-  250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,
-  250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,
-  250,0,6,250,65,45,234,46,234,47,234,59,247,60,247,66,239,80,243,
-  98,234,102,234,106,254,112,234,118,239,193,239,194,239,195,239,196,
-  239,197,239,198,239,211,243,212,243,213,243,214,243,215,243,217,
-  243,225,234,226,234,227,234,228,245,229,234,230,234,233,234,234,
-  234,235,234,236,234,238,254,243,234,244,234,245,234,246,234,247,
-  234,249,234,250,239,251,239,252,239,253,239,0,2,239,0,3,245,0,4,
-  239,0,5,245,0,6,239,0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,
-  0,49,254,0,78,243,0,79,234,0,82,243,0,83,234,0,109,239,0,113,239,
-  0,115,239,0,117,239,19,102,254,112,254,233,254,234,254,235,254,236,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,
-  254,0,27,254,0,29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,
-  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
-  249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,19,
-  102,254,112,254,233,254,234,254,235,254,236,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,
-  254,0,79,254,0,83,254,3,45,254,47,254,4,45,254,47,254,120,252,2,
-  1,32,24,247,14,33,245,101,249,115,249,116,249,0,19,249,0,87,249,
-  0,89,249,0,91,249,0,93,249,0,97,249,0,99,249,1,2,25,249,1,32,25,
-  247,2,33,250
+static afm_cuint8 afm_Helvetica_kerning_data[] = {  /* 6450 */
+    42, 11, 85, 249, 87, 249, 88, 250, 90, 242, 222, 242, 0, 100, 249, 0, 102,
+    249, 0,
+    122, 242, 1, 32, 24, 247, 1, 32, 28, 252, 3, 1, 32, 25, 240, 1, 32, 29,
+    240, 4, 33, 247,
+    1, 32, 25, 240, 1, 32, 29, 240, 2, 33, 249, 2, 33, 249, 49, 68, 252, 72,
+    252, 80, 252,
+    82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119, 250,
+    120, 250,
+    122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217,
+    252,
+    218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252, 252,
+    252,
+    253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0, 36,
+    252, 0, 78,
+    252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252, 0,
+    112, 249, 0,
+    113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 240,
+    12, 45,
+    254, 47, 254, 86, 255, 218, 255, 219, 255, 220, 255, 221, 255, 0, 108,
+    255, 0, 112,
+    255, 0, 114, 255, 0, 116, 255, 3, 45, 252, 47, 252, 18, 45, 245, 47, 245,
+    66, 250,
+    87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195, 250, 196, 250, 197,
+    250, 198,
+    250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 242, 45, 45, 232,
+    47, 232, 66,
+    244, 98, 249, 102, 252, 112, 252, 115, 249, 193, 244, 194, 244, 195, 244,
+    196, 244,
+    197, 244, 198, 244, 225, 249, 226, 249, 227, 249, 228, 249, 229, 249, 230,
+    249,
+    233, 252, 234, 252, 235, 252, 236, 252, 243, 252, 244, 252, 245, 252, 246,
+    252,
+    247, 252, 249, 252, 0, 2, 244, 0, 3, 249, 0, 4, 244, 0, 5, 249, 0, 6, 244,
+    0, 7, 249,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 79, 252, 0, 83, 252, 0,
+    87, 249, 0,
+    89, 249, 0, 91, 249, 32, 45, 252, 47, 252, 66, 254, 98, 254, 118, 254,
+    193, 254, 194,
+    254, 195, 254, 196, 254, 197, 254, 198, 254, 225, 254, 226, 254, 227, 254,
+    228,
+    254, 229, 254, 230, 254, 250, 254, 251, 254, 252, 254, 253, 254, 0, 2,
+    254, 0, 3,
+    254, 0, 4, 254, 0, 5, 254, 0, 6, 254, 0, 7, 254, 0, 109, 254, 0, 113, 254,
+    0, 115, 254,
+    0, 117, 254, 40, 80, 249, 102, 250, 112, 250, 118, 252, 122, 249, 211,
+    249, 212,
+    249, 213, 249, 214, 249, 215, 249, 217, 249, 233, 250, 234, 250, 235, 250,
+    236,
+    250, 243, 250, 244, 250, 245, 250, 246, 250, 247, 250, 249, 250, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 249, 0, 1, 249, 0, 21, 250, 0, 25, 250, 0,
+    27, 250, 0,
+    29, 250, 0, 78, 249, 0, 79, 250, 0, 82, 249, 0, 83, 250, 0, 109, 252, 0,
+    113, 252, 0,
+    115, 252, 0, 117, 252, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122, 252,
+    222, 234,
+    254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32, 25,
+    230, 1, 32, 29,
+    234, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247,
+    90, 245, 193,
+    254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2,
+    254, 0, 4,
+    254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 41, 45, 227, 47,
+    227, 66, 237,
+    98, 250, 102, 249, 112, 249, 193, 237, 194, 237, 195, 237, 196, 237, 197,
+    237, 198,
+    237, 225, 250, 226, 250, 227, 250, 228, 250, 229, 250, 230, 250, 233, 249,
+    234,
+    249, 235, 249, 236, 249, 243, 249, 244, 249, 245, 249, 246, 249, 247, 249,
+    249,
+    249, 0, 2, 237, 0, 3, 250, 0, 4, 237, 0, 5, 250, 0, 6, 237, 0, 7, 250, 0,
+    21, 249, 0, 25,
+    249, 0, 27, 249, 0, 29, 249, 0, 79, 249, 0, 83, 249, 10, 86, 255, 218,
+    255, 219, 255,
+    220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255, 0, 116, 255,
+    27, 80, 254,
+    85, 252, 86, 250, 87, 249, 88, 252, 90, 249, 211, 254, 212, 254, 213, 254,
+    214, 254,
+    215, 254, 217, 254, 218, 250, 219, 250, 220, 250, 221, 250, 222, 249, 0,
+    78, 254,
+    0, 82, 254, 0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114,
+    250, 0, 116,
+    250, 0, 122, 249, 3, 45, 254, 47, 254, 70, 45, 237, 46, 234, 47, 237, 59,
+    254, 60,
+    254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115, 237, 118, 237,
+    120, 237,
+    122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237, 226, 237, 227,
+    237,
+    228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237, 236, 237, 243,
+    237,
+    244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237, 251, 237, 252,
+    237,
+    253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 247,
+    0, 6, 237,
+    0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237, 0, 78, 250, 0,
+    79, 247, 0,
+    82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0, 109, 247, 0,
+    113, 237, 0,
+    115, 237, 0, 117, 237, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250,
+    195, 250,
+    196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 65, 45,
+    236, 46, 244,
+    47, 236, 59, 250, 60, 250, 66, 244, 72, 250, 80, 250, 98, 245, 102, 244,
+    112, 244,
+    118, 245, 193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 245, 226, 245, 227,
+    245,
+    228, 245, 229, 245, 230, 245, 233, 244, 234, 244, 235, 244, 236, 244, 243,
+    244,
+    244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250, 245, 251, 245, 252,
+    245,
+    253, 245, 0, 2, 244, 0, 3, 245, 0, 4, 244, 0, 5, 245, 0, 6, 244, 0, 7,
+    245, 0, 21, 244,
+    0, 25, 244, 0, 27, 244, 0, 29, 244, 0, 32, 250, 0, 36, 250, 0, 78, 250, 0,
+    79, 244, 0,
+    82, 250, 0, 83, 244, 0, 109, 245, 0, 113, 245, 0, 115, 245, 0, 117, 245,
+    63, 45, 244,
+    46, 250, 47, 244, 66, 249, 80, 254, 98, 250, 102, 252, 112, 252, 118, 252,
+    122, 254,
+    193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 211, 254, 212,
+    254,
+    213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226, 250, 227, 250, 228,
+    250,
+    229, 250, 230, 250, 233, 252, 234, 252, 235, 252, 236, 252, 243, 252, 244,
+    252,
+    245, 252, 246, 252, 247, 252, 249, 252, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 254, 0, 1, 254, 0, 2, 249, 0, 3, 250, 0, 4, 249, 0, 5, 250, 0, 6,
+    249, 0, 7, 250,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 78, 254, 0, 79, 252, 0,
+    82, 254, 0,
+    83, 252, 0, 109, 252, 0, 113, 252, 0, 115, 252, 0, 117, 252, 65, 45, 234,
+    46, 234,
+    47, 234, 59, 247, 60, 247, 66, 239, 80, 243, 98, 234, 102, 234, 106, 254,
+    112, 234,
+    118, 239, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211,
+    243,
+    212, 243, 213, 243, 214, 243, 215, 243, 217, 243, 225, 234, 226, 234, 227,
+    234,
+    228, 234, 229, 234, 230, 234, 233, 234, 234, 234, 235, 234, 236, 234, 238,
+    254,
+    243, 234, 244, 234, 245, 234, 246, 234, 247, 234, 249, 234, 250, 239, 251,
+    239,
+    252, 239, 253, 239, 0, 2, 239, 0, 3, 245, 0, 4, 239, 0, 5, 245, 0, 6, 239,
+    0, 7, 234,
+    0, 21, 245, 0, 25, 234, 0, 27, 234, 0, 29, 234, 0, 49, 254, 0, 78, 243, 0,
+    79, 234, 0,
+    82, 243, 0, 83, 234, 0, 109, 239, 0, 113, 239, 0, 115, 239, 0, 117, 239,
+    6, 119, 254,
+    120, 254, 122, 252, 254, 252, 0, 1, 252, 21, 45, 250, 47, 250, 99, 255,
+    109, 254,
+    118, 254, 119, 254, 122, 254, 250, 254, 251, 254, 252, 254, 253, 254, 254,
+    254,
+    0, 1, 254, 0, 60, 254, 0, 62, 254, 0, 68, 254, 0, 109, 254, 0, 113, 254,
+    0, 115, 254,
+    0, 117, 254, 4, 45, 254, 108, 254, 0, 57, 254, 9, 45, 254, 47, 254, 119,
+    252, 120,
+    254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 34, 45, 252, 47, 252, 98,
+    252, 102,
+    252, 112, 252, 225, 252, 226, 252, 227, 252, 228, 252, 229, 252, 230, 252,
+    233,
+    252, 234, 252, 235, 252, 236, 252, 243, 252, 244, 252, 245, 252, 246, 252,
+    247,
+    252, 249, 252, 0, 3, 252, 0, 5, 252, 0, 7, 252, 0, 21, 252, 0, 25, 252, 0,
+    27, 252, 0,
+    29, 252, 0, 51, 252, 0, 79, 252, 0, 83, 252, 1, 32, 25, 8, 1, 32, 29, 10,
+    5, 115, 255,
+    0, 87, 255, 0, 89, 255, 0, 91, 255, 4, 122, 252, 254, 252, 0, 1, 252, 19,
+    102, 254,
+    112, 254, 233, 254, 234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245,
+    254,
+    246, 254, 247, 254, 249, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29,
+    254, 0, 79,
+    254, 0, 83, 254, 13, 118, 255, 122, 254, 250, 255, 251, 255, 252, 255,
+    253, 255,
+    254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255,
+    14, 118, 255,
+    119, 254, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0,
+    1, 254,
+    0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 9, 45, 250, 47, 250,
+    119, 254,
+    120, 254, 121, 252, 122, 252, 254, 252, 0, 1, 252, 6, 45, 251, 47, 251,
+    122, 252,
+    254, 252, 0, 1, 252, 50, 45, 249, 47, 249, 59, 5, 60, 5, 98, 255, 106, 3,
+    108, 3, 109,
+    3, 110, 4, 111, 4, 113, 5, 117, 7, 118, 3, 119, 5, 122, 5, 225, 255, 226,
+    255, 227,
+    255, 228, 255, 229, 255, 230, 255, 237, 3, 238, 3, 239, 3, 240, 3, 242, 4,
+    250, 3,
+    251, 3, 252, 3, 253, 3, 254, 5, 0, 1, 5, 0, 3, 255, 0, 5, 255, 0, 7, 255,
+    0, 45, 3, 0, 49,
+    3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0, 68, 3, 0, 70, 4, 0, 72, 4, 0, 74, 4,
+    0, 101, 7, 0, 109,
+    3, 0, 113, 3, 0, 115, 3, 0, 117, 3, 4, 45, 254, 47, 254, 120, 252, 31, 45,
+    244, 47, 244,
+    98, 253, 102, 253, 112, 253, 225, 253, 226, 253, 227, 253, 228, 253, 229,
+    253, 230,
+    253, 233, 253, 234, 253, 235, 253, 236, 253, 243, 253, 244, 253, 245, 253,
+    246,
+    253, 247, 253, 249, 253, 0, 3, 253, 0, 5, 253, 0, 7, 253, 0, 21, 253, 0,
+    25, 253, 0,
+    27, 253, 0, 29, 253, 0, 79, 253, 0, 83, 253, 31, 45, 247, 47, 247, 98,
+    254, 102, 255,
+    112, 255, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254, 233,
+    255,
+    234, 255, 235, 255, 236, 255, 243, 255, 244, 255, 245, 255, 246, 255, 247,
+    255,
+    249, 255, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 21, 255, 0, 25, 255, 0, 27,
+    255, 0, 29,
+    255, 0, 79, 255, 0, 83, 255, 10, 102, 252, 233, 252, 234, 252, 235, 252,
+    236, 252,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 31, 45, 240, 47, 240, 98,
+    254, 102,
+    254, 112, 254, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254,
+    233,
+    254, 234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254,
+    247,
+    254, 249, 254, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 21, 254, 0, 25, 254, 0,
+    27, 254, 0,
+    29, 254, 0, 79, 254, 0, 83, 254, 19, 102, 254, 112, 254, 233, 254, 234,
+    254, 235,
+    254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254,
+    0, 21,
+    254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 49, 68,
+    252, 72, 252,
+    80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252,
+    119, 250,
+    120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215,
+    252,
+    217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32,
+    252, 0, 36, 252,
+    0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 240,
+    49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88,
+    249, 90, 240,
+    118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213,
+    252,
+    214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    240,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0,
+    14, 252,
+    0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 240, 49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86,
+    249, 87, 245,
+    88, 249, 90, 240, 118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211,
+    252, 212,
+    252, 213, 252, 214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 240, 250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1,
+    250, 0, 8,
+    252, 0, 14, 252, 0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100,
+    237, 0, 102,
+    237, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 240, 49, 68, 252, 72, 252, 80, 252, 82,
+    252, 85,
+    237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119, 250, 120, 250,
+    122, 250,
+    200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0, 36, 252, 0, 78,
+    252, 0, 82,
+    252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0,
+    113, 252,
+    0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 240, 49, 68,
+    252, 72, 252,
+    80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252,
+    119, 250,
+    120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215,
+    252,
+    217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32,
+    252, 0, 36, 252,
+    0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 240,
+    49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88,
+    249, 90, 240,
+    118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213,
+    252,
+    214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    240,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0,
+    14, 252,
+    0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 240, 3, 45, 252, 47, 252, 22, 45, 250, 47, 250, 66, 254, 85,
+    250, 87,
+    249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196, 254,
+    197, 254,
+    198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102,
+    250, 0, 122,
+    245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247,
+    90, 245, 193,
+    254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2,
+    254, 0, 4,
+    254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47,
+    250, 66, 254,
+    85, 250, 87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254,
+    196, 254,
+    197, 254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88,
+    252, 89, 247,
+    90, 245, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222,
+    245, 0,
+    2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22,
+    45, 250, 47,
+    250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194,
+    254, 195,
+    254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6,
+    254, 0, 100,
+    250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87,
+    249, 88,
+    252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254,
+    198, 254,
+    222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0,
+    122, 245, 13,
+    45, 250, 47, 250, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197,
+    250, 198,
+    250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193,
+    250, 194,
+    250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6,
+    250, 13, 45,
+    250, 47, 250, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250,
+    198, 250,
+    0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193, 250,
+    194, 250,
+    195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250,
+    65, 45, 234,
+    46, 234, 47, 234, 59, 247, 60, 247, 66, 239, 80, 243, 98, 234, 102, 234,
+    106, 254,
+    112, 234, 118, 239, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198,
+    239,
+    211, 243, 212, 243, 213, 243, 214, 243, 215, 243, 217, 243, 225, 234, 226,
+    234,
+    227, 234, 228, 245, 229, 234, 230, 234, 233, 234, 234, 234, 235, 234, 236,
+    234,
+    238, 254, 243, 234, 244, 234, 245, 234, 246, 234, 247, 234, 249, 234, 250,
+    239,
+    251, 239, 252, 239, 253, 239, 0, 2, 239, 0, 3, 245, 0, 4, 239, 0, 5, 245,
+    0, 6, 239,
+    0, 7, 234, 0, 21, 245, 0, 25, 234, 0, 27, 234, 0, 29, 234, 0, 49, 254, 0,
+    78, 243, 0,
+    79, 245, 0, 82, 243, 0, 83, 234, 0, 109, 239, 0, 113, 239, 0, 115, 239, 0,
+    117, 239,
+    6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 6, 119, 254, 120,
+    254, 122,
+    252, 254, 252, 0, 1, 252, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1,
+    252, 6,
+    119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 6, 119, 254, 120, 254,
+    122, 252,
+    254, 252, 0, 1, 252, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252,
+    4, 45, 254,
+    108, 254, 0, 57, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 14, 118, 255, 119, 254, 122, 254, 250, 255, 251, 255,
+    252, 255,
+    253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0,
+    117, 255,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    95, 45, 241, 47, 241, 98, 248, 99, 248, 100, 248, 101, 248, 102, 248, 103,
+    248, 104,
+    248, 105, 248, 106, 248, 107, 248, 108, 248, 109, 248, 110, 248, 111, 248,
+    112,
+    248, 113, 248, 114, 248, 115, 248, 116, 248, 117, 248, 118, 248, 119, 245,
+    120,
+    245, 121, 243, 122, 245, 123, 248, 225, 248, 226, 248, 227, 248, 228, 248,
+    229,
+    248, 230, 248, 232, 248, 233, 248, 234, 248, 235, 248, 236, 248, 237, 248,
+    238,
+    248, 239, 248, 240, 248, 242, 248, 243, 248, 244, 248, 245, 248, 246, 248,
+    247,
+    248, 249, 248, 250, 248, 251, 248, 252, 248, 253, 248, 254, 245, 0, 1,
+    245, 0, 3,
+    248, 0, 5, 248, 0, 7, 248, 0, 9, 248, 0, 15, 248, 0, 19, 248, 0, 21, 248,
+    0, 25, 248,
+    0, 27, 248, 0, 29, 248, 0, 33, 248, 0, 37, 248, 0, 45, 248, 0, 49, 248, 0,
+    57, 248, 0,
+    60, 248, 0, 62, 248, 0, 68, 248, 0, 70, 248, 0, 72, 248, 0, 74, 248, 0,
+    79, 248, 0, 83,
+    248, 0, 87, 248, 0, 89, 248, 0, 91, 248, 0, 93, 248, 0, 97, 248, 0, 99,
+    248, 0, 101,
+    248, 0, 109, 248, 0, 113, 248, 0, 115, 248, 0, 117, 248, 0, 124, 248, 0,
+    126, 248,
+    0, 128, 248, 1, 2, 25, 248, 31, 45, 240, 47, 240, 98, 254, 102, 254, 112,
+    254, 225,
+    254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254, 233, 254, 234, 254,
+    235,
+    254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254,
+    0, 3,
+    254, 0, 5, 254, 0, 7, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254,
+    0, 79, 254,
+    0, 83, 254, 31, 45, 240, 47, 240, 98, 254, 102, 254, 112, 254, 225, 254,
+    226, 254,
+    227, 254, 228, 254, 229, 254, 230, 254, 233, 254, 234, 254, 235, 254, 236,
+    254,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 3, 254, 0,
+    5, 254,
+    0, 7, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0,
+    83, 254, 49,
+    68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249,
+    90, 240, 118,
+    252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252,
+    214,
+    252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240,
+    250,
+    252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14,
+    252, 0, 32,
+    252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108,
+    249, 0, 109,
+    252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0,
+    117, 252,
+    0, 122, 240, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 49, 68,
+    252, 72,
+    252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118,
+    252, 119,
+    250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252,
+    215,
+    252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0,
+    32, 252, 0,
+    36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0,
+    109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    240, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 49, 68, 252,
+    72, 252, 80,
+    252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119,
+    250, 120,
+    250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252,
+    217,
+    252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0,
+    36, 252, 0,
+    78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252,
+    0, 112, 249,
+    0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122,
+    240, 6, 119,
+    254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 3, 45, 252, 47, 252, 4, 45,
+    254, 108,
+    254, 0, 57, 254, 3, 45, 252, 47, 252, 4, 45, 254, 108, 254, 0, 57, 254,
+    18, 45, 245,
+    47, 245, 66, 250, 87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195, 250,
+    196, 250,
+    197, 250, 198, 250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122,
+    242, 18, 45,
+    245, 47, 245, 66, 250, 87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195,
+    250, 196,
+    250, 197, 250, 198, 250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0,
+    122, 242, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 5,
+    115, 255, 0, 87, 255, 0, 89, 255, 0, 91, 255, 5, 115, 255, 0, 87, 255, 0,
+    89, 255, 0,
+    91, 255, 40, 80, 249, 102, 250, 112, 250, 118, 252, 122, 249, 211, 249,
+    212, 249,
+    213, 249, 214, 249, 215, 249, 217, 249, 233, 250, 234, 250, 235, 250, 236,
+    250,
+    243, 250, 244, 250, 245, 250, 246, 250, 247, 250, 249, 250, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 249, 0, 1, 249, 0, 21, 250, 0, 25, 250, 0, 27,
+    250, 0, 29,
+    250, 0, 78, 249, 0, 79, 250, 0, 82, 249, 0, 83, 250, 0, 109, 252, 0, 113,
+    252, 0, 115,
+    252, 0, 117, 252, 19, 102, 254, 112, 254, 233, 254, 234, 254, 235, 254,
+    236, 254,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 254, 0,
+    25, 254,
+    0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 14, 85, 239, 87, 239, 88,
+    245, 90, 234,
+    122, 252, 222, 234, 254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122,
+    234, 1,
+    32, 25, 230, 1, 32, 29, 234, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122,
+    252, 222,
+    234, 254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32,
+    25, 230, 1,
+    32, 29, 234, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122, 252, 222, 234,
+    254, 252,
+    0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32, 25, 230, 1, 32,
+    29, 234, 14,
+    85, 239, 87, 239, 88, 245, 90, 234, 122, 252, 222, 234, 254, 252, 0, 1,
+    252, 0, 100,
+    239, 0, 102, 239, 0, 122, 234, 1, 32, 25, 230, 1, 32, 29, 234, 14, 118,
+    255, 119, 254,
+    122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0,
+    109, 255,
+    0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118, 255, 119, 254, 122, 254,
+    250, 255,
+    251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113,
+    255, 0, 115,
+    255, 0, 117, 255, 14, 118, 255, 119, 254, 122, 254, 250, 255, 251, 255,
+    252, 255,
+    253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0,
+    117, 255,
+    22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247, 90,
+    245, 193, 254,
+    194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2, 254, 0,
+    4, 254,
+    0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 9, 45, 250, 47, 250,
+    119, 254, 120,
+    254, 121, 252, 122, 252, 254, 252, 0, 1, 252, 22, 45, 250, 47, 250, 66,
+    254, 85, 250,
+    87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196,
+    254, 197,
+    254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 245, 9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252,
+    254, 252,
+    0, 1, 252, 27, 80, 254, 85, 252, 86, 250, 87, 249, 88, 252, 90, 249, 211,
+    254, 212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 250, 219, 250, 220, 250,
+    221,
+    250, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 252, 0, 102, 252, 0, 108,
+    250, 0, 112,
+    250, 0, 114, 250, 0, 116, 250, 0, 122, 249, 50, 45, 249, 47, 249, 59, 5,
+    60, 5, 98,
+    255, 106, 3, 108, 3, 109, 3, 110, 4, 111, 4, 113, 5, 117, 7, 118, 3, 119,
+    5, 122, 5,
+    225, 255, 226, 255, 227, 255, 228, 255, 229, 255, 230, 255, 237, 3, 238,
+    3, 239,
+    3, 240, 3, 242, 4, 250, 3, 251, 3, 252, 3, 253, 3, 254, 5, 0, 1, 5, 0, 3,
+    255, 0, 5, 255,
+    0, 7, 255, 0, 45, 3, 0, 49, 3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0, 68, 3, 0,
+    70, 4, 0, 72, 4,
+    0, 74, 4, 0, 101, 7, 0, 109, 3, 0, 113, 3, 0, 115, 3, 0, 117, 3, 27, 80,
+    254, 85, 252,
+    86, 250, 87, 249, 88, 252, 90, 249, 211, 254, 212, 254, 213, 254, 214,
+    254, 215,
+    254, 217, 254, 218, 250, 219, 250, 220, 250, 221, 250, 222, 249, 0, 78,
+    254, 0, 82,
+    254, 0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0,
+    116, 250,
+    0, 122, 249, 50, 45, 249, 47, 249, 59, 5, 60, 5, 98, 255, 106, 3, 108, 3,
+    109, 3, 110,
+    4, 111, 4, 113, 5, 117, 7, 118, 3, 119, 5, 122, 5, 225, 255, 226, 255,
+    227, 255, 228,
+    255, 229, 255, 230, 255, 237, 3, 238, 3, 239, 3, 240, 3, 242, 4, 250, 3,
+    251, 3, 252,
+    3, 253, 3, 254, 5, 0, 1, 5, 0, 3, 255, 0, 5, 255, 0, 7, 255, 0, 45, 3, 0,
+    49, 3, 0, 57, 3,
+    0, 60, 3, 0, 62, 3, 0, 68, 3, 0, 70, 4, 0, 72, 4, 0, 74, 4, 0, 101, 7, 0,
+    109, 3, 0, 113,
+    3, 0, 115, 3, 0, 117, 3, 27, 80, 254, 85, 252, 86, 250, 87, 249, 88, 252,
+    90, 249, 211,
+    254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 250, 219, 250,
+    220,
+    250, 221, 250, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 252, 0, 102, 252,
+    0, 108,
+    250, 0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122, 249, 50, 45, 249, 47,
+    249, 59,
+    5, 60, 5, 98, 255, 106, 3, 108, 3, 109, 3, 110, 4, 111, 4, 113, 5, 117, 7,
+    118, 3, 119,
+    5, 122, 5, 225, 255, 226, 255, 227, 255, 228, 255, 229, 255, 230, 255,
+    237, 3, 238,
+    3, 239, 3, 240, 3, 242, 4, 250, 3, 251, 3, 252, 3, 253, 3, 254, 5, 0, 1,
+    5, 0, 3, 255,
+    0, 5, 255, 0, 7, 255, 0, 45, 3, 0, 49, 3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0,
+    68, 3, 0, 70, 4,
+    0, 72, 4, 0, 74, 4, 0, 101, 7, 0, 109, 3, 0, 113, 3, 0, 115, 3, 0, 117, 3,
+    3, 45, 254, 47,
+    254, 4, 45, 254, 47, 254, 120, 252, 3, 45, 254, 47, 254, 4, 45, 254, 47,
+    254, 120,
+    252, 3, 45, 254, 47, 254, 4, 45, 254, 47, 254, 120, 252, 70, 45, 237, 46,
+    234, 47,
+    237, 59, 254, 60, 254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115,
+    237, 118,
+    237, 120, 237, 122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237,
+    198,
+    237, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237,
+    226,
+    237, 227, 237, 228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237,
+    236,
+    237, 243, 237, 244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237,
+    251,
+    237, 252, 237, 253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4,
+    237, 0, 5,
+    247, 0, 6, 237, 0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237,
+    0, 78, 250,
+    0, 79, 247, 0, 82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0,
+    109, 247,
+    0, 113, 237, 0, 115, 237, 0, 117, 237, 70, 45, 237, 46, 234, 47, 237, 59,
+    254, 60,
+    254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115, 237, 118, 237,
+    120, 237,
+    122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237, 226, 237, 227,
+    237,
+    228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237, 236, 237, 243,
+    237,
+    244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237, 251, 237, 252,
+    237,
+    253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 247,
+    0, 6, 237,
+    0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237, 0, 78, 250, 0,
+    79, 247, 0,
+    82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0, 109, 247, 0,
+    113, 237, 0,
+    115, 237, 0, 117, 237, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250,
+    195, 250,
+    196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45,
+    250, 47, 250,
+    66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2,
+    250, 0,
+    4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250, 195,
+    250, 196,
+    250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47,
+    250, 66,
+    250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2,
+    250, 0, 4,
+    250, 0, 6, 250, 65, 45, 234, 46, 234, 47, 234, 59, 247, 60, 247, 66, 239,
+    80, 243,
+    98, 234, 102, 234, 106, 254, 112, 234, 118, 239, 193, 239, 194, 239, 195,
+    239, 196,
+    239, 197, 239, 198, 239, 211, 243, 212, 243, 213, 243, 214, 243, 215, 243,
+    217,
+    243, 225, 234, 226, 234, 227, 234, 228, 245, 229, 234, 230, 234, 233, 234,
+    234,
+    234, 235, 234, 236, 234, 238, 254, 243, 234, 244, 234, 245, 234, 246, 234,
+    247,
+    234, 249, 234, 250, 239, 251, 239, 252, 239, 253, 239, 0, 2, 239, 0, 3,
+    245, 0, 4,
+    239, 0, 5, 245, 0, 6, 239, 0, 7, 234, 0, 21, 245, 0, 25, 234, 0, 27, 234,
+    0, 29, 234,
+    0, 49, 254, 0, 78, 243, 0, 79, 234, 0, 82, 243, 0, 83, 234, 0, 109, 239,
+    0, 113, 239,
+    0, 115, 239, 0, 117, 239, 19, 102, 254, 112, 254, 233, 254, 234, 254, 235,
+    254, 236,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21,
+    254, 0, 25,
+    254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 19, 102, 254, 112,
+    254, 233, 254,
+    234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247,
+    254,
+    249, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0,
+    83, 254, 19,
+    102, 254, 112, 254, 233, 254, 234, 254, 235, 254, 236, 254, 243, 254, 244,
+    254,
+    245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 254, 0, 25, 254, 0, 27,
+    254, 0, 29,
+    254, 0, 79, 254, 0, 83, 254, 3, 45, 254, 47, 254, 4, 45, 254, 47, 254,
+    120, 252, 2,
+    1, 32, 24, 247, 14, 33, 245, 101, 249, 115, 249, 116, 249, 0, 19, 249, 0,
+    87, 249,
+    0, 89, 249, 0, 91, 249, 0, 93, 249, 0, 97, 249, 0, 99, 249, 1, 2, 25, 249,
+    1, 32, 25,
+    247, 2, 33, 250
 };
-static afm_cuint16 afm_Helvetica_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Helvetica_highchars_index[] = {  /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Helvetica_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Helvetica_ligatures[] = {   /* 3 */
+    102, 105, 64257
 };
 
 
@@ -618,381 +1138,742 @@ static afm_cunicode afm_Helvetica_ligatures[] = { /* 3 */
 /* FontName: Helvetica-Bold */
 /* FullName: Helvetica Bold */
 /* FamilyName: Helvetica */
-static afm_cuint8 afm_Helvetica_Bold_widths[] = { /* 315 */
-  46,56,79,93,93,148,120,40,56,56,65,97,46,56,46,46,93,93,93,93,93,
-  93,93,93,93,93,56,56,97,97,97,102,163,120,120,120,120,111,102,130,
-  120,46,93,120,102,139,120,130,111,130,120,111,102,120,111,157,111,
-  111,102,56,46,56,97,93,56,93,102,93,102,93,56,102,102,46,46,93,46,
-  148,102,102,102,102,65,93,56,102,93,130,93,93,83,65,47,65,97,56,
-  93,93,93,93,47,93,56,123,62,93,97,123,56,67,97,56,56,56,102,93,46,
-  56,56,61,93,139,139,139,102,120,120,120,120,120,120,167,120,111,
-  111,111,111,46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,
-  120,120,111,111,102,93,93,93,93,93,93,148,93,93,93,93,93,46,46,46,
-  46,102,102,102,102,102,102,102,97,102,102,102,102,102,93,102,93,
-  120,93,120,93,120,93,120,93,120,93,120,124,120,102,111,93,111,93,
-  111,93,111,93,130,102,130,102,46,46,46,46,46,46,120,93,102,46,102,
-  46,102,67,102,46,120,102,120,102,120,102,130,102,130,102,167,157,
-  120,65,120,65,120,65,111,93,111,93,111,93,102,56,102,65,120,102,
-  120,102,120,102,120,102,111,102,83,102,83,102,83,93,111,93,56,56,
-  56,56,56,56,56,56,93,167,46,46,46,83,83,83,93,93,58,167,167,56,56,
-  28,93,167,82,102,100,97,92,92,92,92,82,42,102,102
+static afm_cuint8 afm_Helvetica_Bold_widths[] = {   /* 315 */
+    46, 56, 79, 93, 93, 148, 120, 40, 56, 56, 65, 97, 46, 56, 46, 46, 93, 93,
+    93, 93, 93,
+    93, 93, 93, 93, 93, 56, 56, 97, 97, 97, 102, 163, 120, 120, 120, 120, 111,
+    102, 130,
+    120, 46, 93, 120, 102, 139, 120, 130, 111, 130, 120, 111, 102, 120, 111,
+    157, 111,
+    111, 102, 56, 46, 56, 97, 93, 56, 93, 102, 93, 102, 93, 56, 102, 102, 46,
+    46, 93, 46,
+    148, 102, 102, 102, 102, 65, 93, 56, 102, 93, 130, 93, 93, 83, 65, 47, 65,
+    97, 56,
+    93, 93, 93, 93, 47, 93, 56, 123, 62, 93, 97, 123, 56, 67, 97, 56, 56, 56,
+    102, 93, 46,
+    56, 56, 61, 93, 139, 139, 139, 102, 120, 120, 120, 120, 120, 120, 167,
+    120, 111,
+    111, 111, 111, 46, 46, 46, 46, 120, 120, 130, 130, 130, 130, 130, 97, 130,
+    120, 120,
+    120, 120, 111, 111, 102, 93, 93, 93, 93, 93, 93, 148, 93, 93, 93, 93, 93,
+    46, 46, 46,
+    46, 102, 102, 102, 102, 102, 102, 102, 97, 102, 102, 102, 102, 102, 93,
+    102, 93,
+    120, 93, 120, 93, 120, 93, 120, 93, 120, 93, 120, 124, 120, 102, 111, 93,
+    111, 93,
+    111, 93, 111, 93, 130, 102, 130, 102, 46, 46, 46, 46, 46, 46, 120, 93,
+    102, 46, 102,
+    46, 102, 67, 102, 46, 120, 102, 120, 102, 120, 102, 130, 102, 130, 102,
+    167, 157,
+    120, 65, 120, 65, 120, 65, 111, 93, 111, 93, 111, 93, 102, 56, 102, 65,
+    120, 102,
+    120, 102, 120, 102, 120, 102, 111, 102, 83, 102, 83, 102, 83, 93, 111, 93,
+    56, 56,
+    56, 56, 56, 56, 56, 56, 93, 167, 46, 46, 46, 83, 83, 83, 93, 93, 58, 167,
+    167, 56, 56,
+    28, 93, 167, 82, 102, 100, 97, 92, 92, 92, 92, 82, 42, 102, 102
 };
-static afm_sint16 afm_Helvetica_Bold_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,29,0,40,0,0,0,0,0,0,0,0,0,0,0,51,54,0,0,
-  0,0,0,57,172,0,218,0,257,0,0,0,308,358,450,0,0,485,534,627,654,0,
-  716,874,902,1051,0,1199,0,0,0,0,0,0,0,1338,1358,1401,1427,1444,1462,
-  1517,1548,0,0,1556,1577,1587,1617,1649,1663,0,1671,1752,0,0,1755,
-  1803,1828,1851,1921,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,1944,2059,2174,2289,2404,2519,0,0,0,0,0,
-  0,0,0,0,0,0,0,2634,2683,2732,2781,2830,0,2879,2928,2956,2984,3012,
-  3040,0,0,3179,3199,3219,3239,3259,3279,0,3299,3325,3343,3361,3379,
-  0,0,0,0,0,3397,3429,3443,3457,3471,3485,0,3499,0,0,0,0,3513,0,3583,
-  3653,3768,3788,3903,3923,4038,0,4058,0,4084,4110,0,4149,4188,0,4205,
-  0,4223,0,4241,0,4259,0,4277,0,4308,0,0,0,0,0,0,4339,4431,4452,4487,
-  4497,4532,0,0,4542,4577,0,4587,0,4619,0,4651,4683,4732,4746,4795,
-  0,0,4809,4871,4952,5014,5095,5157,0,5238,0,5241,0,5244,5247,0,5405,
-  0,5563,0,5591,0,5619,0,5647,0,5675,0,5814,0,5837,0,5860,0,0,5883,
-  0,0,0,0,0,0,0,0,0,0,5886,5891,0,0,5942,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0
+static afm_sint16 afm_Helvetica_Bold_kerning_index[] = {    /* 315 */
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 51, 54, 0, 0,
+    0, 0, 0, 57, 172, 0, 218, 0, 257, 0, 0, 0, 308, 358, 450, 0, 0, 485, 534,
+    627, 654, 0,
+    716, 874, 902, 1051, 0, 1199, 0, 0, 0, 0, 0, 0, 0, 1338, 1358, 1401, 1427,
+    1444, 1462,
+    1517, 1548, 0, 0, 1556, 1577, 1587, 1617, 1649, 1663, 0, 1671, 1752, 0, 0,
+    1755,
+    1803, 1828, 1851, 1921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1944, 2059, 2174, 2289, 2404, 2519, 0,
+    0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 2634, 2683, 2732, 2781, 2830, 0, 2879, 2928, 2956,
+    2984, 3012,
+    3040, 0, 0, 3179, 3199, 3219, 3239, 3259, 3279, 0, 3299, 3325, 3343, 3361,
+    3379,
+    0, 0, 0, 0, 0, 3397, 3429, 3443, 3457, 3471, 3485, 0, 3499, 0, 0, 0, 0,
+    3513, 0, 3583,
+    3653, 3768, 3788, 3903, 3923, 4038, 0, 4058, 0, 4084, 4110, 0, 4149, 4188,
+    0, 4205,
+    0, 4223, 0, 4241, 0, 4259, 0, 4277, 0, 4308, 0, 0, 0, 0, 0, 0, 4339, 4431,
+    4452, 4487,
+    4497, 4532, 0, 0, 4542, 4577, 0, 4587, 0, 4619, 0, 4651, 4683, 4732, 4746,
+    4795,
+    0, 0, 4809, 4871, 4952, 5014, 5095, 5157, 0, 5238, 0, 5241, 0, 5244, 5247,
+    0, 5405,
+    0, 5563, 0, 5591, 0, 5619, 0, 5647, 0, 5675, 0, 5814, 0, 5837, 0, 5860, 0,
+    0, 5883,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5886, 5891, 0, 0, 5942, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
 static afm_cuint8 afm_Helvetica_Bold_kerning_data[] = { /* 5945 */
-  42,11,85,240,87,244,88,244,90,237,222,237,0,100,240,0,102,240,0,
-  122,237,1,32,24,247,1,32,28,244,4,33,250,1,32,25,237,1,32,29,237,
-  4,33,250,1,32,25,237,1,32,29,237,2,33,250,2,33,250,49,68,250,72,
-  249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,
-  250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,
-  250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,
-  252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,
-  36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  239,20,66,252,86,255,193,252,194,252,195,252,196,252,197,252,198,
-  252,218,255,219,255,220,255,221,255,0,2,252,0,4,252,0,6,252,0,108,
-  255,0,112,255,0,114,255,0,116,255,18,45,252,47,252,66,250,87,250,
-  88,250,90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,
-  245,0,2,250,0,4,250,0,6,250,0,122,245,23,45,240,47,240,66,244,98,
-  254,193,244,194,244,195,244,196,244,197,244,198,244,225,254,226,
-  254,227,254,228,254,229,254,230,254,0,2,244,0,3,254,0,4,244,0,5,
-  254,0,6,244,0,7,254,22,45,254,47,254,66,254,118,254,193,254,194,
-  254,195,254,196,254,197,254,198,254,250,254,251,254,252,254,253,
-  254,0,2,254,0,4,254,0,6,254,0,109,254,0,113,254,0,115,254,0,117,
-  254,40,80,252,102,254,112,251,118,252,122,250,211,252,212,252,213,
-  252,214,252,215,252,217,252,233,254,234,254,235,254,236,254,243,
-  251,244,251,245,251,246,251,247,251,249,251,250,252,251,252,252,
-  252,253,252,254,250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,
-  0,78,252,0,79,251,0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,
-  0,117,252,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,
-  0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,22,
-  45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,
-  194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,
-  0,6,249,0,100,250,0,102,250,0,122,245,41,45,237,47,237,66,240,98,
-  252,102,252,112,250,193,240,194,240,195,240,196,240,197,240,198,
-  240,225,252,226,252,227,252,228,252,229,252,230,252,233,252,234,
-  252,235,252,236,252,243,250,244,250,245,250,246,250,247,250,249,
-  250,0,2,240,0,3,252,0,4,240,0,5,252,0,6,240,0,7,252,0,21,252,0,25,
-  252,0,27,252,0,29,252,0,79,250,0,83,250,12,45,3,47,3,86,255,218,
-  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
-  255,27,80,254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,
-  213,254,214,254,215,254,217,254,218,254,219,254,220,254,221,254,
-  222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,
-  0,114,254,0,116,254,0,122,249,69,45,244,46,237,47,244,59,250,60,
-  250,66,242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,
-  122,247,193,242,194,242,195,242,196,242,197,242,198,242,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,244,226,244,227,244,
-  228,244,229,244,230,244,233,247,234,247,235,247,236,247,243,244,
-  244,244,245,244,246,244,247,244,249,244,250,242,251,242,252,242,
-  253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,
-  0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,
-  82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,
-  0,117,242,13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,
-  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,237,46,244,47,237,
-  59,250,60,250,66,244,72,249,80,249,98,247,102,249,112,242,118,247,
-  193,244,194,244,195,244,196,244,197,244,198,244,211,249,212,249,
-  213,249,214,249,215,249,217,249,225,247,226,247,227,247,228,247,
-  229,247,230,247,233,249,234,249,235,249,236,249,243,242,244,242,
-  245,242,246,242,247,242,249,242,250,247,251,247,252,247,253,247,
-  0,2,244,0,3,247,0,4,244,0,5,247,0,6,244,0,7,247,0,21,249,0,25,249,
-  0,27,249,0,29,249,0,32,249,0,36,249,0,78,249,0,79,242,0,82,249,0,
-  83,242,0,109,247,0,113,247,0,115,247,0,117,247,65,45,244,46,250,
-  47,244,59,255,60,255,66,247,80,254,98,250,102,251,112,247,118,249,
-  122,254,193,247,194,247,195,247,196,247,197,247,198,247,211,254,
-  212,254,213,254,214,254,215,254,217,254,225,250,226,250,227,250,
-  228,250,229,250,230,250,233,251,234,251,235,251,236,251,243,247,
-  244,247,245,247,246,247,247,247,249,247,250,249,251,249,252,249,
-  253,249,254,254,0,1,254,0,2,247,0,3,250,0,4,247,0,5,250,0,6,247,
-  0,7,250,0,21,251,0,25,251,0,27,251,0,29,251,0,78,254,0,79,247,0,
-  82,254,0,83,247,0,109,249,0,113,249,0,115,249,0,117,249,61,45,240,
-  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
-  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
-  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
-  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
-  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
-  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
-  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
-  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,33,255,0,37,255,18,109,255,118,254,119,254,122,
-  254,250,254,251,254,252,254,253,254,254,254,0,1,254,0,60,255,0,62,
-  255,0,68,255,0,109,254,0,113,254,0,115,254,0,117,254,11,105,255,
-  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
-  0,68,254,8,101,255,119,254,120,254,122,254,254,254,0,1,254,0,19,
-  255,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
-  23,45,255,47,255,102,255,112,254,233,255,234,255,235,255,236,255,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,21,255,0,25,255,
-  0,27,255,0,29,255,0,79,254,0,83,254,1,32,25,5,1,32,29,5,13,102,2,
-  104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,
-  255,0,37,255,4,122,254,254,254,0,1,254,10,112,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,0,79,254,0,83,254,5,120,254,122,
-  254,254,254,0,1,254,13,118,254,122,252,250,254,251,254,252,254,253,
-  254,254,252,0,1,252,0,109,254,0,113,254,0,115,254,0,117,254,14,118,
-  255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,
-  254,0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,
-  252,122,254,254,254,0,1,254,4,122,254,254,254,0,1,254,34,45,247,
-  46,254,47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,
-  3,119,2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,
-  254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,
-  254,0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,2,120,
-  254,22,45,244,47,244,98,254,112,252,225,254,226,254,227,254,228,
-  254,229,254,230,254,243,252,244,252,245,252,246,252,247,252,249,
-  252,0,3,254,0,5,254,0,7,254,0,79,252,0,83,252,12,45,250,47,250,112,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
-  254,10,102,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,
-  0,27,255,0,29,255,31,45,244,47,244,98,252,102,255,112,253,225,252,
-  226,252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,
-  236,255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,
-  0,5,252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,
-  253,10,102,2,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,
-  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
-  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
-  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
-  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
-  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
-  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
-  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
-  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
-  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
-  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,239,49,68,250,72,249,80,250,82,250,85,
-  242,86,249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,
-  200,250,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
-  219,249,220,249,221,249,222,239,250,252,251,252,252,252,253,252,
-  254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,
-  250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,
-  0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,49,68,250,72,249,
-  80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,250,
-  120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,250,
-  217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,252,
-  252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,
-  0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,
-  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
-  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
-  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
-  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
-  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
-  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
-  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
-  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
-  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
-  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,239,22,45,250,47,250,66,249,85,250,87,
-  249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,
-  198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,
-  245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,
-  249,194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,
-  249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,249,
-  85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,
-  197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,
-  250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
-  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
-  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,
-  250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,
-  249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,
-  250,0,102,250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,
-  249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,198,249,
-  222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,13,
-  45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,
-  249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,
-  249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,13,45,
-  252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
-  0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,249,
-  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,61,45,240,
-  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
-  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
-  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
-  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
-  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
-  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
-  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
-  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,122,
-  254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,
-  122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,
-  254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,
-  120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,
-  254,120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,
-  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
-  0,68,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,
-  254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
-  9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,9,45,
-  2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,14,118,255,
-  119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
-  0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,252,
-  122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,254,
-  0,1,254,7,119,254,120,254,121,252,122,254,254,254,0,1,254,7,119,
-  254,120,254,121,252,122,254,254,254,0,1,254,7,119,254,120,254,121,
-  252,122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,
-  254,0,1,254,31,45,244,47,244,98,252,102,255,112,253,225,252,226,
-  252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,236,
-  255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,
-  252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,
-  31,45,244,47,244,98,252,102,255,112,253,225,252,226,252,227,252,
-  228,252,229,252,230,252,233,255,234,255,235,255,236,255,243,253,
-  244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,252,0,7,252,
-  0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,49,68,250,
-  72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,
-  119,250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,
-  215,250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,
-  251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,
-  0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  239,9,104,255,119,254,120,254,122,254,254,254,0,1,254,0,33,255,0,
-  37,255,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,
-  90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,
-  250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,
-  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
-  0,117,252,0,122,239,9,104,255,119,254,120,254,122,254,254,254,0,
-  1,254,0,33,255,0,37,255,49,68,250,72,249,80,250,82,250,85,242,86,
-  249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,200,250,
-  211,250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,
-  220,249,221,249,222,239,250,252,251,252,252,252,253,252,254,252,
-  0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,
-  242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,
-  0,115,252,0,116,249,0,117,252,0,122,239,9,104,255,119,254,120,254,
-  122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,108,254,109,
-  254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,0,68,254,
-  11,105,255,108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,
-  254,0,62,254,0,68,254,18,45,252,47,252,66,250,87,250,88,250,90,245,
-  193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,2,250,
-  0,4,250,0,6,250,0,122,245,18,45,252,47,252,66,250,87,250,88,250,
-  90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,
-  2,250,0,4,250,0,6,250,0,122,245,8,101,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,19,255,9,45,2,47,3,119,254,120,254,121,254,122,
-  254,254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,
-  254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,
-  254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,
-  0,1,254,13,102,2,104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,
-  27,2,0,29,2,0,33,255,0,37,255,13,102,2,104,255,233,2,234,2,235,2,
-  236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,255,0,37,255,40,80,252,102,
-  254,112,251,118,252,122,250,211,252,212,252,213,252,214,252,215,
-  252,217,252,233,254,234,254,235,254,236,254,243,251,244,251,245,
-  251,246,251,247,251,249,251,250,252,251,252,252,252,253,252,254,
-  250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,0,78,252,0,79,251,
-  0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,0,117,252,10,112,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
-  254,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,0,1,252,
-  0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,5,120,254,
-  122,254,254,254,0,1,254,14,85,242,87,239,88,244,90,237,122,252,222,
-  237,254,252,0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,
-  32,29,234,5,120,254,122,254,254,254,0,1,254,14,85,242,87,239,88,
-  244,90,237,122,252,222,237,254,252,0,1,252,0,100,242,0,102,242,0,
-  122,237,1,32,25,234,1,32,29,234,5,120,254,122,254,254,254,0,1,254,
-  14,118,255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,
-  0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,119,250,
-  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
-  0,113,255,0,115,255,0,117,255,14,118,255,119,250,122,254,250,255,
-  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
-  255,0,117,255,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
-  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
-  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,7,119,254,120,
-  254,121,252,122,254,254,254,0,1,254,22,45,250,47,250,66,249,85,250,
-  87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,
-  249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,
-  0,122,245,7,119,254,120,254,121,252,122,254,254,254,0,1,254,27,80,
-  254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,
-  254,215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,
-  254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,
-  116,254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,
-  112,254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,
-  254,0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,
-  0,101,3,1,2,25,254,27,80,254,85,254,86,254,87,249,88,250,90,249,
-  211,254,212,254,213,254,214,254,215,254,217,254,218,254,219,254,
-  220,254,221,254,222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,
-  108,254,0,112,254,0,114,254,0,116,254,0,122,249,34,45,247,46,254,
-  47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,3,119,
-  2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,254,
-  254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,254,
-  0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,27,80,254,
-  85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,254,
-  215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,254,
-  0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,116,
-  254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,112,
-  254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,245,
-  254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,
-  0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,0,
-  101,3,1,2,25,254,2,120,254,2,120,254,2,120,254,69,45,244,46,237,
-  47,244,59,250,60,250,66,242,80,250,98,244,102,247,112,244,115,244,
-  118,242,120,247,122,247,193,242,194,242,195,242,196,242,197,242,
-  198,242,211,250,212,250,213,250,214,250,215,250,217,250,225,244,
-  226,244,227,244,228,244,229,244,230,244,233,247,234,247,235,247,
-  236,247,243,244,244,244,245,244,246,244,247,244,249,244,250,242,
-  251,242,252,242,253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,
-  0,5,244,0,6,242,0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,
-  250,0,79,244,0,82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,
-  242,0,115,242,0,117,242,69,45,244,46,237,47,244,59,250,60,250,66,
-  242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,122,247,
-  193,242,194,242,195,242,196,242,197,242,198,242,211,250,212,250,
-  213,250,214,250,215,250,217,250,225,244,226,244,227,244,228,244,
-  229,244,230,244,233,247,234,247,235,247,236,247,243,244,244,244,
-  245,244,246,244,247,244,249,244,250,242,251,242,252,242,253,242,
-  254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,0,7,244,
-  0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,82,250,0,
-  83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,0,117,242,
-  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
-  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
-  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
-  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
-  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
-  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
-  61,45,240,47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,
-  240,118,240,193,239,194,239,195,239,196,239,197,239,198,239,211,
-  245,212,245,213,245,214,245,215,245,217,245,225,242,226,242,227,
-  242,228,242,229,242,230,242,233,244,234,244,235,244,236,244,243,
-  240,244,240,245,240,246,240,247,240,249,240,250,240,251,240,252,
-  240,253,240,0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,
-  244,0,25,244,0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,
-  0,109,240,0,113,240,0,115,240,0,117,240,10,102,2,233,2,234,2,235,
-  2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,
-  2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,2,0,
-  21,2,0,25,2,0,27,2,0,29,2,2,120,254,2,1,32,24,249,19,33,244,101,
-  244,109,254,115,250,116,247,119,254,0,19,244,0,60,254,0,62,254,0,
-  68,254,0,87,250,0,89,250,0,91,250,0,93,247,0,97,247,0,99,247,1,2,
-  25,247,1,32,25,249,2,33,244
+    42, 11, 85, 240, 87, 244, 88, 244, 90, 237, 222, 237, 0, 100, 240, 0, 102,
+    240, 0,
+    122, 237, 1, 32, 24, 247, 1, 32, 28, 244, 4, 33, 250, 1, 32, 25, 237, 1,
+    32, 29, 237,
+    4, 33, 250, 1, 32, 25, 237, 1, 32, 29, 237, 2, 33, 250, 2, 33, 250, 49,
+    68, 250, 72,
+    249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239, 118,
+    252, 119,
+    250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214, 250,
+    215,
+    250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0,
+    32, 249, 0,
+    36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0,
+    109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    239, 20, 66, 252, 86, 255, 193, 252, 194, 252, 195, 252, 196, 252, 197,
+    252, 198,
+    252, 218, 255, 219, 255, 220, 255, 221, 255, 0, 2, 252, 0, 4, 252, 0, 6,
+    252, 0, 108,
+    255, 0, 112, 255, 0, 114, 255, 0, 116, 255, 18, 45, 252, 47, 252, 66, 250,
+    87, 250,
+    88, 250, 90, 245, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198,
+    250, 222,
+    245, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 245, 23, 45, 240, 47, 240,
+    66, 244, 98,
+    254, 193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 225, 254,
+    226,
+    254, 227, 254, 228, 254, 229, 254, 230, 254, 0, 2, 244, 0, 3, 254, 0, 4,
+    244, 0, 5,
+    254, 0, 6, 244, 0, 7, 254, 22, 45, 254, 47, 254, 66, 254, 118, 254, 193,
+    254, 194,
+    254, 195, 254, 196, 254, 197, 254, 198, 254, 250, 254, 251, 254, 252, 254,
+    253,
+    254, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 109, 254, 0, 113, 254, 0, 115,
+    254, 0, 117,
+    254, 40, 80, 252, 102, 254, 112, 251, 118, 252, 122, 250, 211, 252, 212,
+    252, 213,
+    252, 214, 252, 215, 252, 217, 252, 233, 254, 234, 254, 235, 254, 236, 254,
+    243,
+    251, 244, 251, 245, 251, 246, 251, 247, 251, 249, 251, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 250, 0, 1, 250, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0,
+    29, 254,
+    0, 78, 252, 0, 79, 251, 0, 82, 252, 0, 83, 251, 0, 109, 252, 0, 113, 252,
+    0, 115, 252,
+    0, 117, 252, 14, 85, 242, 87, 239, 88, 244, 90, 237, 122, 252, 222, 237,
+    254, 252,
+    0, 1, 252, 0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32, 25, 234, 1, 32,
+    29, 234, 22,
+    45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249, 90, 245,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2, 249, 0,
+    4, 249,
+    0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 41, 45, 237, 47, 237,
+    66, 240, 98,
+    252, 102, 252, 112, 250, 193, 240, 194, 240, 195, 240, 196, 240, 197, 240,
+    198,
+    240, 225, 252, 226, 252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 252,
+    234,
+    252, 235, 252, 236, 252, 243, 250, 244, 250, 245, 250, 246, 250, 247, 250,
+    249,
+    250, 0, 2, 240, 0, 3, 252, 0, 4, 240, 0, 5, 252, 0, 6, 240, 0, 7, 252, 0,
+    21, 252, 0, 25,
+    252, 0, 27, 252, 0, 29, 252, 0, 79, 250, 0, 83, 250, 12, 45, 3, 47, 3, 86,
+    255, 218,
+    255, 219, 255, 220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255,
+    0, 116,
+    255, 27, 80, 254, 85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254,
+    212, 254,
+    213, 254, 214, 254, 215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221,
+    254,
+    222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254,
+    0, 112, 254,
+    0, 114, 254, 0, 116, 254, 0, 122, 249, 69, 45, 244, 46, 237, 47, 244, 59,
+    250, 60,
+    250, 66, 242, 80, 250, 98, 244, 102, 247, 112, 244, 115, 244, 118, 242,
+    120, 247,
+    122, 247, 193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 244, 226, 244, 227,
+    244,
+    228, 244, 229, 244, 230, 244, 233, 247, 234, 247, 235, 247, 236, 247, 243,
+    244,
+    244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250, 242, 251, 242, 252,
+    242,
+    253, 242, 254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244, 0, 4, 242, 0, 5, 244,
+    0, 6, 242,
+    0, 7, 244, 0, 21, 247, 0, 25, 247, 0, 27, 247, 0, 29, 247, 0, 78, 250, 0,
+    79, 244, 0,
+    82, 250, 0, 83, 244, 0, 87, 244, 0, 89, 244, 0, 109, 242, 0, 113, 242, 0,
+    115, 242,
+    0, 117, 242, 13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249,
+    196, 249,
+    197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 65, 45, 237, 46, 244,
+    47, 237,
+    59, 250, 60, 250, 66, 244, 72, 249, 80, 249, 98, 247, 102, 249, 112, 242,
+    118, 247,
+    193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 211, 249, 212,
+    249,
+    213, 249, 214, 249, 215, 249, 217, 249, 225, 247, 226, 247, 227, 247, 228,
+    247,
+    229, 247, 230, 247, 233, 249, 234, 249, 235, 249, 236, 249, 243, 242, 244,
+    242,
+    245, 242, 246, 242, 247, 242, 249, 242, 250, 247, 251, 247, 252, 247, 253,
+    247,
+    0, 2, 244, 0, 3, 247, 0, 4, 244, 0, 5, 247, 0, 6, 244, 0, 7, 247, 0, 21,
+    249, 0, 25, 249,
+    0, 27, 249, 0, 29, 249, 0, 32, 249, 0, 36, 249, 0, 78, 249, 0, 79, 242, 0,
+    82, 249, 0,
+    83, 242, 0, 109, 247, 0, 113, 247, 0, 115, 247, 0, 117, 247, 65, 45, 244,
+    46, 250,
+    47, 244, 59, 255, 60, 255, 66, 247, 80, 254, 98, 250, 102, 251, 112, 247,
+    118, 249,
+    122, 254, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 211,
+    254,
+    212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226, 250, 227,
+    250,
+    228, 250, 229, 250, 230, 250, 233, 251, 234, 251, 235, 251, 236, 251, 243,
+    247,
+    244, 247, 245, 247, 246, 247, 247, 247, 249, 247, 250, 249, 251, 249, 252,
+    249,
+    253, 249, 254, 254, 0, 1, 254, 0, 2, 247, 0, 3, 250, 0, 4, 247, 0, 5, 250,
+    0, 6, 247,
+    0, 7, 250, 0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0, 78, 254, 0,
+    79, 247, 0,
+    82, 254, 0, 83, 247, 0, 109, 249, 0, 113, 249, 0, 115, 249, 0, 117, 249,
+    61, 45, 240,
+    47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102, 244, 112, 240,
+    118, 240,
+    193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 245, 212,
+    245,
+    213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242, 227, 242, 228,
+    242,
+    229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244, 243, 240, 244,
+    240,
+    245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240, 252, 240, 253,
+    240,
+    0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0, 7, 242, 0, 21,
+    244, 0, 25, 244,
+    0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82, 245, 0, 83, 240, 0,
+    109, 240,
+    0, 113, 240, 0, 115, 240, 0, 117, 240, 9, 104, 255, 119, 254, 120, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 18, 109, 255, 118, 254, 119,
+    254, 122,
+    254, 250, 254, 251, 254, 252, 254, 253, 254, 254, 254, 0, 1, 254, 0, 60,
+    255, 0, 62,
+    255, 0, 68, 255, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117, 254, 11,
+    105, 255,
+    108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254,
+    0, 62, 254,
+    0, 68, 254, 8, 101, 255, 119, 254, 120, 254, 122, 254, 254, 254, 0, 1,
+    254, 0, 19,
+    255, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0,
+    1, 254,
+    23, 45, 255, 47, 255, 102, 255, 112, 254, 233, 255, 234, 255, 235, 255,
+    236, 255,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 255, 0,
+    25, 255,
+    0, 27, 255, 0, 29, 255, 0, 79, 254, 0, 83, 254, 1, 32, 25, 5, 1, 32, 29,
+    5, 13, 102, 2,
+    104, 255, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0,
+    29, 2, 0, 33,
+    255, 0, 37, 255, 4, 122, 254, 254, 254, 0, 1, 254, 10, 112, 254, 243, 254,
+    244, 254,
+    245, 254, 246, 254, 247, 254, 249, 254, 0, 79, 254, 0, 83, 254, 5, 120,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 13, 118, 254, 122, 252, 250, 254, 251, 254, 252,
+    254, 253,
+    254, 254, 252, 0, 1, 252, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117,
+    254, 14, 118,
+    255, 119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254,
+    0, 1,
+    254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 7, 119, 254, 120,
+    254, 121,
+    252, 122, 254, 254, 254, 0, 1, 254, 4, 122, 254, 254, 254, 0, 1, 254, 34,
+    45, 247,
+    46, 254, 47, 247, 100, 254, 101, 254, 104, 254, 112, 254, 114, 254, 116,
+    254, 117,
+    3, 119, 2, 122, 2, 232, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247,
+    254, 249,
+    254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254, 0, 19, 254, 0, 33, 254, 0,
+    37, 254, 0, 79,
+    254, 0, 83, 254, 0, 93, 254, 0, 97, 254, 0, 99, 254, 0, 101, 3, 1, 2, 25,
+    254, 2, 120,
+    254, 22, 45, 244, 47, 244, 98, 254, 112, 252, 225, 254, 226, 254, 227,
+    254, 228,
+    254, 229, 254, 230, 254, 243, 252, 244, 252, 245, 252, 246, 252, 247, 252,
+    249,
+    252, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 79, 252, 0, 83, 252, 12, 45, 250,
+    47, 250, 112,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 79,
+    254, 0, 83,
+    254, 10, 102, 255, 233, 255, 234, 255, 235, 255, 236, 255, 0, 21, 255, 0,
+    25, 255,
+    0, 27, 255, 0, 29, 255, 31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253,
+    225, 252,
+    226, 252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235,
+    255,
+    236, 255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0,
+    3, 252,
+    0, 5, 252, 0, 7, 252, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0,
+    79, 253, 0, 83,
+    253, 10, 102, 2, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2, 0, 25, 2, 0,
+    27, 2, 0, 29, 2,
+    49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88,
+    247, 90, 239,
+    118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213,
+    250,
+    214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    239,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0,
+    14, 250,
+    0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86,
+    249, 87, 244,
+    88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211,
+    250, 212,
+    250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1,
+    252, 0, 8,
+    250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100,
+    242, 0, 102,
+    242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82,
+    250, 85,
+    242, 86, 249, 87, 244, 88, 247, 90, 239, 118, 252, 119, 250, 120, 252,
+    122, 252,
+    200, 250, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 239, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78,
+    250, 0, 82,
+    250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0,
+    113, 252,
+    0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 239, 49, 68,
+    250, 72, 249,
+    80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239, 118, 252,
+    119, 250,
+    120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214, 250, 215,
+    250,
+    217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32,
+    249, 0, 36, 249,
+    0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 239,
+    49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88,
+    247, 90, 239,
+    118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213,
+    250,
+    214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    239,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0,
+    14, 250,
+    0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86,
+    249, 87, 244,
+    88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211,
+    250, 212,
+    250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1,
+    252, 0, 8,
+    250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100,
+    242, 0, 102,
+    242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 239, 22, 45, 250, 47, 250, 66, 249, 85,
+    250, 87,
+    249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102,
+    250, 0, 122,
+    245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249,
+    90, 245, 193,
+    249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2,
+    249, 0, 4,
+    249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47,
+    250, 66, 249,
+    85, 250, 87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249,
+    196, 249,
+    197, 249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88,
+    249, 89, 249,
+    90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222,
+    245, 0,
+    2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22,
+    45, 250, 47,
+    250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194,
+    249, 195,
+    249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6,
+    249, 0, 100,
+    250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87,
+    249, 88,
+    249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249,
+    198, 249,
+    222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0,
+    122, 245, 13,
+    45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197,
+    249, 198,
+    249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249, 193,
+    249, 194,
+    249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6,
+    249, 13, 45,
+    252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249,
+    198, 249,
+    0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249, 193, 249,
+    194, 249,
+    195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249,
+    61, 45, 240,
+    47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102, 244, 112, 240,
+    118, 240,
+    193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 245, 212,
+    245,
+    213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242, 227, 242, 228,
+    242,
+    229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244, 243, 240, 244,
+    240,
+    245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240, 252, 240, 253,
+    240,
+    0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0, 7, 242, 0, 21,
+    244, 0, 25, 244,
+    0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82, 245, 0, 83, 240, 0,
+    109, 240,
+    0, 113, 240, 0, 115, 240, 0, 117, 240, 9, 104, 255, 119, 254, 120, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119, 254, 120,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119, 254,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119,
+    254, 120,
+    254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255,
+    119, 254,
+    120, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104,
+    255, 119,
+    254, 120, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 11,
+    105, 255,
+    108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254,
+    0, 62, 254,
+    0, 68, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254,
+    254, 0, 1,
+    254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0,
+    1, 254,
+    9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0, 1,
+    254, 9, 45,
+    2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0, 1, 254, 14,
+    118, 255,
+    119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0,
+    1, 254,
+    0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 7, 119, 254, 120, 254,
+    121, 252,
+    122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122, 254,
+    254, 254,
+    0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1, 254,
+    7, 119,
+    254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120,
+    254, 121,
+    252, 122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122,
+    254, 254,
+    254, 0, 1, 254, 31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253, 225,
+    252, 226,
+    252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235, 255,
+    236,
+    255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0, 3,
+    252, 0, 5,
+    252, 0, 7, 252, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79,
+    253, 0, 83, 253,
+    31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253, 225, 252, 226, 252,
+    227, 252,
+    228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235, 255, 236, 255, 243,
+    253,
+    244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0, 3, 252, 0, 5, 252, 0,
+    7, 252,
+    0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 253, 0, 83, 253,
+    49, 68, 250,
+    72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239,
+    118, 252,
+    119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214,
+    250,
+    215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250,
+    252,
+    251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250,
+    0, 32, 249,
+    0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249,
+    0, 109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    239, 9, 104, 255, 119, 254, 120, 254, 122, 254, 254, 254, 0, 1, 254, 0,
+    33, 255, 0,
+    37, 255, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87,
+    244, 88, 247,
+    90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8,
+    250, 0, 14,
+    250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102,
+    242, 0, 108,
+    249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0,
+    116, 249,
+    0, 117, 252, 0, 122, 239, 9, 104, 255, 119, 254, 120, 254, 122, 254, 254,
+    254, 0,
+    1, 254, 0, 33, 255, 0, 37, 255, 49, 68, 250, 72, 249, 80, 250, 82, 250,
+    85, 242, 86,
+    249, 87, 244, 88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252,
+    200, 250,
+    211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219,
+    249,
+    220, 249, 221, 249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254,
+    252,
+    0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0,
+    82, 250, 0, 100,
+    242, 0, 102, 242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0,
+    114, 249,
+    0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 239, 9, 104, 255, 119, 254,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 11, 105, 255, 108,
+    254, 109,
+    254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254, 0, 62, 254, 0,
+    68, 254,
+    11, 105, 255, 108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57,
+    254, 0, 60,
+    254, 0, 62, 254, 0, 68, 254, 18, 45, 252, 47, 252, 66, 250, 87, 250, 88,
+    250, 90, 245,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 245, 0,
+    2, 250,
+    0, 4, 250, 0, 6, 250, 0, 122, 245, 18, 45, 252, 47, 252, 66, 250, 87, 250,
+    88, 250,
+    90, 245, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222,
+    245, 0,
+    2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 245, 8, 101, 255, 119, 254, 120,
+    254, 122, 254,
+    254, 254, 0, 1, 254, 0, 19, 255, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122,
+    254, 254,
+    254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254,
+    254, 254,
+    0, 1, 254, 13, 102, 2, 104, 255, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2,
+    0, 25, 2, 0,
+    27, 2, 0, 29, 2, 0, 33, 255, 0, 37, 255, 13, 102, 2, 104, 255, 233, 2,
+    234, 2, 235, 2,
+    236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 0, 33, 255, 0, 37, 255,
+    40, 80, 252, 102,
+    254, 112, 251, 118, 252, 122, 250, 211, 252, 212, 252, 213, 252, 214, 252,
+    215,
+    252, 217, 252, 233, 254, 234, 254, 235, 254, 236, 254, 243, 251, 244, 251,
+    245,
+    251, 246, 251, 247, 251, 249, 251, 250, 252, 251, 252, 252, 252, 253, 252,
+    254,
+    250, 0, 1, 250, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 78,
+    252, 0, 79, 251,
+    0, 82, 252, 0, 83, 251, 0, 109, 252, 0, 113, 252, 0, 115, 252, 0, 117,
+    252, 10, 112,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 79,
+    254, 0, 83,
+    254, 14, 85, 242, 87, 239, 88, 244, 90, 237, 122, 252, 222, 237, 254, 252,
+    0, 1, 252,
+    0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32, 25, 234, 1, 32, 29, 234, 5,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 14, 85, 242, 87, 239, 88, 244, 90, 237,
+    122, 252, 222,
+    237, 254, 252, 0, 1, 252, 0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32,
+    25, 234, 1,
+    32, 29, 234, 5, 120, 254, 122, 254, 254, 254, 0, 1, 254, 14, 85, 242, 87,
+    239, 88,
+    244, 90, 237, 122, 252, 222, 237, 254, 252, 0, 1, 252, 0, 100, 242, 0,
+    102, 242, 0,
+    122, 237, 1, 32, 25, 234, 1, 32, 29, 234, 5, 120, 254, 122, 254, 254, 254,
+    0, 1, 254,
+    14, 118, 255, 119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255,
+    254, 254,
+    0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118,
+    255, 119, 250,
+    122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0,
+    109, 255,
+    0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118, 255, 119, 250, 122, 254,
+    250, 255,
+    251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113,
+    255, 0, 115,
+    255, 0, 117, 255, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88,
+    249, 89, 249,
+    90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222,
+    245, 0,
+    2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 7,
+    119, 254, 120,
+    254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 22, 45, 250, 47, 250, 66,
+    249, 85, 250,
+    87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196,
+    249, 197,
+    249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 245, 7, 119, 254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 27, 80,
+    254, 85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254, 212, 254, 213,
+    254, 214,
+    254, 215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221, 254, 222, 249,
+    0, 78,
+    254, 0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254, 0, 112, 254, 0,
+    114, 254, 0,
+    116, 254, 0, 122, 249, 34, 45, 247, 46, 254, 47, 247, 100, 254, 101, 254,
+    104, 254,
+    112, 254, 114, 254, 116, 254, 117, 3, 119, 2, 122, 2, 232, 254, 243, 254,
+    244, 254,
+    245, 254, 246, 254, 247, 254, 249, 254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15,
+    254, 0, 19,
+    254, 0, 33, 254, 0, 37, 254, 0, 79, 254, 0, 83, 254, 0, 93, 254, 0, 97,
+    254, 0, 99, 254,
+    0, 101, 3, 1, 2, 25, 254, 27, 80, 254, 85, 254, 86, 254, 87, 249, 88, 250,
+    90, 249,
+    211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 254, 219,
+    254,
+    220, 254, 221, 254, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 254, 0, 102,
+    254, 0,
+    108, 254, 0, 112, 254, 0, 114, 254, 0, 116, 254, 0, 122, 249, 34, 45, 247,
+    46, 254,
+    47, 247, 100, 254, 101, 254, 104, 254, 112, 254, 114, 254, 116, 254, 117,
+    3, 119,
+    2, 122, 2, 232, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254,
+    249, 254,
+    254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254, 0, 19, 254, 0, 33, 254, 0, 37,
+    254, 0, 79, 254,
+    0, 83, 254, 0, 93, 254, 0, 97, 254, 0, 99, 254, 0, 101, 3, 1, 2, 25, 254,
+    27, 80, 254,
+    85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254, 212, 254, 213, 254,
+    214, 254,
+    215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221, 254, 222, 249, 0,
+    78, 254,
+    0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254, 0, 112, 254, 0, 114,
+    254, 0, 116,
+    254, 0, 122, 249, 34, 45, 247, 46, 254, 47, 247, 100, 254, 101, 254, 104,
+    254, 112,
+    254, 114, 254, 116, 254, 117, 3, 119, 2, 122, 2, 232, 254, 243, 254, 244,
+    254, 245,
+    254, 246, 254, 247, 254, 249, 254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254,
+    0, 19, 254,
+    0, 33, 254, 0, 37, 254, 0, 79, 254, 0, 83, 254, 0, 93, 254, 0, 97, 254, 0,
+    99, 254, 0,
+    101, 3, 1, 2, 25, 254, 2, 120, 254, 2, 120, 254, 2, 120, 254, 69, 45, 244,
+    46, 237,
+    47, 244, 59, 250, 60, 250, 66, 242, 80, 250, 98, 244, 102, 247, 112, 244,
+    115, 244,
+    118, 242, 120, 247, 122, 247, 193, 242, 194, 242, 195, 242, 196, 242, 197,
+    242,
+    198, 242, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225,
+    244,
+    226, 244, 227, 244, 228, 244, 229, 244, 230, 244, 233, 247, 234, 247, 235,
+    247,
+    236, 247, 243, 244, 244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250,
+    242,
+    251, 242, 252, 242, 253, 242, 254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244,
+    0, 4, 242,
+    0, 5, 244, 0, 6, 242, 0, 7, 244, 0, 21, 247, 0, 25, 247, 0, 27, 247, 0,
+    29, 247, 0, 78,
+    250, 0, 79, 244, 0, 82, 250, 0, 83, 244, 0, 87, 244, 0, 89, 244, 0, 109,
+    242, 0, 113,
+    242, 0, 115, 242, 0, 117, 242, 69, 45, 244, 46, 237, 47, 244, 59, 250, 60,
+    250, 66,
+    242, 80, 250, 98, 244, 102, 247, 112, 244, 115, 244, 118, 242, 120, 247,
+    122, 247,
+    193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211, 250, 212,
+    250,
+    213, 250, 214, 250, 215, 250, 217, 250, 225, 244, 226, 244, 227, 244, 228,
+    244,
+    229, 244, 230, 244, 233, 247, 234, 247, 235, 247, 236, 247, 243, 244, 244,
+    244,
+    245, 244, 246, 244, 247, 244, 249, 244, 250, 242, 251, 242, 252, 242, 253,
+    242,
+    254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244, 0, 4, 242, 0, 5, 244, 0, 6,
+    242, 0, 7, 244,
+    0, 21, 247, 0, 25, 247, 0, 27, 247, 0, 29, 247, 0, 78, 250, 0, 79, 244, 0,
+    82, 250, 0,
+    83, 244, 0, 87, 244, 0, 89, 244, 0, 109, 242, 0, 113, 242, 0, 115, 242, 0,
+    117, 242,
+    13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0,
+    6, 249,
+    13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0,
+    6, 249,
+    61, 45, 240, 47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102,
+    244, 112,
+    240, 118, 240, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239,
+    211,
+    245, 212, 245, 213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242,
+    227,
+    242, 228, 242, 229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244,
+    243,
+    240, 244, 240, 245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240,
+    252,
+    240, 253, 240, 0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0,
+    7, 242, 0, 21,
+    244, 0, 25, 244, 0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82,
+    245, 0, 83, 240,
+    0, 109, 240, 0, 113, 240, 0, 115, 240, 0, 117, 240, 10, 102, 2, 233, 2,
+    234, 2, 235,
+    2, 236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 10, 102, 2, 233, 2,
+    234, 2, 235, 2, 236,
+    2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 10, 102, 2, 233, 2, 234, 2,
+    235, 2, 236, 2, 0,
+    21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 2, 120, 254, 2, 1, 32, 24, 249, 19,
+    33, 244, 101,
+    244, 109, 254, 115, 250, 116, 247, 119, 254, 0, 19, 244, 0, 60, 254, 0,
+    62, 254, 0,
+    68, 254, 0, 87, 250, 0, 89, 250, 0, 91, 250, 0, 93, 247, 0, 97, 247, 0,
+    99, 247, 1, 2,
+    25, 247, 1, 32, 25, 249, 2, 33, 244
 };
 static afm_cuint16 afm_Helvetica_Bold_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Helvetica_Bold_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Helvetica_Bold_ligatures[] = {  /* 3 */
+    102, 105, 64257
 };
 
 
@@ -1000,381 +1881,742 @@ static afm_cunicode afm_Helvetica_Bold_ligatures[] = { /* 3 */
 /* FontName: Helvetica-BoldOblique */
 /* FullName: Helvetica Bold Oblique */
 /* FamilyName: Helvetica */
-static afm_cuint8 afm_Helvetica_BoldOblique_widths[] = { /* 315 */
-  46,56,79,93,93,148,120,40,56,56,65,97,46,56,46,46,93,93,93,93,93,
-  93,93,93,93,93,56,56,97,97,97,102,163,120,120,120,120,111,102,130,
-  120,46,93,120,102,139,120,130,111,130,120,111,102,120,111,157,111,
-  111,102,56,46,56,97,93,56,93,102,93,102,93,56,102,102,46,46,93,46,
-  148,102,102,102,102,65,93,56,102,93,130,93,93,83,65,47,65,97,56,
-  93,93,93,93,47,93,56,123,62,93,97,123,56,67,97,56,56,56,102,93,46,
-  56,56,61,93,139,139,139,102,120,120,120,120,120,120,167,120,111,
-  111,111,111,46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,
-  120,120,111,111,102,93,93,93,93,93,93,148,93,93,93,93,93,46,46,46,
-  46,102,102,102,102,102,102,102,97,102,102,102,102,102,93,102,93,
-  120,93,120,93,120,93,120,93,120,93,120,124,120,102,111,93,111,93,
-  111,93,111,93,130,102,130,102,46,46,46,46,46,46,120,93,102,46,102,
-  46,102,67,102,46,120,102,120,102,120,102,130,102,130,102,167,157,
-  120,65,120,65,120,65,111,93,111,93,111,93,102,56,102,65,120,102,
-  120,102,120,102,120,102,111,102,83,102,83,102,83,93,111,93,56,56,
-  56,56,56,56,56,56,93,167,46,46,46,83,83,83,93,93,58,167,167,56,56,
-  28,93,167,82,102,100,97,92,92,92,92,82,42,102,102
+static afm_cuint8 afm_Helvetica_BoldOblique_widths[] = {    /* 315 */
+    46, 56, 79, 93, 93, 148, 120, 40, 56, 56, 65, 97, 46, 56, 46, 46, 93, 93,
+    93, 93, 93,
+    93, 93, 93, 93, 93, 56, 56, 97, 97, 97, 102, 163, 120, 120, 120, 120, 111,
+    102, 130,
+    120, 46, 93, 120, 102, 139, 120, 130, 111, 130, 120, 111, 102, 120, 111,
+    157, 111,
+    111, 102, 56, 46, 56, 97, 93, 56, 93, 102, 93, 102, 93, 56, 102, 102, 46,
+    46, 93, 46,
+    148, 102, 102, 102, 102, 65, 93, 56, 102, 93, 130, 93, 93, 83, 65, 47, 65,
+    97, 56,
+    93, 93, 93, 93, 47, 93, 56, 123, 62, 93, 97, 123, 56, 67, 97, 56, 56, 56,
+    102, 93, 46,
+    56, 56, 61, 93, 139, 139, 139, 102, 120, 120, 120, 120, 120, 120, 167,
+    120, 111,
+    111, 111, 111, 46, 46, 46, 46, 120, 120, 130, 130, 130, 130, 130, 97, 130,
+    120, 120,
+    120, 120, 111, 111, 102, 93, 93, 93, 93, 93, 93, 148, 93, 93, 93, 93, 93,
+    46, 46, 46,
+    46, 102, 102, 102, 102, 102, 102, 102, 97, 102, 102, 102, 102, 102, 93,
+    102, 93,
+    120, 93, 120, 93, 120, 93, 120, 93, 120, 93, 120, 124, 120, 102, 111, 93,
+    111, 93,
+    111, 93, 111, 93, 130, 102, 130, 102, 46, 46, 46, 46, 46, 46, 120, 93,
+    102, 46, 102,
+    46, 102, 67, 102, 46, 120, 102, 120, 102, 120, 102, 130, 102, 130, 102,
+    167, 157,
+    120, 65, 120, 65, 120, 65, 111, 93, 111, 93, 111, 93, 102, 56, 102, 65,
+    120, 102,
+    120, 102, 120, 102, 120, 102, 111, 102, 83, 102, 83, 102, 83, 93, 111, 93,
+    56, 56,
+    56, 56, 56, 56, 56, 56, 93, 167, 46, 46, 46, 83, 83, 83, 93, 93, 58, 167,
+    167, 56, 56,
+    28, 93, 167, 82, 102, 100, 97, 92, 92, 92, 92, 82, 42, 102, 102
 };
 static afm_sint16 afm_Helvetica_BoldOblique_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,29,0,40,0,0,0,0,0,0,0,0,0,0,0,51,54,0,0,
-  0,0,0,57,172,0,218,0,257,0,0,0,308,358,450,0,0,485,534,627,654,0,
-  716,874,902,1051,0,1199,0,0,0,0,0,0,0,1338,1358,1401,1427,1444,1462,
-  1517,1548,0,0,1556,1577,1587,1617,1649,1663,0,1671,1752,0,0,1755,
-  1803,1828,1851,1921,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,1944,2059,2174,2289,2404,2519,0,0,0,0,0,
-  0,0,0,0,0,0,0,2634,2683,2732,2781,2830,0,2879,2928,2956,2984,3012,
-  3040,0,0,3179,3199,3219,3239,3259,3279,0,3299,3325,3343,3361,3379,
-  0,0,0,0,0,3397,3429,3443,3457,3471,3485,0,3499,0,0,0,0,3513,0,3583,
-  3653,3768,3788,3903,3923,4038,0,4058,0,4084,4110,0,4149,4188,0,4205,
-  0,4223,0,4241,0,4259,0,4277,0,4308,0,0,0,0,0,0,4339,4431,4452,4487,
-  4497,4532,0,0,4542,4577,0,4587,0,4619,0,4651,4683,4732,4746,4795,
-  0,0,4809,4871,4952,5014,5095,5157,0,5238,0,5241,0,5244,5247,0,5405,
-  0,5563,0,5591,0,5619,0,5647,0,5675,0,5814,0,5837,0,5860,0,0,5883,
-  0,0,0,0,0,0,0,0,0,0,5886,5891,0,0,5942,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 51, 54, 0, 0,
+    0, 0, 0, 57, 172, 0, 218, 0, 257, 0, 0, 0, 308, 358, 450, 0, 0, 485, 534,
+    627, 654, 0,
+    716, 874, 902, 1051, 0, 1199, 0, 0, 0, 0, 0, 0, 0, 1338, 1358, 1401, 1427,
+    1444, 1462,
+    1517, 1548, 0, 0, 1556, 1577, 1587, 1617, 1649, 1663, 0, 1671, 1752, 0, 0,
+    1755,
+    1803, 1828, 1851, 1921, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1944, 2059, 2174, 2289, 2404, 2519, 0,
+    0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 2634, 2683, 2732, 2781, 2830, 0, 2879, 2928, 2956,
+    2984, 3012,
+    3040, 0, 0, 3179, 3199, 3219, 3239, 3259, 3279, 0, 3299, 3325, 3343, 3361,
+    3379,
+    0, 0, 0, 0, 0, 3397, 3429, 3443, 3457, 3471, 3485, 0, 3499, 0, 0, 0, 0,
+    3513, 0, 3583,
+    3653, 3768, 3788, 3903, 3923, 4038, 0, 4058, 0, 4084, 4110, 0, 4149, 4188,
+    0, 4205,
+    0, 4223, 0, 4241, 0, 4259, 0, 4277, 0, 4308, 0, 0, 0, 0, 0, 0, 4339, 4431,
+    4452, 4487,
+    4497, 4532, 0, 0, 4542, 4577, 0, 4587, 0, 4619, 0, 4651, 4683, 4732, 4746,
+    4795,
+    0, 0, 4809, 4871, 4952, 5014, 5095, 5157, 0, 5238, 0, 5241, 0, 5244, 5247,
+    0, 5405,
+    0, 5563, 0, 5591, 0, 5619, 0, 5647, 0, 5675, 0, 5814, 0, 5837, 0, 5860, 0,
+    0, 5883,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5886, 5891, 0, 0, 5942, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static afm_cuint8 afm_Helvetica_BoldOblique_kerning_data[] = { /* 5945 */
-  42,11,85,240,87,244,88,244,90,237,222,237,0,100,240,0,102,240,0,
-  122,237,1,32,24,247,1,32,28,244,4,33,250,1,32,25,237,1,32,29,237,
-  4,33,250,1,32,25,237,1,32,29,237,2,33,250,2,33,250,49,68,250,72,
-  249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,
-  250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,
-  250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,
-  252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,
-  36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  239,20,66,252,86,255,193,252,194,252,195,252,196,252,197,252,198,
-  252,218,255,219,255,220,255,221,255,0,2,252,0,4,252,0,6,252,0,108,
-  255,0,112,255,0,114,255,0,116,255,18,45,252,47,252,66,250,87,250,
-  88,250,90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,
-  245,0,2,250,0,4,250,0,6,250,0,122,245,23,45,240,47,240,66,244,98,
-  254,193,244,194,244,195,244,196,244,197,244,198,244,225,254,226,
-  254,227,254,228,254,229,254,230,254,0,2,244,0,3,254,0,4,244,0,5,
-  254,0,6,244,0,7,254,22,45,254,47,254,66,254,118,254,193,254,194,
-  254,195,254,196,254,197,254,198,254,250,254,251,254,252,254,253,
-  254,0,2,254,0,4,254,0,6,254,0,109,254,0,113,254,0,115,254,0,117,
-  254,40,80,252,102,254,112,251,118,252,122,250,211,252,212,252,213,
-  252,214,252,215,252,217,252,233,254,234,254,235,254,236,254,243,
-  251,244,251,245,251,246,251,247,251,249,251,250,252,251,252,252,
-  252,253,252,254,250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,
-  0,78,252,0,79,251,0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,
-  0,117,252,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,
-  0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,22,
-  45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,
-  194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,
-  0,6,249,0,100,250,0,102,250,0,122,245,41,45,237,47,237,66,240,98,
-  252,102,252,112,250,193,240,194,240,195,240,196,240,197,240,198,
-  240,225,252,226,252,227,252,228,252,229,252,230,252,233,252,234,
-  252,235,252,236,252,243,250,244,250,245,250,246,250,247,250,249,
-  250,0,2,240,0,3,252,0,4,240,0,5,252,0,6,240,0,7,252,0,21,252,0,25,
-  252,0,27,252,0,29,252,0,79,250,0,83,250,12,45,3,47,3,86,255,218,
-  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
-  255,27,80,254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,
-  213,254,214,254,215,254,217,254,218,254,219,254,220,254,221,254,
-  222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,
-  0,114,254,0,116,254,0,122,249,69,45,244,46,237,47,244,59,250,60,
-  250,66,242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,
-  122,247,193,242,194,242,195,242,196,242,197,242,198,242,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,244,226,244,227,244,
-  228,244,229,244,230,244,233,247,234,247,235,247,236,247,243,244,
-  244,244,245,244,246,244,247,244,249,244,250,242,251,242,252,242,
-  253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,
-  0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,
-  82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,
-  0,117,242,13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,
-  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,237,46,244,47,237,
-  59,250,60,250,66,244,72,249,80,249,98,247,102,249,112,242,118,247,
-  193,244,194,244,195,244,196,244,197,244,198,244,211,249,212,249,
-  213,249,214,249,215,249,217,249,225,247,226,247,227,247,228,247,
-  229,247,230,247,233,249,234,249,235,249,236,249,243,242,244,242,
-  245,242,246,242,247,242,249,242,250,247,251,247,252,247,253,247,
-  0,2,244,0,3,247,0,4,244,0,5,247,0,6,244,0,7,247,0,21,249,0,25,249,
-  0,27,249,0,29,249,0,32,249,0,36,249,0,78,249,0,79,242,0,82,249,0,
-  83,242,0,109,247,0,113,247,0,115,247,0,117,247,65,45,244,46,250,
-  47,244,59,255,60,255,66,247,80,254,98,250,102,251,112,247,118,249,
-  122,254,193,247,194,247,195,247,196,247,197,247,198,247,211,254,
-  212,254,213,254,214,254,215,254,217,254,225,250,226,250,227,250,
-  228,250,229,250,230,250,233,251,234,251,235,251,236,251,243,247,
-  244,247,245,247,246,247,247,247,249,247,250,249,251,249,252,249,
-  253,249,254,254,0,1,254,0,2,247,0,3,250,0,4,247,0,5,250,0,6,247,
-  0,7,250,0,21,251,0,25,251,0,27,251,0,29,251,0,78,254,0,79,247,0,
-  82,254,0,83,247,0,109,249,0,113,249,0,115,249,0,117,249,61,45,240,
-  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
-  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
-  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
-  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
-  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
-  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
-  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
-  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,33,255,0,37,255,18,109,255,118,254,119,254,122,
-  254,250,254,251,254,252,254,253,254,254,254,0,1,254,0,60,255,0,62,
-  255,0,68,255,0,109,254,0,113,254,0,115,254,0,117,254,11,105,255,
-  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
-  0,68,254,8,101,255,119,254,120,254,122,254,254,254,0,1,254,0,19,
-  255,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
-  23,45,255,47,255,102,255,112,254,233,255,234,255,235,255,236,255,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,21,255,0,25,255,
-  0,27,255,0,29,255,0,79,254,0,83,254,1,32,25,5,1,32,29,5,13,102,2,
-  104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,
-  255,0,37,255,4,122,254,254,254,0,1,254,10,112,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,0,79,254,0,83,254,5,120,254,122,
-  254,254,254,0,1,254,13,118,254,122,252,250,254,251,254,252,254,253,
-  254,254,252,0,1,252,0,109,254,0,113,254,0,115,254,0,117,254,14,118,
-  255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,
-  254,0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,
-  252,122,254,254,254,0,1,254,4,122,254,254,254,0,1,254,34,45,247,
-  46,254,47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,
-  3,119,2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,
-  254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,
-  254,0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,2,120,
-  254,22,45,244,47,244,98,254,112,252,225,254,226,254,227,254,228,
-  254,229,254,230,254,243,252,244,252,245,252,246,252,247,252,249,
-  252,0,3,254,0,5,254,0,7,254,0,79,252,0,83,252,12,45,250,47,250,112,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
-  254,10,102,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,
-  0,27,255,0,29,255,31,45,244,47,244,98,252,102,255,112,253,225,252,
-  226,252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,
-  236,255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,
-  0,5,252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,
-  253,10,102,2,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,
-  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
-  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
-  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
-  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
-  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
-  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
-  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
-  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
-  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
-  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,239,49,68,250,72,249,80,250,82,250,85,
-  242,86,249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,
-  200,250,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
-  219,249,220,249,221,249,222,239,250,252,251,252,252,252,253,252,
-  254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,
-  250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,
-  0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,49,68,250,72,249,
-  80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,119,250,
-  120,252,122,252,200,250,211,250,212,250,213,250,214,250,215,250,
-  217,250,218,249,219,249,220,249,221,249,222,239,250,252,251,252,
-  252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,
-  0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,239,
-  49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,
-  118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,250,
-  214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,239,
-  250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,
-  0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,239,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,
-  88,247,90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,
-  250,213,250,214,250,215,250,217,250,218,249,219,249,220,249,221,
-  249,222,239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,
-  250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,
-  242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,239,22,45,250,47,250,66,249,85,250,87,
-  249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,
-  198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,
-  245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,90,245,193,
-  249,194,249,195,249,196,249,197,249,198,249,222,245,0,2,249,0,4,
-  249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,249,
-  85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,
-  197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,
-  250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
-  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
-  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,22,45,250,47,
-  250,66,249,85,250,87,249,88,249,89,249,90,245,193,249,194,249,195,
-  249,196,249,197,249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,
-  250,0,102,250,0,122,245,22,45,250,47,250,66,249,85,250,87,249,88,
-  249,89,249,90,245,193,249,194,249,195,249,196,249,197,249,198,249,
-  222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,13,
-  45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,
-  249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,
-  249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,13,45,
-  252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
-  0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,194,249,
-  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,61,45,240,
-  47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,240,118,240,
-  193,239,194,239,195,239,196,239,197,239,198,239,211,245,212,245,
-  213,245,214,245,215,245,217,245,225,242,226,242,227,242,228,242,
-  229,242,230,242,233,244,234,244,235,244,236,244,243,240,244,240,
-  245,240,246,240,247,240,249,240,250,240,251,240,252,240,253,240,
-  0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,244,0,25,244,
-  0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,0,109,240,
-  0,113,240,0,115,240,0,117,240,9,104,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,122,
-  254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,254,
-  122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,120,
-  254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,254,
-  120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,9,104,255,119,
-  254,120,254,122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,
-  108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,
-  0,68,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,
-  254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,
-  9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,9,45,
-  2,47,3,119,254,120,254,121,254,122,254,254,254,0,1,254,14,118,255,
-  119,250,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
-  0,109,255,0,113,255,0,115,255,0,117,255,7,119,254,120,254,121,252,
-  122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,254,
-  0,1,254,7,119,254,120,254,121,252,122,254,254,254,0,1,254,7,119,
-  254,120,254,121,252,122,254,254,254,0,1,254,7,119,254,120,254,121,
-  252,122,254,254,254,0,1,254,7,119,254,120,254,121,252,122,254,254,
-  254,0,1,254,31,45,244,47,244,98,252,102,255,112,253,225,252,226,
-  252,227,252,228,252,229,252,230,252,233,255,234,255,235,255,236,
-  255,243,253,244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,
-  252,0,7,252,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,
-  31,45,244,47,244,98,252,102,255,112,253,225,252,226,252,227,252,
-  228,252,229,252,230,252,233,255,234,255,235,255,236,255,243,253,
-  244,253,245,253,246,253,247,253,249,253,0,3,252,0,5,252,0,7,252,
-  0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,49,68,250,
-  72,249,80,250,82,250,85,242,86,249,87,244,88,247,90,239,118,252,
-  119,250,120,252,122,252,200,250,211,250,212,250,213,250,214,250,
-  215,250,217,250,218,249,219,249,220,249,221,249,222,239,250,252,
-  251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,250,0,32,249,
-  0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  239,9,104,255,119,254,120,254,122,254,254,254,0,1,254,0,33,255,0,
-  37,255,49,68,250,72,249,80,250,82,250,85,242,86,249,87,244,88,247,
-  90,239,118,252,119,250,120,252,122,252,200,250,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  239,250,252,251,252,252,252,253,252,254,252,0,1,252,0,8,250,0,14,
-  250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,242,0,102,242,0,108,
-  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
-  0,117,252,0,122,239,9,104,255,119,254,120,254,122,254,254,254,0,
-  1,254,0,33,255,0,37,255,49,68,250,72,249,80,250,82,250,85,242,86,
-  249,87,244,88,247,90,239,118,252,119,250,120,252,122,252,200,250,
-  211,250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,
-  220,249,221,249,222,239,250,252,251,252,252,252,253,252,254,252,
-  0,1,252,0,8,250,0,14,250,0,32,249,0,36,249,0,78,250,0,82,250,0,100,
-  242,0,102,242,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,
-  0,115,252,0,116,249,0,117,252,0,122,239,9,104,255,119,254,120,254,
-  122,254,254,254,0,1,254,0,33,255,0,37,255,11,105,255,108,254,109,
-  254,122,255,254,255,0,1,255,0,57,254,0,60,254,0,62,254,0,68,254,
-  11,105,255,108,254,109,254,122,255,254,255,0,1,255,0,57,254,0,60,
-  254,0,62,254,0,68,254,18,45,252,47,252,66,250,87,250,88,250,90,245,
-  193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,2,250,
-  0,4,250,0,6,250,0,122,245,18,45,252,47,252,66,250,87,250,88,250,
-  90,245,193,250,194,250,195,250,196,250,197,250,198,250,222,245,0,
-  2,250,0,4,250,0,6,250,0,122,245,8,101,255,119,254,120,254,122,254,
-  254,254,0,1,254,0,19,255,9,45,2,47,3,119,254,120,254,121,254,122,
-  254,254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,
-  254,254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,
-  254,0,1,254,9,45,2,47,3,119,254,120,254,121,254,122,254,254,254,
-  0,1,254,13,102,2,104,255,233,2,234,2,235,2,236,2,0,21,2,0,25,2,0,
-  27,2,0,29,2,0,33,255,0,37,255,13,102,2,104,255,233,2,234,2,235,2,
-  236,2,0,21,2,0,25,2,0,27,2,0,29,2,0,33,255,0,37,255,40,80,252,102,
-  254,112,251,118,252,122,250,211,252,212,252,213,252,214,252,215,
-  252,217,252,233,254,234,254,235,254,236,254,243,251,244,251,245,
-  251,246,251,247,251,249,251,250,252,251,252,252,252,253,252,254,
-  250,0,1,250,0,21,254,0,25,254,0,27,254,0,29,254,0,78,252,0,79,251,
-  0,82,252,0,83,251,0,109,252,0,113,252,0,115,252,0,117,252,10,112,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,79,254,0,83,
-  254,14,85,242,87,239,88,244,90,237,122,252,222,237,254,252,0,1,252,
-  0,100,242,0,102,242,0,122,237,1,32,25,234,1,32,29,234,5,120,254,
-  122,254,254,254,0,1,254,14,85,242,87,239,88,244,90,237,122,252,222,
-  237,254,252,0,1,252,0,100,242,0,102,242,0,122,237,1,32,25,234,1,
-  32,29,234,5,120,254,122,254,254,254,0,1,254,14,85,242,87,239,88,
-  244,90,237,122,252,222,237,254,252,0,1,252,0,100,242,0,102,242,0,
-  122,237,1,32,25,234,1,32,29,234,5,120,254,122,254,254,254,0,1,254,
-  14,118,255,119,250,122,254,250,255,251,255,252,255,253,255,254,254,
-  0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,119,250,
-  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
-  0,113,255,0,115,255,0,117,255,14,118,255,119,250,122,254,250,255,
-  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
-  255,0,117,255,22,45,250,47,250,66,249,85,250,87,249,88,249,89,249,
-  90,245,193,249,194,249,195,249,196,249,197,249,198,249,222,245,0,
-  2,249,0,4,249,0,6,249,0,100,250,0,102,250,0,122,245,7,119,254,120,
-  254,121,252,122,254,254,254,0,1,254,22,45,250,47,250,66,249,85,250,
-  87,249,88,249,89,249,90,245,193,249,194,249,195,249,196,249,197,
-  249,198,249,222,245,0,2,249,0,4,249,0,6,249,0,100,250,0,102,250,
-  0,122,245,7,119,254,120,254,121,252,122,254,254,254,0,1,254,27,80,
-  254,85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,
-  254,215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,
-  254,0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,
-  116,254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,
-  112,254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,
-  254,0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,
-  0,101,3,1,2,25,254,27,80,254,85,254,86,254,87,249,88,250,90,249,
-  211,254,212,254,213,254,214,254,215,254,217,254,218,254,219,254,
-  220,254,221,254,222,249,0,78,254,0,82,254,0,100,254,0,102,254,0,
-  108,254,0,112,254,0,114,254,0,116,254,0,122,249,34,45,247,46,254,
-  47,247,100,254,101,254,104,254,112,254,114,254,116,254,117,3,119,
-  2,122,2,232,254,243,254,244,254,245,254,246,254,247,254,249,254,
-  254,2,0,1,2,0,9,254,0,15,254,0,19,254,0,33,254,0,37,254,0,79,254,
-  0,83,254,0,93,254,0,97,254,0,99,254,0,101,3,1,2,25,254,27,80,254,
-  85,254,86,254,87,249,88,250,90,249,211,254,212,254,213,254,214,254,
-  215,254,217,254,218,254,219,254,220,254,221,254,222,249,0,78,254,
-  0,82,254,0,100,254,0,102,254,0,108,254,0,112,254,0,114,254,0,116,
-  254,0,122,249,34,45,247,46,254,47,247,100,254,101,254,104,254,112,
-  254,114,254,116,254,117,3,119,2,122,2,232,254,243,254,244,254,245,
-  254,246,254,247,254,249,254,254,2,0,1,2,0,9,254,0,15,254,0,19,254,
-  0,33,254,0,37,254,0,79,254,0,83,254,0,93,254,0,97,254,0,99,254,0,
-  101,3,1,2,25,254,2,120,254,2,120,254,2,120,254,69,45,244,46,237,
-  47,244,59,250,60,250,66,242,80,250,98,244,102,247,112,244,115,244,
-  118,242,120,247,122,247,193,242,194,242,195,242,196,242,197,242,
-  198,242,211,250,212,250,213,250,214,250,215,250,217,250,225,244,
-  226,244,227,244,228,244,229,244,230,244,233,247,234,247,235,247,
-  236,247,243,244,244,244,245,244,246,244,247,244,249,244,250,242,
-  251,242,252,242,253,242,254,247,0,1,247,0,2,242,0,3,244,0,4,242,
-  0,5,244,0,6,242,0,7,244,0,21,247,0,25,247,0,27,247,0,29,247,0,78,
-  250,0,79,244,0,82,250,0,83,244,0,87,244,0,89,244,0,109,242,0,113,
-  242,0,115,242,0,117,242,69,45,244,46,237,47,244,59,250,60,250,66,
-  242,80,250,98,244,102,247,112,244,115,244,118,242,120,247,122,247,
-  193,242,194,242,195,242,196,242,197,242,198,242,211,250,212,250,
-  213,250,214,250,215,250,217,250,225,244,226,244,227,244,228,244,
-  229,244,230,244,233,247,234,247,235,247,236,247,243,244,244,244,
-  245,244,246,244,247,244,249,244,250,242,251,242,252,242,253,242,
-  254,247,0,1,247,0,2,242,0,3,244,0,4,242,0,5,244,0,6,242,0,7,244,
-  0,21,247,0,25,247,0,27,247,0,29,247,0,78,250,0,79,244,0,82,250,0,
-  83,244,0,87,244,0,89,244,0,109,242,0,113,242,0,115,242,0,117,242,
-  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
-  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
-  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
-  13,45,252,47,252,66,249,193,249,194,249,195,249,196,249,197,249,
-  198,249,0,2,249,0,4,249,0,6,249,13,45,252,47,252,66,249,193,249,
-  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
-  61,45,240,47,240,59,249,60,249,66,239,80,245,98,242,102,244,112,
-  240,118,240,193,239,194,239,195,239,196,239,197,239,198,239,211,
-  245,212,245,213,245,214,245,215,245,217,245,225,242,226,242,227,
-  242,228,242,229,242,230,242,233,244,234,244,235,244,236,244,243,
-  240,244,240,245,240,246,240,247,240,249,240,250,240,251,240,252,
-  240,253,240,0,2,239,0,3,242,0,4,239,0,5,242,0,6,239,0,7,242,0,21,
-  244,0,25,244,0,27,244,0,29,244,0,78,245,0,79,240,0,82,245,0,83,240,
-  0,109,240,0,113,240,0,115,240,0,117,240,10,102,2,233,2,234,2,235,
-  2,236,2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,
-  2,0,21,2,0,25,2,0,27,2,0,29,2,10,102,2,233,2,234,2,235,2,236,2,0,
-  21,2,0,25,2,0,27,2,0,29,2,2,120,254,2,1,32,24,249,19,33,244,101,
-  244,109,254,115,250,116,247,119,254,0,19,244,0,60,254,0,62,254,0,
-  68,254,0,87,250,0,89,250,0,91,250,0,93,247,0,97,247,0,99,247,1,2,
-  25,247,1,32,25,249,2,33,244
+static afm_cuint8 afm_Helvetica_BoldOblique_kerning_data[] = {  /* 5945 */
+    42, 11, 85, 240, 87, 244, 88, 244, 90, 237, 222, 237, 0, 100, 240, 0, 102,
+    240, 0,
+    122, 237, 1, 32, 24, 247, 1, 32, 28, 244, 4, 33, 250, 1, 32, 25, 237, 1,
+    32, 29, 237,
+    4, 33, 250, 1, 32, 25, 237, 1, 32, 29, 237, 2, 33, 250, 2, 33, 250, 49,
+    68, 250, 72,
+    249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239, 118,
+    252, 119,
+    250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214, 250,
+    215,
+    250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0,
+    32, 249, 0,
+    36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0,
+    109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    239, 20, 66, 252, 86, 255, 193, 252, 194, 252, 195, 252, 196, 252, 197,
+    252, 198,
+    252, 218, 255, 219, 255, 220, 255, 221, 255, 0, 2, 252, 0, 4, 252, 0, 6,
+    252, 0, 108,
+    255, 0, 112, 255, 0, 114, 255, 0, 116, 255, 18, 45, 252, 47, 252, 66, 250,
+    87, 250,
+    88, 250, 90, 245, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198,
+    250, 222,
+    245, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 245, 23, 45, 240, 47, 240,
+    66, 244, 98,
+    254, 193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 225, 254,
+    226,
+    254, 227, 254, 228, 254, 229, 254, 230, 254, 0, 2, 244, 0, 3, 254, 0, 4,
+    244, 0, 5,
+    254, 0, 6, 244, 0, 7, 254, 22, 45, 254, 47, 254, 66, 254, 118, 254, 193,
+    254, 194,
+    254, 195, 254, 196, 254, 197, 254, 198, 254, 250, 254, 251, 254, 252, 254,
+    253,
+    254, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 109, 254, 0, 113, 254, 0, 115,
+    254, 0, 117,
+    254, 40, 80, 252, 102, 254, 112, 251, 118, 252, 122, 250, 211, 252, 212,
+    252, 213,
+    252, 214, 252, 215, 252, 217, 252, 233, 254, 234, 254, 235, 254, 236, 254,
+    243,
+    251, 244, 251, 245, 251, 246, 251, 247, 251, 249, 251, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 250, 0, 1, 250, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0,
+    29, 254,
+    0, 78, 252, 0, 79, 251, 0, 82, 252, 0, 83, 251, 0, 109, 252, 0, 113, 252,
+    0, 115, 252,
+    0, 117, 252, 14, 85, 242, 87, 239, 88, 244, 90, 237, 122, 252, 222, 237,
+    254, 252,
+    0, 1, 252, 0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32, 25, 234, 1, 32,
+    29, 234, 22,
+    45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249, 90, 245,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2, 249, 0,
+    4, 249,
+    0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 41, 45, 237, 47, 237,
+    66, 240, 98,
+    252, 102, 252, 112, 250, 193, 240, 194, 240, 195, 240, 196, 240, 197, 240,
+    198,
+    240, 225, 252, 226, 252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 252,
+    234,
+    252, 235, 252, 236, 252, 243, 250, 244, 250, 245, 250, 246, 250, 247, 250,
+    249,
+    250, 0, 2, 240, 0, 3, 252, 0, 4, 240, 0, 5, 252, 0, 6, 240, 0, 7, 252, 0,
+    21, 252, 0, 25,
+    252, 0, 27, 252, 0, 29, 252, 0, 79, 250, 0, 83, 250, 12, 45, 3, 47, 3, 86,
+    255, 218,
+    255, 219, 255, 220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255,
+    0, 116,
+    255, 27, 80, 254, 85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254,
+    212, 254,
+    213, 254, 214, 254, 215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221,
+    254,
+    222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254,
+    0, 112, 254,
+    0, 114, 254, 0, 116, 254, 0, 122, 249, 69, 45, 244, 46, 237, 47, 244, 59,
+    250, 60,
+    250, 66, 242, 80, 250, 98, 244, 102, 247, 112, 244, 115, 244, 118, 242,
+    120, 247,
+    122, 247, 193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 244, 226, 244, 227,
+    244,
+    228, 244, 229, 244, 230, 244, 233, 247, 234, 247, 235, 247, 236, 247, 243,
+    244,
+    244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250, 242, 251, 242, 252,
+    242,
+    253, 242, 254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244, 0, 4, 242, 0, 5, 244,
+    0, 6, 242,
+    0, 7, 244, 0, 21, 247, 0, 25, 247, 0, 27, 247, 0, 29, 247, 0, 78, 250, 0,
+    79, 244, 0,
+    82, 250, 0, 83, 244, 0, 87, 244, 0, 89, 244, 0, 109, 242, 0, 113, 242, 0,
+    115, 242,
+    0, 117, 242, 13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249,
+    196, 249,
+    197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 65, 45, 237, 46, 244,
+    47, 237,
+    59, 250, 60, 250, 66, 244, 72, 249, 80, 249, 98, 247, 102, 249, 112, 242,
+    118, 247,
+    193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 211, 249, 212,
+    249,
+    213, 249, 214, 249, 215, 249, 217, 249, 225, 247, 226, 247, 227, 247, 228,
+    247,
+    229, 247, 230, 247, 233, 249, 234, 249, 235, 249, 236, 249, 243, 242, 244,
+    242,
+    245, 242, 246, 242, 247, 242, 249, 242, 250, 247, 251, 247, 252, 247, 253,
+    247,
+    0, 2, 244, 0, 3, 247, 0, 4, 244, 0, 5, 247, 0, 6, 244, 0, 7, 247, 0, 21,
+    249, 0, 25, 249,
+    0, 27, 249, 0, 29, 249, 0, 32, 249, 0, 36, 249, 0, 78, 249, 0, 79, 242, 0,
+    82, 249, 0,
+    83, 242, 0, 109, 247, 0, 113, 247, 0, 115, 247, 0, 117, 247, 65, 45, 244,
+    46, 250,
+    47, 244, 59, 255, 60, 255, 66, 247, 80, 254, 98, 250, 102, 251, 112, 247,
+    118, 249,
+    122, 254, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 211,
+    254,
+    212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226, 250, 227,
+    250,
+    228, 250, 229, 250, 230, 250, 233, 251, 234, 251, 235, 251, 236, 251, 243,
+    247,
+    244, 247, 245, 247, 246, 247, 247, 247, 249, 247, 250, 249, 251, 249, 252,
+    249,
+    253, 249, 254, 254, 0, 1, 254, 0, 2, 247, 0, 3, 250, 0, 4, 247, 0, 5, 250,
+    0, 6, 247,
+    0, 7, 250, 0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0, 78, 254, 0,
+    79, 247, 0,
+    82, 254, 0, 83, 247, 0, 109, 249, 0, 113, 249, 0, 115, 249, 0, 117, 249,
+    61, 45, 240,
+    47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102, 244, 112, 240,
+    118, 240,
+    193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 245, 212,
+    245,
+    213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242, 227, 242, 228,
+    242,
+    229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244, 243, 240, 244,
+    240,
+    245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240, 252, 240, 253,
+    240,
+    0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0, 7, 242, 0, 21,
+    244, 0, 25, 244,
+    0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82, 245, 0, 83, 240, 0,
+    109, 240,
+    0, 113, 240, 0, 115, 240, 0, 117, 240, 9, 104, 255, 119, 254, 120, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 18, 109, 255, 118, 254, 119,
+    254, 122,
+    254, 250, 254, 251, 254, 252, 254, 253, 254, 254, 254, 0, 1, 254, 0, 60,
+    255, 0, 62,
+    255, 0, 68, 255, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117, 254, 11,
+    105, 255,
+    108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254,
+    0, 62, 254,
+    0, 68, 254, 8, 101, 255, 119, 254, 120, 254, 122, 254, 254, 254, 0, 1,
+    254, 0, 19,
+    255, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0,
+    1, 254,
+    23, 45, 255, 47, 255, 102, 255, 112, 254, 233, 255, 234, 255, 235, 255,
+    236, 255,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 255, 0,
+    25, 255,
+    0, 27, 255, 0, 29, 255, 0, 79, 254, 0, 83, 254, 1, 32, 25, 5, 1, 32, 29,
+    5, 13, 102, 2,
+    104, 255, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0,
+    29, 2, 0, 33,
+    255, 0, 37, 255, 4, 122, 254, 254, 254, 0, 1, 254, 10, 112, 254, 243, 254,
+    244, 254,
+    245, 254, 246, 254, 247, 254, 249, 254, 0, 79, 254, 0, 83, 254, 5, 120,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 13, 118, 254, 122, 252, 250, 254, 251, 254, 252,
+    254, 253,
+    254, 254, 252, 0, 1, 252, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117,
+    254, 14, 118,
+    255, 119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254,
+    0, 1,
+    254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 7, 119, 254, 120,
+    254, 121,
+    252, 122, 254, 254, 254, 0, 1, 254, 4, 122, 254, 254, 254, 0, 1, 254, 34,
+    45, 247,
+    46, 254, 47, 247, 100, 254, 101, 254, 104, 254, 112, 254, 114, 254, 116,
+    254, 117,
+    3, 119, 2, 122, 2, 232, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247,
+    254, 249,
+    254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254, 0, 19, 254, 0, 33, 254, 0,
+    37, 254, 0, 79,
+    254, 0, 83, 254, 0, 93, 254, 0, 97, 254, 0, 99, 254, 0, 101, 3, 1, 2, 25,
+    254, 2, 120,
+    254, 22, 45, 244, 47, 244, 98, 254, 112, 252, 225, 254, 226, 254, 227,
+    254, 228,
+    254, 229, 254, 230, 254, 243, 252, 244, 252, 245, 252, 246, 252, 247, 252,
+    249,
+    252, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 79, 252, 0, 83, 252, 12, 45, 250,
+    47, 250, 112,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 79,
+    254, 0, 83,
+    254, 10, 102, 255, 233, 255, 234, 255, 235, 255, 236, 255, 0, 21, 255, 0,
+    25, 255,
+    0, 27, 255, 0, 29, 255, 31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253,
+    225, 252,
+    226, 252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235,
+    255,
+    236, 255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0,
+    3, 252,
+    0, 5, 252, 0, 7, 252, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0,
+    79, 253, 0, 83,
+    253, 10, 102, 2, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2, 0, 25, 2, 0,
+    27, 2, 0, 29, 2,
+    49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88,
+    247, 90, 239,
+    118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213,
+    250,
+    214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    239,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0,
+    14, 250,
+    0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86,
+    249, 87, 244,
+    88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211,
+    250, 212,
+    250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1,
+    252, 0, 8,
+    250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100,
+    242, 0, 102,
+    242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82,
+    250, 85,
+    242, 86, 249, 87, 244, 88, 247, 90, 239, 118, 252, 119, 250, 120, 252,
+    122, 252,
+    200, 250, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 239, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78,
+    250, 0, 82,
+    250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0,
+    113, 252,
+    0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 239, 49, 68,
+    250, 72, 249,
+    80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239, 118, 252,
+    119, 250,
+    120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214, 250, 215,
+    250,
+    217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32,
+    249, 0, 36, 249,
+    0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 239,
+    49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88,
+    247, 90, 239,
+    118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213,
+    250,
+    214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    239,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0,
+    14, 250,
+    0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 239, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86,
+    249, 87, 244,
+    88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211,
+    250, 212,
+    250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1,
+    252, 0, 8,
+    250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100,
+    242, 0, 102,
+    242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 239, 22, 45, 250, 47, 250, 66, 249, 85,
+    250, 87,
+    249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102,
+    250, 0, 122,
+    245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249,
+    90, 245, 193,
+    249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2,
+    249, 0, 4,
+    249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47,
+    250, 66, 249,
+    85, 250, 87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249,
+    196, 249,
+    197, 249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88,
+    249, 89, 249,
+    90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222,
+    245, 0,
+    2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22,
+    45, 250, 47,
+    250, 66, 249, 85, 250, 87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194,
+    249, 195,
+    249, 196, 249, 197, 249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6,
+    249, 0, 100,
+    250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87,
+    249, 88,
+    249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249,
+    198, 249,
+    222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0,
+    122, 245, 13,
+    45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197,
+    249, 198,
+    249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249, 193,
+    249, 194,
+    249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6,
+    249, 13, 45,
+    252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249,
+    198, 249,
+    0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249, 193, 249,
+    194, 249,
+    195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249,
+    61, 45, 240,
+    47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102, 244, 112, 240,
+    118, 240,
+    193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 245, 212,
+    245,
+    213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242, 227, 242, 228,
+    242,
+    229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244, 243, 240, 244,
+    240,
+    245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240, 252, 240, 253,
+    240,
+    0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0, 7, 242, 0, 21,
+    244, 0, 25, 244,
+    0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82, 245, 0, 83, 240, 0,
+    109, 240,
+    0, 113, 240, 0, 115, 240, 0, 117, 240, 9, 104, 255, 119, 254, 120, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119, 254, 120,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119, 254,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255, 119,
+    254, 120,
+    254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104, 255,
+    119, 254,
+    120, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 9, 104,
+    255, 119,
+    254, 120, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 11,
+    105, 255,
+    108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254,
+    0, 62, 254,
+    0, 68, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254,
+    254, 0, 1,
+    254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0,
+    1, 254,
+    9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0, 1,
+    254, 9, 45,
+    2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254, 254, 254, 0, 1, 254, 14,
+    118, 255,
+    119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0,
+    1, 254,
+    0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 7, 119, 254, 120, 254,
+    121, 252,
+    122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122, 254,
+    254, 254,
+    0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1, 254,
+    7, 119,
+    254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120,
+    254, 121,
+    252, 122, 254, 254, 254, 0, 1, 254, 7, 119, 254, 120, 254, 121, 252, 122,
+    254, 254,
+    254, 0, 1, 254, 31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253, 225,
+    252, 226,
+    252, 227, 252, 228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235, 255,
+    236,
+    255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0, 3,
+    252, 0, 5,
+    252, 0, 7, 252, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79,
+    253, 0, 83, 253,
+    31, 45, 244, 47, 244, 98, 252, 102, 255, 112, 253, 225, 252, 226, 252,
+    227, 252,
+    228, 252, 229, 252, 230, 252, 233, 255, 234, 255, 235, 255, 236, 255, 243,
+    253,
+    244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 0, 3, 252, 0, 5, 252, 0,
+    7, 252,
+    0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 253, 0, 83, 253,
+    49, 68, 250,
+    72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87, 244, 88, 247, 90, 239,
+    118, 252,
+    119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212, 250, 213, 250, 214,
+    250,
+    215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 239, 250,
+    252,
+    251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8, 250, 0, 14, 250,
+    0, 32, 249,
+    0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102, 242, 0, 108, 249,
+    0, 109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    239, 9, 104, 255, 119, 254, 120, 254, 122, 254, 254, 254, 0, 1, 254, 0,
+    33, 255, 0,
+    37, 255, 49, 68, 250, 72, 249, 80, 250, 82, 250, 85, 242, 86, 249, 87,
+    244, 88, 247,
+    90, 239, 118, 252, 119, 250, 120, 252, 122, 252, 200, 250, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    239, 250, 252, 251, 252, 252, 252, 253, 252, 254, 252, 0, 1, 252, 0, 8,
+    250, 0, 14,
+    250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0, 82, 250, 0, 100, 242, 0, 102,
+    242, 0, 108,
+    249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0,
+    116, 249,
+    0, 117, 252, 0, 122, 239, 9, 104, 255, 119, 254, 120, 254, 122, 254, 254,
+    254, 0,
+    1, 254, 0, 33, 255, 0, 37, 255, 49, 68, 250, 72, 249, 80, 250, 82, 250,
+    85, 242, 86,
+    249, 87, 244, 88, 247, 90, 239, 118, 252, 119, 250, 120, 252, 122, 252,
+    200, 250,
+    211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219,
+    249,
+    220, 249, 221, 249, 222, 239, 250, 252, 251, 252, 252, 252, 253, 252, 254,
+    252,
+    0, 1, 252, 0, 8, 250, 0, 14, 250, 0, 32, 249, 0, 36, 249, 0, 78, 250, 0,
+    82, 250, 0, 100,
+    242, 0, 102, 242, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0,
+    114, 249,
+    0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 239, 9, 104, 255, 119, 254,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 0, 33, 255, 0, 37, 255, 11, 105, 255, 108,
+    254, 109,
+    254, 122, 255, 254, 255, 0, 1, 255, 0, 57, 254, 0, 60, 254, 0, 62, 254, 0,
+    68, 254,
+    11, 105, 255, 108, 254, 109, 254, 122, 255, 254, 255, 0, 1, 255, 0, 57,
+    254, 0, 60,
+    254, 0, 62, 254, 0, 68, 254, 18, 45, 252, 47, 252, 66, 250, 87, 250, 88,
+    250, 90, 245,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 245, 0,
+    2, 250,
+    0, 4, 250, 0, 6, 250, 0, 122, 245, 18, 45, 252, 47, 252, 66, 250, 87, 250,
+    88, 250,
+    90, 245, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222,
+    245, 0,
+    2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 245, 8, 101, 255, 119, 254, 120,
+    254, 122, 254,
+    254, 254, 0, 1, 254, 0, 19, 255, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122,
+    254, 254,
+    254, 0, 1, 254, 9, 45, 2, 47, 3, 119, 254, 120, 254, 121, 254, 122, 254,
+    254, 254,
+    0, 1, 254, 13, 102, 2, 104, 255, 233, 2, 234, 2, 235, 2, 236, 2, 0, 21, 2,
+    0, 25, 2, 0,
+    27, 2, 0, 29, 2, 0, 33, 255, 0, 37, 255, 13, 102, 2, 104, 255, 233, 2,
+    234, 2, 235, 2,
+    236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 0, 33, 255, 0, 37, 255,
+    40, 80, 252, 102,
+    254, 112, 251, 118, 252, 122, 250, 211, 252, 212, 252, 213, 252, 214, 252,
+    215,
+    252, 217, 252, 233, 254, 234, 254, 235, 254, 236, 254, 243, 251, 244, 251,
+    245,
+    251, 246, 251, 247, 251, 249, 251, 250, 252, 251, 252, 252, 252, 253, 252,
+    254,
+    250, 0, 1, 250, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 78,
+    252, 0, 79, 251,
+    0, 82, 252, 0, 83, 251, 0, 109, 252, 0, 113, 252, 0, 115, 252, 0, 117,
+    252, 10, 112,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 79,
+    254, 0, 83,
+    254, 14, 85, 242, 87, 239, 88, 244, 90, 237, 122, 252, 222, 237, 254, 252,
+    0, 1, 252,
+    0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32, 25, 234, 1, 32, 29, 234, 5,
+    120, 254,
+    122, 254, 254, 254, 0, 1, 254, 14, 85, 242, 87, 239, 88, 244, 90, 237,
+    122, 252, 222,
+    237, 254, 252, 0, 1, 252, 0, 100, 242, 0, 102, 242, 0, 122, 237, 1, 32,
+    25, 234, 1,
+    32, 29, 234, 5, 120, 254, 122, 254, 254, 254, 0, 1, 254, 14, 85, 242, 87,
+    239, 88,
+    244, 90, 237, 122, 252, 222, 237, 254, 252, 0, 1, 252, 0, 100, 242, 0,
+    102, 242, 0,
+    122, 237, 1, 32, 25, 234, 1, 32, 29, 234, 5, 120, 254, 122, 254, 254, 254,
+    0, 1, 254,
+    14, 118, 255, 119, 250, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255,
+    254, 254,
+    0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118,
+    255, 119, 250,
+    122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0,
+    109, 255,
+    0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118, 255, 119, 250, 122, 254,
+    250, 255,
+    251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113,
+    255, 0, 115,
+    255, 0, 117, 255, 22, 45, 250, 47, 250, 66, 249, 85, 250, 87, 249, 88,
+    249, 89, 249,
+    90, 245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 222,
+    245, 0,
+    2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0, 102, 250, 0, 122, 245, 7,
+    119, 254, 120,
+    254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 22, 45, 250, 47, 250, 66,
+    249, 85, 250,
+    87, 249, 88, 249, 89, 249, 90, 245, 193, 249, 194, 249, 195, 249, 196,
+    249, 197,
+    249, 198, 249, 222, 245, 0, 2, 249, 0, 4, 249, 0, 6, 249, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 245, 7, 119, 254, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 27, 80,
+    254, 85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254, 212, 254, 213,
+    254, 214,
+    254, 215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221, 254, 222, 249,
+    0, 78,
+    254, 0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254, 0, 112, 254, 0,
+    114, 254, 0,
+    116, 254, 0, 122, 249, 34, 45, 247, 46, 254, 47, 247, 100, 254, 101, 254,
+    104, 254,
+    112, 254, 114, 254, 116, 254, 117, 3, 119, 2, 122, 2, 232, 254, 243, 254,
+    244, 254,
+    245, 254, 246, 254, 247, 254, 249, 254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15,
+    254, 0, 19,
+    254, 0, 33, 254, 0, 37, 254, 0, 79, 254, 0, 83, 254, 0, 93, 254, 0, 97,
+    254, 0, 99, 254,
+    0, 101, 3, 1, 2, 25, 254, 27, 80, 254, 85, 254, 86, 254, 87, 249, 88, 250,
+    90, 249,
+    211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 254, 219,
+    254,
+    220, 254, 221, 254, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 254, 0, 102,
+    254, 0,
+    108, 254, 0, 112, 254, 0, 114, 254, 0, 116, 254, 0, 122, 249, 34, 45, 247,
+    46, 254,
+    47, 247, 100, 254, 101, 254, 104, 254, 112, 254, 114, 254, 116, 254, 117,
+    3, 119,
+    2, 122, 2, 232, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254,
+    249, 254,
+    254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254, 0, 19, 254, 0, 33, 254, 0, 37,
+    254, 0, 79, 254,
+    0, 83, 254, 0, 93, 254, 0, 97, 254, 0, 99, 254, 0, 101, 3, 1, 2, 25, 254,
+    27, 80, 254,
+    85, 254, 86, 254, 87, 249, 88, 250, 90, 249, 211, 254, 212, 254, 213, 254,
+    214, 254,
+    215, 254, 217, 254, 218, 254, 219, 254, 220, 254, 221, 254, 222, 249, 0,
+    78, 254,
+    0, 82, 254, 0, 100, 254, 0, 102, 254, 0, 108, 254, 0, 112, 254, 0, 114,
+    254, 0, 116,
+    254, 0, 122, 249, 34, 45, 247, 46, 254, 47, 247, 100, 254, 101, 254, 104,
+    254, 112,
+    254, 114, 254, 116, 254, 117, 3, 119, 2, 122, 2, 232, 254, 243, 254, 244,
+    254, 245,
+    254, 246, 254, 247, 254, 249, 254, 254, 2, 0, 1, 2, 0, 9, 254, 0, 15, 254,
+    0, 19, 254,
+    0, 33, 254, 0, 37, 254, 0, 79, 254, 0, 83, 254, 0, 93, 254, 0, 97, 254, 0,
+    99, 254, 0,
+    101, 3, 1, 2, 25, 254, 2, 120, 254, 2, 120, 254, 2, 120, 254, 69, 45, 244,
+    46, 237,
+    47, 244, 59, 250, 60, 250, 66, 242, 80, 250, 98, 244, 102, 247, 112, 244,
+    115, 244,
+    118, 242, 120, 247, 122, 247, 193, 242, 194, 242, 195, 242, 196, 242, 197,
+    242,
+    198, 242, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225,
+    244,
+    226, 244, 227, 244, 228, 244, 229, 244, 230, 244, 233, 247, 234, 247, 235,
+    247,
+    236, 247, 243, 244, 244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250,
+    242,
+    251, 242, 252, 242, 253, 242, 254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244,
+    0, 4, 242,
+    0, 5, 244, 0, 6, 242, 0, 7, 244, 0, 21, 247, 0, 25, 247, 0, 27, 247, 0,
+    29, 247, 0, 78,
+    250, 0, 79, 244, 0, 82, 250, 0, 83, 244, 0, 87, 244, 0, 89, 244, 0, 109,
+    242, 0, 113,
+    242, 0, 115, 242, 0, 117, 242, 69, 45, 244, 46, 237, 47, 244, 59, 250, 60,
+    250, 66,
+    242, 80, 250, 98, 244, 102, 247, 112, 244, 115, 244, 118, 242, 120, 247,
+    122, 247,
+    193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211, 250, 212,
+    250,
+    213, 250, 214, 250, 215, 250, 217, 250, 225, 244, 226, 244, 227, 244, 228,
+    244,
+    229, 244, 230, 244, 233, 247, 234, 247, 235, 247, 236, 247, 243, 244, 244,
+    244,
+    245, 244, 246, 244, 247, 244, 249, 244, 250, 242, 251, 242, 252, 242, 253,
+    242,
+    254, 247, 0, 1, 247, 0, 2, 242, 0, 3, 244, 0, 4, 242, 0, 5, 244, 0, 6,
+    242, 0, 7, 244,
+    0, 21, 247, 0, 25, 247, 0, 27, 247, 0, 29, 247, 0, 78, 250, 0, 79, 244, 0,
+    82, 250, 0,
+    83, 244, 0, 87, 244, 0, 89, 244, 0, 109, 242, 0, 113, 242, 0, 115, 242, 0,
+    117, 242,
+    13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0,
+    6, 249,
+    13, 45, 252, 47, 252, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 13, 45, 252, 47, 252, 66, 249,
+    193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0,
+    6, 249,
+    61, 45, 240, 47, 240, 59, 249, 60, 249, 66, 239, 80, 245, 98, 242, 102,
+    244, 112,
+    240, 118, 240, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239,
+    211,
+    245, 212, 245, 213, 245, 214, 245, 215, 245, 217, 245, 225, 242, 226, 242,
+    227,
+    242, 228, 242, 229, 242, 230, 242, 233, 244, 234, 244, 235, 244, 236, 244,
+    243,
+    240, 244, 240, 245, 240, 246, 240, 247, 240, 249, 240, 250, 240, 251, 240,
+    252,
+    240, 253, 240, 0, 2, 239, 0, 3, 242, 0, 4, 239, 0, 5, 242, 0, 6, 239, 0,
+    7, 242, 0, 21,
+    244, 0, 25, 244, 0, 27, 244, 0, 29, 244, 0, 78, 245, 0, 79, 240, 0, 82,
+    245, 0, 83, 240,
+    0, 109, 240, 0, 113, 240, 0, 115, 240, 0, 117, 240, 10, 102, 2, 233, 2,
+    234, 2, 235,
+    2, 236, 2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 10, 102, 2, 233, 2,
+    234, 2, 235, 2, 236,
+    2, 0, 21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 10, 102, 2, 233, 2, 234, 2,
+    235, 2, 236, 2, 0,
+    21, 2, 0, 25, 2, 0, 27, 2, 0, 29, 2, 2, 120, 254, 2, 1, 32, 24, 249, 19,
+    33, 244, 101,
+    244, 109, 254, 115, 250, 116, 247, 119, 254, 0, 19, 244, 0, 60, 254, 0,
+    62, 254, 0,
+    68, 254, 0, 87, 250, 0, 89, 250, 0, 91, 250, 0, 93, 247, 0, 97, 247, 0,
+    99, 247, 1, 2,
+    25, 247, 1, 32, 25, 249, 2, 33, 244
 };
-static afm_cuint16 afm_Helvetica_BoldOblique_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Helvetica_BoldOblique_highchars_index[] = {  /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Helvetica_BoldOblique_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Helvetica_BoldOblique_ligatures[] = {   /* 3 */
+    102, 105, 64257
 };
 
 
@@ -1382,408 +2624,796 @@ static afm_cunicode afm_Helvetica_BoldOblique_ligatures[] = { /* 3 */
 /* FontName: Helvetica-Oblique */
 /* FullName: Helvetica Oblique */
 /* FamilyName: Helvetica */
-static afm_cuint8 afm_Helvetica_Oblique_widths[] = { /* 315 */
-  46,46,59,93,93,148,111,32,56,56,65,97,46,56,46,46,93,93,93,93,93,
-  93,93,93,93,93,46,46,97,97,97,93,169,111,111,120,120,111,102,130,
-  120,46,83,111,93,139,120,130,111,130,120,111,102,120,111,157,111,
-  111,102,46,46,46,78,93,56,93,93,83,93,93,46,93,93,37,37,83,37,139,
-  93,93,93,93,56,83,46,93,83,120,83,83,83,56,43,56,97,56,93,93,93,
-  93,43,93,56,123,62,93,97,123,56,67,97,56,56,56,93,90,46,56,56,61,
-  93,139,139,139,102,111,111,111,111,111,111,167,120,111,111,111,111,
-  46,46,46,46,120,120,130,130,130,130,130,97,130,120,120,120,120,111,
-  111,102,93,93,93,93,93,93,148,83,93,93,93,93,46,46,46,46,93,93,93,
-  93,93,93,93,97,102,93,93,93,93,83,93,83,111,93,111,93,111,93,120,
-  83,120,83,120,107,120,93,111,93,111,93,111,93,111,93,130,93,130,
-  93,46,46,46,37,46,46,111,83,93,37,93,37,93,50,93,37,120,93,120,93,
-  120,93,130,93,130,93,167,157,120,56,120,56,120,56,111,83,111,83,
-  111,83,102,46,102,53,120,93,120,93,120,93,120,93,111,102,83,102,
-  83,102,83,93,111,83,56,56,56,56,56,56,56,56,93,167,37,37,37,56,56,
-  56,93,93,58,167,167,56,56,28,93,167,79,102,100,97,76,92,92,92,79,
-  42,83,83
+static afm_cuint8 afm_Helvetica_Oblique_widths[] = {    /* 315 */
+    46, 46, 59, 93, 93, 148, 111, 32, 56, 56, 65, 97, 46, 56, 46, 46, 93, 93,
+    93, 93, 93,
+    93, 93, 93, 93, 93, 46, 46, 97, 97, 97, 93, 169, 111, 111, 120, 120, 111,
+    102, 130,
+    120, 46, 83, 111, 93, 139, 120, 130, 111, 130, 120, 111, 102, 120, 111,
+    157, 111,
+    111, 102, 46, 46, 46, 78, 93, 56, 93, 93, 83, 93, 93, 46, 93, 93, 37, 37,
+    83, 37, 139,
+    93, 93, 93, 93, 56, 83, 46, 93, 83, 120, 83, 83, 83, 56, 43, 56, 97, 56,
+    93, 93, 93,
+    93, 43, 93, 56, 123, 62, 93, 97, 123, 56, 67, 97, 56, 56, 56, 93, 90, 46,
+    56, 56, 61,
+    93, 139, 139, 139, 102, 111, 111, 111, 111, 111, 111, 167, 120, 111, 111,
+    111, 111,
+    46, 46, 46, 46, 120, 120, 130, 130, 130, 130, 130, 97, 130, 120, 120, 120,
+    120, 111,
+    111, 102, 93, 93, 93, 93, 93, 93, 148, 83, 93, 93, 93, 93, 46, 46, 46, 46,
+    93, 93, 93,
+    93, 93, 93, 93, 97, 102, 93, 93, 93, 93, 83, 93, 83, 111, 93, 111, 93,
+    111, 93, 120,
+    83, 120, 83, 120, 107, 120, 93, 111, 93, 111, 93, 111, 93, 111, 93, 130,
+    93, 130,
+    93, 46, 46, 46, 37, 46, 46, 111, 83, 93, 37, 93, 37, 93, 50, 93, 37, 120,
+    93, 120, 93,
+    120, 93, 130, 93, 130, 93, 167, 157, 120, 56, 120, 56, 120, 56, 111, 83,
+    111, 83,
+    111, 83, 102, 46, 102, 53, 120, 93, 120, 93, 120, 93, 120, 93, 111, 102,
+    83, 102,
+    83, 102, 83, 93, 111, 83, 56, 56, 56, 56, 56, 56, 56, 56, 93, 167, 37, 37,
+    37, 56, 56,
+    56, 93, 93, 58, 167, 167, 56, 56, 28, 93, 167, 79, 102, 100, 97, 76, 92,
+    92, 92, 79,
+    42, 83, 83
 };
 static afm_sint16 afm_Helvetica_Oblique_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,29,0,38,0,0,0,0,0,0,0,0,0,0,0,49,52,0,0,
-  0,0,0,55,170,197,202,0,241,0,0,0,345,418,510,0,0,545,594,687,710,
-  772,777,938,966,1115,0,1259,0,0,0,0,0,0,0,1407,1419,1468,0,1476,
-  1494,1575,1587,0,0,1595,0,1638,1668,1700,1718,0,1730,1847,0,0,1854,
-  1924,1994,2017,2087,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,2130,2245,2360,2475,2590,2705,0,2820,0,0,
-  0,0,0,0,0,0,0,0,2825,2874,2923,2972,3021,0,3070,3119,3147,3175,3203,
-  3231,0,0,3379,3391,3403,3415,3427,3439,0,3451,3459,3477,3495,3513,
-  0,0,0,0,0,3531,3563,3581,3599,3617,3635,0,3653,0,0,0,0,3882,0,3952,
-  4022,4137,4149,4264,4276,4391,4403,4408,4416,4421,4429,0,4468,0,
-  0,4507,0,4525,0,4543,0,4561,0,4579,0,4591,0,0,0,0,0,0,4603,4695,
-  4738,0,4773,0,4808,0,4843,0,0,4878,0,4910,0,4942,4974,5023,5041,
-  5090,0,0,5108,5170,5287,5349,5466,5528,5645,5650,5657,5662,5669,
-  5674,5681,0,5842,0,6003,0,6031,0,6059,0,6087,0,6115,0,6263,0,6306,
-  0,6349,0,6392,6397,0,0,0,0,0,0,0,0,0,0,6404,6409,0,0,6447,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 38, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 49, 52, 0, 0,
+    0, 0, 0, 55, 170, 197, 202, 0, 241, 0, 0, 0, 345, 418, 510, 0, 0, 545,
+    594, 687, 710,
+    772, 777, 938, 966, 1115, 0, 1259, 0, 0, 0, 0, 0, 0, 0, 1407, 1419, 1468,
+    0, 1476,
+    1494, 1575, 1587, 0, 0, 1595, 0, 1638, 1668, 1700, 1718, 0, 1730, 1847, 0,
+    0, 1854,
+    1924, 1994, 2017, 2087, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2130, 2245, 2360, 2475, 2590, 2705, 0,
+    2820, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 2825, 2874, 2923, 2972, 3021, 0, 3070, 3119, 3147,
+    3175, 3203,
+    3231, 0, 0, 3379, 3391, 3403, 3415, 3427, 3439, 0, 3451, 3459, 3477, 3495,
+    3513,
+    0, 0, 0, 0, 0, 3531, 3563, 3581, 3599, 3617, 3635, 0, 3653, 0, 0, 0, 0,
+    3882, 0, 3952,
+    4022, 4137, 4149, 4264, 4276, 4391, 4403, 4408, 4416, 4421, 4429, 0, 4468,
+    0,
+    0, 4507, 0, 4525, 0, 4543, 0, 4561, 0, 4579, 0, 4591, 0, 0, 0, 0, 0, 0,
+    4603, 4695,
+    4738, 0, 4773, 0, 4808, 0, 4843, 0, 0, 4878, 0, 4910, 0, 4942, 4974, 5023,
+    5041,
+    5090, 0, 0, 5108, 5170, 5287, 5349, 5466, 5528, 5645, 5650, 5657, 5662,
+    5669,
+    5674, 5681, 0, 5842, 0, 6003, 0, 6031, 0, 6059, 0, 6087, 0, 6115, 0, 6263,
+    0, 6306,
+    0, 6349, 0, 6392, 6397, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6404, 6409, 0, 0,
+    6447, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static afm_cuint8 afm_Helvetica_Oblique_kerning_data[] = { /* 6450 */
-  42,11,85,249,87,249,88,250,90,242,222,242,0,100,249,0,102,249,0,
-  122,242,1,32,24,247,1,32,28,252,3,1,32,25,240,1,32,29,240,4,33,247,
-  1,32,25,240,1,32,29,240,2,33,249,2,33,249,49,68,252,72,252,80,252,
-  82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,
-  122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,252,
-  218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,252,
-  253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,
-  252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,
-  113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,12,45,
-  254,47,254,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,
-  255,0,114,255,0,116,255,3,45,252,47,252,18,45,245,47,245,66,250,
-  87,245,88,250,90,242,193,250,194,250,195,250,196,250,197,250,198,
-  250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,45,45,232,47,232,66,
-  244,98,249,102,252,112,252,115,249,193,244,194,244,195,244,196,244,
-  197,244,198,244,225,249,226,249,227,249,228,249,229,249,230,249,
-  233,252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,
-  247,252,249,252,0,2,244,0,3,249,0,4,244,0,5,249,0,6,244,0,7,249,
-  0,21,252,0,25,252,0,27,252,0,29,252,0,79,252,0,83,252,0,87,249,0,
-  89,249,0,91,249,32,45,252,47,252,66,254,98,254,118,254,193,254,194,
-  254,195,254,196,254,197,254,198,254,225,254,226,254,227,254,228,
-  254,229,254,230,254,250,254,251,254,252,254,253,254,0,2,254,0,3,
-  254,0,4,254,0,5,254,0,6,254,0,7,254,0,109,254,0,113,254,0,115,254,
-  0,117,254,40,80,249,102,250,112,250,118,252,122,249,211,249,212,
-  249,213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,
-  250,243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,
-  252,252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,
-  29,250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,
-  115,252,0,117,252,14,85,239,87,239,88,245,90,234,122,252,222,234,
-  254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,
-  234,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
-  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
-  254,0,6,254,0,100,250,0,102,250,0,122,245,41,45,227,47,227,66,237,
-  98,250,102,249,112,249,193,237,194,237,195,237,196,237,197,237,198,
-  237,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
-  249,235,249,236,249,243,249,244,249,245,249,246,249,247,249,249,
-  249,0,2,237,0,3,250,0,4,237,0,5,250,0,6,237,0,7,250,0,21,249,0,25,
-  249,0,27,249,0,29,249,0,79,249,0,83,249,10,86,255,218,255,219,255,
-  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,254,
-  85,252,86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,
-  215,254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,
-  0,82,254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
-  250,0,122,249,3,45,254,47,254,70,45,237,46,234,47,237,59,254,60,
-  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
-  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
-  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
-  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
-  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
-  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
-  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
-  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
-  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,236,46,244,
-  47,236,59,250,60,250,66,244,72,250,80,250,98,245,102,244,112,244,
-  118,245,193,244,194,244,195,244,196,244,197,244,198,244,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,245,226,245,227,245,
-  228,245,229,245,230,245,233,244,234,244,235,244,236,244,243,244,
-  244,244,245,244,246,244,247,244,249,244,250,245,251,245,252,245,
-  253,245,0,2,244,0,3,245,0,4,244,0,5,245,0,6,244,0,7,245,0,21,244,
-  0,25,244,0,27,244,0,29,244,0,32,250,0,36,250,0,78,250,0,79,244,0,
-  82,250,0,83,244,0,109,245,0,113,245,0,115,245,0,117,245,63,45,244,
-  46,250,47,244,66,249,80,254,98,250,102,252,112,252,118,252,122,254,
-  193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,254,
-  213,254,214,254,215,254,217,254,225,250,226,250,227,250,228,250,
-  229,250,230,250,233,252,234,252,235,252,236,252,243,252,244,252,
-  245,252,246,252,247,252,249,252,250,252,251,252,252,252,253,252,
-  254,254,0,1,254,0,2,249,0,3,250,0,4,249,0,5,250,0,6,249,0,7,250,
-  0,21,252,0,25,252,0,27,252,0,29,252,0,78,254,0,79,252,0,82,254,0,
-  83,252,0,109,252,0,113,252,0,115,252,0,117,252,65,45,234,46,234,
-  47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,112,234,
-  118,239,193,239,194,239,195,239,196,239,197,239,198,239,211,243,
-  212,243,213,243,214,243,215,243,217,243,225,234,226,234,227,234,
-  228,234,229,234,230,234,233,234,234,234,235,234,236,234,238,254,
-  243,234,244,234,245,234,246,234,247,234,249,234,250,239,251,239,
-  252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,0,7,234,
-  0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,79,234,0,
-  82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,6,119,254,
-  120,254,122,252,254,252,0,1,252,21,45,250,47,250,99,255,109,254,
-  118,254,119,254,122,254,250,254,251,254,252,254,253,254,254,254,
-  0,1,254,0,60,254,0,62,254,0,68,254,0,109,254,0,113,254,0,115,254,
-  0,117,254,4,45,254,108,254,0,57,254,9,45,254,47,254,119,252,120,
-  254,121,252,122,254,254,254,0,1,254,34,45,252,47,252,98,252,102,
-  252,112,252,225,252,226,252,227,252,228,252,229,252,230,252,233,
-  252,234,252,235,252,236,252,243,252,244,252,245,252,246,252,247,
-  252,249,252,0,3,252,0,5,252,0,7,252,0,21,252,0,25,252,0,27,252,0,
-  29,252,0,51,252,0,79,252,0,83,252,1,32,25,8,1,32,29,10,5,115,255,
-  0,87,255,0,89,255,0,91,255,4,122,252,254,252,0,1,252,19,102,254,
-  112,254,233,254,234,254,235,254,236,254,243,254,244,254,245,254,
-  246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,
-  254,0,83,254,13,118,255,122,254,250,255,251,255,252,255,253,255,
-  254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,14,118,255,
-  119,254,122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,
-  0,109,255,0,113,255,0,115,255,0,117,255,9,45,250,47,250,119,254,
-  120,254,121,252,122,252,254,252,0,1,252,6,45,251,47,251,122,252,
-  254,252,0,1,252,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,
-  3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,
-  255,228,255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,
-  251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,
-  3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,
-  3,0,113,3,0,115,3,0,117,3,4,45,254,47,254,120,252,31,45,244,47,244,
-  98,253,102,253,112,253,225,253,226,253,227,253,228,253,229,253,230,
-  253,233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,
-  253,247,253,249,253,0,3,253,0,5,253,0,7,253,0,21,253,0,25,253,0,
-  27,253,0,29,253,0,79,253,0,83,253,31,45,247,47,247,98,254,102,255,
-  112,255,225,254,226,254,227,254,228,254,229,254,230,254,233,255,
-  234,255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,
-  249,255,0,3,254,0,5,254,0,7,254,0,21,255,0,25,255,0,27,255,0,29,
-  255,0,79,255,0,83,255,10,102,252,233,252,234,252,235,252,236,252,
-  0,21,252,0,25,252,0,27,252,0,29,252,31,45,240,47,240,98,254,102,
-  254,112,254,225,254,226,254,227,254,228,254,229,254,230,254,233,
-  254,234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,
-  254,249,254,0,3,254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,
-  29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,234,254,235,
-  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,
-  254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,68,252,72,252,
-  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
-  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
-  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
-  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
-  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
-  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
-  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
-  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
-  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
-  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,240,49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,
-  88,249,90,240,118,252,119,250,120,250,122,250,200,252,211,252,212,
-  252,213,252,214,252,215,252,217,252,218,249,219,249,220,249,221,
-  249,222,240,250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,
-  252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,
-  237,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,
-  0,116,249,0,117,252,0,122,240,49,68,252,72,252,80,252,82,252,85,
-  237,86,249,87,245,88,249,90,240,118,252,119,250,120,250,122,250,
-  200,252,211,252,212,252,213,252,214,252,215,252,217,252,218,249,
-  219,249,220,249,221,249,222,240,250,252,251,252,252,252,253,252,
-  254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,78,252,0,82,
-  252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,0,113,252,
-  0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,49,68,252,72,252,
-  80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,
-  120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,
-  217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,
-  252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,
-  0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,
-  249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,
-  49,68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,
-  118,252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,
-  214,252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,
-  250,252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,
-  0,32,252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,
-  0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,
-  252,0,122,240,3,45,252,47,252,22,45,250,47,250,66,254,85,250,87,
-  249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,
-  198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,
-  245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,
-  254,194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,
-  254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,250,66,254,
-  85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,
-  197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,
-  250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,
-  90,245,193,254,194,254,195,254,196,254,197,254,198,254,222,245,0,
-  2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,22,45,250,47,
-  250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,194,254,195,
-  254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,
-  250,0,102,250,0,122,245,22,45,250,47,250,66,254,85,250,87,249,88,
-  252,89,247,90,245,193,254,194,254,195,254,196,254,197,254,198,254,
-  222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,0,122,245,13,
-  45,250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,
-  250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,
-  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,
-  250,47,250,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
-  0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,
-  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,234,
-  46,234,47,234,59,247,60,247,66,239,80,243,98,234,102,234,106,254,
-  112,234,118,239,193,239,194,239,195,239,196,239,197,239,198,239,
-  211,243,212,243,213,243,214,243,215,243,217,243,225,234,226,234,
-  227,234,228,245,229,234,230,234,233,234,234,234,235,234,236,234,
-  238,254,243,234,244,234,245,234,246,234,247,234,249,234,250,239,
-  251,239,252,239,253,239,0,2,239,0,3,245,0,4,239,0,5,245,0,6,239,
-  0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,0,49,254,0,78,243,0,
-  79,245,0,82,243,0,83,234,0,109,239,0,113,239,0,115,239,0,117,239,
-  6,119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,
-  252,254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,6,
-  119,254,120,254,122,252,254,252,0,1,252,6,119,254,120,254,122,252,
-  254,252,0,1,252,6,119,254,120,254,122,252,254,252,0,1,252,4,45,254,
-  108,254,0,57,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,9,45,254,47,254,119,252,120,254,121,252,122,254,
-  254,254,0,1,254,14,118,255,119,254,122,254,250,255,251,255,252,255,
-  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,0,1,252,
-  95,45,241,47,241,98,248,99,248,100,248,101,248,102,248,103,248,104,
-  248,105,248,106,248,107,248,108,248,109,248,110,248,111,248,112,
-  248,113,248,114,248,115,248,116,248,117,248,118,248,119,245,120,
-  245,121,243,122,245,123,248,225,248,226,248,227,248,228,248,229,
-  248,230,248,232,248,233,248,234,248,235,248,236,248,237,248,238,
-  248,239,248,240,248,242,248,243,248,244,248,245,248,246,248,247,
-  248,249,248,250,248,251,248,252,248,253,248,254,245,0,1,245,0,3,
-  248,0,5,248,0,7,248,0,9,248,0,15,248,0,19,248,0,21,248,0,25,248,
-  0,27,248,0,29,248,0,33,248,0,37,248,0,45,248,0,49,248,0,57,248,0,
-  60,248,0,62,248,0,68,248,0,70,248,0,72,248,0,74,248,0,79,248,0,83,
-  248,0,87,248,0,89,248,0,91,248,0,93,248,0,97,248,0,99,248,0,101,
-  248,0,109,248,0,113,248,0,115,248,0,117,248,0,124,248,0,126,248,
-  0,128,248,1,2,25,248,31,45,240,47,240,98,254,102,254,112,254,225,
-  254,226,254,227,254,228,254,229,254,230,254,233,254,234,254,235,
-  254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,0,3,
-  254,0,5,254,0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,
-  0,83,254,31,45,240,47,240,98,254,102,254,112,254,225,254,226,254,
-  227,254,228,254,229,254,230,254,233,254,234,254,235,254,236,254,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,3,254,0,5,254,
-  0,7,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,49,
-  68,252,72,252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,
-  252,119,250,120,250,122,250,200,252,211,252,212,252,213,252,214,
-  252,215,252,217,252,218,249,219,249,220,249,221,249,222,240,250,
-  252,251,252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,
-  252,0,36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,
-  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
-  0,122,240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,
-  252,80,252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,
-  250,120,250,122,250,200,252,211,252,212,252,213,252,214,252,215,
-  252,217,252,218,249,219,249,220,249,221,249,222,240,250,252,251,
-  252,252,252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,
-  36,252,0,78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,
-  0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,
-  240,6,119,254,120,254,122,252,254,252,0,1,252,49,68,252,72,252,80,
-  252,82,252,85,237,86,249,87,245,88,249,90,240,118,252,119,250,120,
-  250,122,250,200,252,211,252,212,252,213,252,214,252,215,252,217,
-  252,218,249,219,249,220,249,221,249,222,240,250,252,251,252,252,
-  252,253,252,254,250,0,1,250,0,8,252,0,14,252,0,32,252,0,36,252,0,
-  78,252,0,82,252,0,100,237,0,102,237,0,108,249,0,109,252,0,112,249,
-  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,240,6,119,
-  254,120,254,122,252,254,252,0,1,252,3,45,252,47,252,4,45,254,108,
-  254,0,57,254,3,45,252,47,252,4,45,254,108,254,0,57,254,18,45,245,
-  47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,250,
-  197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,18,45,
-  245,47,245,66,250,87,245,88,250,90,242,193,250,194,250,195,250,196,
-  250,197,250,198,250,222,242,0,2,250,0,4,250,0,6,250,0,122,242,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,9,
-  45,254,47,254,119,252,120,254,121,252,122,254,254,254,0,1,254,5,
-  115,255,0,87,255,0,89,255,0,91,255,5,115,255,0,87,255,0,89,255,0,
-  91,255,40,80,249,102,250,112,250,118,252,122,249,211,249,212,249,
-  213,249,214,249,215,249,217,249,233,250,234,250,235,250,236,250,
-  243,250,244,250,245,250,246,250,247,250,249,250,250,252,251,252,
-  252,252,253,252,254,249,0,1,249,0,21,250,0,25,250,0,27,250,0,29,
-  250,0,78,249,0,79,250,0,82,249,0,83,250,0,109,252,0,113,252,0,115,
-  252,0,117,252,19,102,254,112,254,233,254,234,254,235,254,236,254,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,254,
-  0,27,254,0,29,254,0,79,254,0,83,254,14,85,239,87,239,88,245,90,234,
-  122,252,222,234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,
-  32,25,230,1,32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,
-  234,254,252,0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,
-  32,29,234,14,85,239,87,239,88,245,90,234,122,252,222,234,254,252,
-  0,1,252,0,100,239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,
-  85,239,87,239,88,245,90,234,122,252,222,234,254,252,0,1,252,0,100,
-  239,0,102,239,0,122,234,1,32,25,230,1,32,29,234,14,118,255,119,254,
-  122,254,250,255,251,255,252,255,253,255,254,254,0,1,254,0,109,255,
-  0,113,255,0,115,255,0,117,255,14,118,255,119,254,122,254,250,255,
-  251,255,252,255,253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,
-  255,0,117,255,14,118,255,119,254,122,254,250,255,251,255,252,255,
-  253,255,254,254,0,1,254,0,109,255,0,113,255,0,115,255,0,117,255,
-  22,45,250,47,250,66,254,85,250,87,249,88,252,89,247,90,245,193,254,
-  194,254,195,254,196,254,197,254,198,254,222,245,0,2,254,0,4,254,
-  0,6,254,0,100,250,0,102,250,0,122,245,9,45,250,47,250,119,254,120,
-  254,121,252,122,252,254,252,0,1,252,22,45,250,47,250,66,254,85,250,
-  87,249,88,252,89,247,90,245,193,254,194,254,195,254,196,254,197,
-  254,198,254,222,245,0,2,254,0,4,254,0,6,254,0,100,250,0,102,250,
-  0,122,245,9,45,250,47,250,119,254,120,254,121,252,122,252,254,252,
-  0,1,252,27,80,254,85,252,86,250,87,249,88,252,90,249,211,254,212,
-  254,213,254,214,254,215,254,217,254,218,250,219,250,220,250,221,
-  250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,250,0,112,
-  250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,5,60,5,98,
-  255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,5,122,5,
-  225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,3,239,
-  3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,0,5,255,
-  0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,
-  0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,27,80,254,85,252,
-  86,250,87,249,88,252,90,249,211,254,212,254,213,254,214,254,215,
-  254,217,254,218,250,219,250,220,250,221,250,222,249,0,78,254,0,82,
-  254,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,
-  0,122,249,50,45,249,47,249,59,5,60,5,98,255,106,3,108,3,109,3,110,
-  4,111,4,113,5,117,7,118,3,119,5,122,5,225,255,226,255,227,255,228,
-  255,229,255,230,255,237,3,238,3,239,3,240,3,242,4,250,3,251,3,252,
-  3,253,3,254,5,0,1,5,0,3,255,0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,
-  0,60,3,0,62,3,0,68,3,0,70,4,0,72,4,0,74,4,0,101,7,0,109,3,0,113,
-  3,0,115,3,0,117,3,27,80,254,85,252,86,250,87,249,88,252,90,249,211,
-  254,212,254,213,254,214,254,215,254,217,254,218,250,219,250,220,
-  250,221,250,222,249,0,78,254,0,82,254,0,100,252,0,102,252,0,108,
-  250,0,112,250,0,114,250,0,116,250,0,122,249,50,45,249,47,249,59,
-  5,60,5,98,255,106,3,108,3,109,3,110,4,111,4,113,5,117,7,118,3,119,
-  5,122,5,225,255,226,255,227,255,228,255,229,255,230,255,237,3,238,
-  3,239,3,240,3,242,4,250,3,251,3,252,3,253,3,254,5,0,1,5,0,3,255,
-  0,5,255,0,7,255,0,45,3,0,49,3,0,57,3,0,60,3,0,62,3,0,68,3,0,70,4,
-  0,72,4,0,74,4,0,101,7,0,109,3,0,113,3,0,115,3,0,117,3,3,45,254,47,
-  254,4,45,254,47,254,120,252,3,45,254,47,254,4,45,254,47,254,120,
-  252,3,45,254,47,254,4,45,254,47,254,120,252,70,45,237,46,234,47,
-  237,59,254,60,254,66,237,80,250,98,237,102,237,112,237,115,237,118,
-  237,120,237,122,237,193,237,194,237,195,237,196,237,197,237,198,
-  237,211,250,212,250,213,250,214,250,215,250,217,250,225,237,226,
-  237,227,237,228,247,229,237,230,237,233,247,234,237,235,237,236,
-  237,243,237,244,237,245,237,246,247,247,237,249,237,250,237,251,
-  237,252,237,253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,
-  247,0,6,237,0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,
-  0,79,247,0,82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,
-  0,113,237,0,115,237,0,117,237,70,45,237,46,234,47,237,59,254,60,
-  254,66,237,80,250,98,237,102,237,112,237,115,237,118,237,120,237,
-  122,237,193,237,194,237,195,237,196,237,197,237,198,237,211,250,
-  212,250,213,250,214,250,215,250,217,250,225,237,226,237,227,237,
-  228,247,229,237,230,237,233,247,234,237,235,237,236,237,243,237,
-  244,237,245,237,246,247,247,237,249,237,250,237,251,237,252,237,
-  253,237,254,237,0,1,247,0,2,237,0,3,247,0,4,237,0,5,247,0,6,237,
-  0,7,237,0,21,247,0,25,237,0,27,237,0,29,237,0,78,250,0,79,247,0,
-  82,250,0,83,237,0,87,237,0,89,237,0,91,237,0,109,247,0,113,237,0,
-  115,237,0,117,237,13,45,250,47,250,66,250,193,250,194,250,195,250,
-  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,
-  66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,
-  4,250,0,6,250,13,45,250,47,250,66,250,193,250,194,250,195,250,196,
-  250,197,250,198,250,0,2,250,0,4,250,0,6,250,13,45,250,47,250,66,
-  250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,
-  250,0,6,250,65,45,234,46,234,47,234,59,247,60,247,66,239,80,243,
-  98,234,102,234,106,254,112,234,118,239,193,239,194,239,195,239,196,
-  239,197,239,198,239,211,243,212,243,213,243,214,243,215,243,217,
-  243,225,234,226,234,227,234,228,245,229,234,230,234,233,234,234,
-  234,235,234,236,234,238,254,243,234,244,234,245,234,246,234,247,
-  234,249,234,250,239,251,239,252,239,253,239,0,2,239,0,3,245,0,4,
-  239,0,5,245,0,6,239,0,7,234,0,21,245,0,25,234,0,27,234,0,29,234,
-  0,49,254,0,78,243,0,79,234,0,82,243,0,83,234,0,109,239,0,113,239,
-  0,115,239,0,117,239,19,102,254,112,254,233,254,234,254,235,254,236,
-  254,243,254,244,254,245,254,246,254,247,254,249,254,0,21,254,0,25,
-  254,0,27,254,0,29,254,0,79,254,0,83,254,19,102,254,112,254,233,254,
-  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
-  249,254,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,19,
-  102,254,112,254,233,254,234,254,235,254,236,254,243,254,244,254,
-  245,254,246,254,247,254,249,254,0,21,254,0,25,254,0,27,254,0,29,
-  254,0,79,254,0,83,254,3,45,254,47,254,4,45,254,47,254,120,252,2,
-  1,32,24,247,14,33,245,101,249,115,249,116,249,0,19,249,0,87,249,
-  0,89,249,0,91,249,0,93,249,0,97,249,0,99,249,1,2,25,249,1,32,25,
-  247,2,33,250
+static afm_cuint8 afm_Helvetica_Oblique_kerning_data[] = {  /* 6450 */
+    42, 11, 85, 249, 87, 249, 88, 250, 90, 242, 222, 242, 0, 100, 249, 0, 102,
+    249, 0,
+    122, 242, 1, 32, 24, 247, 1, 32, 28, 252, 3, 1, 32, 25, 240, 1, 32, 29,
+    240, 4, 33, 247,
+    1, 32, 25, 240, 1, 32, 29, 240, 2, 33, 249, 2, 33, 249, 49, 68, 252, 72,
+    252, 80, 252,
+    82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119, 250,
+    120, 250,
+    122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217,
+    252,
+    218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252, 252,
+    252,
+    253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0, 36,
+    252, 0, 78,
+    252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252, 0,
+    112, 249, 0,
+    113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 240,
+    12, 45,
+    254, 47, 254, 86, 255, 218, 255, 219, 255, 220, 255, 221, 255, 0, 108,
+    255, 0, 112,
+    255, 0, 114, 255, 0, 116, 255, 3, 45, 252, 47, 252, 18, 45, 245, 47, 245,
+    66, 250,
+    87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195, 250, 196, 250, 197,
+    250, 198,
+    250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 242, 45, 45, 232,
+    47, 232, 66,
+    244, 98, 249, 102, 252, 112, 252, 115, 249, 193, 244, 194, 244, 195, 244,
+    196, 244,
+    197, 244, 198, 244, 225, 249, 226, 249, 227, 249, 228, 249, 229, 249, 230,
+    249,
+    233, 252, 234, 252, 235, 252, 236, 252, 243, 252, 244, 252, 245, 252, 246,
+    252,
+    247, 252, 249, 252, 0, 2, 244, 0, 3, 249, 0, 4, 244, 0, 5, 249, 0, 6, 244,
+    0, 7, 249,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 79, 252, 0, 83, 252, 0,
+    87, 249, 0,
+    89, 249, 0, 91, 249, 32, 45, 252, 47, 252, 66, 254, 98, 254, 118, 254,
+    193, 254, 194,
+    254, 195, 254, 196, 254, 197, 254, 198, 254, 225, 254, 226, 254, 227, 254,
+    228,
+    254, 229, 254, 230, 254, 250, 254, 251, 254, 252, 254, 253, 254, 0, 2,
+    254, 0, 3,
+    254, 0, 4, 254, 0, 5, 254, 0, 6, 254, 0, 7, 254, 0, 109, 254, 0, 113, 254,
+    0, 115, 254,
+    0, 117, 254, 40, 80, 249, 102, 250, 112, 250, 118, 252, 122, 249, 211,
+    249, 212,
+    249, 213, 249, 214, 249, 215, 249, 217, 249, 233, 250, 234, 250, 235, 250,
+    236,
+    250, 243, 250, 244, 250, 245, 250, 246, 250, 247, 250, 249, 250, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 249, 0, 1, 249, 0, 21, 250, 0, 25, 250, 0,
+    27, 250, 0,
+    29, 250, 0, 78, 249, 0, 79, 250, 0, 82, 249, 0, 83, 250, 0, 109, 252, 0,
+    113, 252, 0,
+    115, 252, 0, 117, 252, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122, 252,
+    222, 234,
+    254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32, 25,
+    230, 1, 32, 29,
+    234, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247,
+    90, 245, 193,
+    254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2,
+    254, 0, 4,
+    254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 41, 45, 227, 47,
+    227, 66, 237,
+    98, 250, 102, 249, 112, 249, 193, 237, 194, 237, 195, 237, 196, 237, 197,
+    237, 198,
+    237, 225, 250, 226, 250, 227, 250, 228, 250, 229, 250, 230, 250, 233, 249,
+    234,
+    249, 235, 249, 236, 249, 243, 249, 244, 249, 245, 249, 246, 249, 247, 249,
+    249,
+    249, 0, 2, 237, 0, 3, 250, 0, 4, 237, 0, 5, 250, 0, 6, 237, 0, 7, 250, 0,
+    21, 249, 0, 25,
+    249, 0, 27, 249, 0, 29, 249, 0, 79, 249, 0, 83, 249, 10, 86, 255, 218,
+    255, 219, 255,
+    220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255, 0, 116, 255,
+    27, 80, 254,
+    85, 252, 86, 250, 87, 249, 88, 252, 90, 249, 211, 254, 212, 254, 213, 254,
+    214, 254,
+    215, 254, 217, 254, 218, 250, 219, 250, 220, 250, 221, 250, 222, 249, 0,
+    78, 254,
+    0, 82, 254, 0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114,
+    250, 0, 116,
+    250, 0, 122, 249, 3, 45, 254, 47, 254, 70, 45, 237, 46, 234, 47, 237, 59,
+    254, 60,
+    254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115, 237, 118, 237,
+    120, 237,
+    122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237, 226, 237, 227,
+    237,
+    228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237, 236, 237, 243,
+    237,
+    244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237, 251, 237, 252,
+    237,
+    253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 247,
+    0, 6, 237,
+    0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237, 0, 78, 250, 0,
+    79, 247, 0,
+    82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0, 109, 247, 0,
+    113, 237, 0,
+    115, 237, 0, 117, 237, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250,
+    195, 250,
+    196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 65, 45,
+    236, 46, 244,
+    47, 236, 59, 250, 60, 250, 66, 244, 72, 250, 80, 250, 98, 245, 102, 244,
+    112, 244,
+    118, 245, 193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 245, 226, 245, 227,
+    245,
+    228, 245, 229, 245, 230, 245, 233, 244, 234, 244, 235, 244, 236, 244, 243,
+    244,
+    244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250, 245, 251, 245, 252,
+    245,
+    253, 245, 0, 2, 244, 0, 3, 245, 0, 4, 244, 0, 5, 245, 0, 6, 244, 0, 7,
+    245, 0, 21, 244,
+    0, 25, 244, 0, 27, 244, 0, 29, 244, 0, 32, 250, 0, 36, 250, 0, 78, 250, 0,
+    79, 244, 0,
+    82, 250, 0, 83, 244, 0, 109, 245, 0, 113, 245, 0, 115, 245, 0, 117, 245,
+    63, 45, 244,
+    46, 250, 47, 244, 66, 249, 80, 254, 98, 250, 102, 252, 112, 252, 118, 252,
+    122, 254,
+    193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 211, 254, 212,
+    254,
+    213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226, 250, 227, 250, 228,
+    250,
+    229, 250, 230, 250, 233, 252, 234, 252, 235, 252, 236, 252, 243, 252, 244,
+    252,
+    245, 252, 246, 252, 247, 252, 249, 252, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 254, 0, 1, 254, 0, 2, 249, 0, 3, 250, 0, 4, 249, 0, 5, 250, 0, 6,
+    249, 0, 7, 250,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 78, 254, 0, 79, 252, 0,
+    82, 254, 0,
+    83, 252, 0, 109, 252, 0, 113, 252, 0, 115, 252, 0, 117, 252, 65, 45, 234,
+    46, 234,
+    47, 234, 59, 247, 60, 247, 66, 239, 80, 243, 98, 234, 102, 234, 106, 254,
+    112, 234,
+    118, 239, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211,
+    243,
+    212, 243, 213, 243, 214, 243, 215, 243, 217, 243, 225, 234, 226, 234, 227,
+    234,
+    228, 234, 229, 234, 230, 234, 233, 234, 234, 234, 235, 234, 236, 234, 238,
+    254,
+    243, 234, 244, 234, 245, 234, 246, 234, 247, 234, 249, 234, 250, 239, 251,
+    239,
+    252, 239, 253, 239, 0, 2, 239, 0, 3, 245, 0, 4, 239, 0, 5, 245, 0, 6, 239,
+    0, 7, 234,
+    0, 21, 245, 0, 25, 234, 0, 27, 234, 0, 29, 234, 0, 49, 254, 0, 78, 243, 0,
+    79, 234, 0,
+    82, 243, 0, 83, 234, 0, 109, 239, 0, 113, 239, 0, 115, 239, 0, 117, 239,
+    6, 119, 254,
+    120, 254, 122, 252, 254, 252, 0, 1, 252, 21, 45, 250, 47, 250, 99, 255,
+    109, 254,
+    118, 254, 119, 254, 122, 254, 250, 254, 251, 254, 252, 254, 253, 254, 254,
+    254,
+    0, 1, 254, 0, 60, 254, 0, 62, 254, 0, 68, 254, 0, 109, 254, 0, 113, 254,
+    0, 115, 254,
+    0, 117, 254, 4, 45, 254, 108, 254, 0, 57, 254, 9, 45, 254, 47, 254, 119,
+    252, 120,
+    254, 121, 252, 122, 254, 254, 254, 0, 1, 254, 34, 45, 252, 47, 252, 98,
+    252, 102,
+    252, 112, 252, 225, 252, 226, 252, 227, 252, 228, 252, 229, 252, 230, 252,
+    233,
+    252, 234, 252, 235, 252, 236, 252, 243, 252, 244, 252, 245, 252, 246, 252,
+    247,
+    252, 249, 252, 0, 3, 252, 0, 5, 252, 0, 7, 252, 0, 21, 252, 0, 25, 252, 0,
+    27, 252, 0,
+    29, 252, 0, 51, 252, 0, 79, 252, 0, 83, 252, 1, 32, 25, 8, 1, 32, 29, 10,
+    5, 115, 255,
+    0, 87, 255, 0, 89, 255, 0, 91, 255, 4, 122, 252, 254, 252, 0, 1, 252, 19,
+    102, 254,
+    112, 254, 233, 254, 234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245,
+    254,
+    246, 254, 247, 254, 249, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29,
+    254, 0, 79,
+    254, 0, 83, 254, 13, 118, 255, 122, 254, 250, 255, 251, 255, 252, 255,
+    253, 255,
+    254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255,
+    14, 118, 255,
+    119, 254, 122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0,
+    1, 254,
+    0, 109, 255, 0, 113, 255, 0, 115, 255, 0, 117, 255, 9, 45, 250, 47, 250,
+    119, 254,
+    120, 254, 121, 252, 122, 252, 254, 252, 0, 1, 252, 6, 45, 251, 47, 251,
+    122, 252,
+    254, 252, 0, 1, 252, 50, 45, 249, 47, 249, 59, 5, 60, 5, 98, 255, 106, 3,
+    108, 3, 109,
+    3, 110, 4, 111, 4, 113, 5, 117, 7, 118, 3, 119, 5, 122, 5, 225, 255, 226,
+    255, 227,
+    255, 228, 255, 229, 255, 230, 255, 237, 3, 238, 3, 239, 3, 240, 3, 242, 4,
+    250, 3,
+    251, 3, 252, 3, 253, 3, 254, 5, 0, 1, 5, 0, 3, 255, 0, 5, 255, 0, 7, 255,
+    0, 45, 3, 0, 49,
+    3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0, 68, 3, 0, 70, 4, 0, 72, 4, 0, 74, 4,
+    0, 101, 7, 0, 109,
+    3, 0, 113, 3, 0, 115, 3, 0, 117, 3, 4, 45, 254, 47, 254, 120, 252, 31, 45,
+    244, 47, 244,
+    98, 253, 102, 253, 112, 253, 225, 253, 226, 253, 227, 253, 228, 253, 229,
+    253, 230,
+    253, 233, 253, 234, 253, 235, 253, 236, 253, 243, 253, 244, 253, 245, 253,
+    246,
+    253, 247, 253, 249, 253, 0, 3, 253, 0, 5, 253, 0, 7, 253, 0, 21, 253, 0,
+    25, 253, 0,
+    27, 253, 0, 29, 253, 0, 79, 253, 0, 83, 253, 31, 45, 247, 47, 247, 98,
+    254, 102, 255,
+    112, 255, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254, 233,
+    255,
+    234, 255, 235, 255, 236, 255, 243, 255, 244, 255, 245, 255, 246, 255, 247,
+    255,
+    249, 255, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 21, 255, 0, 25, 255, 0, 27,
+    255, 0, 29,
+    255, 0, 79, 255, 0, 83, 255, 10, 102, 252, 233, 252, 234, 252, 235, 252,
+    236, 252,
+    0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 31, 45, 240, 47, 240, 98,
+    254, 102,
+    254, 112, 254, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254,
+    233,
+    254, 234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254,
+    247,
+    254, 249, 254, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 21, 254, 0, 25, 254, 0,
+    27, 254, 0,
+    29, 254, 0, 79, 254, 0, 83, 254, 19, 102, 254, 112, 254, 233, 254, 234,
+    254, 235,
+    254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254,
+    0, 21,
+    254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 49, 68,
+    252, 72, 252,
+    80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252,
+    119, 250,
+    120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215,
+    252,
+    217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32,
+    252, 0, 36, 252,
+    0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 240,
+    49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88,
+    249, 90, 240,
+    118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213,
+    252,
+    214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    240,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0,
+    14, 252,
+    0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 240, 49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86,
+    249, 87, 245,
+    88, 249, 90, 240, 118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211,
+    252, 212,
+    252, 213, 252, 214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 240, 250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1,
+    250, 0, 8,
+    252, 0, 14, 252, 0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100,
+    237, 0, 102,
+    237, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0,
+    115, 252,
+    0, 116, 249, 0, 117, 252, 0, 122, 240, 49, 68, 252, 72, 252, 80, 252, 82,
+    252, 85,
+    237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119, 250, 120, 250,
+    122, 250,
+    200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0, 36, 252, 0, 78,
+    252, 0, 82,
+    252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0,
+    113, 252,
+    0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 240, 49, 68,
+    252, 72, 252,
+    80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252,
+    119, 250,
+    120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215,
+    252,
+    217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32,
+    252, 0, 36, 252,
+    0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109,
+    252, 0, 112,
+    249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0,
+    122, 240,
+    49, 68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88,
+    249, 90, 240,
+    118, 252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213,
+    252,
+    214, 252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222,
+    240,
+    250, 252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0,
+    14, 252,
+    0, 32, 252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237,
+    0, 108, 249,
+    0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116,
+    249, 0, 117,
+    252, 0, 122, 240, 3, 45, 252, 47, 252, 22, 45, 250, 47, 250, 66, 254, 85,
+    250, 87,
+    249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196, 254,
+    197, 254,
+    198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102,
+    250, 0, 122,
+    245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247,
+    90, 245, 193,
+    254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2,
+    254, 0, 4,
+    254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47,
+    250, 66, 254,
+    85, 250, 87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254,
+    196, 254,
+    197, 254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88,
+    252, 89, 247,
+    90, 245, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222,
+    245, 0,
+    2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 22,
+    45, 250, 47,
+    250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194,
+    254, 195,
+    254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6,
+    254, 0, 100,
+    250, 0, 102, 250, 0, 122, 245, 22, 45, 250, 47, 250, 66, 254, 85, 250, 87,
+    249, 88,
+    252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254,
+    198, 254,
+    222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0, 102, 250, 0,
+    122, 245, 13,
+    45, 250, 47, 250, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197,
+    250, 198,
+    250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193,
+    250, 194,
+    250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6,
+    250, 13, 45,
+    250, 47, 250, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250,
+    198, 250,
+    0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193, 250,
+    194, 250,
+    195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250,
+    65, 45, 234,
+    46, 234, 47, 234, 59, 247, 60, 247, 66, 239, 80, 243, 98, 234, 102, 234,
+    106, 254,
+    112, 234, 118, 239, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198,
+    239,
+    211, 243, 212, 243, 213, 243, 214, 243, 215, 243, 217, 243, 225, 234, 226,
+    234,
+    227, 234, 228, 245, 229, 234, 230, 234, 233, 234, 234, 234, 235, 234, 236,
+    234,
+    238, 254, 243, 234, 244, 234, 245, 234, 246, 234, 247, 234, 249, 234, 250,
+    239,
+    251, 239, 252, 239, 253, 239, 0, 2, 239, 0, 3, 245, 0, 4, 239, 0, 5, 245,
+    0, 6, 239,
+    0, 7, 234, 0, 21, 245, 0, 25, 234, 0, 27, 234, 0, 29, 234, 0, 49, 254, 0,
+    78, 243, 0,
+    79, 245, 0, 82, 243, 0, 83, 234, 0, 109, 239, 0, 113, 239, 0, 115, 239, 0,
+    117, 239,
+    6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 6, 119, 254, 120,
+    254, 122,
+    252, 254, 252, 0, 1, 252, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1,
+    252, 6,
+    119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 6, 119, 254, 120, 254,
+    122, 252,
+    254, 252, 0, 1, 252, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252,
+    4, 45, 254,
+    108, 254, 0, 57, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 9, 45, 254, 47, 254, 119, 252, 120, 254, 121, 252,
+    122, 254,
+    254, 254, 0, 1, 254, 14, 118, 255, 119, 254, 122, 254, 250, 255, 251, 255,
+    252, 255,
+    253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0,
+    117, 255,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252, 254, 252, 0,
+    1, 252,
+    95, 45, 241, 47, 241, 98, 248, 99, 248, 100, 248, 101, 248, 102, 248, 103,
+    248, 104,
+    248, 105, 248, 106, 248, 107, 248, 108, 248, 109, 248, 110, 248, 111, 248,
+    112,
+    248, 113, 248, 114, 248, 115, 248, 116, 248, 117, 248, 118, 248, 119, 245,
+    120,
+    245, 121, 243, 122, 245, 123, 248, 225, 248, 226, 248, 227, 248, 228, 248,
+    229,
+    248, 230, 248, 232, 248, 233, 248, 234, 248, 235, 248, 236, 248, 237, 248,
+    238,
+    248, 239, 248, 240, 248, 242, 248, 243, 248, 244, 248, 245, 248, 246, 248,
+    247,
+    248, 249, 248, 250, 248, 251, 248, 252, 248, 253, 248, 254, 245, 0, 1,
+    245, 0, 3,
+    248, 0, 5, 248, 0, 7, 248, 0, 9, 248, 0, 15, 248, 0, 19, 248, 0, 21, 248,
+    0, 25, 248,
+    0, 27, 248, 0, 29, 248, 0, 33, 248, 0, 37, 248, 0, 45, 248, 0, 49, 248, 0,
+    57, 248, 0,
+    60, 248, 0, 62, 248, 0, 68, 248, 0, 70, 248, 0, 72, 248, 0, 74, 248, 0,
+    79, 248, 0, 83,
+    248, 0, 87, 248, 0, 89, 248, 0, 91, 248, 0, 93, 248, 0, 97, 248, 0, 99,
+    248, 0, 101,
+    248, 0, 109, 248, 0, 113, 248, 0, 115, 248, 0, 117, 248, 0, 124, 248, 0,
+    126, 248,
+    0, 128, 248, 1, 2, 25, 248, 31, 45, 240, 47, 240, 98, 254, 102, 254, 112,
+    254, 225,
+    254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254, 233, 254, 234, 254,
+    235,
+    254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254,
+    0, 3,
+    254, 0, 5, 254, 0, 7, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254,
+    0, 79, 254,
+    0, 83, 254, 31, 45, 240, 47, 240, 98, 254, 102, 254, 112, 254, 225, 254,
+    226, 254,
+    227, 254, 228, 254, 229, 254, 230, 254, 233, 254, 234, 254, 235, 254, 236,
+    254,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 3, 254, 0,
+    5, 254,
+    0, 7, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0,
+    83, 254, 49,
+    68, 252, 72, 252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249,
+    90, 240, 118,
+    252, 119, 250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252,
+    214,
+    252, 215, 252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240,
+    250,
+    252, 251, 252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14,
+    252, 0, 32,
+    252, 0, 36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108,
+    249, 0, 109,
+    252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0,
+    117, 252,
+    0, 122, 240, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 49, 68,
+    252, 72,
+    252, 80, 252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118,
+    252, 119,
+    250, 120, 250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252,
+    215,
+    252, 217, 252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252,
+    251,
+    252, 252, 252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0,
+    32, 252, 0,
+    36, 252, 0, 78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0,
+    109, 252,
+    0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117,
+    252, 0, 122,
+    240, 6, 119, 254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 49, 68, 252,
+    72, 252, 80,
+    252, 82, 252, 85, 237, 86, 249, 87, 245, 88, 249, 90, 240, 118, 252, 119,
+    250, 120,
+    250, 122, 250, 200, 252, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252,
+    217,
+    252, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 250, 0, 1, 250, 0, 8, 252, 0, 14, 252, 0, 32, 252, 0,
+    36, 252, 0,
+    78, 252, 0, 82, 252, 0, 100, 237, 0, 102, 237, 0, 108, 249, 0, 109, 252,
+    0, 112, 249,
+    0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122,
+    240, 6, 119,
+    254, 120, 254, 122, 252, 254, 252, 0, 1, 252, 3, 45, 252, 47, 252, 4, 45,
+    254, 108,
+    254, 0, 57, 254, 3, 45, 252, 47, 252, 4, 45, 254, 108, 254, 0, 57, 254,
+    18, 45, 245,
+    47, 245, 66, 250, 87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195, 250,
+    196, 250,
+    197, 250, 198, 250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122,
+    242, 18, 45,
+    245, 47, 245, 66, 250, 87, 245, 88, 250, 90, 242, 193, 250, 194, 250, 195,
+    250, 196,
+    250, 197, 250, 198, 250, 222, 242, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0,
+    122, 242, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 9,
+    45, 254, 47, 254, 119, 252, 120, 254, 121, 252, 122, 254, 254, 254, 0, 1,
+    254, 5,
+    115, 255, 0, 87, 255, 0, 89, 255, 0, 91, 255, 5, 115, 255, 0, 87, 255, 0,
+    89, 255, 0,
+    91, 255, 40, 80, 249, 102, 250, 112, 250, 118, 252, 122, 249, 211, 249,
+    212, 249,
+    213, 249, 214, 249, 215, 249, 217, 249, 233, 250, 234, 250, 235, 250, 236,
+    250,
+    243, 250, 244, 250, 245, 250, 246, 250, 247, 250, 249, 250, 250, 252, 251,
+    252,
+    252, 252, 253, 252, 254, 249, 0, 1, 249, 0, 21, 250, 0, 25, 250, 0, 27,
+    250, 0, 29,
+    250, 0, 78, 249, 0, 79, 250, 0, 82, 249, 0, 83, 250, 0, 109, 252, 0, 113,
+    252, 0, 115,
+    252, 0, 117, 252, 19, 102, 254, 112, 254, 233, 254, 234, 254, 235, 254,
+    236, 254,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 254, 0,
+    25, 254,
+    0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 14, 85, 239, 87, 239, 88,
+    245, 90, 234,
+    122, 252, 222, 234, 254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122,
+    234, 1,
+    32, 25, 230, 1, 32, 29, 234, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122,
+    252, 222,
+    234, 254, 252, 0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32,
+    25, 230, 1,
+    32, 29, 234, 14, 85, 239, 87, 239, 88, 245, 90, 234, 122, 252, 222, 234,
+    254, 252,
+    0, 1, 252, 0, 100, 239, 0, 102, 239, 0, 122, 234, 1, 32, 25, 230, 1, 32,
+    29, 234, 14,
+    85, 239, 87, 239, 88, 245, 90, 234, 122, 252, 222, 234, 254, 252, 0, 1,
+    252, 0, 100,
+    239, 0, 102, 239, 0, 122, 234, 1, 32, 25, 230, 1, 32, 29, 234, 14, 118,
+    255, 119, 254,
+    122, 254, 250, 255, 251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0,
+    109, 255,
+    0, 113, 255, 0, 115, 255, 0, 117, 255, 14, 118, 255, 119, 254, 122, 254,
+    250, 255,
+    251, 255, 252, 255, 253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113,
+    255, 0, 115,
+    255, 0, 117, 255, 14, 118, 255, 119, 254, 122, 254, 250, 255, 251, 255,
+    252, 255,
+    253, 255, 254, 254, 0, 1, 254, 0, 109, 255, 0, 113, 255, 0, 115, 255, 0,
+    117, 255,
+    22, 45, 250, 47, 250, 66, 254, 85, 250, 87, 249, 88, 252, 89, 247, 90,
+    245, 193, 254,
+    194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 222, 245, 0, 2, 254, 0,
+    4, 254,
+    0, 6, 254, 0, 100, 250, 0, 102, 250, 0, 122, 245, 9, 45, 250, 47, 250,
+    119, 254, 120,
+    254, 121, 252, 122, 252, 254, 252, 0, 1, 252, 22, 45, 250, 47, 250, 66,
+    254, 85, 250,
+    87, 249, 88, 252, 89, 247, 90, 245, 193, 254, 194, 254, 195, 254, 196,
+    254, 197,
+    254, 198, 254, 222, 245, 0, 2, 254, 0, 4, 254, 0, 6, 254, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 245, 9, 45, 250, 47, 250, 119, 254, 120, 254, 121, 252, 122, 252,
+    254, 252,
+    0, 1, 252, 27, 80, 254, 85, 252, 86, 250, 87, 249, 88, 252, 90, 249, 211,
+    254, 212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 250, 219, 250, 220, 250,
+    221,
+    250, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 252, 0, 102, 252, 0, 108,
+    250, 0, 112,
+    250, 0, 114, 250, 0, 116, 250, 0, 122, 249, 50, 45, 249, 47, 249, 59, 5,
+    60, 5, 98,
+    255, 106, 3, 108, 3, 109, 3, 110, 4, 111, 4, 113, 5, 117, 7, 118, 3, 119,
+    5, 122, 5,
+    225, 255, 226, 255, 227, 255, 228, 255, 229, 255, 230, 255, 237, 3, 238,
+    3, 239,
+    3, 240, 3, 242, 4, 250, 3, 251, 3, 252, 3, 253, 3, 254, 5, 0, 1, 5, 0, 3,
+    255, 0, 5, 255,
+    0, 7, 255, 0, 45, 3, 0, 49, 3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0, 68, 3, 0,
+    70, 4, 0, 72, 4,
+    0, 74, 4, 0, 101, 7, 0, 109, 3, 0, 113, 3, 0, 115, 3, 0, 117, 3, 27, 80,
+    254, 85, 252,
+    86, 250, 87, 249, 88, 252, 90, 249, 211, 254, 212, 254, 213, 254, 214,
+    254, 215,
+    254, 217, 254, 218, 250, 219, 250, 220, 250, 221, 250, 222, 249, 0, 78,
+    254, 0, 82,
+    254, 0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0,
+    116, 250,
+    0, 122, 249, 50, 45, 249, 47, 249, 59, 5, 60, 5, 98, 255, 106, 3, 108, 3,
+    109, 3, 110,
+    4, 111, 4, 113, 5, 117, 7, 118, 3, 119, 5, 122, 5, 225, 255, 226, 255,
+    227, 255, 228,
+    255, 229, 255, 230, 255, 237, 3, 238, 3, 239, 3, 240, 3, 242, 4, 250, 3,
+    251, 3, 252,
+    3, 253, 3, 254, 5, 0, 1, 5, 0, 3, 255, 0, 5, 255, 0, 7, 255, 0, 45, 3, 0,
+    49, 3, 0, 57, 3,
+    0, 60, 3, 0, 62, 3, 0, 68, 3, 0, 70, 4, 0, 72, 4, 0, 74, 4, 0, 101, 7, 0,
+    109, 3, 0, 113,
+    3, 0, 115, 3, 0, 117, 3, 27, 80, 254, 85, 252, 86, 250, 87, 249, 88, 252,
+    90, 249, 211,
+    254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 218, 250, 219, 250,
+    220,
+    250, 221, 250, 222, 249, 0, 78, 254, 0, 82, 254, 0, 100, 252, 0, 102, 252,
+    0, 108,
+    250, 0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122, 249, 50, 45, 249, 47,
+    249, 59,
+    5, 60, 5, 98, 255, 106, 3, 108, 3, 109, 3, 110, 4, 111, 4, 113, 5, 117, 7,
+    118, 3, 119,
+    5, 122, 5, 225, 255, 226, 255, 227, 255, 228, 255, 229, 255, 230, 255,
+    237, 3, 238,
+    3, 239, 3, 240, 3, 242, 4, 250, 3, 251, 3, 252, 3, 253, 3, 254, 5, 0, 1,
+    5, 0, 3, 255,
+    0, 5, 255, 0, 7, 255, 0, 45, 3, 0, 49, 3, 0, 57, 3, 0, 60, 3, 0, 62, 3, 0,
+    68, 3, 0, 70, 4,
+    0, 72, 4, 0, 74, 4, 0, 101, 7, 0, 109, 3, 0, 113, 3, 0, 115, 3, 0, 117, 3,
+    3, 45, 254, 47,
+    254, 4, 45, 254, 47, 254, 120, 252, 3, 45, 254, 47, 254, 4, 45, 254, 47,
+    254, 120,
+    252, 3, 45, 254, 47, 254, 4, 45, 254, 47, 254, 120, 252, 70, 45, 237, 46,
+    234, 47,
+    237, 59, 254, 60, 254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115,
+    237, 118,
+    237, 120, 237, 122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237,
+    198,
+    237, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237,
+    226,
+    237, 227, 237, 228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237,
+    236,
+    237, 243, 237, 244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237,
+    251,
+    237, 252, 237, 253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4,
+    237, 0, 5,
+    247, 0, 6, 237, 0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237,
+    0, 78, 250,
+    0, 79, 247, 0, 82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0,
+    109, 247,
+    0, 113, 237, 0, 115, 237, 0, 117, 237, 70, 45, 237, 46, 234, 47, 237, 59,
+    254, 60,
+    254, 66, 237, 80, 250, 98, 237, 102, 237, 112, 237, 115, 237, 118, 237,
+    120, 237,
+    122, 237, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211,
+    250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 225, 237, 226, 237, 227,
+    237,
+    228, 247, 229, 237, 230, 237, 233, 247, 234, 237, 235, 237, 236, 237, 243,
+    237,
+    244, 237, 245, 237, 246, 247, 247, 237, 249, 237, 250, 237, 251, 237, 252,
+    237,
+    253, 237, 254, 237, 0, 1, 247, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 247,
+    0, 6, 237,
+    0, 7, 237, 0, 21, 247, 0, 25, 237, 0, 27, 237, 0, 29, 237, 0, 78, 250, 0,
+    79, 247, 0,
+    82, 250, 0, 83, 237, 0, 87, 237, 0, 89, 237, 0, 91, 237, 0, 109, 247, 0,
+    113, 237, 0,
+    115, 237, 0, 117, 237, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250,
+    195, 250,
+    196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45,
+    250, 47, 250,
+    66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2,
+    250, 0,
+    4, 250, 0, 6, 250, 13, 45, 250, 47, 250, 66, 250, 193, 250, 194, 250, 195,
+    250, 196,
+    250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 250, 47,
+    250, 66,
+    250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2,
+    250, 0, 4,
+    250, 0, 6, 250, 65, 45, 234, 46, 234, 47, 234, 59, 247, 60, 247, 66, 239,
+    80, 243,
+    98, 234, 102, 234, 106, 254, 112, 234, 118, 239, 193, 239, 194, 239, 195,
+    239, 196,
+    239, 197, 239, 198, 239, 211, 243, 212, 243, 213, 243, 214, 243, 215, 243,
+    217,
+    243, 225, 234, 226, 234, 227, 234, 228, 245, 229, 234, 230, 234, 233, 234,
+    234,
+    234, 235, 234, 236, 234, 238, 254, 243, 234, 244, 234, 245, 234, 246, 234,
+    247,
+    234, 249, 234, 250, 239, 251, 239, 252, 239, 253, 239, 0, 2, 239, 0, 3,
+    245, 0, 4,
+    239, 0, 5, 245, 0, 6, 239, 0, 7, 234, 0, 21, 245, 0, 25, 234, 0, 27, 234,
+    0, 29, 234,
+    0, 49, 254, 0, 78, 243, 0, 79, 234, 0, 82, 243, 0, 83, 234, 0, 109, 239,
+    0, 113, 239,
+    0, 115, 239, 0, 117, 239, 19, 102, 254, 112, 254, 233, 254, 234, 254, 235,
+    254, 236,
+    254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 21,
+    254, 0, 25,
+    254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 19, 102, 254, 112,
+    254, 233, 254,
+    234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247,
+    254,
+    249, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0,
+    83, 254, 19,
+    102, 254, 112, 254, 233, 254, 234, 254, 235, 254, 236, 254, 243, 254, 244,
+    254,
+    245, 254, 246, 254, 247, 254, 249, 254, 0, 21, 254, 0, 25, 254, 0, 27,
+    254, 0, 29,
+    254, 0, 79, 254, 0, 83, 254, 3, 45, 254, 47, 254, 4, 45, 254, 47, 254,
+    120, 252, 2,
+    1, 32, 24, 247, 14, 33, 245, 101, 249, 115, 249, 116, 249, 0, 19, 249, 0,
+    87, 249,
+    0, 89, 249, 0, 91, 249, 0, 93, 249, 0, 97, 249, 0, 99, 249, 1, 2, 25, 249,
+    1, 32, 25,
+    247, 2, 33, 250
 };
-static afm_cuint16 afm_Helvetica_Oblique_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Helvetica_Oblique_highchars_index[] = {  /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Helvetica_Oblique_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Helvetica_Oblique_ligatures[] = {   /* 3 */
+    102, 105, 64257
 };
 
 
@@ -1792,27 +3422,44 @@ static afm_cunicode afm_Helvetica_Oblique_ligatures[] = { /* 3 */
 /* FullName: ITC Zapf Dingbats */
 /* FamilyName: ZapfDingbats */
 static afm_cuint8 afm_ZapfDingbats_widths[] = { /* 202 */
-  46,162,160,162,163,120,132,132,132,115,160,157,92,143,152,156,152,
-  158,162,126,141,127,127,95,113,127,127,127,126,82,92,90,96,115,131,
-  131,131,132,132,132,136,137,132,140,137,139,136,139,154,124,121,
-  125,132,132,116,129,128,132,127,118,118,114,117,138,136,132,132,
-  118,115,116,115,131,131,119,132,131,132,146,127,127,127,127,127,
-  149,149,131,131,73,23,46,69,65,65,111,111,65,65,53,53,46,46,85,85,
-  68,68,39,39,56,56,122,91,91,152,111,127,127,129,99,116,104,131,131,
-  131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
-  131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,
-  131,131,131,131,131,131,149,140,169,76,125,154,125,153,155,155,155,
-  139,146,138,154,154,153,155,155,77,147,139,139,145,145,116,116,146,
-  146,127,158,129,144,129,148,161,148,139,146,155,162,153
+    46, 162, 160, 162, 163, 120, 132, 132, 132, 115, 160, 157, 92, 143, 152,
+    156, 152,
+    158, 162, 126, 141, 127, 127, 95, 113, 127, 127, 127, 126, 82, 92, 90, 96,
+    115, 131,
+    131, 131, 132, 132, 132, 136, 137, 132, 140, 137, 139, 136, 139, 154, 124,
+    121,
+    125, 132, 132, 116, 129, 128, 132, 127, 118, 118, 114, 117, 138, 136, 132,
+    132,
+    118, 115, 116, 115, 131, 131, 119, 132, 131, 132, 146, 127, 127, 127, 127,
+    127,
+    149, 149, 131, 131, 73, 23, 46, 69, 65, 65, 111, 111, 65, 65, 53, 53, 46,
+    46, 85, 85,
+    68, 68, 39, 39, 56, 56, 122, 91, 91, 152, 111, 127, 127, 129, 99, 116,
+    104, 131, 131,
+    131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+    131,
+    131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
+    131,
+    131, 131, 131, 131, 131, 131, 149, 140, 169, 76, 125, 154, 125, 153, 155,
+    155, 155,
+    139, 146, 138, 154, 154, 153, 155, 155, 77, 147, 139, 139, 145, 145, 116,
+    116, 146,
+    146, 127, 158, 129, 144, 129, 148, 161, 148, 139, 146, 155, 162, 153
 };
-static afm_cuint16 afm_ZapfDingbats_highchars_index[] = { /* 107 */
-  128,129,130,131,132,133,134,135,136,137,138,139,140,141,161,162,
-  163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,
-  179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,
-  195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,
-  211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,
-  227,228,229,230,231,232,233,234,235,236,237,238,239,241,242,243,
-  244,245,246,247,248,249,250,251,252,253,254
+static afm_cuint16 afm_ZapfDingbats_highchars_index[] = {   /* 107 */
+    128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 161,
+    162,
+    163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177,
+    178,
+    179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+    194,
+    195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
+    210,
+    211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225,
+    226,
+    227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 241, 242,
+    243,
+    244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254
 };
 
 
@@ -1820,33 +3467,56 @@ static afm_cuint16 afm_ZapfDingbats_highchars_index[] = { /* 107 */
 /* FontName: Symbol */
 /* FullName: Symbol */
 /* FamilyName: Symbol */
-static afm_cuint8 afm_Symbol_widths[] = { /* 251 */
-  42,56,0,83,0,139,130,0,56,56,0,92,42,0,42,46,83,83,83,83,83,83,83,
-  83,83,83,46,46,92,92,92,74,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,56,0,56,0,83,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,80,33,80,0,119,67,92,96,92,92,83,120,111,101,102,
-  102,120,124,56,120,114,148,120,108,120,128,93,99,102,115,127,120,
-  133,105,92,69,82,73,82,101,87,55,92,92,87,82,92,92,92,73,101,73,
-  96,87,92,114,114,105,103,101,119,77,167,41,69,28,125,114,165,133,
-  128,137,165,101,165,101,174,110,165,101,165,101,174,119,82,92,137,
-  102,119,119,119,73,137,119,92,83,92,119,119,128,101,101,128,128,
-  46,144,92,92,92,92,92,92,92,119,119,119,119,119,128,128,110,42,114,
-  114,55,55,82,126,126,126,126,132,132,148,83,101,167,132,132,131,
-  64,64,64,64,64,64,82,82,82,82,114,64,64,64,64,64,64,82,82,82
+static afm_cuint8 afm_Symbol_widths[] = {   /* 251 */
+    42, 56, 0, 83, 0, 139, 130, 0, 56, 56, 0, 92, 42, 0, 42, 46, 83, 83, 83,
+    83, 83, 83, 83,
+    83, 83, 83, 46, 46, 92, 92, 92, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 56, 0, 56, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 33, 80, 0, 119, 67, 92, 96, 92, 92, 83,
+    120, 111, 101, 102,
+    102, 120, 124, 56, 120, 114, 148, 120, 108, 120, 128, 93, 99, 102, 115,
+    127, 120,
+    133, 105, 92, 69, 82, 73, 82, 101, 87, 55, 92, 92, 87, 82, 92, 92, 92, 73,
+    101, 73,
+    96, 87, 92, 114, 114, 105, 103, 101, 119, 77, 167, 41, 69, 28, 125, 114,
+    165, 133,
+    128, 137, 165, 101, 165, 101, 174, 110, 165, 101, 165, 101, 174, 119, 82,
+    92, 137,
+    102, 119, 119, 119, 73, 137, 119, 92, 83, 92, 119, 119, 128, 101, 101,
+    128, 128,
+    46, 144, 92, 92, 92, 92, 92, 92, 92, 119, 119, 119, 119, 119, 128, 128,
+    110, 42, 114,
+    114, 55, 55, 82, 126, 126, 126, 126, 132, 132, 148, 83, 101, 167, 132,
+    132, 131,
+    64, 64, 64, 64, 64, 64, 82, 82, 82, 82, 114, 64, 64, 64, 64, 64, 64, 82,
+    82, 82
 };
 static afm_cuint16 afm_Symbol_highchars_index[] = { /* 156 */
-  172,176,177,181,215,247,402,913,914,915,917,918,919,920,921,922,
-  923,924,925,926,927,928,929,931,932,933,934,935,936,945,946,947,
-  948,949,950,951,952,953,954,955,957,958,959,960,961,962,963,964,
-  965,966,967,968,969,977,978,981,982,8226,8230,8242,8243,8260,8364,
-  8465,8472,8476,8486,8501,8592,8593,8594,8595,8596,8629,8656,8657,
-  8658,8659,8660,8704,8706,8707,8709,8710,8711,8712,8713,8715,8719,
-  8721,8722,8727,8730,8733,8734,8736,8743,8744,8745,8746,8747,8756,
-  8764,8773,8776,8800,8801,8804,8805,8834,8835,8836,8838,8839,8853,
-  8855,8869,8901,8992,8993,9001,9002,9674,9824,9827,9829,9830,63193,
-  63194,63195,63717,63718,63719,63720,63721,63722,63723,63724,63725,
-  63726,63727,63728,63729,63730,63731,63732,63733,63734,63735,63736,
-  63737,63738,63739,63740,63741,63742
+    172, 176, 177, 181, 215, 247, 402, 913, 914, 915, 917, 918, 919, 920, 921,
+    922,
+    923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 945, 946,
+    947,
+    948, 949, 950, 951, 952, 953, 954, 955, 957, 958, 959, 960, 961, 962, 963,
+    964,
+    965, 966, 967, 968, 969, 977, 978, 981, 982, 8226, 8230, 8242, 8243, 8260,
+    8364,
+    8465, 8472, 8476, 8486, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656,
+    8657,
+    8658, 8659, 8660, 8704, 8706, 8707, 8709, 8710, 8711, 8712, 8713, 8715,
+    8719,
+    8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747,
+    8756,
+    8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839,
+    8853,
+    8855, 8869, 8901, 8992, 8993, 9001, 9002, 9674, 9824, 9827, 9829, 9830,
+    63193,
+    63194, 63195, 63717, 63718, 63719, 63720, 63721, 63722, 63723, 63724,
+    63725,
+    63726, 63727, 63728, 63729, 63730, 63731, 63732, 63733, 63734, 63735,
+    63736,
+    63737, 63738, 63739, 63740, 63741, 63742
 };
 
 
@@ -1854,353 +3524,687 @@ static afm_cuint16 afm_Symbol_highchars_index[] = { /* 156 */
 /* FontName: Times-Bold */
 /* FullName: Times Bold */
 /* FamilyName: Times */
-static afm_cuint8 afm_Times_Bold_widths[] = { /* 315 */
-  42,56,93,83,83,167,139,46,56,56,83,95,42,56,42,46,83,83,83,83,83,
-  83,83,83,83,83,56,56,95,95,95,83,155,120,111,120,120,111,102,130,
-  130,65,83,130,111,157,120,130,102,130,120,93,111,120,120,167,120,
-  120,111,56,46,56,97,83,56,83,93,74,93,74,56,83,93,46,56,93,46,139,
-  93,83,93,93,74,65,56,93,83,120,83,83,74,66,37,66,87,56,83,83,83,
-  83,37,83,56,125,50,83,95,125,56,67,95,50,50,56,93,90,42,56,50,55,
-  83,125,125,125,83,120,120,120,120,120,120,167,120,111,111,111,111,
-  65,65,65,65,120,120,130,130,130,130,130,95,130,120,120,120,120,120,
-  102,93,83,83,83,83,83,83,120,74,74,74,74,74,46,46,46,46,83,93,83,
-  83,83,83,83,95,83,93,93,93,93,83,93,83,120,83,120,83,120,83,120,
-  74,120,74,120,112,120,93,111,74,111,74,111,74,111,74,130,83,130,
-  83,65,46,65,46,65,46,130,93,111,46,111,46,111,66,111,46,120,93,120,
-  93,120,93,130,83,130,83,167,120,120,74,120,74,120,74,93,65,93,65,
-  93,65,111,56,111,69,120,93,120,93,120,93,120,93,120,111,74,111,74,
-  111,74,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,83,83,83,
-  83,83,58,167,167,56,56,28,83,167,82,102,100,95,92,92,92,92,82,42,
-  93,93
+static afm_cuint8 afm_Times_Bold_widths[] = {   /* 315 */
+    42, 56, 93, 83, 83, 167, 139, 46, 56, 56, 83, 95, 42, 56, 42, 46, 83, 83,
+    83, 83, 83,
+    83, 83, 83, 83, 83, 56, 56, 95, 95, 95, 83, 155, 120, 111, 120, 120, 111,
+    102, 130,
+    130, 65, 83, 130, 111, 157, 120, 130, 102, 130, 120, 93, 111, 120, 120,
+    167, 120,
+    120, 111, 56, 46, 56, 97, 83, 56, 83, 93, 74, 93, 74, 56, 83, 93, 46, 56,
+    93, 46, 139,
+    93, 83, 93, 93, 74, 65, 56, 93, 83, 120, 83, 83, 74, 66, 37, 66, 87, 56,
+    83, 83, 83,
+    83, 37, 83, 56, 125, 50, 83, 95, 125, 56, 67, 95, 50, 50, 56, 93, 90, 42,
+    56, 50, 55,
+    83, 125, 125, 125, 83, 120, 120, 120, 120, 120, 120, 167, 120, 111, 111,
+    111, 111,
+    65, 65, 65, 65, 120, 120, 130, 130, 130, 130, 130, 95, 130, 120, 120, 120,
+    120, 120,
+    102, 93, 83, 83, 83, 83, 83, 83, 120, 74, 74, 74, 74, 74, 46, 46, 46, 46,
+    83, 93, 83,
+    83, 83, 83, 83, 95, 83, 93, 93, 93, 93, 83, 93, 83, 120, 83, 120, 83, 120,
+    83, 120,
+    74, 120, 74, 120, 112, 120, 93, 111, 74, 111, 74, 111, 74, 111, 74, 130,
+    83, 130,
+    83, 65, 46, 65, 46, 65, 46, 130, 93, 111, 46, 111, 46, 111, 66, 111, 46,
+    120, 93, 120,
+    93, 120, 93, 130, 83, 130, 83, 167, 120, 120, 74, 120, 74, 120, 74, 93,
+    65, 93, 65,
+    93, 65, 111, 56, 111, 69, 120, 93, 120, 93, 120, 93, 120, 93, 120, 111,
+    74, 111, 74,
+    111, 74, 83, 93, 65, 56, 56, 56, 56, 56, 56, 56, 56, 83, 167, 56, 56, 56,
+    83, 83, 83,
+    83, 83, 58, 167, 167, 56, 56, 28, 83, 167, 82, 102, 100, 95, 92, 92, 92,
+    92, 82, 42,
+    93, 93
 };
-static afm_sint16 afm_Times_Bold_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,62,183,0,229,0,266,0,0,0,359,472,564,0,599,623,668,761,786,0,
-  848,1016,1044,1209,0,1364,0,0,0,0,0,0,0,1512,1515,0,1544,1547,1550,
-  1588,1591,1599,0,1602,0,0,1652,1655,0,0,1660,0,0,0,1746,1816,0,1841,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,1888,2009,2130,2251,2372,2493,0,0,0,0,0,0,0,0,0,0,0,2614,2638,
-  2683,2728,2773,2818,0,2863,2908,2936,2964,2992,3020,0,0,3168,3171,
-  3174,3177,3180,3183,0,0,3186,3189,3192,3195,3198,3201,3204,3207,
-  0,3210,3213,3218,3223,3228,3233,0,3238,0,0,0,0,3243,0,3290,3337,
-  3458,3461,3582,3585,3706,0,0,0,0,3709,0,3746,3783,0,3786,0,3789,
-  0,3792,0,3795,0,3798,0,3801,0,3804,0,3807,0,0,3810,3902,3952,0,3987,
-  0,0,0,4022,0,4057,4081,4084,4108,4111,4135,4138,4183,4188,4233,0,
-  0,4238,4300,4386,4448,4534,4596,0,0,0,0,0,0,4682,0,4850,0,5018,0,
-  5046,0,5074,0,5102,0,5130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  5278,5306,0,5346,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+static afm_sint16 afm_Times_Bold_kerning_index[] = {    /* 315 */
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 62, 183, 0, 229, 0, 266, 0, 0, 0, 359, 472, 564, 0, 599, 623, 668,
+    761, 786, 0,
+    848, 1016, 1044, 1209, 0, 1364, 0, 0, 0, 0, 0, 0, 0, 1512, 1515, 0, 1544,
+    1547, 1550,
+    1588, 1591, 1599, 0, 1602, 0, 0, 1652, 1655, 0, 0, 1660, 0, 0, 0, 1746,
+    1816, 0, 1841,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 1888, 2009, 2130, 2251, 2372, 2493, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 2614, 2638,
+    2683, 2728, 2773, 2818, 0, 2863, 2908, 2936, 2964, 2992, 3020, 0, 0, 3168,
+    3171,
+    3174, 3177, 3180, 3183, 0, 0, 3186, 3189, 3192, 3195, 3198, 3201, 3204,
+    3207,
+    0, 3210, 3213, 3218, 3223, 3228, 3233, 0, 3238, 0, 0, 0, 0, 3243, 0, 3290,
+    3337,
+    3458, 3461, 3582, 3585, 3706, 0, 0, 0, 0, 3709, 0, 3746, 3783, 0, 3786, 0,
+    3789,
+    0, 3792, 0, 3795, 0, 3798, 0, 3801, 0, 3804, 0, 3807, 0, 0, 3810, 3902,
+    3952, 0, 3987,
+    0, 0, 0, 4022, 0, 4057, 4081, 4084, 4108, 4111, 4135, 4138, 4183, 4188,
+    4233, 0,
+    0, 4238, 4300, 4386, 4448, 4534, 4596, 0, 0, 0, 0, 0, 0, 4682, 0, 4850, 0,
+    5018, 0,
+    5046, 0, 5074, 0, 5102, 0, 5130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    5278, 5306, 0, 5346, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0
 };
 static afm_cuint8 afm_Times_Bold_kerning_data[] = { /* 5370 */
-  42,19,66,248,85,252,87,249,88,252,90,248,193,248,194,248,195,248,
-  196,248,197,248,198,248,222,248,0,2,248,0,4,248,0,6,248,0,100,252,
-  0,102,252,0,122,248,3,1,32,25,248,1,32,29,249,3,1,32,25,248,1,32,
-  29,248,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,
-  90,240,113,253,118,249,119,240,120,242,122,245,200,248,211,249,212,
-  249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,221,
-  249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,
-  248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,
-  241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,
-  0,116,249,0,117,249,0,122,240,1,32,25,245,20,66,252,86,255,193,252,
-  194,252,195,252,196,252,197,252,198,252,218,255,219,255,220,255,
-  221,255,0,2,252,0,4,252,0,6,252,0,108,255,0,112,255,0,114,255,0,
-  116,255,17,47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,
-  251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,
-  250,41,45,242,47,239,66,242,98,253,102,253,112,253,193,242,194,242,
-  195,242,196,242,197,242,198,242,225,253,226,253,227,253,228,253,
-  229,253,230,253,233,253,234,253,235,253,236,253,243,253,244,253,
-  245,253,246,253,247,253,249,253,0,2,242,0,3,253,0,4,242,0,5,253,
-  0,6,242,0,7,253,0,21,253,0,25,253,0,27,253,0,29,253,0,79,253,0,83,
-  253,49,47,254,66,252,98,254,102,254,112,254,118,254,193,252,194,
-  252,195,252,196,252,197,252,198,252,225,254,226,254,227,254,228,
-  254,229,254,230,254,233,254,234,254,235,254,236,254,243,254,244,
-  254,245,254,246,254,247,254,249,254,250,254,251,254,252,254,253,
-  254,0,2,252,0,3,254,0,4,252,0,5,254,0,6,252,0,7,254,0,21,254,0,25,
-  254,0,27,254,0,29,254,0,79,254,0,83,254,0,109,254,0,113,254,0,115,
-  254,0,117,254,40,80,252,102,253,112,253,118,254,122,249,211,252,
-  212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,253,
-  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,254,
-  251,254,252,254,253,254,254,249,0,1,249,0,21,253,0,25,253,0,27,253,
-  0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,113,254,
-  0,115,254,0,117,254,14,85,242,87,242,88,242,90,242,122,248,222,242,
-  254,248,0,1,248,0,100,242,0,102,242,0,122,242,1,32,25,239,1,32,29,
-  254,11,66,254,193,254,194,254,195,254,196,254,197,254,198,254,0,
-  2,254,0,4,254,0,6,254,20,66,250,85,250,87,249,88,249,89,250,90,249,
-  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
-  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,41,45,242,47,239,66,
-  245,98,255,102,254,112,254,193,245,194,245,195,245,196,245,197,245,
-  198,245,225,255,226,255,227,255,228,255,229,255,230,255,233,254,
-  234,254,235,254,236,254,243,254,244,254,245,254,246,254,247,254,
-  249,254,0,2,245,0,3,255,0,4,245,0,5,255,0,6,245,0,7,255,0,21,254,
-  0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,11,47,254,86,255,218,
-  255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,
-  255,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,252,
-  213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,252,
-  222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,252,
-  0,114,252,0,116,252,0,122,251,73,45,245,46,242,47,242,59,245,60,
-  245,66,242,80,254,98,242,102,242,106,254,112,242,115,245,118,242,
-  120,245,122,251,193,242,194,242,195,242,196,242,197,242,198,242,
-  211,254,212,254,213,254,214,254,215,254,217,254,225,248,226,242,
-  227,248,228,248,229,248,230,242,233,248,234,242,235,242,236,248,
-  238,254,243,242,244,242,245,242,246,242,247,242,249,242,250,242,
-  251,242,252,242,253,242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,
-  0,5,248,0,6,242,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,
-  254,0,78,254,0,79,242,0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,
-  0,109,242,0,113,242,0,115,242,0,117,242,13,45,249,47,249,66,247,
-  193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,247,
-  0,6,247,72,45,235,46,245,47,233,59,242,60,242,66,234,72,252,80,249,
-  98,242,102,240,106,251,112,240,118,242,193,234,194,234,195,234,196,
-  234,197,234,198,234,211,249,212,249,213,249,214,249,215,249,217,
-  249,225,242,226,242,227,242,228,242,229,242,230,242,233,240,234,
-  240,235,240,236,240,237,251,238,251,239,251,240,251,243,240,244,
-  240,245,240,246,240,247,240,249,240,250,242,251,242,252,242,253,
-  242,0,2,234,0,3,242,0,4,234,0,5,242,0,6,234,0,7,242,0,21,240,0,25,
-  240,0,27,240,0,29,240,0,32,252,0,36,252,0,45,251,0,49,251,0,78,249,
-  0,79,240,0,82,249,0,83,240,0,109,242,0,113,242,0,115,242,0,117,242,
-  68,45,242,46,251,47,242,59,248,60,248,66,237,80,255,98,246,102,246,
-  106,254,112,244,118,249,122,247,193,237,194,237,195,237,196,237,
-  197,237,198,237,211,255,212,255,213,255,214,255,215,255,217,255,
-  225,246,226,246,227,246,228,246,229,246,230,246,233,246,234,246,
-  235,246,236,246,238,254,243,244,244,244,245,244,246,244,247,244,
-  249,244,250,249,251,249,252,249,253,249,254,247,0,1,247,0,2,237,
-  0,3,246,0,4,237,0,5,246,0,6,237,0,7,246,0,21,246,0,25,246,0,27,246,
-  0,29,246,0,49,254,0,78,255,0,79,244,0,82,255,0,83,244,0,109,249,
-  0,113,249,0,115,249,0,117,249,65,45,242,46,242,47,242,59,242,60,
-  242,66,239,80,251,98,243,102,238,106,251,112,238,118,242,193,239,
-  194,239,195,239,196,239,197,239,198,239,211,251,212,251,213,251,
-  214,251,215,251,217,251,225,243,226,243,227,243,228,243,229,243,
-  230,243,233,245,234,238,235,238,236,245,238,251,243,238,244,238,
-  245,238,246,238,247,238,249,238,250,242,251,242,252,242,253,242,
-  0,2,239,0,3,243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,245,0,25,238,
-  0,27,238,0,29,238,0,49,251,0,78,251,0,79,238,0,82,251,0,83,238,0,
-  109,242,0,113,242,0,115,242,0,117,242,2,119,253,13,47,250,99,255,
-  118,254,119,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
-  254,0,115,254,0,117,254,2,120,254,2,119,254,16,45,254,47,254,106,
-  253,112,253,243,253,244,253,245,253,246,253,247,253,249,253,0,51,
-  251,0,79,253,0,83,253,1,32,25,9,1,32,29,8,2,47,254,4,122,254,254,
-  254,0,1,254,2,119,255,22,102,255,112,254,122,254,233,255,234,255,
-  235,255,236,255,243,254,244,254,245,254,246,254,247,254,249,254,
-  254,254,0,1,254,0,21,255,0,25,255,0,27,255,0,29,255,0,79,254,0,83,
-  254,2,119,250,3,119,255,120,255,37,45,242,46,251,47,240,100,254,
-  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
-  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
-  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
-  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
-  0,83,254,31,45,248,47,245,98,255,102,255,112,255,225,255,226,255,
-  227,255,228,255,229,255,230,255,233,255,234,255,235,255,236,255,
-  243,255,244,255,245,255,246,255,247,255,249,255,0,3,255,0,5,255,
-  0,7,255,0,21,255,0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,12,
-  45,248,47,245,112,255,243,255,244,255,245,255,246,255,247,255,249,
-  255,0,79,255,0,83,255,21,45,248,47,245,102,255,112,253,233,255,234,
-  255,235,255,236,255,243,253,244,253,245,253,246,253,247,253,249,
-  253,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,51,68,
-  248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,240,113,
-  253,118,249,119,240,120,242,122,245,200,248,211,249,212,249,213,
-  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
-  240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,
-  248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,
-  249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,
-  0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,249,82,249,85,
-  241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,120,242,
-  122,245,200,248,211,249,212,249,213,249,214,249,215,249,217,249,
-  218,249,219,249,220,249,221,249,222,240,250,249,251,249,252,249,
-  253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,0,78,
-  249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,249,0,
-  113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,1,32,25,
-  245,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,
-  240,113,253,118,249,119,240,120,242,122,245,200,248,211,249,212,
-  249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,221,
-  249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,
-  248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,
-  241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,
-  0,116,249,0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,249,
-  82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,
-  120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,249,
-  217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,249,
-  252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,
-  0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,
-  249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,
-  1,32,25,245,51,68,248,72,248,80,249,82,249,85,241,86,249,87,233,
-  88,235,90,240,113,253,118,249,119,240,120,242,122,245,200,248,211,
-  249,212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,
-  249,221,249,222,240,250,249,251,249,252,249,253,249,254,245,0,1,
-  245,0,8,248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,
-  0,102,241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,
-  249,0,116,249,0,117,249,0,122,240,1,32,25,245,51,68,248,72,248,80,
-  249,82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,
-  240,120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,
-  249,217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,
-  249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,
-  36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,
-  0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,
-  240,1,32,25,245,11,66,254,193,254,194,254,195,254,196,254,197,254,
-  198,254,0,2,254,0,4,254,0,6,254,20,66,250,85,250,87,249,88,249,89,
-  250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,249,
-  0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,
-  85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,
-  197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,
-  250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,
-  194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,
-  0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,88,
-  249,89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,
-  222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,
-  66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,
-  196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,
-  0,102,250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,
-  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
-  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,13,45,249,47,249,66,
-  247,193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,
-  247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,195,247,196,
-  247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,249,47,249,66,
-  247,193,247,194,247,195,247,196,247,197,247,198,247,0,2,247,0,4,
-  247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,195,247,196,
-  247,197,247,198,247,0,2,247,0,4,247,0,6,247,65,45,242,46,242,47,
-  242,59,242,60,242,66,239,80,251,98,243,102,238,106,251,112,238,118,
-  242,193,239,194,239,195,239,196,239,197,239,198,239,211,251,212,
-  251,213,251,214,251,215,251,217,251,225,243,226,243,227,243,228,
-  243,229,243,230,243,233,245,234,238,235,238,236,245,238,251,243,
-  238,244,238,245,238,246,238,247,238,249,238,250,242,251,242,252,
-  242,253,242,0,2,239,0,3,243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,
-  245,0,25,238,0,27,238,0,29,238,0,49,251,0,78,251,0,79,238,0,82,251,
-  0,83,238,0,109,242,0,113,242,0,115,242,0,117,242,2,119,253,2,119,
-  253,2,119,253,2,119,253,2,119,253,2,119,253,2,119,254,2,119,254,
-  2,119,254,2,119,254,2,119,255,2,119,255,2,119,255,2,119,255,2,119,
-  250,3,119,255,120,255,3,119,255,120,255,3,119,255,120,255,3,119,
-  255,120,255,3,119,255,120,255,3,119,255,120,255,21,45,248,47,245,
-  102,255,112,253,233,255,234,255,235,255,236,255,243,253,244,253,
-  245,253,246,253,247,253,249,253,0,21,255,0,25,255,0,27,255,0,29,
-  255,0,79,253,0,83,253,21,45,248,47,245,102,255,112,253,233,255,234,
-  255,235,255,236,255,243,253,244,253,245,253,246,253,247,253,249,
-  253,0,21,255,0,25,255,0,27,255,0,29,255,0,79,253,0,83,253,51,68,
-  248,72,248,80,249,82,249,85,241,86,249,87,233,88,235,90,240,113,
-  253,118,249,119,240,120,242,122,245,200,248,211,249,212,249,213,
-  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
-  240,250,249,251,249,252,249,253,249,254,245,0,1,245,0,8,248,0,14,
-  248,0,32,248,0,36,248,0,78,249,0,82,249,0,100,241,0,102,241,0,108,
-  249,0,109,249,0,112,249,0,113,249,0,114,249,0,115,249,0,116,249,
-  0,117,249,0,122,240,1,32,25,245,2,119,253,51,68,248,72,248,80,249,
-  82,249,85,241,86,249,87,233,88,235,90,240,113,253,118,249,119,240,
-  120,242,122,245,200,248,211,249,212,249,213,249,214,249,215,249,
-  217,249,218,249,219,249,220,249,221,249,222,240,250,249,251,249,
-  252,249,253,249,254,245,0,1,245,0,8,248,0,14,248,0,32,248,0,36,248,
-  0,78,249,0,82,249,0,100,241,0,102,241,0,108,249,0,109,249,0,112,
-  249,0,113,249,0,114,249,0,115,249,0,116,249,0,117,249,0,122,240,
-  1,32,25,245,2,119,253,51,68,248,72,248,80,249,82,249,85,241,86,249,
-  87,233,88,235,90,240,113,253,118,249,119,240,120,242,122,251,200,
-  248,211,249,212,249,213,249,214,249,215,249,217,249,218,249,219,
-  249,220,249,221,249,222,240,250,249,251,249,252,249,253,249,254,
-  251,0,1,251,0,8,248,0,14,248,0,32,248,0,36,248,0,78,249,0,82,249,
-  0,100,241,0,102,241,0,108,249,0,109,249,0,112,249,0,113,249,0,114,
-  249,0,115,249,0,116,249,0,117,249,0,122,240,1,32,25,245,2,119,253,
-  17,47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,
-  251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,17,
-  47,254,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,251,
-  197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,2,120,
-  254,2,119,254,2,119,254,2,119,254,2,119,254,2,47,254,2,47,254,2,
-  119,255,2,119,255,40,80,252,102,253,112,253,118,254,122,249,211,
-  252,212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,
-  253,236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,
-  254,251,254,252,254,253,254,254,249,0,1,249,0,21,253,0,25,253,0,
-  27,253,0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,
-  113,254,0,115,254,0,117,254,22,102,255,112,254,122,254,233,255,234,
-  255,235,255,236,255,243,254,244,254,245,254,246,254,247,254,249,
-  254,254,254,0,1,254,0,21,255,0,25,255,0,27,255,0,29,255,0,79,254,
-  0,83,254,14,85,242,87,242,88,242,90,242,122,248,222,242,254,248,
-  0,1,248,0,100,242,0,102,242,0,122,242,1,32,25,239,1,32,29,254,14,
-  85,242,87,242,88,242,90,242,122,248,222,242,254,248,0,1,248,0,100,
-  242,0,102,242,0,122,242,1,32,25,239,1,32,29,254,14,85,242,87,242,
-  88,242,90,242,122,248,222,242,254,248,0,1,248,0,100,242,0,102,242,
-  0,122,242,1,32,25,239,1,32,29,254,11,66,254,193,254,194,254,195,
-  254,196,254,197,254,198,254,0,2,254,0,4,254,0,6,254,2,119,250,11,
-  66,254,193,254,194,254,195,254,196,254,197,254,198,254,0,2,254,0,
-  4,254,0,6,254,2,119,250,11,66,254,193,254,194,254,195,254,196,254,
-  197,254,198,254,0,2,254,0,4,254,0,6,254,2,119,250,20,66,250,85,250,
-  87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,
-  250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,
-  0,122,249,3,119,255,120,255,20,66,250,85,250,87,249,88,249,89,250,
-  90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,
-  2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,3,119,255,120,
-  255,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,252,
-  213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,252,
-  222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,252,
-  0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,102,
-  254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,233,
-  254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,246,
-  254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,254,
-  0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,0,
-  83,254,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,
-  252,213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,
-  252,222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,
-  252,0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,
-  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
-  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
-  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
-  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
-  0,83,254,27,80,252,85,250,86,252,87,248,88,251,90,251,211,252,212,
-  252,213,252,214,252,215,252,217,252,218,252,219,252,220,252,221,
-  252,222,251,0,78,252,0,82,252,0,100,250,0,102,250,0,108,252,0,112,
-  252,0,114,252,0,116,252,0,122,251,37,45,242,46,251,47,240,100,254,
-  102,254,104,255,111,254,112,254,113,255,114,254,119,255,232,254,
-  233,254,234,254,235,254,236,254,242,254,243,254,244,254,245,254,
-  246,254,247,254,249,254,0,9,254,0,15,254,0,21,254,0,25,254,0,27,
-  254,0,29,254,0,33,255,0,37,255,0,70,254,0,72,254,0,74,254,0,79,254,
-  0,83,254,73,45,245,46,242,47,242,59,245,60,245,66,242,80,254,98,
-  242,102,242,106,254,112,242,115,245,118,242,120,245,122,251,193,
-  242,194,242,195,242,196,242,197,242,198,242,211,254,212,254,213,
-  254,214,254,215,254,217,254,225,248,226,242,227,248,228,248,229,
-  248,230,242,233,248,234,242,235,242,236,248,238,254,243,242,244,
-  242,245,242,246,242,247,242,249,242,250,242,251,242,252,242,253,
-  242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,0,5,248,0,6,242,0,7,
-  242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,254,0,78,254,0,79,242,
-  0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,0,109,242,0,113,242,
-  0,115,242,0,117,242,73,45,245,46,242,47,242,59,245,60,245,66,242,
-  80,254,98,242,102,242,106,254,112,242,115,245,118,242,120,245,122,
-  251,193,242,194,242,195,242,196,242,197,242,198,242,211,254,212,
-  254,213,254,214,254,215,254,217,254,225,248,226,242,227,248,228,
-  248,229,248,230,242,233,248,234,242,235,242,236,248,238,254,243,
-  242,244,242,245,242,246,242,247,242,249,242,250,242,251,242,252,
-  242,253,242,254,251,0,1,251,0,2,242,0,3,248,0,4,242,0,5,248,0,6,
-  242,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,254,0,78,254,
-  0,79,242,0,82,254,0,83,242,0,87,245,0,89,245,0,91,245,0,109,242,
-  0,113,242,0,115,242,0,117,242,13,45,249,47,249,66,247,193,247,194,
-  247,195,247,196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,
-  249,47,249,66,247,193,247,194,247,195,247,196,247,197,247,198,247,
-  0,2,247,0,4,247,0,6,247,13,45,249,47,249,66,247,193,247,194,247,
-  195,247,196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,13,45,249,
-  47,249,66,247,193,247,194,247,195,247,196,247,197,247,198,247,0,
-  2,247,0,4,247,0,6,247,65,45,242,46,242,47,242,59,242,60,242,66,239,
-  80,251,98,243,102,238,106,251,112,238,118,242,193,239,194,239,195,
-  239,196,239,197,239,198,239,211,251,212,251,213,251,214,251,215,
-  251,217,251,225,243,226,243,227,243,228,243,229,243,230,243,233,
-  245,234,238,235,238,236,245,238,251,243,238,244,238,245,238,246,
-  238,247,238,249,238,250,242,251,242,252,242,253,242,0,2,239,0,3,
-  243,0,4,239,0,5,243,0,6,239,0,7,243,0,21,245,0,25,238,0,27,238,0,
-  29,238,0,49,251,0,78,251,0,79,238,0,82,251,0,83,238,0,109,242,0,
-  113,242,0,115,242,0,117,242,12,66,255,193,255,194,255,195,255,196,
-  255,197,255,198,255,0,2,255,0,4,255,0,6,255,1,32,24,246,15,33,245,
-  101,254,115,254,116,251,119,254,0,19,254,0,87,254,0,89,254,0,91,
-  254,0,93,251,0,97,251,0,99,251,1,2,25,251,1,32,25,246,11,66,255,
-  193,255,194,255,195,255,196,255,197,255,198,255,0,2,255,0,4,255,
-  0,6,255
+    42, 19, 66, 248, 85, 252, 87, 249, 88, 252, 90, 248, 193, 248, 194, 248,
+    195, 248,
+    196, 248, 197, 248, 198, 248, 222, 248, 0, 2, 248, 0, 4, 248, 0, 6, 248,
+    0, 100, 252,
+    0, 102, 252, 0, 122, 248, 3, 1, 32, 25, 248, 1, 32, 29, 249, 3, 1, 32, 25,
+    248, 1, 32,
+    29, 248, 51, 68, 248, 72, 248, 80, 249, 82, 249, 85, 241, 86, 249, 87,
+    233, 88, 235,
+    90, 240, 113, 253, 118, 249, 119, 240, 120, 242, 122, 245, 200, 248, 211,
+    249, 212,
+    249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 240, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245, 0, 1,
+    245, 0, 8,
+    248, 0, 14, 248, 0, 32, 248, 0, 36, 248, 0, 78, 249, 0, 82, 249, 0, 100,
+    241, 0, 102,
+    241, 0, 108, 249, 0, 109, 249, 0, 112, 249, 0, 113, 249, 0, 114, 249, 0,
+    115, 249,
+    0, 116, 249, 0, 117, 249, 0, 122, 240, 1, 32, 25, 245, 20, 66, 252, 86,
+    255, 193, 252,
+    194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 218, 255, 219, 255, 220,
+    255,
+    221, 255, 0, 2, 252, 0, 4, 252, 0, 6, 252, 0, 108, 255, 0, 112, 255, 0,
+    114, 255, 0,
+    116, 255, 17, 47, 254, 66, 251, 87, 250, 88, 250, 90, 250, 193, 251, 194,
+    251, 195,
+    251, 196, 251, 197, 251, 198, 251, 222, 250, 0, 2, 251, 0, 4, 251, 0, 6,
+    251, 0, 122,
+    250, 41, 45, 242, 47, 239, 66, 242, 98, 253, 102, 253, 112, 253, 193, 242,
+    194, 242,
+    195, 242, 196, 242, 197, 242, 198, 242, 225, 253, 226, 253, 227, 253, 228,
+    253,
+    229, 253, 230, 253, 233, 253, 234, 253, 235, 253, 236, 253, 243, 253, 244,
+    253,
+    245, 253, 246, 253, 247, 253, 249, 253, 0, 2, 242, 0, 3, 253, 0, 4, 242,
+    0, 5, 253,
+    0, 6, 242, 0, 7, 253, 0, 21, 253, 0, 25, 253, 0, 27, 253, 0, 29, 253, 0,
+    79, 253, 0, 83,
+    253, 49, 47, 254, 66, 252, 98, 254, 102, 254, 112, 254, 118, 254, 193,
+    252, 194,
+    252, 195, 252, 196, 252, 197, 252, 198, 252, 225, 254, 226, 254, 227, 254,
+    228,
+    254, 229, 254, 230, 254, 233, 254, 234, 254, 235, 254, 236, 254, 243, 254,
+    244,
+    254, 245, 254, 246, 254, 247, 254, 249, 254, 250, 254, 251, 254, 252, 254,
+    253,
+    254, 0, 2, 252, 0, 3, 254, 0, 4, 252, 0, 5, 254, 0, 6, 252, 0, 7, 254, 0,
+    21, 254, 0, 25,
+    254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 0, 109, 254, 0, 113,
+    254, 0, 115,
+    254, 0, 117, 254, 40, 80, 252, 102, 253, 112, 253, 118, 254, 122, 249,
+    211, 252,
+    212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 233, 253, 234, 253, 235,
+    253,
+    236, 253, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 250,
+    254,
+    251, 254, 252, 254, 253, 254, 254, 249, 0, 1, 249, 0, 21, 253, 0, 25, 253,
+    0, 27, 253,
+    0, 29, 253, 0, 78, 252, 0, 79, 253, 0, 82, 252, 0, 83, 253, 0, 109, 254,
+    0, 113, 254,
+    0, 115, 254, 0, 117, 254, 14, 85, 242, 87, 242, 88, 242, 90, 242, 122,
+    248, 222, 242,
+    254, 248, 0, 1, 248, 0, 100, 242, 0, 102, 242, 0, 122, 242, 1, 32, 25,
+    239, 1, 32, 29,
+    254, 11, 66, 254, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254, 198,
+    254, 0,
+    2, 254, 0, 4, 254, 0, 6, 254, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89,
+    250, 90, 249,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0,
+    2, 250,
+    0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 41, 45, 242,
+    47, 239, 66,
+    245, 98, 255, 102, 254, 112, 254, 193, 245, 194, 245, 195, 245, 196, 245,
+    197, 245,
+    198, 245, 225, 255, 226, 255, 227, 255, 228, 255, 229, 255, 230, 255, 233,
+    254,
+    234, 254, 235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247,
+    254,
+    249, 254, 0, 2, 245, 0, 3, 255, 0, 4, 245, 0, 5, 255, 0, 6, 245, 0, 7,
+    255, 0, 21, 254,
+    0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254, 11, 47, 254,
+    86, 255, 218,
+    255, 219, 255, 220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255,
+    0, 116,
+    255, 27, 80, 252, 85, 250, 86, 252, 87, 248, 88, 251, 90, 251, 211, 252,
+    212, 252,
+    213, 252, 214, 252, 215, 252, 217, 252, 218, 252, 219, 252, 220, 252, 221,
+    252,
+    222, 251, 0, 78, 252, 0, 82, 252, 0, 100, 250, 0, 102, 250, 0, 108, 252,
+    0, 112, 252,
+    0, 114, 252, 0, 116, 252, 0, 122, 251, 73, 45, 245, 46, 242, 47, 242, 59,
+    245, 60,
+    245, 66, 242, 80, 254, 98, 242, 102, 242, 106, 254, 112, 242, 115, 245,
+    118, 242,
+    120, 245, 122, 251, 193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198,
+    242,
+    211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 248, 226,
+    242,
+    227, 248, 228, 248, 229, 248, 230, 242, 233, 248, 234, 242, 235, 242, 236,
+    248,
+    238, 254, 243, 242, 244, 242, 245, 242, 246, 242, 247, 242, 249, 242, 250,
+    242,
+    251, 242, 252, 242, 253, 242, 254, 251, 0, 1, 251, 0, 2, 242, 0, 3, 248,
+    0, 4, 242,
+    0, 5, 248, 0, 6, 242, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0,
+    29, 242, 0, 49,
+    254, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0, 83, 242, 0, 87, 245, 0, 89,
+    245, 0, 91, 245,
+    0, 109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 13, 45, 249, 47, 249,
+    66, 247,
+    193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 0, 2, 247, 0,
+    4, 247,
+    0, 6, 247, 72, 45, 235, 46, 245, 47, 233, 59, 242, 60, 242, 66, 234, 72,
+    252, 80, 249,
+    98, 242, 102, 240, 106, 251, 112, 240, 118, 242, 193, 234, 194, 234, 195,
+    234, 196,
+    234, 197, 234, 198, 234, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249,
+    217,
+    249, 225, 242, 226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 240,
+    234,
+    240, 235, 240, 236, 240, 237, 251, 238, 251, 239, 251, 240, 251, 243, 240,
+    244,
+    240, 245, 240, 246, 240, 247, 240, 249, 240, 250, 242, 251, 242, 252, 242,
+    253,
+    242, 0, 2, 234, 0, 3, 242, 0, 4, 234, 0, 5, 242, 0, 6, 234, 0, 7, 242, 0,
+    21, 240, 0, 25,
+    240, 0, 27, 240, 0, 29, 240, 0, 32, 252, 0, 36, 252, 0, 45, 251, 0, 49,
+    251, 0, 78, 249,
+    0, 79, 240, 0, 82, 249, 0, 83, 240, 0, 109, 242, 0, 113, 242, 0, 115, 242,
+    0, 117, 242,
+    68, 45, 242, 46, 251, 47, 242, 59, 248, 60, 248, 66, 237, 80, 255, 98,
+    246, 102, 246,
+    106, 254, 112, 244, 118, 249, 122, 247, 193, 237, 194, 237, 195, 237, 196,
+    237,
+    197, 237, 198, 237, 211, 255, 212, 255, 213, 255, 214, 255, 215, 255, 217,
+    255,
+    225, 246, 226, 246, 227, 246, 228, 246, 229, 246, 230, 246, 233, 246, 234,
+    246,
+    235, 246, 236, 246, 238, 254, 243, 244, 244, 244, 245, 244, 246, 244, 247,
+    244,
+    249, 244, 250, 249, 251, 249, 252, 249, 253, 249, 254, 247, 0, 1, 247, 0,
+    2, 237,
+    0, 3, 246, 0, 4, 237, 0, 5, 246, 0, 6, 237, 0, 7, 246, 0, 21, 246, 0, 25,
+    246, 0, 27, 246,
+    0, 29, 246, 0, 49, 254, 0, 78, 255, 0, 79, 244, 0, 82, 255, 0, 83, 244, 0,
+    109, 249,
+    0, 113, 249, 0, 115, 249, 0, 117, 249, 65, 45, 242, 46, 242, 47, 242, 59,
+    242, 60,
+    242, 66, 239, 80, 251, 98, 243, 102, 238, 106, 251, 112, 238, 118, 242,
+    193, 239,
+    194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 251, 212, 251, 213,
+    251,
+    214, 251, 215, 251, 217, 251, 225, 243, 226, 243, 227, 243, 228, 243, 229,
+    243,
+    230, 243, 233, 245, 234, 238, 235, 238, 236, 245, 238, 251, 243, 238, 244,
+    238,
+    245, 238, 246, 238, 247, 238, 249, 238, 250, 242, 251, 242, 252, 242, 253,
+    242,
+    0, 2, 239, 0, 3, 243, 0, 4, 239, 0, 5, 243, 0, 6, 239, 0, 7, 243, 0, 21,
+    245, 0, 25, 238,
+    0, 27, 238, 0, 29, 238, 0, 49, 251, 0, 78, 251, 0, 79, 238, 0, 82, 251, 0,
+    83, 238, 0,
+    109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 2, 119, 253, 13, 47, 250,
+    99, 255,
+    118, 254, 119, 254, 250, 254, 251, 254, 252, 254, 253, 254, 0, 109, 254,
+    0, 113,
+    254, 0, 115, 254, 0, 117, 254, 2, 120, 254, 2, 119, 254, 16, 45, 254, 47,
+    254, 106,
+    253, 112, 253, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253,
+    0, 51,
+    251, 0, 79, 253, 0, 83, 253, 1, 32, 25, 9, 1, 32, 29, 8, 2, 47, 254, 4,
+    122, 254, 254,
+    254, 0, 1, 254, 2, 119, 255, 22, 102, 255, 112, 254, 122, 254, 233, 255,
+    234, 255,
+    235, 255, 236, 255, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249,
+    254,
+    254, 254, 0, 1, 254, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0,
+    79, 254, 0, 83,
+    254, 2, 119, 250, 3, 119, 255, 120, 255, 37, 45, 242, 46, 251, 47, 240,
+    100, 254,
+    102, 254, 104, 255, 111, 254, 112, 254, 113, 255, 114, 254, 119, 255, 232,
+    254,
+    233, 254, 234, 254, 235, 254, 236, 254, 242, 254, 243, 254, 244, 254, 245,
+    254,
+    246, 254, 247, 254, 249, 254, 0, 9, 254, 0, 15, 254, 0, 21, 254, 0, 25,
+    254, 0, 27,
+    254, 0, 29, 254, 0, 33, 255, 0, 37, 255, 0, 70, 254, 0, 72, 254, 0, 74,
+    254, 0, 79, 254,
+    0, 83, 254, 31, 45, 248, 47, 245, 98, 255, 102, 255, 112, 255, 225, 255,
+    226, 255,
+    227, 255, 228, 255, 229, 255, 230, 255, 233, 255, 234, 255, 235, 255, 236,
+    255,
+    243, 255, 244, 255, 245, 255, 246, 255, 247, 255, 249, 255, 0, 3, 255, 0,
+    5, 255,
+    0, 7, 255, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 255, 0,
+    83, 255, 12,
+    45, 248, 47, 245, 112, 255, 243, 255, 244, 255, 245, 255, 246, 255, 247,
+    255, 249,
+    255, 0, 79, 255, 0, 83, 255, 21, 45, 248, 47, 245, 102, 255, 112, 253,
+    233, 255, 234,
+    255, 235, 255, 236, 255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253,
+    249,
+    253, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 253, 0, 83,
+    253, 51, 68,
+    248, 72, 248, 80, 249, 82, 249, 85, 241, 86, 249, 87, 233, 88, 235, 90,
+    240, 113,
+    253, 118, 249, 119, 240, 120, 242, 122, 245, 200, 248, 211, 249, 212, 249,
+    213,
+    249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    240, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245, 0, 1, 245, 0, 8,
+    248, 0, 14,
+    248, 0, 32, 248, 0, 36, 248, 0, 78, 249, 0, 82, 249, 0, 100, 241, 0, 102,
+    241, 0, 108,
+    249, 0, 109, 249, 0, 112, 249, 0, 113, 249, 0, 114, 249, 0, 115, 249, 0,
+    116, 249,
+    0, 117, 249, 0, 122, 240, 1, 32, 25, 245, 51, 68, 248, 72, 248, 80, 249,
+    82, 249, 85,
+    241, 86, 249, 87, 233, 88, 235, 90, 240, 113, 253, 118, 249, 119, 240,
+    120, 242,
+    122, 245, 200, 248, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249, 217,
+    249,
+    218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 249, 251, 249, 252,
+    249,
+    253, 249, 254, 245, 0, 1, 245, 0, 8, 248, 0, 14, 248, 0, 32, 248, 0, 36,
+    248, 0, 78,
+    249, 0, 82, 249, 0, 100, 241, 0, 102, 241, 0, 108, 249, 0, 109, 249, 0,
+    112, 249, 0,
+    113, 249, 0, 114, 249, 0, 115, 249, 0, 116, 249, 0, 117, 249, 0, 122, 240,
+    1, 32, 25,
+    245, 51, 68, 248, 72, 248, 80, 249, 82, 249, 85, 241, 86, 249, 87, 233,
+    88, 235, 90,
+    240, 113, 253, 118, 249, 119, 240, 120, 242, 122, 245, 200, 248, 211, 249,
+    212,
+    249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249,
+    221,
+    249, 222, 240, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245, 0, 1,
+    245, 0, 8,
+    248, 0, 14, 248, 0, 32, 248, 0, 36, 248, 0, 78, 249, 0, 82, 249, 0, 100,
+    241, 0, 102,
+    241, 0, 108, 249, 0, 109, 249, 0, 112, 249, 0, 113, 249, 0, 114, 249, 0,
+    115, 249,
+    0, 116, 249, 0, 117, 249, 0, 122, 240, 1, 32, 25, 245, 51, 68, 248, 72,
+    248, 80, 249,
+    82, 249, 85, 241, 86, 249, 87, 233, 88, 235, 90, 240, 113, 253, 118, 249,
+    119, 240,
+    120, 242, 122, 245, 200, 248, 211, 249, 212, 249, 213, 249, 214, 249, 215,
+    249,
+    217, 249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 249, 251,
+    249,
+    252, 249, 253, 249, 254, 245, 0, 1, 245, 0, 8, 248, 0, 14, 248, 0, 32,
+    248, 0, 36, 248,
+    0, 78, 249, 0, 82, 249, 0, 100, 241, 0, 102, 241, 0, 108, 249, 0, 109,
+    249, 0, 112,
+    249, 0, 113, 249, 0, 114, 249, 0, 115, 249, 0, 116, 249, 0, 117, 249, 0,
+    122, 240,
+    1, 32, 25, 245, 51, 68, 248, 72, 248, 80, 249, 82, 249, 85, 241, 86, 249,
+    87, 233,
+    88, 235, 90, 240, 113, 253, 118, 249, 119, 240, 120, 242, 122, 245, 200,
+    248, 211,
+    249, 212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249,
+    220,
+    249, 221, 249, 222, 240, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245,
+    0, 1,
+    245, 0, 8, 248, 0, 14, 248, 0, 32, 248, 0, 36, 248, 0, 78, 249, 0, 82,
+    249, 0, 100, 241,
+    0, 102, 241, 0, 108, 249, 0, 109, 249, 0, 112, 249, 0, 113, 249, 0, 114,
+    249, 0, 115,
+    249, 0, 116, 249, 0, 117, 249, 0, 122, 240, 1, 32, 25, 245, 51, 68, 248,
+    72, 248, 80,
+    249, 82, 249, 85, 241, 86, 249, 87, 233, 88, 235, 90, 240, 113, 253, 118,
+    249, 119,
+    240, 120, 242, 122, 245, 200, 248, 211, 249, 212, 249, 213, 249, 214, 249,
+    215,
+    249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 249,
+    251,
+    249, 252, 249, 253, 249, 254, 245, 0, 1, 245, 0, 8, 248, 0, 14, 248, 0,
+    32, 248, 0,
+    36, 248, 0, 78, 249, 0, 82, 249, 0, 100, 241, 0, 102, 241, 0, 108, 249, 0,
+    109, 249,
+    0, 112, 249, 0, 113, 249, 0, 114, 249, 0, 115, 249, 0, 116, 249, 0, 117,
+    249, 0, 122,
+    240, 1, 32, 25, 245, 11, 66, 254, 193, 254, 194, 254, 195, 254, 196, 254,
+    197, 254,
+    198, 254, 0, 2, 254, 0, 4, 254, 0, 6, 254, 20, 66, 250, 85, 250, 87, 249,
+    88, 249, 89,
+    250, 90, 249, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250,
+    222, 249,
+    0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249,
+    20, 66, 250,
+    85, 250, 87, 249, 88, 249, 89, 250, 90, 249, 193, 250, 194, 250, 195, 250,
+    196, 250,
+    197, 250, 198, 250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 249, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250, 90,
+    249, 193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0,
+    4, 250,
+    0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 250, 85, 250,
+    87, 249, 88,
+    249, 89, 250, 90, 249, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250,
+    198, 250,
+    222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0,
+    122, 249, 20,
+    66, 250, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249, 193, 250, 194, 250,
+    195, 250,
+    196, 250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250,
+    0, 100, 250,
+    0, 102, 250, 0, 122, 249, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250,
+    90, 249,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0,
+    2, 250,
+    0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 13, 45, 249,
+    47, 249, 66,
+    247, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 0, 2,
+    247, 0, 4,
+    247, 0, 6, 247, 13, 45, 249, 47, 249, 66, 247, 193, 247, 194, 247, 195,
+    247, 196,
+    247, 197, 247, 198, 247, 0, 2, 247, 0, 4, 247, 0, 6, 247, 13, 45, 249, 47,
+    249, 66,
+    247, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 0, 2,
+    247, 0, 4,
+    247, 0, 6, 247, 13, 45, 249, 47, 249, 66, 247, 193, 247, 194, 247, 195,
+    247, 196,
+    247, 197, 247, 198, 247, 0, 2, 247, 0, 4, 247, 0, 6, 247, 65, 45, 242, 46,
+    242, 47,
+    242, 59, 242, 60, 242, 66, 239, 80, 251, 98, 243, 102, 238, 106, 251, 112,
+    238, 118,
+    242, 193, 239, 194, 239, 195, 239, 196, 239, 197, 239, 198, 239, 211, 251,
+    212,
+    251, 213, 251, 214, 251, 215, 251, 217, 251, 225, 243, 226, 243, 227, 243,
+    228,
+    243, 229, 243, 230, 243, 233, 245, 234, 238, 235, 238, 236, 245, 238, 251,
+    243,
+    238, 244, 238, 245, 238, 246, 238, 247, 238, 249, 238, 250, 242, 251, 242,
+    252,
+    242, 253, 242, 0, 2, 239, 0, 3, 243, 0, 4, 239, 0, 5, 243, 0, 6, 239, 0,
+    7, 243, 0, 21,
+    245, 0, 25, 238, 0, 27, 238, 0, 29, 238, 0, 49, 251, 0, 78, 251, 0, 79,
+    238, 0, 82, 251,
+    0, 83, 238, 0, 109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 2, 119,
+    253, 2, 119,
+    253, 2, 119, 253, 2, 119, 253, 2, 119, 253, 2, 119, 253, 2, 119, 254, 2,
+    119, 254,
+    2, 119, 254, 2, 119, 254, 2, 119, 255, 2, 119, 255, 2, 119, 255, 2, 119,
+    255, 2, 119,
+    250, 3, 119, 255, 120, 255, 3, 119, 255, 120, 255, 3, 119, 255, 120, 255,
+    3, 119,
+    255, 120, 255, 3, 119, 255, 120, 255, 3, 119, 255, 120, 255, 21, 45, 248,
+    47, 245,
+    102, 255, 112, 253, 233, 255, 234, 255, 235, 255, 236, 255, 243, 253, 244,
+    253,
+    245, 253, 246, 253, 247, 253, 249, 253, 0, 21, 255, 0, 25, 255, 0, 27,
+    255, 0, 29,
+    255, 0, 79, 253, 0, 83, 253, 21, 45, 248, 47, 245, 102, 255, 112, 253,
+    233, 255, 234,
+    255, 235, 255, 236, 255, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253,
+    249,
+    253, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 253, 0, 83,
+    253, 51, 68,
+    248, 72, 248, 80, 249, 82, 249, 85, 241, 86, 249, 87, 233, 88, 235, 90,
+    240, 113,
+    253, 118, 249, 119, 240, 120, 242, 122, 245, 200, 248, 211, 249, 212, 249,
+    213,
+    249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    240, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245, 0, 1, 245, 0, 8,
+    248, 0, 14,
+    248, 0, 32, 248, 0, 36, 248, 0, 78, 249, 0, 82, 249, 0, 100, 241, 0, 102,
+    241, 0, 108,
+    249, 0, 109, 249, 0, 112, 249, 0, 113, 249, 0, 114, 249, 0, 115, 249, 0,
+    116, 249,
+    0, 117, 249, 0, 122, 240, 1, 32, 25, 245, 2, 119, 253, 51, 68, 248, 72,
+    248, 80, 249,
+    82, 249, 85, 241, 86, 249, 87, 233, 88, 235, 90, 240, 113, 253, 118, 249,
+    119, 240,
+    120, 242, 122, 245, 200, 248, 211, 249, 212, 249, 213, 249, 214, 249, 215,
+    249,
+    217, 249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 240, 250, 249, 251,
+    249,
+    252, 249, 253, 249, 254, 245, 0, 1, 245, 0, 8, 248, 0, 14, 248, 0, 32,
+    248, 0, 36, 248,
+    0, 78, 249, 0, 82, 249, 0, 100, 241, 0, 102, 241, 0, 108, 249, 0, 109,
+    249, 0, 112,
+    249, 0, 113, 249, 0, 114, 249, 0, 115, 249, 0, 116, 249, 0, 117, 249, 0,
+    122, 240,
+    1, 32, 25, 245, 2, 119, 253, 51, 68, 248, 72, 248, 80, 249, 82, 249, 85,
+    241, 86, 249,
+    87, 233, 88, 235, 90, 240, 113, 253, 118, 249, 119, 240, 120, 242, 122,
+    251, 200,
+    248, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249,
+    219,
+    249, 220, 249, 221, 249, 222, 240, 250, 249, 251, 249, 252, 249, 253, 249,
+    254,
+    251, 0, 1, 251, 0, 8, 248, 0, 14, 248, 0, 32, 248, 0, 36, 248, 0, 78, 249,
+    0, 82, 249,
+    0, 100, 241, 0, 102, 241, 0, 108, 249, 0, 109, 249, 0, 112, 249, 0, 113,
+    249, 0, 114,
+    249, 0, 115, 249, 0, 116, 249, 0, 117, 249, 0, 122, 240, 1, 32, 25, 245,
+    2, 119, 253,
+    17, 47, 254, 66, 251, 87, 250, 88, 250, 90, 250, 193, 251, 194, 251, 195,
+    251, 196,
+    251, 197, 251, 198, 251, 222, 250, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0,
+    122, 250, 17,
+    47, 254, 66, 251, 87, 250, 88, 250, 90, 250, 193, 251, 194, 251, 195, 251,
+    196, 251,
+    197, 251, 198, 251, 222, 250, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 122,
+    250, 2, 120,
+    254, 2, 119, 254, 2, 119, 254, 2, 119, 254, 2, 119, 254, 2, 47, 254, 2,
+    47, 254, 2,
+    119, 255, 2, 119, 255, 40, 80, 252, 102, 253, 112, 253, 118, 254, 122,
+    249, 211,
+    252, 212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 233, 253, 234, 253,
+    235,
+    253, 236, 253, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253,
+    250,
+    254, 251, 254, 252, 254, 253, 254, 254, 249, 0, 1, 249, 0, 21, 253, 0, 25,
+    253, 0,
+    27, 253, 0, 29, 253, 0, 78, 252, 0, 79, 253, 0, 82, 252, 0, 83, 253, 0,
+    109, 254, 0,
+    113, 254, 0, 115, 254, 0, 117, 254, 22, 102, 255, 112, 254, 122, 254, 233,
+    255, 234,
+    255, 235, 255, 236, 255, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254,
+    249,
+    254, 254, 254, 0, 1, 254, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255,
+    0, 79, 254,
+    0, 83, 254, 14, 85, 242, 87, 242, 88, 242, 90, 242, 122, 248, 222, 242,
+    254, 248,
+    0, 1, 248, 0, 100, 242, 0, 102, 242, 0, 122, 242, 1, 32, 25, 239, 1, 32,
+    29, 254, 14,
+    85, 242, 87, 242, 88, 242, 90, 242, 122, 248, 222, 242, 254, 248, 0, 1,
+    248, 0, 100,
+    242, 0, 102, 242, 0, 122, 242, 1, 32, 25, 239, 1, 32, 29, 254, 14, 85,
+    242, 87, 242,
+    88, 242, 90, 242, 122, 248, 222, 242, 254, 248, 0, 1, 248, 0, 100, 242, 0,
+    102, 242,
+    0, 122, 242, 1, 32, 25, 239, 1, 32, 29, 254, 11, 66, 254, 193, 254, 194,
+    254, 195,
+    254, 196, 254, 197, 254, 198, 254, 0, 2, 254, 0, 4, 254, 0, 6, 254, 2,
+    119, 250, 11,
+    66, 254, 193, 254, 194, 254, 195, 254, 196, 254, 197, 254, 198, 254, 0, 2,
+    254, 0,
+    4, 254, 0, 6, 254, 2, 119, 250, 11, 66, 254, 193, 254, 194, 254, 195, 254,
+    196, 254,
+    197, 254, 198, 254, 0, 2, 254, 0, 4, 254, 0, 6, 254, 2, 119, 250, 20, 66,
+    250, 85, 250,
+    87, 249, 88, 249, 89, 250, 90, 249, 193, 250, 194, 250, 195, 250, 196,
+    250, 197,
+    250, 198, 250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 249, 3, 119, 255, 120, 255, 20, 66, 250, 85, 250, 87, 249, 88,
+    249, 89, 250,
+    90, 249, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222,
+    249, 0,
+    2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 3,
+    119, 255, 120,
+    255, 27, 80, 252, 85, 250, 86, 252, 87, 248, 88, 251, 90, 251, 211, 252,
+    212, 252,
+    213, 252, 214, 252, 215, 252, 217, 252, 218, 252, 219, 252, 220, 252, 221,
+    252,
+    222, 251, 0, 78, 252, 0, 82, 252, 0, 100, 250, 0, 102, 250, 0, 108, 252,
+    0, 112, 252,
+    0, 114, 252, 0, 116, 252, 0, 122, 251, 37, 45, 242, 46, 251, 47, 240, 100,
+    254, 102,
+    254, 104, 255, 111, 254, 112, 254, 113, 255, 114, 254, 119, 255, 232, 254,
+    233,
+    254, 234, 254, 235, 254, 236, 254, 242, 254, 243, 254, 244, 254, 245, 254,
+    246,
+    254, 247, 254, 249, 254, 0, 9, 254, 0, 15, 254, 0, 21, 254, 0, 25, 254, 0,
+    27, 254,
+    0, 29, 254, 0, 33, 255, 0, 37, 255, 0, 70, 254, 0, 72, 254, 0, 74, 254, 0,
+    79, 254, 0,
+    83, 254, 27, 80, 252, 85, 250, 86, 252, 87, 248, 88, 251, 90, 251, 211,
+    252, 212,
+    252, 213, 252, 214, 252, 215, 252, 217, 252, 218, 252, 219, 252, 220, 252,
+    221,
+    252, 222, 251, 0, 78, 252, 0, 82, 252, 0, 100, 250, 0, 102, 250, 0, 108,
+    252, 0, 112,
+    252, 0, 114, 252, 0, 116, 252, 0, 122, 251, 37, 45, 242, 46, 251, 47, 240,
+    100, 254,
+    102, 254, 104, 255, 111, 254, 112, 254, 113, 255, 114, 254, 119, 255, 232,
+    254,
+    233, 254, 234, 254, 235, 254, 236, 254, 242, 254, 243, 254, 244, 254, 245,
+    254,
+    246, 254, 247, 254, 249, 254, 0, 9, 254, 0, 15, 254, 0, 21, 254, 0, 25,
+    254, 0, 27,
+    254, 0, 29, 254, 0, 33, 255, 0, 37, 255, 0, 70, 254, 0, 72, 254, 0, 74,
+    254, 0, 79, 254,
+    0, 83, 254, 27, 80, 252, 85, 250, 86, 252, 87, 248, 88, 251, 90, 251, 211,
+    252, 212,
+    252, 213, 252, 214, 252, 215, 252, 217, 252, 218, 252, 219, 252, 220, 252,
+    221,
+    252, 222, 251, 0, 78, 252, 0, 82, 252, 0, 100, 250, 0, 102, 250, 0, 108,
+    252, 0, 112,
+    252, 0, 114, 252, 0, 116, 252, 0, 122, 251, 37, 45, 242, 46, 251, 47, 240,
+    100, 254,
+    102, 254, 104, 255, 111, 254, 112, 254, 113, 255, 114, 254, 119, 255, 232,
+    254,
+    233, 254, 234, 254, 235, 254, 236, 254, 242, 254, 243, 254, 244, 254, 245,
+    254,
+    246, 254, 247, 254, 249, 254, 0, 9, 254, 0, 15, 254, 0, 21, 254, 0, 25,
+    254, 0, 27,
+    254, 0, 29, 254, 0, 33, 255, 0, 37, 255, 0, 70, 254, 0, 72, 254, 0, 74,
+    254, 0, 79, 254,
+    0, 83, 254, 73, 45, 245, 46, 242, 47, 242, 59, 245, 60, 245, 66, 242, 80,
+    254, 98,
+    242, 102, 242, 106, 254, 112, 242, 115, 245, 118, 242, 120, 245, 122, 251,
+    193,
+    242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211, 254, 212, 254,
+    213,
+    254, 214, 254, 215, 254, 217, 254, 225, 248, 226, 242, 227, 248, 228, 248,
+    229,
+    248, 230, 242, 233, 248, 234, 242, 235, 242, 236, 248, 238, 254, 243, 242,
+    244,
+    242, 245, 242, 246, 242, 247, 242, 249, 242, 250, 242, 251, 242, 252, 242,
+    253,
+    242, 254, 251, 0, 1, 251, 0, 2, 242, 0, 3, 248, 0, 4, 242, 0, 5, 248, 0,
+    6, 242, 0, 7,
+    242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49, 254, 0, 78,
+    254, 0, 79, 242,
+    0, 82, 254, 0, 83, 242, 0, 87, 245, 0, 89, 245, 0, 91, 245, 0, 109, 242,
+    0, 113, 242,
+    0, 115, 242, 0, 117, 242, 73, 45, 245, 46, 242, 47, 242, 59, 245, 60, 245,
+    66, 242,
+    80, 254, 98, 242, 102, 242, 106, 254, 112, 242, 115, 245, 118, 242, 120,
+    245, 122,
+    251, 193, 242, 194, 242, 195, 242, 196, 242, 197, 242, 198, 242, 211, 254,
+    212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 248, 226, 242, 227, 248,
+    228,
+    248, 229, 248, 230, 242, 233, 248, 234, 242, 235, 242, 236, 248, 238, 254,
+    243,
+    242, 244, 242, 245, 242, 246, 242, 247, 242, 249, 242, 250, 242, 251, 242,
+    252,
+    242, 253, 242, 254, 251, 0, 1, 251, 0, 2, 242, 0, 3, 248, 0, 4, 242, 0, 5,
+    248, 0, 6,
+    242, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49,
+    254, 0, 78, 254,
+    0, 79, 242, 0, 82, 254, 0, 83, 242, 0, 87, 245, 0, 89, 245, 0, 91, 245, 0,
+    109, 242,
+    0, 113, 242, 0, 115, 242, 0, 117, 242, 13, 45, 249, 47, 249, 66, 247, 193,
+    247, 194,
+    247, 195, 247, 196, 247, 197, 247, 198, 247, 0, 2, 247, 0, 4, 247, 0, 6,
+    247, 13, 45,
+    249, 47, 249, 66, 247, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247,
+    198, 247,
+    0, 2, 247, 0, 4, 247, 0, 6, 247, 13, 45, 249, 47, 249, 66, 247, 193, 247,
+    194, 247,
+    195, 247, 196, 247, 197, 247, 198, 247, 0, 2, 247, 0, 4, 247, 0, 6, 247,
+    13, 45, 249,
+    47, 249, 66, 247, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198,
+    247, 0,
+    2, 247, 0, 4, 247, 0, 6, 247, 65, 45, 242, 46, 242, 47, 242, 59, 242, 60,
+    242, 66, 239,
+    80, 251, 98, 243, 102, 238, 106, 251, 112, 238, 118, 242, 193, 239, 194,
+    239, 195,
+    239, 196, 239, 197, 239, 198, 239, 211, 251, 212, 251, 213, 251, 214, 251,
+    215,
+    251, 217, 251, 225, 243, 226, 243, 227, 243, 228, 243, 229, 243, 230, 243,
+    233,
+    245, 234, 238, 235, 238, 236, 245, 238, 251, 243, 238, 244, 238, 245, 238,
+    246,
+    238, 247, 238, 249, 238, 250, 242, 251, 242, 252, 242, 253, 242, 0, 2,
+    239, 0, 3,
+    243, 0, 4, 239, 0, 5, 243, 0, 6, 239, 0, 7, 243, 0, 21, 245, 0, 25, 238,
+    0, 27, 238, 0,
+    29, 238, 0, 49, 251, 0, 78, 251, 0, 79, 238, 0, 82, 251, 0, 83, 238, 0,
+    109, 242, 0,
+    113, 242, 0, 115, 242, 0, 117, 242, 12, 66, 255, 193, 255, 194, 255, 195,
+    255, 196,
+    255, 197, 255, 198, 255, 0, 2, 255, 0, 4, 255, 0, 6, 255, 1, 32, 24, 246,
+    15, 33, 245,
+    101, 254, 115, 254, 116, 251, 119, 254, 0, 19, 254, 0, 87, 254, 0, 89,
+    254, 0, 91,
+    254, 0, 93, 251, 0, 97, 251, 0, 99, 251, 1, 2, 25, 251, 1, 32, 25, 246,
+    11, 66, 255,
+    193, 255, 194, 255, 195, 255, 196, 255, 197, 255, 198, 255, 0, 2, 255, 0,
+    4, 255,
+    0, 6, 255
 };
 static afm_cuint16 afm_Times_Bold_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Times_Bold_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Times_Bold_ligatures[] = {  /* 3 */
+    102, 105, 64257
 };
 
 
@@ -2209,325 +4213,631 @@ static afm_cunicode afm_Times_Bold_ligatures[] = { /* 3 */
 /* FullName: Times Bold Italic */
 /* FamilyName: Times */
 static afm_cuint8 afm_Times_BoldItalic_widths[] = { /* 315 */
-  42,65,93,83,83,139,130,46,56,56,83,95,42,56,42,46,83,83,83,83,83,
-  83,83,83,83,83,56,56,95,95,95,83,139,111,111,111,120,111,111,120,
-  130,65,83,111,102,148,120,120,102,120,111,93,102,120,111,148,111,
-  102,102,56,46,56,95,83,56,83,83,74,83,74,56,83,93,46,46,83,46,130,
-  93,83,83,83,65,65,46,93,74,111,83,74,65,58,37,58,95,65,83,83,83,
-  83,37,83,56,125,44,83,101,125,56,67,95,50,50,56,96,83,42,56,50,50,
-  83,125,125,125,83,111,111,111,111,111,111,157,111,111,111,111,111,
-  65,65,65,65,120,120,120,120,120,120,120,95,120,120,120,120,120,102,
-  102,83,83,83,83,83,83,83,120,74,74,74,74,74,46,46,46,46,83,93,83,
-  83,83,83,83,95,83,93,93,93,93,74,83,74,111,83,111,83,111,83,111,
-  74,111,74,120,101,120,83,111,74,111,74,111,74,111,74,120,83,120,
-  83,65,46,65,46,65,46,111,83,102,46,102,46,102,64,102,46,120,93,120,
-  93,120,93,120,83,120,83,157,120,111,65,111,65,111,65,93,65,93,65,
-  93,65,102,46,102,61,120,93,120,93,120,93,120,93,102,102,65,102,65,
-  102,65,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,83,83,83,
-  83,83,58,167,167,56,56,28,83,167,82,102,100,101,92,92,92,92,82,42,
-  93,93
+    42, 65, 93, 83, 83, 139, 130, 46, 56, 56, 83, 95, 42, 56, 42, 46, 83, 83,
+    83, 83, 83,
+    83, 83, 83, 83, 83, 56, 56, 95, 95, 95, 83, 139, 111, 111, 111, 120, 111,
+    111, 120,
+    130, 65, 83, 111, 102, 148, 120, 120, 102, 120, 111, 93, 102, 120, 111,
+    148, 111,
+    102, 102, 56, 46, 56, 95, 83, 56, 83, 83, 74, 83, 74, 56, 83, 93, 46, 46,
+    83, 46, 130,
+    93, 83, 83, 83, 65, 65, 46, 93, 74, 111, 83, 74, 65, 58, 37, 58, 95, 65,
+    83, 83, 83,
+    83, 37, 83, 56, 125, 44, 83, 101, 125, 56, 67, 95, 50, 50, 56, 96, 83, 42,
+    56, 50, 50,
+    83, 125, 125, 125, 83, 111, 111, 111, 111, 111, 111, 157, 111, 111, 111,
+    111, 111,
+    65, 65, 65, 65, 120, 120, 120, 120, 120, 120, 120, 95, 120, 120, 120, 120,
+    120, 102,
+    102, 83, 83, 83, 83, 83, 83, 83, 120, 74, 74, 74, 74, 74, 46, 46, 46, 46,
+    83, 93, 83,
+    83, 83, 83, 83, 95, 83, 93, 93, 93, 93, 74, 83, 74, 111, 83, 111, 83, 111,
+    83, 111,
+    74, 111, 74, 120, 101, 120, 83, 111, 74, 111, 74, 111, 74, 111, 74, 120,
+    83, 120,
+    83, 65, 46, 65, 46, 65, 46, 111, 83, 102, 46, 102, 46, 102, 64, 102, 46,
+    120, 93, 120,
+    93, 120, 93, 120, 83, 120, 83, 157, 120, 111, 65, 111, 65, 111, 65, 93,
+    65, 93, 65,
+    93, 65, 102, 46, 102, 61, 120, 93, 120, 93, 120, 93, 120, 93, 102, 102,
+    65, 102, 65,
+    102, 65, 83, 93, 65, 56, 56, 56, 56, 56, 56, 56, 56, 83, 167, 56, 56, 56,
+    83, 83, 83,
+    83, 83, 58, 167, 167, 56, 56, 28, 83, 167, 82, 102, 100, 101, 92, 92, 92,
+    92, 82, 42,
+    93, 93
 };
-static afm_sint16 afm_Times_BoldItalic_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,36,0,45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,54,173,0,219,0,254,0,0,0,374,489,581,0,612,636,681,774,797,0,
-  859,1027,1051,1207,0,1362,0,0,0,0,0,0,0,0,1510,1537,0,1545,1548,
-  0,0,0,0,1587,0,0,1630,1633,0,0,1647,0,0,0,1652,1699,1769,1792,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,1797,1916,2035,2154,2273,2392,0,0,0,0,0,0,0,0,0,0,0,2511,2535,
-  2580,2625,2670,2715,0,2760,2805,2829,2853,2877,2901,0,0,0,0,0,0,
-  0,0,0,3049,3057,3060,3063,3066,0,0,0,0,0,3069,3072,3086,3100,3114,
-  3128,0,3142,0,0,0,0,3156,0,3161,3166,0,3285,0,3404,0,0,3523,0,3531,
-  3539,0,3574,0,0,3609,0,3612,0,3615,0,3618,0,0,0,0,0,0,0,0,0,0,3621,
-  3713,3756,0,3787,0,0,0,3818,0,3849,3873,3876,3900,3903,3927,3930,
-  3975,3989,4034,0,0,4048,4110,4115,4177,4182,4244,0,0,0,0,0,0,4249,
-  0,4417,0,4585,0,4609,0,4633,0,4657,0,4681,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,4829,4834,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,0,0
+static afm_sint16 afm_Times_BoldItalic_kerning_index[] = {  /* 315 */
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 54, 173, 0, 219, 0, 254, 0, 0, 0, 374, 489, 581, 0, 612, 636, 681,
+    774, 797, 0,
+    859, 1027, 1051, 1207, 0, 1362, 0, 0, 0, 0, 0, 0, 0, 0, 1510, 1537, 0,
+    1545, 1548,
+    0, 0, 0, 0, 1587, 0, 0, 1630, 1633, 0, 0, 1647, 0, 0, 0, 1652, 1699, 1769,
+    1792, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 1797, 1916, 2035, 2154, 2273, 2392, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    2511, 2535,
+    2580, 2625, 2670, 2715, 0, 2760, 2805, 2829, 2853, 2877, 2901, 0, 0, 0, 0,
+    0, 0,
+    0, 0, 0, 3049, 3057, 3060, 3063, 3066, 0, 0, 0, 0, 0, 3069, 3072, 3086,
+    3100, 3114,
+    3128, 0, 3142, 0, 0, 0, 0, 3156, 0, 3161, 3166, 0, 3285, 0, 3404, 0, 0,
+    3523, 0, 3531,
+    3539, 0, 3574, 0, 0, 3609, 0, 3612, 0, 3615, 0, 3618, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 3621,
+    3713, 3756, 0, 3787, 0, 0, 0, 3818, 0, 3849, 3873, 3876, 3900, 3903, 3927,
+    3930,
+    3975, 3989, 4034, 0, 0, 4048, 4110, 4115, 4177, 4182, 4244, 0, 0, 0, 0, 0,
+    0, 4249,
+    0, 4417, 0, 4585, 0, 4609, 0, 4633, 0, 4657, 0, 4681, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 4829, 4834, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0
 };
-static afm_cuint8 afm_Times_BoldItalic_kerning_data[] = { /* 4879 */
-  42,16,66,251,87,245,88,245,90,245,193,251,194,251,195,251,196,251,
-  197,251,198,251,222,245,0,2,251,0,4,251,0,6,251,0,122,245,3,1,32,
-  25,241,1,32,29,241,3,1,32,25,241,1,32,29,241,50,68,246,72,247,80,
-  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
-  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
-  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
-  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
-  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
-  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
-  25,245,20,66,253,86,255,193,253,194,253,195,253,196,253,197,253,
-  198,253,218,255,219,255,220,255,221,255,0,2,253,0,4,253,0,6,253,
-  0,108,255,0,112,255,0,114,255,0,116,255,16,66,253,87,249,88,250,
-  90,249,193,253,194,253,195,253,196,253,197,253,198,253,222,249,0,
-  2,253,0,4,253,0,6,253,0,122,249,52,45,235,47,235,66,240,98,241,102,
-  240,106,250,112,245,115,249,193,240,194,240,195,240,196,240,197,
-  240,198,240,225,241,226,241,227,241,228,241,229,241,230,241,233,
-  240,234,240,235,240,236,240,237,250,238,250,239,250,240,250,243,
-  245,244,245,245,245,246,245,247,245,249,245,0,2,240,0,3,241,0,4,
-  240,0,5,241,0,6,240,0,7,241,0,21,240,0,25,240,0,27,240,0,29,240,
-  0,45,250,0,49,250,0,79,245,0,83,245,0,87,249,0,89,249,0,91,249,50,
-  45,255,47,255,66,253,98,250,102,250,112,250,118,250,193,253,194,
-  253,195,253,196,253,197,253,198,253,225,250,226,250,227,250,228,
-  250,229,250,230,250,233,250,234,250,235,250,236,250,243,250,244,
-  250,245,250,246,250,247,250,249,250,250,250,251,250,252,250,253,
-  250,0,2,253,0,3,250,0,4,253,0,5,250,0,6,253,0,7,250,0,21,250,0,25,
-  250,0,27,250,0,29,250,0,79,250,0,83,250,0,109,250,0,113,250,0,115,
-  250,0,117,250,40,80,252,102,253,112,253,118,254,122,254,211,252,
-  212,252,213,252,214,252,215,252,217,252,233,253,234,253,235,253,
-  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,254,
-  251,254,252,254,253,254,254,254,0,1,254,0,21,253,0,25,253,0,27,253,
-  0,29,253,0,78,252,0,79,253,0,82,252,0,83,253,0,109,254,0,113,254,
-  0,115,254,0,117,254,13,85,254,87,251,88,251,90,251,122,251,222,251,
-  254,251,0,1,251,0,100,254,0,102,254,0,122,251,1,32,25,248,11,66,
-  252,193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,
-  252,0,6,252,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,
-  194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,
-  0,6,250,0,100,250,0,102,250,0,122,249,41,45,235,47,235,66,243,98,
-  250,102,249,112,248,193,243,194,243,195,243,196,243,197,243,198,
-  243,225,250,226,250,227,250,228,250,229,250,230,250,233,249,234,
-  249,235,249,236,249,243,248,244,248,245,248,246,248,247,248,249,
-  248,0,2,243,0,3,250,0,4,243,0,5,250,0,6,243,0,7,250,0,21,249,0,25,
-  249,0,27,249,0,29,249,0,79,248,0,83,248,10,86,255,218,255,219,255,
-  220,255,221,255,0,108,255,0,112,255,0,114,255,0,116,255,27,80,250,
-  85,252,86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,
-  215,250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,
-  0,82,250,0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,
-  250,0,122,254,73,45,242,46,242,47,242,59,245,60,245,66,248,80,254,
-  98,242,102,242,106,251,112,241,115,251,118,251,120,251,122,251,193,
-  248,194,248,195,248,196,248,197,248,198,248,211,254,212,254,213,
-  254,214,254,215,254,217,254,225,242,226,242,227,242,228,242,229,
-  242,230,242,233,248,234,242,235,242,236,248,238,251,243,241,244,
-  241,245,241,246,241,247,241,249,241,250,251,251,251,252,251,253,
-  251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,0,5,242,0,6,248,0,7,
-  242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,251,0,78,254,0,79,241,
-  0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,0,109,251,0,113,251,
-  0,115,251,0,117,251,11,66,249,193,249,194,249,195,249,196,249,197,
-  249,198,249,0,2,249,0,4,249,0,6,249,68,45,235,46,245,47,235,59,245,
-  60,245,66,243,72,255,80,252,98,238,102,238,106,248,112,238,118,248,
-  193,243,194,243,195,243,196,243,197,243,198,243,211,252,212,252,
-  213,252,214,252,215,252,217,252,225,238,226,238,227,238,228,238,
-  229,238,230,238,233,245,234,238,235,238,236,245,238,248,243,238,
-  244,238,245,238,246,238,247,238,249,238,250,248,251,248,252,248,
-  253,248,0,2,243,0,3,238,0,4,243,0,5,238,0,6,243,0,7,238,0,21,245,
-  0,25,238,0,27,238,0,29,238,0,32,255,0,36,255,0,49,248,0,78,252,0,
-  79,238,0,82,252,0,83,238,0,109,248,0,113,248,0,115,248,0,117,248,
-  68,45,245,46,249,47,245,59,248,60,248,66,245,80,254,98,243,102,242,
-  106,251,112,244,118,248,122,248,193,245,194,245,195,245,196,245,
-  197,245,198,245,211,254,212,254,213,254,214,254,215,254,217,254,
-  225,243,226,243,227,243,228,243,229,243,230,243,233,249,234,242,
-  235,242,236,249,238,251,243,244,244,244,245,244,246,244,247,244,
-  249,244,250,248,251,248,252,248,253,248,254,248,0,1,248,0,2,245,
-  0,3,243,0,4,245,0,5,243,0,6,245,0,7,243,0,21,249,0,25,242,0,27,242,
-  0,29,242,0,49,251,0,78,254,0,79,244,0,82,254,0,83,244,0,109,248,
-  0,113,248,0,115,248,0,117,248,65,45,242,46,242,47,245,59,242,60,
-  242,66,245,80,253,98,242,102,238,106,248,112,238,118,242,193,245,
-  194,245,195,245,196,245,197,245,198,245,211,253,212,253,213,253,
-  214,253,215,253,217,253,225,242,226,242,227,242,228,242,229,242,
-  230,242,233,245,234,238,235,245,236,245,238,248,243,238,244,238,
-  245,238,246,238,247,238,249,238,250,242,251,242,252,242,253,242,
-  0,2,245,0,3,242,0,4,245,0,5,242,0,6,245,0,7,242,0,21,245,0,25,238,
-  0,27,238,0,29,238,0,49,248,0,78,253,0,79,238,0,82,253,0,83,238,0,
-  109,242,0,113,242,0,115,242,0,117,242,12,47,250,99,255,118,254,250,
-  254,251,254,252,254,253,254,0,109,254,0,113,254,0,115,254,0,117,
-  254,4,105,255,108,255,0,57,255,2,99,255,17,45,255,47,255,102,255,
-  103,254,112,255,234,255,243,255,244,255,245,255,246,255,249,255,
-  0,25,255,0,27,255,0,51,252,0,83,255,1,32,25,9,19,102,252,112,255,
-  233,252,234,252,235,252,236,252,243,255,244,255,245,255,246,255,
-  247,255,249,255,0,21,252,0,25,252,0,27,252,0,29,252,0,79,255,0,83,
-  255,2,119,250,7,119,254,120,253,121,255,122,255,254,255,0,1,255,
-  3,45,246,47,246,21,45,251,47,251,102,254,112,254,233,254,234,254,
-  235,254,236,254,243,254,244,254,245,254,246,254,247,254,249,254,
-  0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,31,45,251,
-  47,251,98,255,102,255,112,254,225,255,226,255,227,255,228,255,229,
-  255,230,255,233,255,234,255,235,255,236,255,243,254,244,254,245,
-  254,246,254,247,254,249,254,0,3,255,0,5,255,0,7,255,0,21,255,0,25,
-  255,0,27,255,0,29,255,0,79,254,0,83,254,10,102,255,233,255,234,255,
-  235,255,236,255,0,21,255,0,25,255,0,27,255,0,29,255,3,45,251,47,
-  251,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,90,
-  245,118,252,119,245,120,245,122,245,200,246,211,249,212,249,213,
-  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
-  245,250,252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,
-  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
-  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
-  0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,249,82,248,85,
-  248,86,249,87,241,88,240,90,245,118,252,119,245,120,245,122,245,
-  200,246,211,249,212,249,213,249,214,249,215,249,217,249,218,249,
-  219,249,220,249,221,249,222,245,250,252,251,252,252,252,253,252,
-  254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,
-  249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,0,113,252,
-  0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,
-  68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,90,245,118,
-  252,119,245,120,245,122,245,200,246,211,249,212,249,213,249,214,
-  249,215,249,217,249,218,249,219,249,220,249,221,249,222,245,250,
-  252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,
-  247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,
-  252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,
-  0,122,245,1,32,25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,
-  87,241,88,240,90,245,118,252,119,245,120,245,122,245,200,246,211,
-  249,212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,
-  249,221,249,222,245,250,252,251,252,252,252,253,252,254,245,0,1,
-  245,0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,
-  0,102,248,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,
-  252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,
-  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
-  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
-  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
-  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
-  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
-  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
-  25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,
-  90,245,118,252,119,245,120,245,122,245,200,246,211,249,212,249,213,
-  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
-  245,250,252,251,252,252,252,253,252,254,245,0,1,245,0,8,246,0,14,
-  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
-  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
-  0,117,252,0,122,245,1,32,25,245,11,66,252,193,252,194,252,195,252,
-  196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,250,85,250,
-  87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,
-  250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,
-  0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,
-  250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,
-  250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,88,249,
-  89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,250,222,
-  249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,
-  250,85,250,87,249,88,249,89,250,90,249,193,250,194,250,195,250,196,
-  250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,
-  102,250,0,122,249,20,66,250,85,250,87,249,88,249,89,250,90,249,193,
-  250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,
-  250,0,6,250,0,100,250,0,102,250,0,122,249,20,66,250,85,250,87,249,
-  88,249,89,250,90,249,193,250,194,250,195,250,196,250,197,250,198,
-  250,222,249,0,2,250,0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,
-  11,66,249,193,249,194,249,195,249,196,249,197,249,198,249,0,2,249,
-  0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,196,249,197,249,
-  198,249,0,2,249,0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,
-  196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,11,66,249,193,249,
-  194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,
-  65,45,242,46,242,47,245,59,242,60,242,66,245,80,253,98,242,102,238,
-  106,248,112,238,118,242,193,245,194,245,195,245,196,245,197,245,
-  198,245,211,253,212,253,213,253,214,253,215,253,217,253,225,242,
-  226,242,227,242,228,242,229,242,230,242,233,245,234,238,235,245,
-  236,245,238,248,243,238,244,238,245,238,246,238,247,238,249,238,
-  250,242,251,242,252,242,253,242,0,2,245,0,3,242,0,4,245,0,5,242,
-  0,6,245,0,7,242,0,21,245,0,25,238,0,27,238,0,29,238,0,49,248,0,78,
-  253,0,79,238,0,82,253,0,83,238,0,109,242,0,113,242,0,115,242,0,117,
-  242,4,105,255,108,255,0,57,255,2,99,255,2,99,255,2,99,255,2,99,255,
-  2,119,250,7,119,254,120,253,121,255,122,255,254,255,0,1,255,7,119,
-  254,120,253,121,255,122,255,254,255,0,1,255,7,119,254,120,253,121,
-  255,122,255,254,255,0,1,255,7,119,254,120,253,121,255,122,255,254,
-  255,0,1,255,7,119,254,120,253,121,255,122,255,254,255,0,1,255,7,
-  119,254,120,253,121,255,122,255,254,255,0,1,255,3,45,251,47,251,
-  3,45,251,47,251,50,68,246,72,247,80,249,82,248,85,248,86,249,87,
-  241,88,240,90,245,118,252,119,245,120,245,122,245,200,246,211,249,
-  212,249,213,249,214,249,215,249,217,249,218,249,219,249,220,249,
-  221,249,222,245,250,252,251,252,252,252,253,252,254,245,0,1,245,
-  0,8,246,0,14,246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,
-  102,248,0,108,249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,
-  252,0,116,249,0,117,252,0,122,245,1,32,25,245,50,68,246,72,247,80,
-  249,82,248,85,248,86,249,87,241,88,240,90,245,118,252,119,245,120,
-  245,122,245,200,246,211,249,212,249,213,249,214,249,215,249,217,
-  249,218,249,219,249,220,249,221,249,222,245,250,252,251,252,252,
-  252,253,252,254,245,0,1,245,0,8,246,0,14,246,0,32,247,0,36,247,0,
-  78,249,0,82,249,0,100,248,0,102,248,0,108,249,0,109,252,0,112,249,
-  0,113,252,0,114,249,0,115,252,0,116,249,0,117,252,0,122,245,1,32,
-  25,245,50,68,246,72,247,80,249,82,248,85,248,86,249,87,241,88,240,
-  90,245,118,252,119,245,120,245,122,251,200,246,211,249,212,249,213,
-  249,214,249,215,249,217,249,218,249,219,249,220,249,221,249,222,
-  245,250,252,251,252,252,252,253,252,254,251,0,1,251,0,8,246,0,14,
-  246,0,32,247,0,36,247,0,78,249,0,82,249,0,100,248,0,102,248,0,108,
-  249,0,109,252,0,112,249,0,113,252,0,114,249,0,115,252,0,116,249,
-  0,117,252,0,122,245,1,32,25,245,4,105,255,108,255,0,57,255,4,105,
-  255,108,255,0,57,255,16,66,253,87,249,88,250,90,249,193,253,194,
-  253,195,253,196,253,197,253,198,253,222,249,0,2,253,0,4,253,0,6,
-  253,0,122,249,16,66,253,87,249,88,250,90,249,193,253,194,253,195,
-  253,196,253,197,253,198,253,222,249,0,2,253,0,4,253,0,6,253,0,122,
-  249,2,99,255,2,99,255,2,99,255,2,99,255,40,80,252,102,253,112,253,
-  118,254,122,254,211,252,212,252,213,252,214,252,215,252,217,252,
-  233,253,234,253,235,253,236,253,243,253,244,253,245,253,246,253,
-  247,253,249,253,250,254,251,254,252,254,253,254,254,254,0,1,254,
-  0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,0,79,253,0,82,252,0,
-  83,253,0,109,254,0,113,254,0,115,254,0,117,254,19,102,252,112,255,
-  233,252,234,252,235,252,236,252,243,255,244,255,245,255,246,255,
-  247,255,249,255,0,21,252,0,25,252,0,27,252,0,29,252,0,79,255,0,83,
-  255,13,85,254,87,251,88,251,90,251,122,251,222,251,254,251,0,1,251,
-  0,100,254,0,102,254,0,122,251,1,32,25,248,13,85,254,87,251,88,251,
-  90,251,122,251,222,251,254,251,0,1,251,0,100,254,0,102,254,0,122,
-  251,1,32,25,248,13,85,254,87,251,88,251,90,251,122,251,222,251,254,
-  251,0,1,251,0,100,254,0,102,254,0,122,251,1,32,25,248,11,66,252,
-  193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,
-  0,6,252,2,119,250,11,66,252,193,252,194,252,195,252,196,252,197,
-  252,198,252,0,2,252,0,4,252,0,6,252,2,119,250,11,66,252,193,252,
-  194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,
-  2,119,250,20,66,250,85,250,87,249,88,249,89,250,90,249,193,250,194,
-  250,195,250,196,250,197,250,198,250,222,249,0,2,250,0,4,250,0,6,
-  250,0,100,250,0,102,250,0,122,249,7,119,254,120,253,121,255,122,
-  255,254,255,0,1,255,20,66,250,85,250,87,249,88,249,89,250,90,249,
-  193,250,194,250,195,250,196,250,197,250,198,250,222,249,0,2,250,
-  0,4,250,0,6,250,0,100,250,0,102,250,0,122,249,7,119,254,120,253,
-  121,255,122,255,254,255,0,1,255,27,80,250,85,252,86,250,87,254,88,
-  254,90,254,211,250,212,250,213,250,214,250,215,250,217,250,218,250,
-  219,250,220,250,221,250,222,254,0,78,250,0,82,250,0,100,252,0,102,
-  252,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,3,45,246,47,
-  246,27,80,250,85,252,86,250,87,254,88,254,90,254,211,250,212,250,
-  213,250,214,250,215,250,217,250,218,250,219,250,220,250,221,250,
-  222,254,0,78,250,0,82,250,0,100,252,0,102,252,0,108,250,0,112,250,
-  0,114,250,0,116,250,0,122,254,3,45,246,47,246,27,80,250,85,252,86,
-  250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,215,250,
-  217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,0,82,250,
-  0,100,252,0,102,252,0,108,250,0,112,250,0,114,250,0,116,250,0,122,
-  254,3,45,246,47,246,73,45,242,46,242,47,242,59,245,60,245,66,248,
-  80,254,98,242,102,242,106,251,112,241,115,251,118,251,120,251,122,
-  251,193,248,194,248,195,248,196,248,197,248,198,248,211,254,212,
-  254,213,254,214,254,215,254,217,254,225,242,226,242,227,242,228,
-  242,229,242,230,242,233,248,234,242,235,242,236,248,238,251,243,
-  241,244,241,245,241,246,241,247,241,249,241,250,251,251,251,252,
-  251,253,251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,0,5,242,0,6,
-  248,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,251,0,78,254,
-  0,79,241,0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,0,109,251,
-  0,113,251,0,115,251,0,117,251,73,45,242,46,242,47,242,59,245,60,
-  245,66,248,80,254,98,242,102,242,106,251,112,241,115,251,118,251,
-  120,251,122,251,193,248,194,248,195,248,196,248,197,248,198,248,
-  211,254,212,254,213,254,214,254,215,254,217,254,225,242,226,242,
-  227,242,228,242,229,242,230,242,233,248,234,242,235,242,236,248,
-  238,251,243,241,244,241,245,241,246,241,247,241,249,241,250,251,
-  251,251,252,251,253,251,254,251,0,1,251,0,2,248,0,3,242,0,4,248,
-  0,5,242,0,6,248,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,
-  251,0,78,254,0,79,241,0,82,254,0,83,241,0,87,251,0,89,251,0,91,251,
-  0,109,251,0,113,251,0,115,251,0,117,251,11,66,249,193,249,194,249,
-  195,249,196,249,197,249,198,249,0,2,249,0,4,249,0,6,249,11,66,249,
-  193,249,194,249,195,249,196,249,197,249,198,249,0,2,249,0,4,249,
-  0,6,249,11,66,249,193,249,194,249,195,249,196,249,197,249,198,249,
-  0,2,249,0,4,249,0,6,249,11,66,249,193,249,194,249,195,249,196,249,
-  197,249,198,249,0,2,249,0,4,249,0,6,249,65,45,242,46,242,47,245,
-  59,242,60,242,66,245,80,253,98,242,102,238,106,248,112,238,118,242,
-  193,245,194,245,195,245,196,245,197,245,198,245,211,253,212,253,
-  213,253,214,253,215,253,217,253,225,242,226,242,227,242,228,242,
-  229,242,230,242,233,245,234,238,235,245,236,245,238,248,243,238,
-  244,238,245,238,246,238,247,238,249,238,250,242,251,242,252,242,
-  253,242,0,2,245,0,3,242,0,4,245,0,5,242,0,6,245,0,7,242,0,21,245,
-  0,25,238,0,27,238,0,29,238,0,49,248,0,78,253,0,79,238,0,82,253,0,
-  83,238,0,109,242,0,113,242,0,115,242,0,117,242,2,1,32,24,245,17,
-  33,245,101,254,115,254,116,245,117,251,119,254,0,19,254,0,87,254,
-  0,89,254,0,91,254,0,93,245,0,97,245,0,99,245,0,101,251,1,2,25,245,
-  1,32,25,245
+static afm_cuint8 afm_Times_BoldItalic_kerning_data[] = {   /* 4879 */
+    42, 16, 66, 251, 87, 245, 88, 245, 90, 245, 193, 251, 194, 251, 195, 251,
+    196, 251,
+    197, 251, 198, 251, 222, 245, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 122,
+    245, 3, 1, 32,
+    25, 241, 1, 32, 29, 241, 3, 1, 32, 25, 241, 1, 32, 29, 241, 50, 68, 246,
+    72, 247, 80,
+    249, 82, 248, 85, 248, 86, 249, 87, 241, 88, 240, 90, 245, 118, 252, 119,
+    245, 120,
+    245, 122, 245, 200, 246, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249,
+    217,
+    249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 245, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 245, 0, 1, 245, 0, 8, 246, 0, 14, 246, 0, 32, 247, 0,
+    36, 247, 0,
+    78, 249, 0, 82, 249, 0, 100, 248, 0, 102, 248, 0, 108, 249, 0, 109, 252,
+    0, 112, 249,
+    0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122,
+    245, 1, 32,
+    25, 245, 20, 66, 253, 86, 255, 193, 253, 194, 253, 195, 253, 196, 253,
+    197, 253,
+    198, 253, 218, 255, 219, 255, 220, 255, 221, 255, 0, 2, 253, 0, 4, 253, 0,
+    6, 253,
+    0, 108, 255, 0, 112, 255, 0, 114, 255, 0, 116, 255, 16, 66, 253, 87, 249,
+    88, 250,
+    90, 249, 193, 253, 194, 253, 195, 253, 196, 253, 197, 253, 198, 253, 222,
+    249, 0,
+    2, 253, 0, 4, 253, 0, 6, 253, 0, 122, 249, 52, 45, 235, 47, 235, 66, 240,
+    98, 241, 102,
+    240, 106, 250, 112, 245, 115, 249, 193, 240, 194, 240, 195, 240, 196, 240,
+    197,
+    240, 198, 240, 225, 241, 226, 241, 227, 241, 228, 241, 229, 241, 230, 241,
+    233,
+    240, 234, 240, 235, 240, 236, 240, 237, 250, 238, 250, 239, 250, 240, 250,
+    243,
+    245, 244, 245, 245, 245, 246, 245, 247, 245, 249, 245, 0, 2, 240, 0, 3,
+    241, 0, 4,
+    240, 0, 5, 241, 0, 6, 240, 0, 7, 241, 0, 21, 240, 0, 25, 240, 0, 27, 240,
+    0, 29, 240,
+    0, 45, 250, 0, 49, 250, 0, 79, 245, 0, 83, 245, 0, 87, 249, 0, 89, 249, 0,
+    91, 249, 50,
+    45, 255, 47, 255, 66, 253, 98, 250, 102, 250, 112, 250, 118, 250, 193,
+    253, 194,
+    253, 195, 253, 196, 253, 197, 253, 198, 253, 225, 250, 226, 250, 227, 250,
+    228,
+    250, 229, 250, 230, 250, 233, 250, 234, 250, 235, 250, 236, 250, 243, 250,
+    244,
+    250, 245, 250, 246, 250, 247, 250, 249, 250, 250, 250, 251, 250, 252, 250,
+    253,
+    250, 0, 2, 253, 0, 3, 250, 0, 4, 253, 0, 5, 250, 0, 6, 253, 0, 7, 250, 0,
+    21, 250, 0, 25,
+    250, 0, 27, 250, 0, 29, 250, 0, 79, 250, 0, 83, 250, 0, 109, 250, 0, 113,
+    250, 0, 115,
+    250, 0, 117, 250, 40, 80, 252, 102, 253, 112, 253, 118, 254, 122, 254,
+    211, 252,
+    212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 233, 253, 234, 253, 235,
+    253,
+    236, 253, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 250,
+    254,
+    251, 254, 252, 254, 253, 254, 254, 254, 0, 1, 254, 0, 21, 253, 0, 25, 253,
+    0, 27, 253,
+    0, 29, 253, 0, 78, 252, 0, 79, 253, 0, 82, 252, 0, 83, 253, 0, 109, 254,
+    0, 113, 254,
+    0, 115, 254, 0, 117, 254, 13, 85, 254, 87, 251, 88, 251, 90, 251, 122,
+    251, 222, 251,
+    254, 251, 0, 1, 251, 0, 100, 254, 0, 102, 254, 0, 122, 251, 1, 32, 25,
+    248, 11, 66,
+    252, 193, 252, 194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 0, 2,
+    252, 0, 4,
+    252, 0, 6, 252, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0,
+    4, 250,
+    0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 41, 45, 235, 47, 235,
+    66, 243, 98,
+    250, 102, 249, 112, 248, 193, 243, 194, 243, 195, 243, 196, 243, 197, 243,
+    198,
+    243, 225, 250, 226, 250, 227, 250, 228, 250, 229, 250, 230, 250, 233, 249,
+    234,
+    249, 235, 249, 236, 249, 243, 248, 244, 248, 245, 248, 246, 248, 247, 248,
+    249,
+    248, 0, 2, 243, 0, 3, 250, 0, 4, 243, 0, 5, 250, 0, 6, 243, 0, 7, 250, 0,
+    21, 249, 0, 25,
+    249, 0, 27, 249, 0, 29, 249, 0, 79, 248, 0, 83, 248, 10, 86, 255, 218,
+    255, 219, 255,
+    220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114, 255, 0, 116, 255,
+    27, 80, 250,
+    85, 252, 86, 250, 87, 254, 88, 254, 90, 254, 211, 250, 212, 250, 213, 250,
+    214, 250,
+    215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222, 254, 0,
+    78, 250,
+    0, 82, 250, 0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114,
+    250, 0, 116,
+    250, 0, 122, 254, 73, 45, 242, 46, 242, 47, 242, 59, 245, 60, 245, 66,
+    248, 80, 254,
+    98, 242, 102, 242, 106, 251, 112, 241, 115, 251, 118, 251, 120, 251, 122,
+    251, 193,
+    248, 194, 248, 195, 248, 196, 248, 197, 248, 198, 248, 211, 254, 212, 254,
+    213,
+    254, 214, 254, 215, 254, 217, 254, 225, 242, 226, 242, 227, 242, 228, 242,
+    229,
+    242, 230, 242, 233, 248, 234, 242, 235, 242, 236, 248, 238, 251, 243, 241,
+    244,
+    241, 245, 241, 246, 241, 247, 241, 249, 241, 250, 251, 251, 251, 252, 251,
+    253,
+    251, 254, 251, 0, 1, 251, 0, 2, 248, 0, 3, 242, 0, 4, 248, 0, 5, 242, 0,
+    6, 248, 0, 7,
+    242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49, 251, 0, 78,
+    254, 0, 79, 241,
+    0, 82, 254, 0, 83, 241, 0, 87, 251, 0, 89, 251, 0, 91, 251, 0, 109, 251,
+    0, 113, 251,
+    0, 115, 251, 0, 117, 251, 11, 66, 249, 193, 249, 194, 249, 195, 249, 196,
+    249, 197,
+    249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 68, 45, 235, 46, 245, 47,
+    235, 59, 245,
+    60, 245, 66, 243, 72, 255, 80, 252, 98, 238, 102, 238, 106, 248, 112, 238,
+    118, 248,
+    193, 243, 194, 243, 195, 243, 196, 243, 197, 243, 198, 243, 211, 252, 212,
+    252,
+    213, 252, 214, 252, 215, 252, 217, 252, 225, 238, 226, 238, 227, 238, 228,
+    238,
+    229, 238, 230, 238, 233, 245, 234, 238, 235, 238, 236, 245, 238, 248, 243,
+    238,
+    244, 238, 245, 238, 246, 238, 247, 238, 249, 238, 250, 248, 251, 248, 252,
+    248,
+    253, 248, 0, 2, 243, 0, 3, 238, 0, 4, 243, 0, 5, 238, 0, 6, 243, 0, 7,
+    238, 0, 21, 245,
+    0, 25, 238, 0, 27, 238, 0, 29, 238, 0, 32, 255, 0, 36, 255, 0, 49, 248, 0,
+    78, 252, 0,
+    79, 238, 0, 82, 252, 0, 83, 238, 0, 109, 248, 0, 113, 248, 0, 115, 248, 0,
+    117, 248,
+    68, 45, 245, 46, 249, 47, 245, 59, 248, 60, 248, 66, 245, 80, 254, 98,
+    243, 102, 242,
+    106, 251, 112, 244, 118, 248, 122, 248, 193, 245, 194, 245, 195, 245, 196,
+    245,
+    197, 245, 198, 245, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217,
+    254,
+    225, 243, 226, 243, 227, 243, 228, 243, 229, 243, 230, 243, 233, 249, 234,
+    242,
+    235, 242, 236, 249, 238, 251, 243, 244, 244, 244, 245, 244, 246, 244, 247,
+    244,
+    249, 244, 250, 248, 251, 248, 252, 248, 253, 248, 254, 248, 0, 1, 248, 0,
+    2, 245,
+    0, 3, 243, 0, 4, 245, 0, 5, 243, 0, 6, 245, 0, 7, 243, 0, 21, 249, 0, 25,
+    242, 0, 27, 242,
+    0, 29, 242, 0, 49, 251, 0, 78, 254, 0, 79, 244, 0, 82, 254, 0, 83, 244, 0,
+    109, 248,
+    0, 113, 248, 0, 115, 248, 0, 117, 248, 65, 45, 242, 46, 242, 47, 245, 59,
+    242, 60,
+    242, 66, 245, 80, 253, 98, 242, 102, 238, 106, 248, 112, 238, 118, 242,
+    193, 245,
+    194, 245, 195, 245, 196, 245, 197, 245, 198, 245, 211, 253, 212, 253, 213,
+    253,
+    214, 253, 215, 253, 217, 253, 225, 242, 226, 242, 227, 242, 228, 242, 229,
+    242,
+    230, 242, 233, 245, 234, 238, 235, 245, 236, 245, 238, 248, 243, 238, 244,
+    238,
+    245, 238, 246, 238, 247, 238, 249, 238, 250, 242, 251, 242, 252, 242, 253,
+    242,
+    0, 2, 245, 0, 3, 242, 0, 4, 245, 0, 5, 242, 0, 6, 245, 0, 7, 242, 0, 21,
+    245, 0, 25, 238,
+    0, 27, 238, 0, 29, 238, 0, 49, 248, 0, 78, 253, 0, 79, 238, 0, 82, 253, 0,
+    83, 238, 0,
+    109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 12, 47, 250, 99, 255,
+    118, 254, 250,
+    254, 251, 254, 252, 254, 253, 254, 0, 109, 254, 0, 113, 254, 0, 115, 254,
+    0, 117,
+    254, 4, 105, 255, 108, 255, 0, 57, 255, 2, 99, 255, 17, 45, 255, 47, 255,
+    102, 255,
+    103, 254, 112, 255, 234, 255, 243, 255, 244, 255, 245, 255, 246, 255, 249,
+    255,
+    0, 25, 255, 0, 27, 255, 0, 51, 252, 0, 83, 255, 1, 32, 25, 9, 19, 102,
+    252, 112, 255,
+    233, 252, 234, 252, 235, 252, 236, 252, 243, 255, 244, 255, 245, 255, 246,
+    255,
+    247, 255, 249, 255, 0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 79,
+    255, 0, 83,
+    255, 2, 119, 250, 7, 119, 254, 120, 253, 121, 255, 122, 255, 254, 255, 0,
+    1, 255,
+    3, 45, 246, 47, 246, 21, 45, 251, 47, 251, 102, 254, 112, 254, 233, 254,
+    234, 254,
+    235, 254, 236, 254, 243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249,
+    254,
+    0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0, 83, 254,
+    31, 45, 251,
+    47, 251, 98, 255, 102, 255, 112, 254, 225, 255, 226, 255, 227, 255, 228,
+    255, 229,
+    255, 230, 255, 233, 255, 234, 255, 235, 255, 236, 255, 243, 254, 244, 254,
+    245,
+    254, 246, 254, 247, 254, 249, 254, 0, 3, 255, 0, 5, 255, 0, 7, 255, 0, 21,
+    255, 0, 25,
+    255, 0, 27, 255, 0, 29, 255, 0, 79, 254, 0, 83, 254, 10, 102, 255, 233,
+    255, 234, 255,
+    235, 255, 236, 255, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 3, 45,
+    251, 47,
+    251, 50, 68, 246, 72, 247, 80, 249, 82, 248, 85, 248, 86, 249, 87, 241,
+    88, 240, 90,
+    245, 118, 252, 119, 245, 120, 245, 122, 245, 200, 246, 211, 249, 212, 249,
+    213,
+    249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    245, 250, 252, 251, 252, 252, 252, 253, 252, 254, 245, 0, 1, 245, 0, 8,
+    246, 0, 14,
+    246, 0, 32, 247, 0, 36, 247, 0, 78, 249, 0, 82, 249, 0, 100, 248, 0, 102,
+    248, 0, 108,
+    249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0,
+    116, 249,
+    0, 117, 252, 0, 122, 245, 1, 32, 25, 245, 50, 68, 246, 72, 247, 80, 249,
+    82, 248, 85,
+    248, 86, 249, 87, 241, 88, 240, 90, 245, 118, 252, 119, 245, 120, 245,
+    122, 245,
+    200, 246, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 245, 250, 252, 251, 252, 252, 252, 253,
+    252,
+    254, 245, 0, 1, 245, 0, 8, 246, 0, 14, 246, 0, 32, 247, 0, 36, 247, 0, 78,
+    249, 0, 82,
+    249, 0, 100, 248, 0, 102, 248, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0,
+    113, 252,
+    0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122, 245, 1, 32,
+    25, 245, 50,
+    68, 246, 72, 247, 80, 249, 82, 248, 85, 248, 86, 249, 87, 241, 88, 240,
+    90, 245, 118,
+    252, 119, 245, 120, 245, 122, 245, 200, 246, 211, 249, 212, 249, 213, 249,
+    214,
+    249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 245,
+    250,
+    252, 251, 252, 252, 252, 253, 252, 254, 245, 0, 1, 245, 0, 8, 246, 0, 14,
+    246, 0, 32,
+    247, 0, 36, 247, 0, 78, 249, 0, 82, 249, 0, 100, 248, 0, 102, 248, 0, 108,
+    249, 0, 109,
+    252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0,
+    117, 252,
+    0, 122, 245, 1, 32, 25, 245, 50, 68, 246, 72, 247, 80, 249, 82, 248, 85,
+    248, 86, 249,
+    87, 241, 88, 240, 90, 245, 118, 252, 119, 245, 120, 245, 122, 245, 200,
+    246, 211,
+    249, 212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249,
+    220,
+    249, 221, 249, 222, 245, 250, 252, 251, 252, 252, 252, 253, 252, 254, 245,
+    0, 1,
+    245, 0, 8, 246, 0, 14, 246, 0, 32, 247, 0, 36, 247, 0, 78, 249, 0, 82,
+    249, 0, 100, 248,
+    0, 102, 248, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114,
+    249, 0, 115,
+    252, 0, 116, 249, 0, 117, 252, 0, 122, 245, 1, 32, 25, 245, 50, 68, 246,
+    72, 247, 80,
+    249, 82, 248, 85, 248, 86, 249, 87, 241, 88, 240, 90, 245, 118, 252, 119,
+    245, 120,
+    245, 122, 245, 200, 246, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249,
+    217,
+    249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 245, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 245, 0, 1, 245, 0, 8, 246, 0, 14, 246, 0, 32, 247, 0,
+    36, 247, 0,
+    78, 249, 0, 82, 249, 0, 100, 248, 0, 102, 248, 0, 108, 249, 0, 109, 252,
+    0, 112, 249,
+    0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122,
+    245, 1, 32,
+    25, 245, 50, 68, 246, 72, 247, 80, 249, 82, 248, 85, 248, 86, 249, 87,
+    241, 88, 240,
+    90, 245, 118, 252, 119, 245, 120, 245, 122, 245, 200, 246, 211, 249, 212,
+    249, 213,
+    249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    245, 250, 252, 251, 252, 252, 252, 253, 252, 254, 245, 0, 1, 245, 0, 8,
+    246, 0, 14,
+    246, 0, 32, 247, 0, 36, 247, 0, 78, 249, 0, 82, 249, 0, 100, 248, 0, 102,
+    248, 0, 108,
+    249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0,
+    116, 249,
+    0, 117, 252, 0, 122, 245, 1, 32, 25, 245, 11, 66, 252, 193, 252, 194, 252,
+    195, 252,
+    196, 252, 197, 252, 198, 252, 0, 2, 252, 0, 4, 252, 0, 6, 252, 20, 66,
+    250, 85, 250,
+    87, 249, 88, 249, 89, 250, 90, 249, 193, 250, 194, 250, 195, 250, 196,
+    250, 197,
+    250, 198, 250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 249, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249,
+    193, 250, 194,
+    250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0, 4,
+    250, 0, 6,
+    250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 250, 85, 250, 87, 249,
+    88, 249,
+    89, 250, 90, 249, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198,
+    250, 222,
+    249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122,
+    249, 20, 66,
+    250, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249, 193, 250, 194, 250, 195,
+    250, 196,
+    250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0,
+    100, 250, 0,
+    102, 250, 0, 122, 249, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250,
+    90, 249, 193,
+    250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0, 2,
+    250, 0, 4,
+    250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 250, 85,
+    250, 87, 249,
+    88, 249, 89, 250, 90, 249, 193, 250, 194, 250, 195, 250, 196, 250, 197,
+    250, 198,
+    250, 222, 249, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250,
+    0, 122, 249,
+    11, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249,
+    0, 2, 249,
+    0, 4, 249, 0, 6, 249, 11, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249,
+    197, 249,
+    198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 11, 66, 249, 193, 249, 194,
+    249, 195, 249,
+    196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 11, 66,
+    249, 193, 249,
+    194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0,
+    6, 249,
+    65, 45, 242, 46, 242, 47, 245, 59, 242, 60, 242, 66, 245, 80, 253, 98,
+    242, 102, 238,
+    106, 248, 112, 238, 118, 242, 193, 245, 194, 245, 195, 245, 196, 245, 197,
+    245,
+    198, 245, 211, 253, 212, 253, 213, 253, 214, 253, 215, 253, 217, 253, 225,
+    242,
+    226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 245, 234, 238, 235,
+    245,
+    236, 245, 238, 248, 243, 238, 244, 238, 245, 238, 246, 238, 247, 238, 249,
+    238,
+    250, 242, 251, 242, 252, 242, 253, 242, 0, 2, 245, 0, 3, 242, 0, 4, 245,
+    0, 5, 242,
+    0, 6, 245, 0, 7, 242, 0, 21, 245, 0, 25, 238, 0, 27, 238, 0, 29, 238, 0,
+    49, 248, 0, 78,
+    253, 0, 79, 238, 0, 82, 253, 0, 83, 238, 0, 109, 242, 0, 113, 242, 0, 115,
+    242, 0, 117,
+    242, 4, 105, 255, 108, 255, 0, 57, 255, 2, 99, 255, 2, 99, 255, 2, 99,
+    255, 2, 99, 255,
+    2, 119, 250, 7, 119, 254, 120, 253, 121, 255, 122, 255, 254, 255, 0, 1,
+    255, 7, 119,
+    254, 120, 253, 121, 255, 122, 255, 254, 255, 0, 1, 255, 7, 119, 254, 120,
+    253, 121,
+    255, 122, 255, 254, 255, 0, 1, 255, 7, 119, 254, 120, 253, 121, 255, 122,
+    255, 254,
+    255, 0, 1, 255, 7, 119, 254, 120, 253, 121, 255, 122, 255, 254, 255, 0, 1,
+    255, 7,
+    119, 254, 120, 253, 121, 255, 122, 255, 254, 255, 0, 1, 255, 3, 45, 251,
+    47, 251,
+    3, 45, 251, 47, 251, 50, 68, 246, 72, 247, 80, 249, 82, 248, 85, 248, 86,
+    249, 87,
+    241, 88, 240, 90, 245, 118, 252, 119, 245, 120, 245, 122, 245, 200, 246,
+    211, 249,
+    212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220,
+    249,
+    221, 249, 222, 245, 250, 252, 251, 252, 252, 252, 253, 252, 254, 245, 0,
+    1, 245,
+    0, 8, 246, 0, 14, 246, 0, 32, 247, 0, 36, 247, 0, 78, 249, 0, 82, 249, 0,
+    100, 248, 0,
+    102, 248, 0, 108, 249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249,
+    0, 115,
+    252, 0, 116, 249, 0, 117, 252, 0, 122, 245, 1, 32, 25, 245, 50, 68, 246,
+    72, 247, 80,
+    249, 82, 248, 85, 248, 86, 249, 87, 241, 88, 240, 90, 245, 118, 252, 119,
+    245, 120,
+    245, 122, 245, 200, 246, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249,
+    217,
+    249, 218, 249, 219, 249, 220, 249, 221, 249, 222, 245, 250, 252, 251, 252,
+    252,
+    252, 253, 252, 254, 245, 0, 1, 245, 0, 8, 246, 0, 14, 246, 0, 32, 247, 0,
+    36, 247, 0,
+    78, 249, 0, 82, 249, 0, 100, 248, 0, 102, 248, 0, 108, 249, 0, 109, 252,
+    0, 112, 249,
+    0, 113, 252, 0, 114, 249, 0, 115, 252, 0, 116, 249, 0, 117, 252, 0, 122,
+    245, 1, 32,
+    25, 245, 50, 68, 246, 72, 247, 80, 249, 82, 248, 85, 248, 86, 249, 87,
+    241, 88, 240,
+    90, 245, 118, 252, 119, 245, 120, 245, 122, 251, 200, 246, 211, 249, 212,
+    249, 213,
+    249, 214, 249, 215, 249, 217, 249, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    245, 250, 252, 251, 252, 252, 252, 253, 252, 254, 251, 0, 1, 251, 0, 8,
+    246, 0, 14,
+    246, 0, 32, 247, 0, 36, 247, 0, 78, 249, 0, 82, 249, 0, 100, 248, 0, 102,
+    248, 0, 108,
+    249, 0, 109, 252, 0, 112, 249, 0, 113, 252, 0, 114, 249, 0, 115, 252, 0,
+    116, 249,
+    0, 117, 252, 0, 122, 245, 1, 32, 25, 245, 4, 105, 255, 108, 255, 0, 57,
+    255, 4, 105,
+    255, 108, 255, 0, 57, 255, 16, 66, 253, 87, 249, 88, 250, 90, 249, 193,
+    253, 194,
+    253, 195, 253, 196, 253, 197, 253, 198, 253, 222, 249, 0, 2, 253, 0, 4,
+    253, 0, 6,
+    253, 0, 122, 249, 16, 66, 253, 87, 249, 88, 250, 90, 249, 193, 253, 194,
+    253, 195,
+    253, 196, 253, 197, 253, 198, 253, 222, 249, 0, 2, 253, 0, 4, 253, 0, 6,
+    253, 0, 122,
+    249, 2, 99, 255, 2, 99, 255, 2, 99, 255, 2, 99, 255, 40, 80, 252, 102,
+    253, 112, 253,
+    118, 254, 122, 254, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217,
+    252,
+    233, 253, 234, 253, 235, 253, 236, 253, 243, 253, 244, 253, 245, 253, 246,
+    253,
+    247, 253, 249, 253, 250, 254, 251, 254, 252, 254, 253, 254, 254, 254, 0,
+    1, 254,
+    0, 21, 253, 0, 25, 253, 0, 27, 253, 0, 29, 253, 0, 78, 252, 0, 79, 253, 0,
+    82, 252, 0,
+    83, 253, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117, 254, 19, 102, 252,
+    112, 255,
+    233, 252, 234, 252, 235, 252, 236, 252, 243, 255, 244, 255, 245, 255, 246,
+    255,
+    247, 255, 249, 255, 0, 21, 252, 0, 25, 252, 0, 27, 252, 0, 29, 252, 0, 79,
+    255, 0, 83,
+    255, 13, 85, 254, 87, 251, 88, 251, 90, 251, 122, 251, 222, 251, 254, 251,
+    0, 1, 251,
+    0, 100, 254, 0, 102, 254, 0, 122, 251, 1, 32, 25, 248, 13, 85, 254, 87,
+    251, 88, 251,
+    90, 251, 122, 251, 222, 251, 254, 251, 0, 1, 251, 0, 100, 254, 0, 102,
+    254, 0, 122,
+    251, 1, 32, 25, 248, 13, 85, 254, 87, 251, 88, 251, 90, 251, 122, 251,
+    222, 251, 254,
+    251, 0, 1, 251, 0, 100, 254, 0, 102, 254, 0, 122, 251, 1, 32, 25, 248, 11,
+    66, 252,
+    193, 252, 194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 0, 2, 252, 0,
+    4, 252,
+    0, 6, 252, 2, 119, 250, 11, 66, 252, 193, 252, 194, 252, 195, 252, 196,
+    252, 197,
+    252, 198, 252, 0, 2, 252, 0, 4, 252, 0, 6, 252, 2, 119, 250, 11, 66, 252,
+    193, 252,
+    194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 0, 2, 252, 0, 4, 252, 0,
+    6, 252,
+    2, 119, 250, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249,
+    193, 250, 194,
+    250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0, 2, 250, 0, 4,
+    250, 0, 6,
+    250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 7, 119, 254, 120, 253, 121,
+    255, 122,
+    255, 254, 255, 0, 1, 255, 20, 66, 250, 85, 250, 87, 249, 88, 249, 89, 250,
+    90, 249,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 222, 249, 0,
+    2, 250,
+    0, 4, 250, 0, 6, 250, 0, 100, 250, 0, 102, 250, 0, 122, 249, 7, 119, 254,
+    120, 253,
+    121, 255, 122, 255, 254, 255, 0, 1, 255, 27, 80, 250, 85, 252, 86, 250,
+    87, 254, 88,
+    254, 90, 254, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250,
+    218, 250,
+    219, 250, 220, 250, 221, 250, 222, 254, 0, 78, 250, 0, 82, 250, 0, 100,
+    252, 0, 102,
+    252, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122, 254, 3,
+    45, 246, 47,
+    246, 27, 80, 250, 85, 252, 86, 250, 87, 254, 88, 254, 90, 254, 211, 250,
+    212, 250,
+    213, 250, 214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221,
+    250,
+    222, 254, 0, 78, 250, 0, 82, 250, 0, 100, 252, 0, 102, 252, 0, 108, 250,
+    0, 112, 250,
+    0, 114, 250, 0, 116, 250, 0, 122, 254, 3, 45, 246, 47, 246, 27, 80, 250,
+    85, 252, 86,
+    250, 87, 254, 88, 254, 90, 254, 211, 250, 212, 250, 213, 250, 214, 250,
+    215, 250,
+    217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222, 254, 0, 78, 250, 0,
+    82, 250,
+    0, 100, 252, 0, 102, 252, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0, 116,
+    250, 0, 122,
+    254, 3, 45, 246, 47, 246, 73, 45, 242, 46, 242, 47, 242, 59, 245, 60, 245,
+    66, 248,
+    80, 254, 98, 242, 102, 242, 106, 251, 112, 241, 115, 251, 118, 251, 120,
+    251, 122,
+    251, 193, 248, 194, 248, 195, 248, 196, 248, 197, 248, 198, 248, 211, 254,
+    212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 242, 226, 242, 227, 242,
+    228,
+    242, 229, 242, 230, 242, 233, 248, 234, 242, 235, 242, 236, 248, 238, 251,
+    243,
+    241, 244, 241, 245, 241, 246, 241, 247, 241, 249, 241, 250, 251, 251, 251,
+    252,
+    251, 253, 251, 254, 251, 0, 1, 251, 0, 2, 248, 0, 3, 242, 0, 4, 248, 0, 5,
+    242, 0, 6,
+    248, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49,
+    251, 0, 78, 254,
+    0, 79, 241, 0, 82, 254, 0, 83, 241, 0, 87, 251, 0, 89, 251, 0, 91, 251, 0,
+    109, 251,
+    0, 113, 251, 0, 115, 251, 0, 117, 251, 73, 45, 242, 46, 242, 47, 242, 59,
+    245, 60,
+    245, 66, 248, 80, 254, 98, 242, 102, 242, 106, 251, 112, 241, 115, 251,
+    118, 251,
+    120, 251, 122, 251, 193, 248, 194, 248, 195, 248, 196, 248, 197, 248, 198,
+    248,
+    211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 242, 226,
+    242,
+    227, 242, 228, 242, 229, 242, 230, 242, 233, 248, 234, 242, 235, 242, 236,
+    248,
+    238, 251, 243, 241, 244, 241, 245, 241, 246, 241, 247, 241, 249, 241, 250,
+    251,
+    251, 251, 252, 251, 253, 251, 254, 251, 0, 1, 251, 0, 2, 248, 0, 3, 242,
+    0, 4, 248,
+    0, 5, 242, 0, 6, 248, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0,
+    29, 242, 0, 49,
+    251, 0, 78, 254, 0, 79, 241, 0, 82, 254, 0, 83, 241, 0, 87, 251, 0, 89,
+    251, 0, 91, 251,
+    0, 109, 251, 0, 113, 251, 0, 115, 251, 0, 117, 251, 11, 66, 249, 193, 249,
+    194, 249,
+    195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249,
+    11, 66, 249,
+    193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 0, 2, 249, 0,
+    4, 249,
+    0, 6, 249, 11, 66, 249, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249,
+    198, 249,
+    0, 2, 249, 0, 4, 249, 0, 6, 249, 11, 66, 249, 193, 249, 194, 249, 195,
+    249, 196, 249,
+    197, 249, 198, 249, 0, 2, 249, 0, 4, 249, 0, 6, 249, 65, 45, 242, 46, 242,
+    47, 245,
+    59, 242, 60, 242, 66, 245, 80, 253, 98, 242, 102, 238, 106, 248, 112, 238,
+    118, 242,
+    193, 245, 194, 245, 195, 245, 196, 245, 197, 245, 198, 245, 211, 253, 212,
+    253,
+    213, 253, 214, 253, 215, 253, 217, 253, 225, 242, 226, 242, 227, 242, 228,
+    242,
+    229, 242, 230, 242, 233, 245, 234, 238, 235, 245, 236, 245, 238, 248, 243,
+    238,
+    244, 238, 245, 238, 246, 238, 247, 238, 249, 238, 250, 242, 251, 242, 252,
+    242,
+    253, 242, 0, 2, 245, 0, 3, 242, 0, 4, 245, 0, 5, 242, 0, 6, 245, 0, 7,
+    242, 0, 21, 245,
+    0, 25, 238, 0, 27, 238, 0, 29, 238, 0, 49, 248, 0, 78, 253, 0, 79, 238, 0,
+    82, 253, 0,
+    83, 238, 0, 109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 2, 1, 32, 24,
+    245, 17,
+    33, 245, 101, 254, 115, 254, 116, 245, 117, 251, 119, 254, 0, 19, 254, 0,
+    87, 254,
+    0, 89, 254, 0, 91, 254, 0, 93, 245, 0, 97, 245, 0, 99, 245, 0, 101, 251,
+    1, 2, 25, 245,
+    1, 32, 25, 245
 };
-static afm_cuint16 afm_Times_BoldItalic_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Times_BoldItalic_highchars_index[] = {   /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Times_BoldItalic_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Times_BoldItalic_ligatures[] = {    /* 3 */
+    102, 105, 64257
 };
 
 
@@ -2536,361 +4846,704 @@ static afm_cunicode afm_Times_BoldItalic_ligatures[] = { /* 3 */
 /* FullName: Times Italic */
 /* FamilyName: Times */
 static afm_cuint8 afm_Times_Italic_widths[] = { /* 315 */
-  42,56,70,83,83,139,130,36,56,56,83,113,42,56,42,46,83,83,83,83,83,
-  83,83,83,83,83,56,56,113,113,113,83,153,102,102,111,120,102,102,
-  120,120,56,74,111,93,139,111,120,102,120,102,83,93,120,102,139,102,
-  93,93,65,46,65,70,83,56,83,83,74,83,74,46,83,83,46,46,74,46,120,
-  83,83,83,83,65,65,46,83,74,111,74,74,65,67,46,67,90,65,83,83,83,
-  83,46,83,56,127,46,83,113,127,56,67,113,50,50,56,83,87,42,56,50,
-  52,83,125,125,125,83,102,102,102,102,102,102,148,111,102,102,102,
-  102,56,56,56,56,120,111,120,120,120,120,120,113,120,120,120,120,
-  120,93,102,83,83,83,83,83,83,83,111,74,74,74,74,74,46,46,46,46,83,
-  83,83,83,83,83,83,113,83,83,83,83,83,74,83,74,102,83,102,83,102,
-  83,111,74,111,74,120,91,120,83,102,74,102,74,102,74,102,74,120,83,
-  120,83,56,46,56,46,56,46,111,74,93,46,93,46,102,50,93,46,111,83,
-  111,83,111,83,120,83,120,83,157,111,102,65,102,65,102,65,83,65,83,
-  65,83,65,93,46,93,50,120,83,120,83,120,83,120,83,93,93,65,93,65,
-  93,65,83,83,65,56,56,56,56,56,56,56,56,83,148,56,56,56,93,93,93,
-  83,83,58,148,167,56,56,28,83,163,79,102,100,113,76,92,92,92,79,42,
-  83,83
+    42, 56, 70, 83, 83, 139, 130, 36, 56, 56, 83, 113, 42, 56, 42, 46, 83, 83,
+    83, 83, 83,
+    83, 83, 83, 83, 83, 56, 56, 113, 113, 113, 83, 153, 102, 102, 111, 120,
+    102, 102,
+    120, 120, 56, 74, 111, 93, 139, 111, 120, 102, 120, 102, 83, 93, 120, 102,
+    139, 102,
+    93, 93, 65, 46, 65, 70, 83, 56, 83, 83, 74, 83, 74, 46, 83, 83, 46, 46,
+    74, 46, 120,
+    83, 83, 83, 83, 65, 65, 46, 83, 74, 111, 74, 74, 65, 67, 46, 67, 90, 65,
+    83, 83, 83,
+    83, 46, 83, 56, 127, 46, 83, 113, 127, 56, 67, 113, 50, 50, 56, 83, 87,
+    42, 56, 50,
+    52, 83, 125, 125, 125, 83, 102, 102, 102, 102, 102, 102, 148, 111, 102,
+    102, 102,
+    102, 56, 56, 56, 56, 120, 111, 120, 120, 120, 120, 120, 113, 120, 120,
+    120, 120,
+    120, 93, 102, 83, 83, 83, 83, 83, 83, 83, 111, 74, 74, 74, 74, 74, 46, 46,
+    46, 46, 83,
+    83, 83, 83, 83, 83, 83, 113, 83, 83, 83, 83, 83, 74, 83, 74, 102, 83, 102,
+    83, 102,
+    83, 111, 74, 111, 74, 120, 91, 120, 83, 102, 74, 102, 74, 102, 74, 102,
+    74, 120, 83,
+    120, 83, 56, 46, 56, 46, 56, 46, 111, 74, 93, 46, 93, 46, 102, 50, 93, 46,
+    111, 83,
+    111, 83, 111, 83, 120, 83, 120, 83, 157, 111, 102, 65, 102, 65, 102, 65,
+    83, 65, 83,
+    65, 83, 65, 93, 46, 93, 50, 120, 83, 120, 83, 120, 83, 120, 83, 93, 93,
+    65, 93, 65,
+    93, 65, 83, 83, 65, 56, 56, 56, 56, 56, 56, 56, 56, 83, 148, 56, 56, 56,
+    93, 93, 93,
+    83, 83, 58, 148, 167, 56, 56, 28, 83, 163, 79, 102, 100, 113, 76, 92, 92,
+    92, 79, 42,
+    83, 83
 };
-static afm_sint16 afm_Times_Italic_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,62,181,0,227,0,262,0,0,0,382,497,589,0,620,644,689,782,805,0,
-  859,1027,1055,1212,0,1367,0,0,0,0,0,0,0,1524,1533,1558,0,1566,1592,
-  1611,0,0,0,1646,0,0,1696,1699,0,0,1710,0,0,0,1822,1827,0,1832,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,1837,1956,2075,2194,2313,2432,0,0,0,0,0,0,0,0,0,0,0,2551,2575,
-  2620,2665,2710,2755,0,2800,2845,2873,2901,2929,2957,0,0,3114,3123,
-  3132,3141,3150,3159,0,3168,3176,3202,3228,3254,0,0,0,0,0,3280,3283,
-  3294,3305,3316,3327,0,3338,0,0,0,0,3349,0,3354,3359,3478,3487,3606,
-  3615,3734,0,3743,0,3751,3759,0,3794,0,0,3829,0,3855,0,3881,0,3907,
-  0,3933,0,3968,0,0,0,0,0,0,4003,4095,4145,0,4176,0,0,0,4207,0,4238,
-  4262,4265,4289,4292,4316,4319,4364,4375,4420,0,0,4431,4485,4597,
-  4651,4763,4817,0,0,0,0,0,0,4929,0,5097,0,5265,0,5293,0,5321,0,5349,
-  0,5377,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5534,5539,0,0,0,0,0,
-  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+static afm_sint16 afm_Times_Italic_kerning_index[] = {  /* 315 */
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 62, 181, 0, 227, 0, 262, 0, 0, 0, 382, 497, 589, 0, 620, 644, 689,
+    782, 805, 0,
+    859, 1027, 1055, 1212, 0, 1367, 0, 0, 0, 0, 0, 0, 0, 1524, 1533, 1558, 0,
+    1566, 1592,
+    1611, 0, 0, 0, 1646, 0, 0, 1696, 1699, 0, 0, 1710, 0, 0, 0, 1822, 1827, 0,
+    1832, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 1837, 1956, 2075, 2194, 2313, 2432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    2551, 2575,
+    2620, 2665, 2710, 2755, 0, 2800, 2845, 2873, 2901, 2929, 2957, 0, 0, 3114,
+    3123,
+    3132, 3141, 3150, 3159, 0, 3168, 3176, 3202, 3228, 3254, 0, 0, 0, 0, 0,
+    3280, 3283,
+    3294, 3305, 3316, 3327, 0, 3338, 0, 0, 0, 0, 3349, 0, 3354, 3359, 3478,
+    3487, 3606,
+    3615, 3734, 0, 3743, 0, 3751, 3759, 0, 3794, 0, 0, 3829, 0, 3855, 0, 3881,
+    0, 3907,
+    0, 3933, 0, 3968, 0, 0, 0, 0, 0, 0, 4003, 4095, 4145, 0, 4176, 0, 0, 0,
+    4207, 0, 4238,
+    4262, 4265, 4289, 4292, 4316, 4319, 4364, 4375, 4420, 0, 0, 4431, 4485,
+    4597,
+    4651, 4763, 4817, 0, 0, 0, 0, 0, 0, 4929, 0, 5097, 0, 5265, 0, 5293, 0,
+    5321, 0, 5349,
+    0, 5377, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5534,
+    5539, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static afm_cuint8 afm_Times_Italic_kerning_data[] = { /* 5584 */
-  42,19,66,254,85,254,87,251,88,250,90,244,193,254,194,254,195,254,
-  196,254,197,254,198,254,222,244,0,2,254,0,4,254,0,6,254,0,100,254,
-  0,102,254,0,122,244,3,1,32,25,234,1,32,29,234,3,1,32,25,234,1,32,
-  29,234,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
-  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
-  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
-  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
-  0,117,254,0,122,248,1,32,25,251,20,66,253,86,255,193,253,194,253,
-  195,253,196,253,197,253,198,253,218,255,219,255,220,255,221,255,
-  0,2,253,0,4,253,0,6,253,0,108,255,0,112,255,0,114,255,0,116,255,
-  16,66,251,87,250,88,250,90,250,193,251,194,251,195,251,196,251,197,
-  251,198,251,222,250,0,2,251,0,4,251,0,6,251,0,122,250,52,45,234,
-  47,234,66,238,98,244,102,244,106,249,112,239,115,248,193,238,194,
-  238,195,238,196,238,197,238,198,238,225,244,226,244,227,244,228,
-  244,229,244,230,244,233,244,234,244,235,244,236,244,237,249,238,
-  249,239,249,240,249,243,239,244,239,245,239,246,239,247,239,249,
-  239,0,2,238,0,3,244,0,4,238,0,5,244,0,6,238,0,7,244,0,21,244,0,25,
-  244,0,27,244,0,29,244,0,45,249,0,49,249,0,79,239,0,83,239,0,87,248,
-  0,89,248,0,91,248,50,45,253,47,253,66,250,98,251,102,253,112,253,
-  118,251,193,250,194,250,195,250,196,250,197,250,198,250,225,251,
-  226,251,227,251,228,251,229,251,230,251,233,253,234,253,235,253,
-  236,253,243,253,244,253,245,253,246,253,247,253,249,253,250,251,
-  251,251,252,251,253,251,0,2,250,0,3,251,0,4,250,0,5,251,0,6,250,
-  0,7,251,0,21,253,0,25,253,0,27,253,0,29,253,0,79,253,0,83,253,0,
-  109,251,0,113,251,0,115,251,0,117,251,40,80,249,102,251,112,250,
-  118,250,122,250,211,249,212,249,213,249,214,249,215,249,217,249,
-  233,251,234,251,235,251,236,251,243,250,244,250,245,250,246,250,
-  247,250,249,250,250,250,251,250,252,250,253,250,254,250,0,1,250,
-  0,21,251,0,25,251,0,27,251,0,29,251,0,78,249,0,79,250,0,82,249,0,
-  83,250,0,109,250,0,113,250,0,115,250,0,117,250,13,85,254,87,248,
-  88,248,90,254,122,252,222,254,254,252,0,1,252,0,100,254,0,102,254,
-  0,122,254,1,32,25,251,11,66,252,193,252,194,252,195,252,196,252,
-  197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,248,85,250,87,249,
-  88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,
-  248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,
-  41,45,234,47,234,66,242,98,244,102,244,112,244,193,242,194,242,195,
-  242,196,242,197,242,198,242,225,244,226,244,227,244,228,244,229,
-  244,230,244,233,244,234,244,235,244,236,244,243,244,244,244,245,
-  244,246,244,247,244,249,244,0,2,242,0,3,244,0,4,242,0,5,244,0,6,
-  242,0,7,244,0,21,244,0,25,244,0,27,244,0,29,244,0,79,244,0,83,244,
-  10,86,255,218,255,219,255,220,255,221,255,0,108,255,0,112,255,0,
-  114,255,0,116,255,24,80,250,86,250,87,254,88,254,90,254,211,250,
-  212,250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,
-  221,250,222,254,0,78,250,0,82,250,0,108,250,0,112,250,0,114,250,
-  0,116,250,0,122,254,73,45,245,46,245,47,245,59,248,60,246,66,249,
-  80,254,98,242,102,242,106,248,112,242,115,248,118,248,120,245,122,
-  245,193,249,194,249,195,249,196,249,197,249,198,249,211,254,212,
-  254,213,254,214,254,215,254,217,254,225,242,226,242,227,242,228,
-  242,229,242,230,242,233,248,234,242,235,248,236,248,238,248,243,
-  242,244,242,245,242,246,242,247,242,249,242,250,248,251,248,252,
-  248,253,248,254,245,0,1,251,0,2,249,0,3,242,0,4,249,0,5,242,0,6,
-  249,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,248,0,78,254,
-  0,79,242,0,82,254,0,83,242,0,87,248,0,89,248,0,91,248,0,109,248,
-  0,113,248,0,115,248,0,117,248,13,45,253,47,253,66,250,193,250,194,
-  250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,69,45,
-  235,46,248,47,235,59,246,60,245,66,247,80,252,98,238,102,238,106,
-  245,112,238,118,245,193,247,194,247,195,247,196,247,197,247,198,
-  247,211,252,212,252,213,252,214,252,215,252,217,252,225,238,226,
-  238,227,238,228,238,229,238,230,238,233,245,234,238,235,238,236,
-  245,237,251,238,245,239,251,240,251,243,238,244,238,245,238,246,
-  238,247,238,249,238,250,245,251,245,252,245,253,245,0,2,247,0,3,
-  238,0,4,247,0,5,238,0,6,247,0,7,238,0,21,245,0,25,238,0,27,238,0,
-  29,238,0,45,251,0,49,245,0,78,252,0,79,238,0,82,252,0,83,238,0,109,
-  245,0,113,245,0,115,245,0,117,245,68,45,242,46,251,47,242,59,246,
-  60,246,66,247,80,253,98,242,102,242,106,248,112,242,118,248,122,
-  245,193,247,194,247,195,247,196,247,197,247,198,247,211,253,212,
-  253,213,253,214,253,215,253,217,253,225,242,226,242,227,242,228,
-  242,229,242,230,242,233,248,234,242,235,242,236,248,238,248,243,
-  242,244,242,245,242,246,242,247,242,249,242,250,248,251,248,252,
-  248,253,248,254,245,0,1,245,0,2,247,0,3,242,0,4,247,0,5,242,0,6,
-  247,0,7,242,0,21,248,0,25,242,0,27,242,0,29,242,0,49,248,0,78,253,
-  0,79,242,0,82,253,0,83,242,0,109,248,0,113,248,0,115,248,0,117,248,
-  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
-  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
-  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
-  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
-  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
-  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
-  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
-  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
-  109,242,0,113,242,0,115,242,0,117,242,4,104,255,0,33,255,0,37,255,
-  11,47,250,118,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
-  254,0,115,254,0,117,254,4,105,254,108,254,0,57,254,12,45,255,47,
-  254,104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,0,33,
-  250,0,37,250,8,45,255,47,254,103,254,106,254,0,49,254,0,51,247,1,
-  32,25,15,15,45,255,47,254,102,255,104,255,233,255,234,255,235,255,
-  236,255,0,21,255,0,25,255,0,27,255,0,29,255,0,33,255,0,37,255,22,
-  102,255,112,255,122,255,233,255,234,255,235,255,236,255,243,255,
-  244,255,245,255,246,255,247,255,249,255,254,255,0,1,255,0,21,255,
-  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,2,119,250,5,104,255,
-  119,255,0,33,255,0,37,255,47,45,238,46,254,47,238,98,254,100,251,
-  101,251,102,251,104,251,112,249,114,251,116,255,225,254,226,254,
-  227,254,228,254,229,254,230,254,232,251,233,251,234,251,235,251,
-  236,251,243,249,244,249,245,249,246,249,247,249,249,249,0,3,254,
-  0,5,254,0,7,254,0,9,251,0,15,251,0,19,251,0,21,251,0,25,251,0,27,
-  251,0,29,251,0,33,251,0,37,251,0,79,249,0,83,249,0,93,255,0,97,255,
-  0,99,255,1,2,25,255,3,45,245,47,245,3,45,245,47,245,3,45,248,47,
-  248,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,
-  248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
-  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
-  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
-  0,117,254,0,122,248,1,32,25,251,50,68,252,72,251,80,250,82,250,85,
-  251,86,249,87,239,88,241,90,248,118,254,119,248,120,248,122,248,
-  200,252,211,250,212,250,213,250,214,250,215,250,217,250,218,249,
-  219,249,220,249,221,249,222,248,250,254,251,254,252,254,253,254,
-  254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,0,78,250,0,82,
-  250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,249,0,113,254,
-  0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,1,32,25,251,50,
-  68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,
-  254,119,248,120,248,122,248,200,252,211,250,212,250,213,250,214,
-  250,215,250,217,250,218,249,219,249,220,249,221,249,222,248,250,
-  254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,
-  251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,
-  254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,
-  0,122,248,1,32,25,251,50,68,252,72,251,80,250,82,250,85,251,86,249,
-  87,239,88,241,90,248,118,254,119,248,120,248,122,248,200,252,211,
-  250,212,250,213,250,214,250,215,250,217,250,218,249,219,249,220,
-  249,221,249,222,248,250,254,251,254,252,254,253,254,254,248,0,1,
-  248,0,8,252,0,14,252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,
-  0,102,251,0,108,249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,
-  254,0,116,249,0,117,254,0,122,248,1,32,25,251,50,68,252,72,251,80,
-  250,82,250,85,251,86,249,87,239,88,241,90,248,118,254,119,248,120,
-  248,122,248,200,252,211,250,212,250,213,250,214,250,215,250,217,
-  250,218,249,219,249,220,249,221,249,222,248,250,254,251,254,252,
-  254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,0,
-  78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,249,
-  0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,1,32,
-  25,251,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
-  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
-  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
-  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
-  0,117,254,0,122,248,1,32,25,251,11,66,252,193,252,194,252,195,252,
-  196,252,197,252,198,252,0,2,252,0,4,252,0,6,252,20,66,248,85,250,
-  87,249,88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,
-  248,198,248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,
-  0,122,249,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,194,
-  248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,
-  248,0,100,250,0,102,250,0,122,249,20,66,248,85,250,87,249,88,249,
-  89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,248,222,
-  249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,20,66,
-  248,85,250,87,249,88,249,89,250,90,249,193,248,194,248,195,248,196,
-  248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,
-  102,250,0,122,249,20,66,248,85,250,87,249,88,249,89,250,90,249,193,
-  248,194,248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,
-  248,0,6,248,0,100,250,0,102,250,0,122,249,20,66,248,85,250,87,249,
-  88,249,89,250,90,249,193,248,194,248,195,248,196,248,197,248,198,
-  248,222,249,0,2,248,0,4,248,0,6,248,0,100,250,0,102,250,0,122,249,
-  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
-  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
-  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
-  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
-  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
-  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
-  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
-  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
-  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
-  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
-  109,242,0,113,242,0,115,242,0,117,242,4,104,255,0,33,255,0,37,255,
-  4,104,255,0,33,255,0,37,255,4,104,255,0,33,255,0,37,255,4,104,255,
-  0,33,255,0,37,255,4,104,255,0,33,255,0,37,255,4,104,255,0,33,255,
-  0,37,255,4,105,254,108,254,0,57,254,12,45,255,47,254,104,250,119,
-  254,120,254,121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,
-  45,255,47,254,104,250,119,254,120,254,121,254,122,252,254,252,0,
-  1,252,0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,120,254,
-  121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,45,255,47,254,
-  104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,0,33,250,
-  0,37,250,2,119,250,5,104,255,119,255,0,33,255,0,37,255,5,104,255,
-  119,255,0,33,255,0,37,255,5,104,255,119,255,0,33,255,0,37,255,5,
-  104,255,119,255,0,33,255,0,37,255,5,104,255,119,255,0,33,255,0,37,
-  255,5,104,255,119,255,0,33,255,0,37,255,3,45,248,47,248,3,45,248,
-  47,248,50,68,252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,
-  90,248,118,254,119,248,120,248,122,248,200,252,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,249,219,249,220,249,221,249,222,
-  248,250,254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,
-  252,0,32,251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,
-  249,0,109,254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,
-  0,117,254,0,122,248,1,32,25,251,4,104,255,0,33,255,0,37,255,50,68,
-  252,72,251,80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,
-  254,119,248,120,248,122,248,200,252,211,250,212,250,213,250,214,
-  250,215,250,217,250,218,249,219,249,220,249,221,249,222,248,250,
-  254,251,254,252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,
-  251,0,36,251,0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,
-  254,0,112,249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,
-  0,122,248,1,32,25,251,4,104,255,0,33,255,0,37,255,50,68,252,72,251,
-  80,250,82,250,85,251,86,249,87,239,88,241,90,248,118,254,119,248,
-  120,248,122,248,200,252,211,250,212,250,213,250,214,250,215,250,
-  217,250,218,249,219,249,220,249,221,249,222,248,250,254,251,254,
-  252,254,253,254,254,248,0,1,248,0,8,252,0,14,252,0,32,251,0,36,251,
-  0,78,250,0,82,250,0,100,251,0,102,251,0,108,249,0,109,254,0,112,
-  249,0,113,254,0,114,249,0,115,254,0,116,249,0,117,254,0,122,248,
-  1,32,25,251,4,104,255,0,33,255,0,37,255,4,105,254,108,254,0,57,254,
-  4,105,254,108,254,0,57,254,16,66,251,87,250,88,250,90,250,193,251,
-  194,251,195,251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,
-  0,6,251,0,122,250,16,66,251,87,250,88,250,90,250,193,251,194,251,
-  195,251,196,251,197,251,198,251,222,250,0,2,251,0,4,251,0,6,251,
-  0,122,250,12,45,255,47,254,104,250,119,254,120,254,121,254,122,252,
-  254,252,0,1,252,0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,
-  120,254,121,254,122,252,254,252,0,1,252,0,33,250,0,37,250,12,45,
-  255,47,254,104,250,119,254,120,254,121,254,122,252,254,252,0,1,252,
-  0,33,250,0,37,250,12,45,255,47,254,104,250,119,254,120,254,121,254,
-  122,252,254,252,0,1,252,0,33,250,0,37,250,15,45,255,47,254,102,255,
-  104,255,233,255,234,255,235,255,236,255,0,21,255,0,25,255,0,27,255,
-  0,29,255,0,33,255,0,37,255,15,45,255,47,254,102,255,104,255,233,
-  255,234,255,235,255,236,255,0,21,255,0,25,255,0,27,255,0,29,255,
-  0,33,255,0,37,255,40,80,249,102,251,112,250,118,250,122,250,211,
-  249,212,249,213,249,214,249,215,249,217,249,233,251,234,251,235,
-  251,236,251,243,250,244,250,245,250,246,250,247,250,249,250,250,
-  250,251,250,252,250,253,250,254,250,0,1,250,0,21,251,0,25,251,0,
-  27,251,0,29,251,0,78,249,0,79,250,0,82,249,0,83,250,0,109,250,0,
-  113,250,0,115,250,0,117,250,22,102,255,112,255,122,255,233,255,234,
-  255,235,255,236,255,243,255,244,255,245,255,246,255,247,255,249,
-  255,254,255,0,1,255,0,21,255,0,25,255,0,27,255,0,29,255,0,79,255,
-  0,83,255,13,85,254,87,248,88,248,90,254,122,252,222,254,254,252,
-  0,1,252,0,100,254,0,102,254,0,122,254,1,32,25,251,13,85,254,87,248,
-  88,248,90,254,122,252,222,254,254,252,0,1,252,0,100,254,0,102,254,
-  0,122,254,1,32,25,251,13,85,254,87,248,88,248,90,254,122,252,222,
-  254,254,252,0,1,252,0,100,254,0,102,254,0,122,254,1,32,25,251,11,
-  66,252,193,252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,
-  4,252,0,6,252,2,119,250,11,66,252,193,252,194,252,195,252,196,252,
-  197,252,198,252,0,2,252,0,4,252,0,6,252,2,119,250,11,66,252,193,
-  252,194,252,195,252,196,252,197,252,198,252,0,2,252,0,4,252,0,6,
-  252,2,119,250,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,
-  194,248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,
-  0,6,248,0,100,250,0,102,250,0,122,249,5,104,255,119,255,0,33,255,
-  0,37,255,20,66,248,85,250,87,249,88,249,89,250,90,249,193,248,194,
-  248,195,248,196,248,197,248,198,248,222,249,0,2,248,0,4,248,0,6,
-  248,0,100,250,0,102,250,0,122,249,5,104,255,119,255,0,33,255,0,37,
-  255,24,80,250,86,250,87,254,88,254,90,254,211,250,212,250,213,250,
-  214,250,215,250,217,250,218,250,219,250,220,250,221,250,222,254,
-  0,78,250,0,82,250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,
-  254,47,45,238,46,254,47,238,98,254,100,251,101,251,102,251,104,251,
-  112,249,114,251,116,255,225,254,226,254,227,254,228,254,229,254,
-  230,254,232,251,233,251,234,251,235,251,236,251,243,249,244,249,
-  245,249,246,249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,
-  0,15,251,0,19,251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,
-  37,251,0,79,249,0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,24,
-  80,250,86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,
-  215,250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,
-  0,82,250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,47,45,
-  238,46,254,47,238,98,254,100,251,101,251,102,251,104,251,112,249,
-  114,251,116,255,225,254,226,254,227,254,228,254,229,254,230,254,
-  232,251,233,251,234,251,235,251,236,251,243,249,244,249,245,249,
-  246,249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,0,15,251,
-  0,19,251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,37,251,0,
-  79,249,0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,24,80,250,
-  86,250,87,254,88,254,90,254,211,250,212,250,213,250,214,250,215,
-  250,217,250,218,250,219,250,220,250,221,250,222,254,0,78,250,0,82,
-  250,0,108,250,0,112,250,0,114,250,0,116,250,0,122,254,47,45,238,
-  46,254,47,238,98,254,100,251,101,251,102,251,104,251,112,249,114,
-  251,116,255,225,254,226,254,227,254,228,254,229,254,230,254,232,
-  251,233,251,234,251,235,251,236,251,243,249,244,249,245,249,246,
-  249,247,249,249,249,0,3,254,0,5,254,0,7,254,0,9,251,0,15,251,0,19,
-  251,0,21,251,0,25,251,0,27,251,0,29,251,0,33,251,0,37,251,0,79,249,
-  0,83,249,0,93,255,0,97,255,0,99,255,1,2,25,255,73,45,245,46,245,
-  47,245,59,248,60,246,66,249,80,254,98,242,102,242,106,248,112,242,
-  115,248,118,248,120,245,122,245,193,249,194,249,195,249,196,249,
-  197,249,198,249,211,254,212,254,213,254,214,254,215,254,217,254,
-  225,242,226,242,227,242,228,242,229,242,230,242,233,248,234,242,
-  235,248,236,248,238,248,243,242,244,242,245,242,246,242,247,242,
-  249,242,250,248,251,248,252,248,253,248,254,245,0,1,251,0,2,249,
-  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
-  0,29,242,0,49,248,0,78,254,0,79,242,0,82,254,0,83,242,0,87,248,0,
-  89,248,0,91,248,0,109,248,0,113,248,0,115,248,0,117,248,73,45,245,
-  46,245,47,245,59,248,60,246,66,249,80,254,98,242,102,242,106,248,
-  112,242,115,248,118,248,120,245,122,245,193,249,194,249,195,249,
-  196,249,197,249,198,249,211,254,212,254,213,254,214,254,215,254,
-  217,254,225,242,226,242,227,242,228,242,229,242,230,242,233,248,
-  234,242,235,248,236,248,238,248,243,242,244,242,245,242,246,242,
-  247,242,249,242,250,248,251,248,252,248,253,248,254,245,0,1,251,
-  0,2,249,0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,
-  0,27,242,0,29,242,0,49,248,0,78,254,0,79,242,0,82,254,0,83,242,0,
-  87,248,0,89,248,0,91,248,0,109,248,0,113,248,0,115,248,0,117,248,
-  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
-  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  13,45,253,47,253,66,250,193,250,194,250,195,250,196,250,197,250,
-  198,250,0,2,250,0,4,250,0,6,250,13,45,253,47,253,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  69,45,242,46,245,47,242,59,246,60,246,66,249,80,254,98,242,102,242,
-  106,245,112,242,118,242,193,249,194,249,195,249,196,249,197,249,
-  198,249,211,254,212,254,213,254,214,254,215,254,217,254,225,242,
-  226,242,227,242,228,242,229,242,230,242,233,248,234,242,235,242,
-  236,248,237,251,238,245,239,251,240,251,243,242,244,242,245,242,
-  246,242,247,242,249,242,250,242,251,242,252,242,253,242,0,2,249,
-  0,3,242,0,4,249,0,5,242,0,6,249,0,7,242,0,21,248,0,25,242,0,27,242,
-  0,29,242,0,45,251,0,49,245,0,78,254,0,79,242,0,82,254,0,83,242,0,
-  109,242,0,113,242,0,115,242,0,117,242,2,1,32,24,238,17,33,238,101,
-  253,115,253,116,250,117,252,119,255,0,19,253,0,87,253,0,89,253,0,
-  91,253,0,93,250,0,97,250,0,99,250,0,101,252,1,2,25,250,1,32,25,238
+static afm_cuint8 afm_Times_Italic_kerning_data[] = {   /* 5584 */
+    42, 19, 66, 254, 85, 254, 87, 251, 88, 250, 90, 244, 193, 254, 194, 254,
+    195, 254,
+    196, 254, 197, 254, 198, 254, 222, 244, 0, 2, 254, 0, 4, 254, 0, 6, 254,
+    0, 100, 254,
+    0, 102, 254, 0, 122, 244, 3, 1, 32, 25, 234, 1, 32, 29, 234, 3, 1, 32, 25,
+    234, 1, 32,
+    29, 234, 50, 68, 252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87,
+    239, 88, 241,
+    90, 248, 118, 254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    248, 250, 254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8,
+    252, 0, 14,
+    252, 0, 32, 251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102,
+    251, 0, 108,
+    249, 0, 109, 254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0,
+    116, 249,
+    0, 117, 254, 0, 122, 248, 1, 32, 25, 251, 20, 66, 253, 86, 255, 193, 253,
+    194, 253,
+    195, 253, 196, 253, 197, 253, 198, 253, 218, 255, 219, 255, 220, 255, 221,
+    255,
+    0, 2, 253, 0, 4, 253, 0, 6, 253, 0, 108, 255, 0, 112, 255, 0, 114, 255, 0,
+    116, 255,
+    16, 66, 251, 87, 250, 88, 250, 90, 250, 193, 251, 194, 251, 195, 251, 196,
+    251, 197,
+    251, 198, 251, 222, 250, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 122, 250, 52,
+    45, 234,
+    47, 234, 66, 238, 98, 244, 102, 244, 106, 249, 112, 239, 115, 248, 193,
+    238, 194,
+    238, 195, 238, 196, 238, 197, 238, 198, 238, 225, 244, 226, 244, 227, 244,
+    228,
+    244, 229, 244, 230, 244, 233, 244, 234, 244, 235, 244, 236, 244, 237, 249,
+    238,
+    249, 239, 249, 240, 249, 243, 239, 244, 239, 245, 239, 246, 239, 247, 239,
+    249,
+    239, 0, 2, 238, 0, 3, 244, 0, 4, 238, 0, 5, 244, 0, 6, 238, 0, 7, 244, 0,
+    21, 244, 0, 25,
+    244, 0, 27, 244, 0, 29, 244, 0, 45, 249, 0, 49, 249, 0, 79, 239, 0, 83,
+    239, 0, 87, 248,
+    0, 89, 248, 0, 91, 248, 50, 45, 253, 47, 253, 66, 250, 98, 251, 102, 253,
+    112, 253,
+    118, 251, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 225,
+    251,
+    226, 251, 227, 251, 228, 251, 229, 251, 230, 251, 233, 253, 234, 253, 235,
+    253,
+    236, 253, 243, 253, 244, 253, 245, 253, 246, 253, 247, 253, 249, 253, 250,
+    251,
+    251, 251, 252, 251, 253, 251, 0, 2, 250, 0, 3, 251, 0, 4, 250, 0, 5, 251,
+    0, 6, 250,
+    0, 7, 251, 0, 21, 253, 0, 25, 253, 0, 27, 253, 0, 29, 253, 0, 79, 253, 0,
+    83, 253, 0,
+    109, 251, 0, 113, 251, 0, 115, 251, 0, 117, 251, 40, 80, 249, 102, 251,
+    112, 250,
+    118, 250, 122, 250, 211, 249, 212, 249, 213, 249, 214, 249, 215, 249, 217,
+    249,
+    233, 251, 234, 251, 235, 251, 236, 251, 243, 250, 244, 250, 245, 250, 246,
+    250,
+    247, 250, 249, 250, 250, 250, 251, 250, 252, 250, 253, 250, 254, 250, 0,
+    1, 250,
+    0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0, 78, 249, 0, 79, 250, 0,
+    82, 249, 0,
+    83, 250, 0, 109, 250, 0, 113, 250, 0, 115, 250, 0, 117, 250, 13, 85, 254,
+    87, 248,
+    88, 248, 90, 254, 122, 252, 222, 254, 254, 252, 0, 1, 252, 0, 100, 254, 0,
+    102, 254,
+    0, 122, 254, 1, 32, 25, 251, 11, 66, 252, 193, 252, 194, 252, 195, 252,
+    196, 252,
+    197, 252, 198, 252, 0, 2, 252, 0, 4, 252, 0, 6, 252, 20, 66, 248, 85, 250,
+    87, 249,
+    88, 249, 89, 250, 90, 249, 193, 248, 194, 248, 195, 248, 196, 248, 197,
+    248, 198,
+    248, 222, 249, 0, 2, 248, 0, 4, 248, 0, 6, 248, 0, 100, 250, 0, 102, 250,
+    0, 122, 249,
+    41, 45, 234, 47, 234, 66, 242, 98, 244, 102, 244, 112, 244, 193, 242, 194,
+    242, 195,
+    242, 196, 242, 197, 242, 198, 242, 225, 244, 226, 244, 227, 244, 228, 244,
+    229,
+    244, 230, 244, 233, 244, 234, 244, 235, 244, 236, 244, 243, 244, 244, 244,
+    245,
+    244, 246, 244, 247, 244, 249, 244, 0, 2, 242, 0, 3, 244, 0, 4, 242, 0, 5,
+    244, 0, 6,
+    242, 0, 7, 244, 0, 21, 244, 0, 25, 244, 0, 27, 244, 0, 29, 244, 0, 79,
+    244, 0, 83, 244,
+    10, 86, 255, 218, 255, 219, 255, 220, 255, 221, 255, 0, 108, 255, 0, 112,
+    255, 0,
+    114, 255, 0, 116, 255, 24, 80, 250, 86, 250, 87, 254, 88, 254, 90, 254,
+    211, 250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220,
+    250,
+    221, 250, 222, 254, 0, 78, 250, 0, 82, 250, 0, 108, 250, 0, 112, 250, 0,
+    114, 250,
+    0, 116, 250, 0, 122, 254, 73, 45, 245, 46, 245, 47, 245, 59, 248, 60, 246,
+    66, 249,
+    80, 254, 98, 242, 102, 242, 106, 248, 112, 242, 115, 248, 118, 248, 120,
+    245, 122,
+    245, 193, 249, 194, 249, 195, 249, 196, 249, 197, 249, 198, 249, 211, 254,
+    212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 242, 226, 242, 227, 242,
+    228,
+    242, 229, 242, 230, 242, 233, 248, 234, 242, 235, 248, 236, 248, 238, 248,
+    243,
+    242, 244, 242, 245, 242, 246, 242, 247, 242, 249, 242, 250, 248, 251, 248,
+    252,
+    248, 253, 248, 254, 245, 0, 1, 251, 0, 2, 249, 0, 3, 242, 0, 4, 249, 0, 5,
+    242, 0, 6,
+    249, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49,
+    248, 0, 78, 254,
+    0, 79, 242, 0, 82, 254, 0, 83, 242, 0, 87, 248, 0, 89, 248, 0, 91, 248, 0,
+    109, 248,
+    0, 113, 248, 0, 115, 248, 0, 117, 248, 13, 45, 253, 47, 253, 66, 250, 193,
+    250, 194,
+    250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6,
+    250, 69, 45,
+    235, 46, 248, 47, 235, 59, 246, 60, 245, 66, 247, 80, 252, 98, 238, 102,
+    238, 106,
+    245, 112, 238, 118, 245, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247,
+    198,
+    247, 211, 252, 212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 225, 238,
+    226,
+    238, 227, 238, 228, 238, 229, 238, 230, 238, 233, 245, 234, 238, 235, 238,
+    236,
+    245, 237, 251, 238, 245, 239, 251, 240, 251, 243, 238, 244, 238, 245, 238,
+    246,
+    238, 247, 238, 249, 238, 250, 245, 251, 245, 252, 245, 253, 245, 0, 2,
+    247, 0, 3,
+    238, 0, 4, 247, 0, 5, 238, 0, 6, 247, 0, 7, 238, 0, 21, 245, 0, 25, 238,
+    0, 27, 238, 0,
+    29, 238, 0, 45, 251, 0, 49, 245, 0, 78, 252, 0, 79, 238, 0, 82, 252, 0,
+    83, 238, 0, 109,
+    245, 0, 113, 245, 0, 115, 245, 0, 117, 245, 68, 45, 242, 46, 251, 47, 242,
+    59, 246,
+    60, 246, 66, 247, 80, 253, 98, 242, 102, 242, 106, 248, 112, 242, 118,
+    248, 122,
+    245, 193, 247, 194, 247, 195, 247, 196, 247, 197, 247, 198, 247, 211, 253,
+    212,
+    253, 213, 253, 214, 253, 215, 253, 217, 253, 225, 242, 226, 242, 227, 242,
+    228,
+    242, 229, 242, 230, 242, 233, 248, 234, 242, 235, 242, 236, 248, 238, 248,
+    243,
+    242, 244, 242, 245, 242, 246, 242, 247, 242, 249, 242, 250, 248, 251, 248,
+    252,
+    248, 253, 248, 254, 245, 0, 1, 245, 0, 2, 247, 0, 3, 242, 0, 4, 247, 0, 5,
+    242, 0, 6,
+    247, 0, 7, 242, 0, 21, 248, 0, 25, 242, 0, 27, 242, 0, 29, 242, 0, 49,
+    248, 0, 78, 253,
+    0, 79, 242, 0, 82, 253, 0, 83, 242, 0, 109, 248, 0, 113, 248, 0, 115, 248,
+    0, 117, 248,
+    69, 45, 242, 46, 245, 47, 242, 59, 246, 60, 246, 66, 249, 80, 254, 98,
+    242, 102, 242,
+    106, 245, 112, 242, 118, 242, 193, 249, 194, 249, 195, 249, 196, 249, 197,
+    249,
+    198, 249, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225,
+    242,
+    226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 248, 234, 242, 235,
+    242,
+    236, 248, 237, 251, 238, 245, 239, 251, 240, 251, 243, 242, 244, 242, 245,
+    242,
+    246, 242, 247, 242, 249, 242, 250, 242, 251, 242, 252, 242, 253, 242, 0,
+    2, 249,
+    0, 3, 242, 0, 4, 249, 0, 5, 242, 0, 6, 249, 0, 7, 242, 0, 21, 248, 0, 25,
+    242, 0, 27, 242,
+    0, 29, 242, 0, 45, 251, 0, 49, 245, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0,
+    83, 242, 0,
+    109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 4, 104, 255, 0, 33, 255,
+    0, 37, 255,
+    11, 47, 250, 118, 254, 250, 254, 251, 254, 252, 254, 253, 254, 0, 109,
+    254, 0, 113,
+    254, 0, 115, 254, 0, 117, 254, 4, 105, 254, 108, 254, 0, 57, 254, 12, 45,
+    255, 47,
+    254, 104, 250, 119, 254, 120, 254, 121, 254, 122, 252, 254, 252, 0, 1,
+    252, 0, 33,
+    250, 0, 37, 250, 8, 45, 255, 47, 254, 103, 254, 106, 254, 0, 49, 254, 0,
+    51, 247, 1,
+    32, 25, 15, 15, 45, 255, 47, 254, 102, 255, 104, 255, 233, 255, 234, 255,
+    235, 255,
+    236, 255, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 33, 255, 0,
+    37, 255, 22,
+    102, 255, 112, 255, 122, 255, 233, 255, 234, 255, 235, 255, 236, 255, 243,
+    255,
+    244, 255, 245, 255, 246, 255, 247, 255, 249, 255, 254, 255, 0, 1, 255, 0,
+    21, 255,
+    0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 255, 0, 83, 255, 2, 119, 250,
+    5, 104, 255,
+    119, 255, 0, 33, 255, 0, 37, 255, 47, 45, 238, 46, 254, 47, 238, 98, 254,
+    100, 251,
+    101, 251, 102, 251, 104, 251, 112, 249, 114, 251, 116, 255, 225, 254, 226,
+    254,
+    227, 254, 228, 254, 229, 254, 230, 254, 232, 251, 233, 251, 234, 251, 235,
+    251,
+    236, 251, 243, 249, 244, 249, 245, 249, 246, 249, 247, 249, 249, 249, 0,
+    3, 254,
+    0, 5, 254, 0, 7, 254, 0, 9, 251, 0, 15, 251, 0, 19, 251, 0, 21, 251, 0,
+    25, 251, 0, 27,
+    251, 0, 29, 251, 0, 33, 251, 0, 37, 251, 0, 79, 249, 0, 83, 249, 0, 93,
+    255, 0, 97, 255,
+    0, 99, 255, 1, 2, 25, 255, 3, 45, 245, 47, 245, 3, 45, 245, 47, 245, 3,
+    45, 248, 47,
+    248, 50, 68, 252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87, 239,
+    88, 241, 90,
+    248, 118, 254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212, 250,
+    213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    248, 250, 254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8,
+    252, 0, 14,
+    252, 0, 32, 251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102,
+    251, 0, 108,
+    249, 0, 109, 254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0,
+    116, 249,
+    0, 117, 254, 0, 122, 248, 1, 32, 25, 251, 50, 68, 252, 72, 251, 80, 250,
+    82, 250, 85,
+    251, 86, 249, 87, 239, 88, 241, 90, 248, 118, 254, 119, 248, 120, 248,
+    122, 248,
+    200, 252, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218,
+    249,
+    219, 249, 220, 249, 221, 249, 222, 248, 250, 254, 251, 254, 252, 254, 253,
+    254,
+    254, 248, 0, 1, 248, 0, 8, 252, 0, 14, 252, 0, 32, 251, 0, 36, 251, 0, 78,
+    250, 0, 82,
+    250, 0, 100, 251, 0, 102, 251, 0, 108, 249, 0, 109, 254, 0, 112, 249, 0,
+    113, 254,
+    0, 114, 249, 0, 115, 254, 0, 116, 249, 0, 117, 254, 0, 122, 248, 1, 32,
+    25, 251, 50,
+    68, 252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87, 239, 88, 241,
+    90, 248, 118,
+    254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212, 250, 213, 250,
+    214,
+    250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 248,
+    250,
+    254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8, 252, 0, 14,
+    252, 0, 32,
+    251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102, 251, 0, 108,
+    249, 0, 109,
+    254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0, 116, 249, 0,
+    117, 254,
+    0, 122, 248, 1, 32, 25, 251, 50, 68, 252, 72, 251, 80, 250, 82, 250, 85,
+    251, 86, 249,
+    87, 239, 88, 241, 90, 248, 118, 254, 119, 248, 120, 248, 122, 248, 200,
+    252, 211,
+    250, 212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249,
+    220,
+    249, 221, 249, 222, 248, 250, 254, 251, 254, 252, 254, 253, 254, 254, 248,
+    0, 1,
+    248, 0, 8, 252, 0, 14, 252, 0, 32, 251, 0, 36, 251, 0, 78, 250, 0, 82,
+    250, 0, 100, 251,
+    0, 102, 251, 0, 108, 249, 0, 109, 254, 0, 112, 249, 0, 113, 254, 0, 114,
+    249, 0, 115,
+    254, 0, 116, 249, 0, 117, 254, 0, 122, 248, 1, 32, 25, 251, 50, 68, 252,
+    72, 251, 80,
+    250, 82, 250, 85, 251, 86, 249, 87, 239, 88, 241, 90, 248, 118, 254, 119,
+    248, 120,
+    248, 122, 248, 200, 252, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250,
+    217,
+    250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 248, 250, 254, 251, 254,
+    252,
+    254, 253, 254, 254, 248, 0, 1, 248, 0, 8, 252, 0, 14, 252, 0, 32, 251, 0,
+    36, 251, 0,
+    78, 250, 0, 82, 250, 0, 100, 251, 0, 102, 251, 0, 108, 249, 0, 109, 254,
+    0, 112, 249,
+    0, 113, 254, 0, 114, 249, 0, 115, 254, 0, 116, 249, 0, 117, 254, 0, 122,
+    248, 1, 32,
+    25, 251, 50, 68, 252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87,
+    239, 88, 241,
+    90, 248, 118, 254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    248, 250, 254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8,
+    252, 0, 14,
+    252, 0, 32, 251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102,
+    251, 0, 108,
+    249, 0, 109, 254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0,
+    116, 249,
+    0, 117, 254, 0, 122, 248, 1, 32, 25, 251, 11, 66, 252, 193, 252, 194, 252,
+    195, 252,
+    196, 252, 197, 252, 198, 252, 0, 2, 252, 0, 4, 252, 0, 6, 252, 20, 66,
+    248, 85, 250,
+    87, 249, 88, 249, 89, 250, 90, 249, 193, 248, 194, 248, 195, 248, 196,
+    248, 197,
+    248, 198, 248, 222, 249, 0, 2, 248, 0, 4, 248, 0, 6, 248, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 249, 20, 66, 248, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249,
+    193, 248, 194,
+    248, 195, 248, 196, 248, 197, 248, 198, 248, 222, 249, 0, 2, 248, 0, 4,
+    248, 0, 6,
+    248, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 248, 85, 250, 87, 249,
+    88, 249,
+    89, 250, 90, 249, 193, 248, 194, 248, 195, 248, 196, 248, 197, 248, 198,
+    248, 222,
+    249, 0, 2, 248, 0, 4, 248, 0, 6, 248, 0, 100, 250, 0, 102, 250, 0, 122,
+    249, 20, 66,
+    248, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249, 193, 248, 194, 248, 195,
+    248, 196,
+    248, 197, 248, 198, 248, 222, 249, 0, 2, 248, 0, 4, 248, 0, 6, 248, 0,
+    100, 250, 0,
+    102, 250, 0, 122, 249, 20, 66, 248, 85, 250, 87, 249, 88, 249, 89, 250,
+    90, 249, 193,
+    248, 194, 248, 195, 248, 196, 248, 197, 248, 198, 248, 222, 249, 0, 2,
+    248, 0, 4,
+    248, 0, 6, 248, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 248, 85,
+    250, 87, 249,
+    88, 249, 89, 250, 90, 249, 193, 248, 194, 248, 195, 248, 196, 248, 197,
+    248, 198,
+    248, 222, 249, 0, 2, 248, 0, 4, 248, 0, 6, 248, 0, 100, 250, 0, 102, 250,
+    0, 122, 249,
+    13, 45, 253, 47, 253, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250,
+    197, 250,
+    198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 253, 47, 253, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    13, 45, 253, 47, 253, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250,
+    197, 250,
+    198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 253, 47, 253, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    69, 45, 242, 46, 245, 47, 242, 59, 246, 60, 246, 66, 249, 80, 254, 98,
+    242, 102, 242,
+    106, 245, 112, 242, 118, 242, 193, 249, 194, 249, 195, 249, 196, 249, 197,
+    249,
+    198, 249, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225,
+    242,
+    226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 248, 234, 242, 235,
+    242,
+    236, 248, 237, 251, 238, 245, 239, 251, 240, 251, 243, 242, 244, 242, 245,
+    242,
+    246, 242, 247, 242, 249, 242, 250, 242, 251, 242, 252, 242, 253, 242, 0,
+    2, 249,
+    0, 3, 242, 0, 4, 249, 0, 5, 242, 0, 6, 249, 0, 7, 242, 0, 21, 248, 0, 25,
+    242, 0, 27, 242,
+    0, 29, 242, 0, 45, 251, 0, 49, 245, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0,
+    83, 242, 0,
+    109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 4, 104, 255, 0, 33, 255,
+    0, 37, 255,
+    4, 104, 255, 0, 33, 255, 0, 37, 255, 4, 104, 255, 0, 33, 255, 0, 37, 255,
+    4, 104, 255,
+    0, 33, 255, 0, 37, 255, 4, 104, 255, 0, 33, 255, 0, 37, 255, 4, 104, 255,
+    0, 33, 255,
+    0, 37, 255, 4, 105, 254, 108, 254, 0, 57, 254, 12, 45, 255, 47, 254, 104,
+    250, 119,
+    254, 120, 254, 121, 254, 122, 252, 254, 252, 0, 1, 252, 0, 33, 250, 0, 37,
+    250, 12,
+    45, 255, 47, 254, 104, 250, 119, 254, 120, 254, 121, 254, 122, 252, 254,
+    252, 0,
+    1, 252, 0, 33, 250, 0, 37, 250, 12, 45, 255, 47, 254, 104, 250, 119, 254,
+    120, 254,
+    121, 254, 122, 252, 254, 252, 0, 1, 252, 0, 33, 250, 0, 37, 250, 12, 45,
+    255, 47, 254,
+    104, 250, 119, 254, 120, 254, 121, 254, 122, 252, 254, 252, 0, 1, 252, 0,
+    33, 250,
+    0, 37, 250, 2, 119, 250, 5, 104, 255, 119, 255, 0, 33, 255, 0, 37, 255, 5,
+    104, 255,
+    119, 255, 0, 33, 255, 0, 37, 255, 5, 104, 255, 119, 255, 0, 33, 255, 0,
+    37, 255, 5,
+    104, 255, 119, 255, 0, 33, 255, 0, 37, 255, 5, 104, 255, 119, 255, 0, 33,
+    255, 0, 37,
+    255, 5, 104, 255, 119, 255, 0, 33, 255, 0, 37, 255, 3, 45, 248, 47, 248,
+    3, 45, 248,
+    47, 248, 50, 68, 252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87,
+    239, 88, 241,
+    90, 248, 118, 254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249,
+    222,
+    248, 250, 254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8,
+    252, 0, 14,
+    252, 0, 32, 251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102,
+    251, 0, 108,
+    249, 0, 109, 254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0,
+    116, 249,
+    0, 117, 254, 0, 122, 248, 1, 32, 25, 251, 4, 104, 255, 0, 33, 255, 0, 37,
+    255, 50, 68,
+    252, 72, 251, 80, 250, 82, 250, 85, 251, 86, 249, 87, 239, 88, 241, 90,
+    248, 118,
+    254, 119, 248, 120, 248, 122, 248, 200, 252, 211, 250, 212, 250, 213, 250,
+    214,
+    250, 215, 250, 217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 248,
+    250,
+    254, 251, 254, 252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8, 252, 0, 14,
+    252, 0, 32,
+    251, 0, 36, 251, 0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102, 251, 0, 108,
+    249, 0, 109,
+    254, 0, 112, 249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0, 116, 249, 0,
+    117, 254,
+    0, 122, 248, 1, 32, 25, 251, 4, 104, 255, 0, 33, 255, 0, 37, 255, 50, 68,
+    252, 72, 251,
+    80, 250, 82, 250, 85, 251, 86, 249, 87, 239, 88, 241, 90, 248, 118, 254,
+    119, 248,
+    120, 248, 122, 248, 200, 252, 211, 250, 212, 250, 213, 250, 214, 250, 215,
+    250,
+    217, 250, 218, 249, 219, 249, 220, 249, 221, 249, 222, 248, 250, 254, 251,
+    254,
+    252, 254, 253, 254, 254, 248, 0, 1, 248, 0, 8, 252, 0, 14, 252, 0, 32,
+    251, 0, 36, 251,
+    0, 78, 250, 0, 82, 250, 0, 100, 251, 0, 102, 251, 0, 108, 249, 0, 109,
+    254, 0, 112,
+    249, 0, 113, 254, 0, 114, 249, 0, 115, 254, 0, 116, 249, 0, 117, 254, 0,
+    122, 248,
+    1, 32, 25, 251, 4, 104, 255, 0, 33, 255, 0, 37, 255, 4, 105, 254, 108,
+    254, 0, 57, 254,
+    4, 105, 254, 108, 254, 0, 57, 254, 16, 66, 251, 87, 250, 88, 250, 90, 250,
+    193, 251,
+    194, 251, 195, 251, 196, 251, 197, 251, 198, 251, 222, 250, 0, 2, 251, 0,
+    4, 251,
+    0, 6, 251, 0, 122, 250, 16, 66, 251, 87, 250, 88, 250, 90, 250, 193, 251,
+    194, 251,
+    195, 251, 196, 251, 197, 251, 198, 251, 222, 250, 0, 2, 251, 0, 4, 251, 0,
+    6, 251,
+    0, 122, 250, 12, 45, 255, 47, 254, 104, 250, 119, 254, 120, 254, 121, 254,
+    122, 252,
+    254, 252, 0, 1, 252, 0, 33, 250, 0, 37, 250, 12, 45, 255, 47, 254, 104,
+    250, 119, 254,
+    120, 254, 121, 254, 122, 252, 254, 252, 0, 1, 252, 0, 33, 250, 0, 37, 250,
+    12, 45,
+    255, 47, 254, 104, 250, 119, 254, 120, 254, 121, 254, 122, 252, 254, 252,
+    0, 1, 252,
+    0, 33, 250, 0, 37, 250, 12, 45, 255, 47, 254, 104, 250, 119, 254, 120,
+    254, 121, 254,
+    122, 252, 254, 252, 0, 1, 252, 0, 33, 250, 0, 37, 250, 15, 45, 255, 47,
+    254, 102, 255,
+    104, 255, 233, 255, 234, 255, 235, 255, 236, 255, 0, 21, 255, 0, 25, 255,
+    0, 27, 255,
+    0, 29, 255, 0, 33, 255, 0, 37, 255, 15, 45, 255, 47, 254, 102, 255, 104,
+    255, 233,
+    255, 234, 255, 235, 255, 236, 255, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0,
+    29, 255,
+    0, 33, 255, 0, 37, 255, 40, 80, 249, 102, 251, 112, 250, 118, 250, 122,
+    250, 211,
+    249, 212, 249, 213, 249, 214, 249, 215, 249, 217, 249, 233, 251, 234, 251,
+    235,
+    251, 236, 251, 243, 250, 244, 250, 245, 250, 246, 250, 247, 250, 249, 250,
+    250,
+    250, 251, 250, 252, 250, 253, 250, 254, 250, 0, 1, 250, 0, 21, 251, 0, 25,
+    251, 0,
+    27, 251, 0, 29, 251, 0, 78, 249, 0, 79, 250, 0, 82, 249, 0, 83, 250, 0,
+    109, 250, 0,
+    113, 250, 0, 115, 250, 0, 117, 250, 22, 102, 255, 112, 255, 122, 255, 233,
+    255, 234,
+    255, 235, 255, 236, 255, 243, 255, 244, 255, 245, 255, 246, 255, 247, 255,
+    249,
+    255, 254, 255, 0, 1, 255, 0, 21, 255, 0, 25, 255, 0, 27, 255, 0, 29, 255,
+    0, 79, 255,
+    0, 83, 255, 13, 85, 254, 87, 248, 88, 248, 90, 254, 122, 252, 222, 254,
+    254, 252,
+    0, 1, 252, 0, 100, 254, 0, 102, 254, 0, 122, 254, 1, 32, 25, 251, 13, 85,
+    254, 87, 248,
+    88, 248, 90, 254, 122, 252, 222, 254, 254, 252, 0, 1, 252, 0, 100, 254, 0,
+    102, 254,
+    0, 122, 254, 1, 32, 25, 251, 13, 85, 254, 87, 248, 88, 248, 90, 254, 122,
+    252, 222,
+    254, 254, 252, 0, 1, 252, 0, 100, 254, 0, 102, 254, 0, 122, 254, 1, 32,
+    25, 251, 11,
+    66, 252, 193, 252, 194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 0, 2,
+    252, 0,
+    4, 252, 0, 6, 252, 2, 119, 250, 11, 66, 252, 193, 252, 194, 252, 195, 252,
+    196, 252,
+    197, 252, 198, 252, 0, 2, 252, 0, 4, 252, 0, 6, 252, 2, 119, 250, 11, 66,
+    252, 193,
+    252, 194, 252, 195, 252, 196, 252, 197, 252, 198, 252, 0, 2, 252, 0, 4,
+    252, 0, 6,
+    252, 2, 119, 250, 20, 66, 248, 85, 250, 87, 249, 88, 249, 89, 250, 90,
+    249, 193, 248,
+    194, 248, 195, 248, 196, 248, 197, 248, 198, 248, 222, 249, 0, 2, 248, 0,
+    4, 248,
+    0, 6, 248, 0, 100, 250, 0, 102, 250, 0, 122, 249, 5, 104, 255, 119, 255,
+    0, 33, 255,
+    0, 37, 255, 20, 66, 248, 85, 250, 87, 249, 88, 249, 89, 250, 90, 249, 193,
+    248, 194,
+    248, 195, 248, 196, 248, 197, 248, 198, 248, 222, 249, 0, 2, 248, 0, 4,
+    248, 0, 6,
+    248, 0, 100, 250, 0, 102, 250, 0, 122, 249, 5, 104, 255, 119, 255, 0, 33,
+    255, 0, 37,
+    255, 24, 80, 250, 86, 250, 87, 254, 88, 254, 90, 254, 211, 250, 212, 250,
+    213, 250,
+    214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222,
+    254,
+    0, 78, 250, 0, 82, 250, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0, 116,
+    250, 0, 122,
+    254, 47, 45, 238, 46, 254, 47, 238, 98, 254, 100, 251, 101, 251, 102, 251,
+    104, 251,
+    112, 249, 114, 251, 116, 255, 225, 254, 226, 254, 227, 254, 228, 254, 229,
+    254,
+    230, 254, 232, 251, 233, 251, 234, 251, 235, 251, 236, 251, 243, 249, 244,
+    249,
+    245, 249, 246, 249, 247, 249, 249, 249, 0, 3, 254, 0, 5, 254, 0, 7, 254,
+    0, 9, 251,
+    0, 15, 251, 0, 19, 251, 0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0,
+    33, 251, 0,
+    37, 251, 0, 79, 249, 0, 83, 249, 0, 93, 255, 0, 97, 255, 0, 99, 255, 1, 2,
+    25, 255, 24,
+    80, 250, 86, 250, 87, 254, 88, 254, 90, 254, 211, 250, 212, 250, 213, 250,
+    214, 250,
+    215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222, 254, 0,
+    78, 250,
+    0, 82, 250, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122,
+    254, 47, 45,
+    238, 46, 254, 47, 238, 98, 254, 100, 251, 101, 251, 102, 251, 104, 251,
+    112, 249,
+    114, 251, 116, 255, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230,
+    254,
+    232, 251, 233, 251, 234, 251, 235, 251, 236, 251, 243, 249, 244, 249, 245,
+    249,
+    246, 249, 247, 249, 249, 249, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 9, 251,
+    0, 15, 251,
+    0, 19, 251, 0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0, 33, 251, 0,
+    37, 251, 0,
+    79, 249, 0, 83, 249, 0, 93, 255, 0, 97, 255, 0, 99, 255, 1, 2, 25, 255,
+    24, 80, 250,
+    86, 250, 87, 254, 88, 254, 90, 254, 211, 250, 212, 250, 213, 250, 214,
+    250, 215,
+    250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222, 254, 0, 78,
+    250, 0, 82,
+    250, 0, 108, 250, 0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122, 254, 47,
+    45, 238,
+    46, 254, 47, 238, 98, 254, 100, 251, 101, 251, 102, 251, 104, 251, 112,
+    249, 114,
+    251, 116, 255, 225, 254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254,
+    232,
+    251, 233, 251, 234, 251, 235, 251, 236, 251, 243, 249, 244, 249, 245, 249,
+    246,
+    249, 247, 249, 249, 249, 0, 3, 254, 0, 5, 254, 0, 7, 254, 0, 9, 251, 0,
+    15, 251, 0, 19,
+    251, 0, 21, 251, 0, 25, 251, 0, 27, 251, 0, 29, 251, 0, 33, 251, 0, 37,
+    251, 0, 79, 249,
+    0, 83, 249, 0, 93, 255, 0, 97, 255, 0, 99, 255, 1, 2, 25, 255, 73, 45,
+    245, 46, 245,
+    47, 245, 59, 248, 60, 246, 66, 249, 80, 254, 98, 242, 102, 242, 106, 248,
+    112, 242,
+    115, 248, 118, 248, 120, 245, 122, 245, 193, 249, 194, 249, 195, 249, 196,
+    249,
+    197, 249, 198, 249, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217,
+    254,
+    225, 242, 226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 248, 234,
+    242,
+    235, 248, 236, 248, 238, 248, 243, 242, 244, 242, 245, 242, 246, 242, 247,
+    242,
+    249, 242, 250, 248, 251, 248, 252, 248, 253, 248, 254, 245, 0, 1, 251, 0,
+    2, 249,
+    0, 3, 242, 0, 4, 249, 0, 5, 242, 0, 6, 249, 0, 7, 242, 0, 21, 248, 0, 25,
+    242, 0, 27, 242,
+    0, 29, 242, 0, 49, 248, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0, 83, 242, 0,
+    87, 248, 0,
+    89, 248, 0, 91, 248, 0, 109, 248, 0, 113, 248, 0, 115, 248, 0, 117, 248,
+    73, 45, 245,
+    46, 245, 47, 245, 59, 248, 60, 246, 66, 249, 80, 254, 98, 242, 102, 242,
+    106, 248,
+    112, 242, 115, 248, 118, 248, 120, 245, 122, 245, 193, 249, 194, 249, 195,
+    249,
+    196, 249, 197, 249, 198, 249, 211, 254, 212, 254, 213, 254, 214, 254, 215,
+    254,
+    217, 254, 225, 242, 226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233,
+    248,
+    234, 242, 235, 248, 236, 248, 238, 248, 243, 242, 244, 242, 245, 242, 246,
+    242,
+    247, 242, 249, 242, 250, 248, 251, 248, 252, 248, 253, 248, 254, 245, 0,
+    1, 251,
+    0, 2, 249, 0, 3, 242, 0, 4, 249, 0, 5, 242, 0, 6, 249, 0, 7, 242, 0, 21,
+    248, 0, 25, 242,
+    0, 27, 242, 0, 29, 242, 0, 49, 248, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0,
+    83, 242, 0,
+    87, 248, 0, 89, 248, 0, 91, 248, 0, 109, 248, 0, 113, 248, 0, 115, 248, 0,
+    117, 248,
+    13, 45, 253, 47, 253, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250,
+    197, 250,
+    198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 253, 47, 253, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    13, 45, 253, 47, 253, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250,
+    197, 250,
+    198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 13, 45, 253, 47, 253, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    69, 45, 242, 46, 245, 47, 242, 59, 246, 60, 246, 66, 249, 80, 254, 98,
+    242, 102, 242,
+    106, 245, 112, 242, 118, 242, 193, 249, 194, 249, 195, 249, 196, 249, 197,
+    249,
+    198, 249, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225,
+    242,
+    226, 242, 227, 242, 228, 242, 229, 242, 230, 242, 233, 248, 234, 242, 235,
+    242,
+    236, 248, 237, 251, 238, 245, 239, 251, 240, 251, 243, 242, 244, 242, 245,
+    242,
+    246, 242, 247, 242, 249, 242, 250, 242, 251, 242, 252, 242, 253, 242, 0,
+    2, 249,
+    0, 3, 242, 0, 4, 249, 0, 5, 242, 0, 6, 249, 0, 7, 242, 0, 21, 248, 0, 25,
+    242, 0, 27, 242,
+    0, 29, 242, 0, 45, 251, 0, 49, 245, 0, 78, 254, 0, 79, 242, 0, 82, 254, 0,
+    83, 242, 0,
+    109, 242, 0, 113, 242, 0, 115, 242, 0, 117, 242, 2, 1, 32, 24, 238, 17,
+    33, 238, 101,
+    253, 115, 253, 116, 250, 117, 252, 119, 255, 0, 19, 253, 0, 87, 253, 0,
+    89, 253, 0,
+    91, 253, 0, 93, 250, 0, 97, 250, 0, 99, 250, 0, 101, 252, 1, 2, 25, 250,
+    1, 32, 25, 238
 };
-static afm_cuint16 afm_Times_Italic_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Times_Italic_highchars_index[] = {   /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
-static afm_cunicode afm_Times_Italic_ligatures[] = { /* 3 */
-  102,105,64257
+static afm_cunicode afm_Times_Italic_ligatures[] = {    /* 3 */
+    102, 105, 64257
 };
 
 
@@ -2898,441 +5551,748 @@ static afm_cunicode afm_Times_Italic_ligatures[] = { /* 3 */
 /* FontName: Times-Roman */
 /* FullName: Times Roman */
 /* FamilyName: Times */
-static afm_cuint8 afm_Times_Roman_widths[] = { /* 315 */
-  42,56,68,83,83,139,130,30,56,56,83,94,42,56,42,46,83,83,83,83,83,
-  83,83,83,83,83,46,46,94,94,94,74,154,120,111,111,120,102,93,120,
-  120,56,65,120,102,148,120,120,93,120,111,93,102,120,120,157,120,
-  120,102,56,46,56,78,83,56,74,83,74,83,74,56,83,83,46,46,83,46,130,
-  83,83,83,83,56,65,46,83,83,120,83,83,74,80,33,80,90,56,83,83,83,
-  83,33,83,56,127,46,83,94,127,56,67,94,50,50,56,83,76,42,56,50,52,
-  83,125,125,125,74,120,120,120,120,120,120,148,111,102,102,102,102,
-  56,56,56,56,120,120,120,120,120,120,120,94,120,120,120,120,120,120,
-  93,83,74,74,74,74,74,74,111,74,74,74,74,74,46,46,46,46,83,83,83,
-  83,83,83,83,94,83,83,83,83,83,83,83,83,120,74,120,74,120,74,111,
-  74,111,74,120,98,120,83,102,74,102,74,102,74,102,74,120,83,120,83,
-  56,46,56,46,56,46,120,83,102,46,102,46,102,57,102,46,120,83,120,
-  83,120,83,120,83,120,83,148,120,111,56,111,56,111,56,93,65,93,65,
-  93,65,102,46,102,54,120,83,120,83,120,83,120,83,120,102,74,102,74,
-  102,74,83,93,65,56,56,56,56,56,56,56,56,83,167,56,56,56,74,74,74,
-  83,83,58,167,167,56,56,28,83,163,79,102,100,94,76,92,92,92,79,42,
-  93,93
+static afm_cuint8 afm_Times_Roman_widths[] = {  /* 315 */
+    42, 56, 68, 83, 83, 139, 130, 30, 56, 56, 83, 94, 42, 56, 42, 46, 83, 83,
+    83, 83, 83,
+    83, 83, 83, 83, 83, 46, 46, 94, 94, 94, 74, 154, 120, 111, 111, 120, 102,
+    93, 120,
+    120, 56, 65, 120, 102, 148, 120, 120, 93, 120, 111, 93, 102, 120, 120,
+    157, 120,
+    120, 102, 56, 46, 56, 78, 83, 56, 74, 83, 74, 83, 74, 56, 83, 83, 46, 46,
+    83, 46, 130,
+    83, 83, 83, 83, 56, 65, 46, 83, 83, 120, 83, 83, 74, 80, 33, 80, 90, 56,
+    83, 83, 83,
+    83, 33, 83, 56, 127, 46, 83, 94, 127, 56, 67, 94, 50, 50, 56, 83, 76, 42,
+    56, 50, 52,
+    83, 125, 125, 125, 74, 120, 120, 120, 120, 120, 120, 148, 111, 102, 102,
+    102, 102,
+    56, 56, 56, 56, 120, 120, 120, 120, 120, 120, 120, 94, 120, 120, 120, 120,
+    120, 120,
+    93, 83, 74, 74, 74, 74, 74, 74, 111, 74, 74, 74, 74, 74, 46, 46, 46, 46,
+    83, 83, 83,
+    83, 83, 83, 83, 94, 83, 83, 83, 83, 83, 83, 83, 83, 120, 74, 120, 74, 120,
+    74, 111,
+    74, 111, 74, 120, 98, 120, 83, 102, 74, 102, 74, 102, 74, 102, 74, 120,
+    83, 120, 83,
+    56, 46, 56, 46, 56, 46, 120, 83, 102, 46, 102, 46, 102, 57, 102, 46, 120,
+    83, 120,
+    83, 120, 83, 120, 83, 120, 83, 148, 120, 111, 56, 111, 56, 111, 56, 93,
+    65, 93, 65,
+    93, 65, 102, 46, 102, 54, 120, 83, 120, 83, 120, 83, 120, 83, 120, 102,
+    74, 102, 74,
+    102, 74, 83, 93, 65, 56, 56, 56, 56, 56, 56, 56, 56, 83, 167, 56, 56, 56,
+    74, 74, 74,
+    83, 83, 58, 167, 167, 56, 56, 28, 83, 163, 79, 102, 100, 94, 76, 92, 92,
+    92, 79, 42,
+    93, 93
 };
-static afm_sint16 afm_Times_Roman_kerning_index[] = { /* 315 */
-  1,0,0,0,0,0,0,0,0,0,0,0,44,0,53,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,62,159,0,205,0,240,0,0,0,311,335,427,0,458,482,527,578,601,0,
-  663,831,855,1020,0,1175,0,0,0,0,0,0,0,1323,1328,1355,0,1363,1385,
-  0,0,1422,0,1425,1475,0,1478,1488,1500,0,1508,0,0,0,1523,1593,1641,
-  1664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,0,1669,1766,1863,1960,2057,2154,0,0,0,0,0,0,0,0,0,0,0,2251,
-  2275,2320,2365,2410,2455,0,2500,2545,2569,2593,2617,2641,0,0,2789,
-  2794,2799,2804,2809,2814,0,2819,2827,2849,2871,2893,2915,2918,2921,
-  2924,0,2927,2937,2949,2961,2973,2985,0,2997,0,0,0,0,3009,0,3014,
-  3019,3116,3121,3218,3223,3320,0,3325,0,3333,3341,0,3376,0,0,3411,
-  0,3433,0,3455,0,3477,0,0,0,0,0,3499,0,3502,0,0,3505,3597,3647,3678,
-  3681,3712,3715,0,3727,3758,3761,3785,3795,3819,3829,3853,3863,3908,
-  3920,3965,0,0,3977,4039,4054,4116,4131,4193,0,0,0,0,0,0,4208,0,4376,
-  0,4544,0,4568,0,4592,0,4616,0,4640,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0,4788,4816,0,4872,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-  0,0,0,0
+static afm_sint16 afm_Times_Roman_kerning_index[] = {   /* 315 */
+    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 62, 159, 0, 205, 0, 240, 0, 0, 0, 311, 335, 427, 0, 458, 482, 527,
+    578, 601, 0,
+    663, 831, 855, 1020, 0, 1175, 0, 0, 0, 0, 0, 0, 0, 1323, 1328, 1355, 0,
+    1363, 1385,
+    0, 0, 1422, 0, 1425, 1475, 0, 1478, 1488, 1500, 0, 1508, 0, 0, 0, 1523,
+    1593, 1641,
+    1664, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 1669, 1766, 1863, 1960, 2057, 2154, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 2251,
+    2275, 2320, 2365, 2410, 2455, 0, 2500, 2545, 2569, 2593, 2617, 2641, 0, 0,
+    2789,
+    2794, 2799, 2804, 2809, 2814, 0, 2819, 2827, 2849, 2871, 2893, 2915, 2918,
+    2921,
+    2924, 0, 2927, 2937, 2949, 2961, 2973, 2985, 0, 2997, 0, 0, 0, 0, 3009, 0,
+    3014,
+    3019, 3116, 3121, 3218, 3223, 3320, 0, 3325, 0, 3333, 3341, 0, 3376, 0, 0,
+    3411,
+    0, 3433, 0, 3455, 0, 3477, 0, 0, 0, 0, 0, 3499, 0, 3502, 0, 0, 3505, 3597,
+    3647, 3678,
+    3681, 3712, 3715, 0, 3727, 3758, 3761, 3785, 3795, 3819, 3829, 3853, 3863,
+    3908,
+    3920, 3965, 0, 0, 3977, 4039, 4054, 4116, 4131, 4193, 0, 0, 0, 0, 0, 0,
+    4208, 0, 4376,
+    0, 4544, 0, 4568, 0, 4592, 0, 4616, 0, 4640, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0,
+    0, 0, 0, 0, 4788, 4816, 0, 4872, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0
 };
-static afm_cuint8 afm_Times_Roman_kerning_data[] = { /* 4896 */
-  42,19,66,248,85,254,87,249,88,252,90,242,193,248,194,248,195,248,
-  196,248,197,248,198,248,222,242,0,2,248,0,4,248,0,6,248,0,100,254,
-  0,102,254,0,122,242,3,1,32,25,245,1,32,29,245,3,1,32,25,245,1,32,
-  29,245,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,
-  90,239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
-  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
-  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
-  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
-  239,1,32,25,238,20,66,251,86,255,193,251,194,251,195,251,196,251,
-  197,251,198,251,218,255,219,255,220,255,221,255,0,2,251,0,4,251,
-  0,6,251,0,108,255,0,112,255,0,114,255,0,116,255,16,66,250,87,250,
-  88,252,90,248,193,250,194,250,195,250,196,250,197,250,198,250,222,
-  248,0,2,250,0,4,250,0,6,250,0,122,248,32,45,244,47,244,66,245,98,
-  254,112,254,193,245,194,245,195,245,196,245,197,245,198,245,225,
-  254,226,254,227,254,228,254,229,254,230,254,243,254,244,254,245,
-  254,246,254,247,254,249,254,0,2,245,0,3,254,0,4,245,0,5,254,0,6,
-  245,0,7,254,0,79,254,0,83,254,11,66,247,193,247,194,247,195,247,
-  196,247,197,247,198,247,0,2,247,0,4,247,0,6,247,40,80,252,102,253,
-  112,251,118,254,122,253,211,252,212,252,213,252,214,252,215,252,
-  217,252,233,253,234,253,235,253,236,253,243,251,244,251,245,251,
-  246,251,247,251,249,251,250,254,251,254,252,254,253,254,254,253,
-  0,1,253,0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,0,79,251,0,
-  82,252,0,83,251,0,109,254,0,113,254,0,115,254,0,117,254,13,85,242,
-  87,240,88,245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,
-  102,242,0,122,240,1,32,25,242,11,66,251,193,251,194,251,195,251,
-  196,251,197,251,198,251,0,2,251,0,4,251,0,6,251,20,66,251,85,250,
-  87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,251,197,
-  251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,250,
-  0,122,249,23,45,238,47,238,66,242,98,254,193,242,194,242,195,242,
-  196,242,197,242,198,242,225,254,226,254,227,254,228,254,229,254,
-  230,254,0,2,242,0,3,254,0,4,242,0,5,254,0,6,242,0,7,254,10,86,255,
-  218,255,219,255,220,255,221,255,0,108,255,0,112,255,0,114,255,0,
-  116,255,27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,212,
-  250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,221,
-  250,222,246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,
-  250,0,114,250,0,116,250,0,122,246,73,45,245,46,242,47,245,59,249,
-  60,248,66,241,80,254,98,244,102,245,106,251,112,244,115,251,118,
-  249,120,244,122,244,193,241,194,241,195,241,196,241,197,241,198,
-  241,211,254,212,254,213,254,214,254,215,254,217,254,225,250,226,
-  244,227,244,228,250,229,250,230,244,233,245,234,245,235,245,236,
-  252,238,251,243,244,244,244,245,244,246,244,247,244,249,244,250,
-  249,251,249,252,249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,
-  241,0,5,244,0,6,241,0,7,244,0,21,252,0,25,245,0,27,245,0,29,245,
-  0,49,251,0,78,254,0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,
-  91,251,0,109,249,0,113,249,0,115,249,0,117,249,11,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  72,45,235,46,240,47,235,59,245,60,245,66,234,72,254,80,250,98,238,
-  102,238,106,247,112,235,118,244,193,234,194,234,195,234,196,234,
-  197,234,198,234,211,250,212,250,213,250,214,250,215,250,217,250,
-  225,245,226,238,227,245,228,245,229,245,230,238,233,245,234,238,
-  235,245,236,245,237,254,238,247,239,254,240,254,243,242,244,235,
-  245,235,246,242,247,242,249,235,250,244,251,244,252,244,253,244,
-  0,2,234,0,3,245,0,4,234,0,5,238,0,6,234,0,7,238,0,21,245,0,25,238,
-  0,27,238,0,29,245,0,32,254,0,36,254,0,45,254,0,49,247,0,78,250,0,
-  79,242,0,82,250,0,83,235,0,109,244,0,113,244,0,115,244,0,117,244,
-  68,45,242,46,246,47,242,59,251,60,251,66,237,80,255,98,244,102,244,
-  106,250,112,244,118,249,122,245,193,237,194,237,195,237,196,237,
-  197,237,198,237,211,255,212,255,213,255,214,255,215,255,217,255,
-  225,244,226,244,227,244,228,244,229,244,230,244,233,250,234,244,
-  235,244,236,250,238,250,243,244,244,244,245,244,246,244,247,244,
-  249,244,250,249,251,249,252,249,253,249,254,245,0,1,245,0,2,237,
-  0,3,244,0,4,237,0,5,244,0,6,237,0,7,244,0,21,250,0,25,244,0,27,244,
-  0,29,244,0,49,250,0,78,255,0,79,244,0,82,255,0,83,244,0,109,249,
-  0,113,249,0,115,249,0,117,249,65,45,235,46,238,47,235,59,242,60,
-  242,66,237,80,252,98,240,102,240,106,248,112,239,118,238,193,237,
-  194,237,195,237,196,237,197,237,198,237,211,252,212,252,213,252,
-  214,252,215,252,217,252,225,247,226,240,227,240,228,247,229,247,
-  230,240,233,247,234,240,235,240,236,247,238,248,243,245,244,239,
-  245,239,246,245,247,245,249,239,250,245,251,238,252,238,253,245,
-  0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,0,21,247,0,25,240,
-  0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,82,252,0,83,239,0,
-  109,245,0,113,238,0,115,238,0,117,238,3,119,254,120,254,12,47,250,
-  118,254,119,254,250,254,251,254,252,254,253,254,0,109,254,0,113,
-  254,0,115,254,0,117,254,4,122,254,254,254,0,1,254,10,104,254,119,
-  253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,254,16,
-  98,255,103,253,106,254,225,255,226,255,227,255,228,255,229,255,230,
-  255,238,254,0,3,255,0,5,255,0,7,255,0,51,249,1,32,25,9,2,119,253,
-  22,102,255,112,255,122,254,233,255,234,255,235,255,236,255,243,255,
-  244,255,245,255,246,255,247,255,249,255,254,254,0,1,254,0,21,255,
-  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,2,120,255,5,119,250,
-  122,254,254,254,0,1,254,6,119,254,120,253,122,255,254,255,0,1,255,
-  4,122,255,254,255,0,1,255,7,45,250,46,254,47,248,104,254,0,33,254,
-  0,37,254,31,45,246,47,246,98,253,102,254,112,254,225,253,226,253,
-  227,253,228,253,229,253,230,253,233,254,234,254,235,254,236,254,
-  243,254,244,254,245,254,246,254,247,254,249,254,0,3,253,0,5,253,
-  0,7,253,0,21,254,0,25,254,0,27,254,0,29,254,0,79,254,0,83,254,22,
-  45,246,47,246,98,255,112,255,225,255,226,255,227,255,228,255,229,
-  255,230,255,243,255,244,255,245,255,246,255,247,255,249,255,0,3,
-  255,0,5,255,0,7,255,0,79,255,0,83,255,10,102,254,233,254,234,254,
-  235,254,236,254,0,21,254,0,25,254,0,27,254,0,29,254,3,45,246,47,
-  246,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,
-  239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
-  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
-  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
-  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
-  239,1,32,25,238,41,68,250,72,250,80,248,82,248,85,238,86,248,87,
-  234,88,242,90,239,119,245,120,242,122,242,200,250,211,248,212,248,
-  213,248,214,248,215,248,217,248,218,248,219,248,220,248,221,248,
-  222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,
-  248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,
-  116,248,0,122,239,1,32,25,238,41,68,250,72,250,80,248,82,248,85,
-  238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,200,250,
-  211,248,212,248,213,248,214,248,215,248,217,248,218,248,219,248,
-  220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,
-  0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,
-  0,114,248,0,116,248,0,122,239,1,32,25,238,41,68,250,72,250,80,248,
-  82,248,85,238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,
-  200,250,211,248,212,248,213,248,214,248,215,248,217,248,218,248,
-  219,248,220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,
-  0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,
-  0,112,248,0,114,248,0,116,248,0,122,239,1,32,25,238,41,68,250,72,
-  250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,119,245,120,
-  242,122,242,200,250,211,248,212,248,213,248,214,248,215,248,217,
-  248,218,248,219,248,220,248,221,248,222,239,254,242,0,1,242,0,8,
-  250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,0,102,
-  238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,1,32,25,238,
-  41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,
-  119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,248,
-  215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,242,
-  0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,
-  238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,
-  1,32,25,238,11,66,251,193,251,194,251,195,251,196,251,197,251,198,
-  251,0,2,251,0,4,251,0,6,251,20,66,251,85,250,87,249,88,251,89,250,
-  90,249,193,251,194,251,195,251,196,251,197,251,198,251,222,249,0,
-  2,251,0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,20,66,251,85,
-  250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,251,
-  197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,
-  250,0,122,249,20,66,251,85,250,87,249,88,251,89,250,90,249,193,251,
-  194,251,195,251,196,251,197,251,198,251,222,249,0,2,251,0,4,251,
-  0,6,251,0,100,250,0,102,250,0,122,249,20,66,251,85,250,87,249,88,
-  251,89,250,90,249,193,251,194,251,195,251,196,251,197,251,198,251,
-  222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,20,
-  66,251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,
-  196,251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,
-  0,102,250,0,122,249,20,66,251,85,250,87,249,88,251,89,250,90,249,
-  193,251,194,251,195,251,196,251,197,251,198,251,222,249,0,2,251,
-  0,4,251,0,6,251,0,100,250,0,102,250,0,122,249,11,66,250,193,250,
-  194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,
-  11,66,250,193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,
-  0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,196,250,197,250,
-  198,250,0,2,250,0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,
-  196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,235,46,238,
-  47,235,59,242,60,242,66,237,80,252,98,240,102,240,106,248,112,239,
-  118,238,193,237,194,237,195,237,196,237,197,237,198,237,211,252,
-  212,252,213,252,214,252,215,252,217,252,225,247,226,240,227,240,
-  228,247,229,247,230,240,233,247,234,240,235,240,236,247,238,248,
-  243,245,244,239,245,239,246,245,247,245,249,239,250,245,251,238,
-  252,238,253,245,0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,
-  0,21,247,0,25,240,0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,
-  82,252,0,83,239,0,109,245,0,113,238,0,115,238,0,117,238,3,119,254,
-  120,254,3,119,254,120,254,3,119,254,120,254,3,119,254,120,254,3,
-  119,254,120,254,3,119,254,120,254,4,122,254,254,254,0,1,254,10,104,
-  254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,
-  254,10,104,254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,
-  33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,254,254,254,
-  0,1,254,0,33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,
-  254,254,254,0,1,254,0,33,254,0,37,254,2,119,253,2,119,253,2,119,
-  253,2,119,253,5,119,250,122,254,254,254,0,1,254,6,119,254,120,253,
-  122,255,254,255,0,1,255,6,119,254,120,253,122,255,254,255,0,1,255,
-  6,119,254,120,253,122,255,254,255,0,1,255,6,119,254,120,253,122,
-  255,254,255,0,1,255,6,119,254,120,253,122,255,254,255,0,1,255,6,
-  119,254,120,253,122,255,254,255,0,1,255,3,45,246,47,246,3,45,246,
-  47,246,41,68,250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,
-  90,239,119,245,120,242,122,242,200,250,211,248,212,248,213,248,214,
-  248,215,248,217,248,218,248,219,248,220,248,221,248,222,239,254,
-  242,0,1,242,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,
-  0,100,238,0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,
-  239,1,32,25,238,3,119,254,120,254,41,68,250,72,250,80,248,82,248,
-  85,238,86,248,87,234,88,242,90,239,119,245,120,242,122,242,200,250,
-  211,248,212,248,213,248,214,248,215,248,217,248,218,248,219,248,
-  220,248,221,248,222,239,254,242,0,1,242,0,8,250,0,14,250,0,32,250,
-  0,36,250,0,78,248,0,82,248,0,100,238,0,102,238,0,108,248,0,112,248,
-  0,114,248,0,116,248,0,122,239,1,32,25,238,3,119,254,120,254,41,68,
-  250,72,250,80,248,82,248,85,238,86,248,87,234,88,242,90,239,119,
-  245,120,248,122,248,200,250,211,248,212,248,213,248,214,248,215,
-  248,217,248,218,248,219,248,220,248,221,248,222,239,254,248,0,1,
-  248,0,8,250,0,14,250,0,32,250,0,36,250,0,78,248,0,82,248,0,100,238,
-  0,102,238,0,108,248,0,112,248,0,114,248,0,116,248,0,122,239,1,32,
-  25,238,3,119,254,120,254,4,122,254,254,254,0,1,254,4,122,254,254,
-  254,0,1,254,16,66,250,87,250,88,252,90,248,193,250,194,250,195,250,
-  196,250,197,250,198,250,222,248,0,2,250,0,4,250,0,6,250,0,122,248,
-  16,66,250,87,250,88,252,90,248,193,250,194,250,195,250,196,250,197,
-  250,198,250,222,248,0,2,250,0,4,250,0,6,250,0,122,248,10,104,254,
-  119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,254,0,37,254,
-  10,104,254,119,253,120,253,121,254,122,254,254,254,0,1,254,0,33,
-  254,0,37,254,10,104,254,119,253,120,253,121,254,122,254,254,254,
-  0,1,254,0,33,254,0,37,254,10,104,254,119,253,120,253,121,254,122,
-  254,254,254,0,1,254,0,33,254,0,37,254,2,119,253,2,119,253,40,80,
-  252,102,253,112,251,118,254,122,253,211,252,212,252,213,252,214,
-  252,215,252,217,252,233,253,234,253,235,253,236,253,243,251,244,
-  251,245,251,246,251,247,251,249,251,250,254,251,254,252,254,253,
-  254,254,253,0,1,253,0,21,253,0,25,253,0,27,253,0,29,253,0,78,252,
-  0,79,251,0,82,252,0,83,251,0,109,254,0,113,254,0,115,254,0,117,254,
-  22,102,255,112,255,122,254,233,255,234,255,235,255,236,255,243,255,
-  244,255,245,255,246,255,247,255,249,255,254,254,0,1,254,0,21,255,
-  0,25,255,0,27,255,0,29,255,0,79,255,0,83,255,13,85,242,87,240,88,
-  245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,102,242,0,
-  122,240,1,32,25,242,2,120,255,13,85,242,87,240,88,245,90,240,122,
-  248,222,240,254,248,0,1,248,0,100,242,0,102,242,0,122,240,1,32,25,
-  242,2,120,255,5,122,248,254,248,0,1,248,1,32,25,242,13,85,242,87,
-  240,88,245,90,240,122,248,222,240,254,248,0,1,248,0,100,242,0,102,
-  242,0,122,240,1,32,25,242,2,120,255,11,66,251,193,251,194,251,195,
-  251,196,251,197,251,198,251,0,2,251,0,4,251,0,6,251,5,119,250,122,
-  254,254,254,0,1,254,11,66,251,193,251,194,251,195,251,196,251,197,
-  251,198,251,0,2,251,0,4,251,0,6,251,5,119,250,122,254,254,254,0,
-  1,254,11,66,251,193,251,194,251,195,251,196,251,197,251,198,251,
-  0,2,251,0,4,251,0,6,251,5,119,250,122,254,254,254,0,1,254,20,66,
-  251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,
-  251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,
-  102,250,0,122,249,6,119,254,120,253,122,255,254,255,0,1,255,20,66,
-  251,85,250,87,249,88,251,89,250,90,249,193,251,194,251,195,251,196,
-  251,197,251,198,251,222,249,0,2,251,0,4,251,0,6,251,0,100,250,0,
-  102,250,0,122,249,6,119,254,120,253,122,255,254,255,0,1,255,27,80,
-  250,85,247,86,250,87,244,88,248,90,246,211,250,212,250,213,250,214,
-  250,215,250,217,250,218,250,219,250,220,250,221,250,222,246,0,78,
-  250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,250,0,114,250,0,
-  116,250,0,122,246,7,45,250,46,254,47,248,104,254,0,33,254,0,37,254,
-  27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,212,250,213,
-  250,214,250,215,250,217,250,218,250,219,250,220,250,221,250,222,
-  246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,0,112,250,0,
-  114,250,0,116,250,0,122,246,7,45,250,46,254,47,248,104,254,0,33,
-  254,0,37,254,27,80,250,85,247,86,250,87,244,88,248,90,246,211,250,
-  212,250,213,250,214,250,215,250,217,250,218,250,219,250,220,250,
-  221,250,222,246,0,78,250,0,82,250,0,100,247,0,102,247,0,108,250,
-  0,112,250,0,114,250,0,116,250,0,122,246,7,45,250,46,254,47,248,104,
-  254,0,33,254,0,37,254,73,45,245,46,242,47,245,59,249,60,248,66,241,
-  80,254,98,244,102,245,106,251,112,244,115,251,118,249,120,244,122,
-  244,193,241,194,241,195,241,196,241,197,241,198,241,211,254,212,
-  254,213,254,214,254,215,254,217,254,225,250,226,244,227,244,228,
-  250,229,250,230,244,233,252,234,245,235,252,236,252,238,251,243,
-  244,244,244,245,244,246,244,247,244,249,244,250,249,251,249,252,
-  249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,241,0,5,244,0,6,
-  241,0,7,244,0,21,245,0,25,245,0,27,245,0,29,245,0,49,251,0,78,254,
-  0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,91,251,0,109,249,
-  0,113,249,0,115,249,0,117,249,73,45,245,46,242,47,245,59,249,60,
-  248,66,241,80,254,98,244,102,245,106,251,112,244,115,251,118,249,
-  120,244,122,244,193,241,194,241,195,241,196,241,197,241,198,241,
-  211,254,212,254,213,254,214,254,215,254,217,254,225,250,226,244,
-  227,244,228,250,229,250,230,244,233,245,234,245,235,252,236,252,
-  238,251,243,244,244,244,245,244,246,244,247,244,249,244,250,249,
-  251,249,252,249,253,249,254,244,0,1,244,0,2,241,0,3,250,0,4,241,
-  0,5,244,0,6,241,0,7,244,0,21,252,0,25,245,0,27,245,0,29,245,0,49,
-  251,0,78,254,0,79,244,0,82,254,0,83,244,0,87,251,0,89,251,0,91,251,
-  0,109,249,0,113,249,0,115,249,0,117,249,11,66,250,193,250,194,250,
-  195,250,196,250,197,250,198,250,0,2,250,0,4,250,0,6,250,11,66,250,
-  193,250,194,250,195,250,196,250,197,250,198,250,0,2,250,0,4,250,
-  0,6,250,11,66,250,193,250,194,250,195,250,196,250,197,250,198,250,
-  0,2,250,0,4,250,0,6,250,11,66,250,193,250,194,250,195,250,196,250,
-  197,250,198,250,0,2,250,0,4,250,0,6,250,65,45,235,46,238,47,235,
-  59,242,60,242,66,237,80,252,98,240,102,240,106,248,112,239,118,238,
-  193,237,194,237,195,237,196,237,197,237,198,237,211,252,212,252,
-  213,252,214,252,215,252,217,252,225,247,226,240,227,240,228,240,
-  229,247,230,240,233,247,234,240,235,240,236,247,238,248,243,245,
-  244,239,245,239,246,245,247,245,249,239,250,245,251,238,252,238,
-  253,245,0,2,237,0,3,247,0,4,237,0,5,240,0,6,237,0,7,240,0,21,247,
-  0,25,240,0,27,240,0,29,240,0,49,248,0,78,252,0,79,245,0,82,252,0,
-  83,239,0,109,245,0,113,238,0,115,238,0,117,238,12,66,244,193,244,
-  194,244,195,244,196,244,197,244,198,244,0,2,244,0,4,244,0,6,244,
-  1,32,24,245,21,33,245,101,249,109,255,115,249,116,248,117,254,119,
-  249,0,19,249,0,60,255,0,62,255,0,68,255,0,87,249,0,89,249,0,91,249,
-  0,93,248,0,97,248,0,99,248,0,101,254,1,2,25,248,1,32,25,245,11,66,
-  244,193,244,194,244,195,244,196,244,197,244,198,244,0,2,244,0,4,
-  244,0,6,244
+static afm_cuint8 afm_Times_Roman_kerning_data[] = {    /* 4896 */
+    42, 19, 66, 248, 85, 254, 87, 249, 88, 252, 90, 242, 193, 248, 194, 248,
+    195, 248,
+    196, 248, 197, 248, 198, 248, 222, 242, 0, 2, 248, 0, 4, 248, 0, 6, 248,
+    0, 100, 254,
+    0, 102, 254, 0, 122, 242, 3, 1, 32, 25, 245, 1, 32, 29, 245, 3, 1, 32, 25,
+    245, 1, 32,
+    29, 245, 41, 68, 250, 72, 250, 80, 248, 82, 248, 85, 238, 86, 248, 87,
+    234, 88, 242,
+    90, 239, 119, 245, 120, 242, 122, 242, 200, 250, 211, 248, 212, 248, 213,
+    248, 214,
+    248, 215, 248, 217, 248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239,
+    254,
+    242, 0, 1, 242, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248,
+    0, 82, 248,
+    0, 100, 238, 0, 102, 238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116,
+    248, 0, 122,
+    239, 1, 32, 25, 238, 20, 66, 251, 86, 255, 193, 251, 194, 251, 195, 251,
+    196, 251,
+    197, 251, 198, 251, 218, 255, 219, 255, 220, 255, 221, 255, 0, 2, 251, 0,
+    4, 251,
+    0, 6, 251, 0, 108, 255, 0, 112, 255, 0, 114, 255, 0, 116, 255, 16, 66,
+    250, 87, 250,
+    88, 252, 90, 248, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198,
+    250, 222,
+    248, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 248, 32, 45, 244, 47, 244,
+    66, 245, 98,
+    254, 112, 254, 193, 245, 194, 245, 195, 245, 196, 245, 197, 245, 198, 245,
+    225,
+    254, 226, 254, 227, 254, 228, 254, 229, 254, 230, 254, 243, 254, 244, 254,
+    245,
+    254, 246, 254, 247, 254, 249, 254, 0, 2, 245, 0, 3, 254, 0, 4, 245, 0, 5,
+    254, 0, 6,
+    245, 0, 7, 254, 0, 79, 254, 0, 83, 254, 11, 66, 247, 193, 247, 194, 247,
+    195, 247,
+    196, 247, 197, 247, 198, 247, 0, 2, 247, 0, 4, 247, 0, 6, 247, 40, 80,
+    252, 102, 253,
+    112, 251, 118, 254, 122, 253, 211, 252, 212, 252, 213, 252, 214, 252, 215,
+    252,
+    217, 252, 233, 253, 234, 253, 235, 253, 236, 253, 243, 251, 244, 251, 245,
+    251,
+    246, 251, 247, 251, 249, 251, 250, 254, 251, 254, 252, 254, 253, 254, 254,
+    253,
+    0, 1, 253, 0, 21, 253, 0, 25, 253, 0, 27, 253, 0, 29, 253, 0, 78, 252, 0,
+    79, 251, 0,
+    82, 252, 0, 83, 251, 0, 109, 254, 0, 113, 254, 0, 115, 254, 0, 117, 254,
+    13, 85, 242,
+    87, 240, 88, 245, 90, 240, 122, 248, 222, 240, 254, 248, 0, 1, 248, 0,
+    100, 242, 0,
+    102, 242, 0, 122, 240, 1, 32, 25, 242, 11, 66, 251, 193, 251, 194, 251,
+    195, 251,
+    196, 251, 197, 251, 198, 251, 0, 2, 251, 0, 4, 251, 0, 6, 251, 20, 66,
+    251, 85, 250,
+    87, 249, 88, 251, 89, 250, 90, 249, 193, 251, 194, 251, 195, 251, 196,
+    251, 197,
+    251, 198, 251, 222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 100, 250, 0,
+    102, 250,
+    0, 122, 249, 23, 45, 238, 47, 238, 66, 242, 98, 254, 193, 242, 194, 242,
+    195, 242,
+    196, 242, 197, 242, 198, 242, 225, 254, 226, 254, 227, 254, 228, 254, 229,
+    254,
+    230, 254, 0, 2, 242, 0, 3, 254, 0, 4, 242, 0, 5, 254, 0, 6, 242, 0, 7,
+    254, 10, 86, 255,
+    218, 255, 219, 255, 220, 255, 221, 255, 0, 108, 255, 0, 112, 255, 0, 114,
+    255, 0,
+    116, 255, 27, 80, 250, 85, 247, 86, 250, 87, 244, 88, 248, 90, 246, 211,
+    250, 212,
+    250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220, 250,
+    221,
+    250, 222, 246, 0, 78, 250, 0, 82, 250, 0, 100, 247, 0, 102, 247, 0, 108,
+    250, 0, 112,
+    250, 0, 114, 250, 0, 116, 250, 0, 122, 246, 73, 45, 245, 46, 242, 47, 245,
+    59, 249,
+    60, 248, 66, 241, 80, 254, 98, 244, 102, 245, 106, 251, 112, 244, 115,
+    251, 118,
+    249, 120, 244, 122, 244, 193, 241, 194, 241, 195, 241, 196, 241, 197, 241,
+    198,
+    241, 211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 250,
+    226,
+    244, 227, 244, 228, 250, 229, 250, 230, 244, 233, 245, 234, 245, 235, 245,
+    236,
+    252, 238, 251, 243, 244, 244, 244, 245, 244, 246, 244, 247, 244, 249, 244,
+    250,
+    249, 251, 249, 252, 249, 253, 249, 254, 244, 0, 1, 244, 0, 2, 241, 0, 3,
+    250, 0, 4,
+    241, 0, 5, 244, 0, 6, 241, 0, 7, 244, 0, 21, 252, 0, 25, 245, 0, 27, 245,
+    0, 29, 245,
+    0, 49, 251, 0, 78, 254, 0, 79, 244, 0, 82, 254, 0, 83, 244, 0, 87, 251, 0,
+    89, 251, 0,
+    91, 251, 0, 109, 249, 0, 113, 249, 0, 115, 249, 0, 117, 249, 11, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    72, 45, 235, 46, 240, 47, 235, 59, 245, 60, 245, 66, 234, 72, 254, 80,
+    250, 98, 238,
+    102, 238, 106, 247, 112, 235, 118, 244, 193, 234, 194, 234, 195, 234, 196,
+    234,
+    197, 234, 198, 234, 211, 250, 212, 250, 213, 250, 214, 250, 215, 250, 217,
+    250,
+    225, 245, 226, 238, 227, 245, 228, 245, 229, 245, 230, 238, 233, 245, 234,
+    238,
+    235, 245, 236, 245, 237, 254, 238, 247, 239, 254, 240, 254, 243, 242, 244,
+    235,
+    245, 235, 246, 242, 247, 242, 249, 235, 250, 244, 251, 244, 252, 244, 253,
+    244,
+    0, 2, 234, 0, 3, 245, 0, 4, 234, 0, 5, 238, 0, 6, 234, 0, 7, 238, 0, 21,
+    245, 0, 25, 238,
+    0, 27, 238, 0, 29, 245, 0, 32, 254, 0, 36, 254, 0, 45, 254, 0, 49, 247, 0,
+    78, 250, 0,
+    79, 242, 0, 82, 250, 0, 83, 235, 0, 109, 244, 0, 113, 244, 0, 115, 244, 0,
+    117, 244,
+    68, 45, 242, 46, 246, 47, 242, 59, 251, 60, 251, 66, 237, 80, 255, 98,
+    244, 102, 244,
+    106, 250, 112, 244, 118, 249, 122, 245, 193, 237, 194, 237, 195, 237, 196,
+    237,
+    197, 237, 198, 237, 211, 255, 212, 255, 213, 255, 214, 255, 215, 255, 217,
+    255,
+    225, 244, 226, 244, 227, 244, 228, 244, 229, 244, 230, 244, 233, 250, 234,
+    244,
+    235, 244, 236, 250, 238, 250, 243, 244, 244, 244, 245, 244, 246, 244, 247,
+    244,
+    249, 244, 250, 249, 251, 249, 252, 249, 253, 249, 254, 245, 0, 1, 245, 0,
+    2, 237,
+    0, 3, 244, 0, 4, 237, 0, 5, 244, 0, 6, 237, 0, 7, 244, 0, 21, 250, 0, 25,
+    244, 0, 27, 244,
+    0, 29, 244, 0, 49, 250, 0, 78, 255, 0, 79, 244, 0, 82, 255, 0, 83, 244, 0,
+    109, 249,
+    0, 113, 249, 0, 115, 249, 0, 117, 249, 65, 45, 235, 46, 238, 47, 235, 59,
+    242, 60,
+    242, 66, 237, 80, 252, 98, 240, 102, 240, 106, 248, 112, 239, 118, 238,
+    193, 237,
+    194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211, 252, 212, 252, 213,
+    252,
+    214, 252, 215, 252, 217, 252, 225, 247, 226, 240, 227, 240, 228, 247, 229,
+    247,
+    230, 240, 233, 247, 234, 240, 235, 240, 236, 247, 238, 248, 243, 245, 244,
+    239,
+    245, 239, 246, 245, 247, 245, 249, 239, 250, 245, 251, 238, 252, 238, 253,
+    245,
+    0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 240, 0, 6, 237, 0, 7, 240, 0, 21,
+    247, 0, 25, 240,
+    0, 27, 240, 0, 29, 240, 0, 49, 248, 0, 78, 252, 0, 79, 245, 0, 82, 252, 0,
+    83, 239, 0,
+    109, 245, 0, 113, 238, 0, 115, 238, 0, 117, 238, 3, 119, 254, 120, 254,
+    12, 47, 250,
+    118, 254, 119, 254, 250, 254, 251, 254, 252, 254, 253, 254, 0, 109, 254,
+    0, 113,
+    254, 0, 115, 254, 0, 117, 254, 4, 122, 254, 254, 254, 0, 1, 254, 10, 104,
+    254, 119,
+    253, 120, 253, 121, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 254, 0, 37,
+    254, 16,
+    98, 255, 103, 253, 106, 254, 225, 255, 226, 255, 227, 255, 228, 255, 229,
+    255, 230,
+    255, 238, 254, 0, 3, 255, 0, 5, 255, 0, 7, 255, 0, 51, 249, 1, 32, 25, 9,
+    2, 119, 253,
+    22, 102, 255, 112, 255, 122, 254, 233, 255, 234, 255, 235, 255, 236, 255,
+    243, 255,
+    244, 255, 245, 255, 246, 255, 247, 255, 249, 255, 254, 254, 0, 1, 254, 0,
+    21, 255,
+    0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 255, 0, 83, 255, 2, 120, 255,
+    5, 119, 250,
+    122, 254, 254, 254, 0, 1, 254, 6, 119, 254, 120, 253, 122, 255, 254, 255,
+    0, 1, 255,
+    4, 122, 255, 254, 255, 0, 1, 255, 7, 45, 250, 46, 254, 47, 248, 104, 254,
+    0, 33, 254,
+    0, 37, 254, 31, 45, 246, 47, 246, 98, 253, 102, 254, 112, 254, 225, 253,
+    226, 253,
+    227, 253, 228, 253, 229, 253, 230, 253, 233, 254, 234, 254, 235, 254, 236,
+    254,
+    243, 254, 244, 254, 245, 254, 246, 254, 247, 254, 249, 254, 0, 3, 253, 0,
+    5, 253,
+    0, 7, 253, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 0, 79, 254, 0,
+    83, 254, 22,
+    45, 246, 47, 246, 98, 255, 112, 255, 225, 255, 226, 255, 227, 255, 228,
+    255, 229,
+    255, 230, 255, 243, 255, 244, 255, 245, 255, 246, 255, 247, 255, 249, 255,
+    0, 3,
+    255, 0, 5, 255, 0, 7, 255, 0, 79, 255, 0, 83, 255, 10, 102, 254, 233, 254,
+    234, 254,
+    235, 254, 236, 254, 0, 21, 254, 0, 25, 254, 0, 27, 254, 0, 29, 254, 3, 45,
+    246, 47,
+    246, 41, 68, 250, 72, 250, 80, 248, 82, 248, 85, 238, 86, 248, 87, 234,
+    88, 242, 90,
+    239, 119, 245, 120, 242, 122, 242, 200, 250, 211, 248, 212, 248, 213, 248,
+    214,
+    248, 215, 248, 217, 248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239,
+    254,
+    242, 0, 1, 242, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248,
+    0, 82, 248,
+    0, 100, 238, 0, 102, 238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116,
+    248, 0, 122,
+    239, 1, 32, 25, 238, 41, 68, 250, 72, 250, 80, 248, 82, 248, 85, 238, 86,
+    248, 87,
+    234, 88, 242, 90, 239, 119, 245, 120, 242, 122, 242, 200, 250, 211, 248,
+    212, 248,
+    213, 248, 214, 248, 215, 248, 217, 248, 218, 248, 219, 248, 220, 248, 221,
+    248,
+    222, 239, 254, 242, 0, 1, 242, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36,
+    250, 0, 78,
+    248, 0, 82, 248, 0, 100, 238, 0, 102, 238, 0, 108, 248, 0, 112, 248, 0,
+    114, 248, 0,
+    116, 248, 0, 122, 239, 1, 32, 25, 238, 41, 68, 250, 72, 250, 80, 248, 82,
+    248, 85,
+    238, 86, 248, 87, 234, 88, 242, 90, 239, 119, 245, 120, 242, 122, 242,
+    200, 250,
+    211, 248, 212, 248, 213, 248, 214, 248, 215, 248, 217, 248, 218, 248, 219,
+    248,
+    220, 248, 221, 248, 222, 239, 254, 242, 0, 1, 242, 0, 8, 250, 0, 14, 250,
+    0, 32, 250,
+    0, 36, 250, 0, 78, 248, 0, 82, 248, 0, 100, 238, 0, 102, 238, 0, 108, 248,
+    0, 112, 248,
+    0, 114, 248, 0, 116, 248, 0, 122, 239, 1, 32, 25, 238, 41, 68, 250, 72,
+    250, 80, 248,
+    82, 248, 85, 238, 86, 248, 87, 234, 88, 242, 90, 239, 119, 245, 120, 242,
+    122, 242,
+    200, 250, 211, 248, 212, 248, 213, 248, 214, 248, 215, 248, 217, 248, 218,
+    248,
+    219, 248, 220, 248, 221, 248, 222, 239, 254, 242, 0, 1, 242, 0, 8, 250, 0,
+    14, 250,
+    0, 32, 250, 0, 36, 250, 0, 78, 248, 0, 82, 248, 0, 100, 238, 0, 102, 238,
+    0, 108, 248,
+    0, 112, 248, 0, 114, 248, 0, 116, 248, 0, 122, 239, 1, 32, 25, 238, 41,
+    68, 250, 72,
+    250, 80, 248, 82, 248, 85, 238, 86, 248, 87, 234, 88, 242, 90, 239, 119,
+    245, 120,
+    242, 122, 242, 200, 250, 211, 248, 212, 248, 213, 248, 214, 248, 215, 248,
+    217,
+    248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239, 254, 242, 0, 1,
+    242, 0, 8,
+    250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248, 0, 82, 248, 0, 100,
+    238, 0, 102,
+    238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116, 248, 0, 122, 239, 1,
+    32, 25, 238,
+    41, 68, 250, 72, 250, 80, 248, 82, 248, 85, 238, 86, 248, 87, 234, 88,
+    242, 90, 239,
+    119, 245, 120, 242, 122, 242, 200, 250, 211, 248, 212, 248, 213, 248, 214,
+    248,
+    215, 248, 217, 248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239, 254,
+    242,
+    0, 1, 242, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248, 0,
+    82, 248, 0, 100,
+    238, 0, 102, 238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116, 248, 0,
+    122, 239,
+    1, 32, 25, 238, 11, 66, 251, 193, 251, 194, 251, 195, 251, 196, 251, 197,
+    251, 198,
+    251, 0, 2, 251, 0, 4, 251, 0, 6, 251, 20, 66, 251, 85, 250, 87, 249, 88,
+    251, 89, 250,
+    90, 249, 193, 251, 194, 251, 195, 251, 196, 251, 197, 251, 198, 251, 222,
+    249, 0,
+    2, 251, 0, 4, 251, 0, 6, 251, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20,
+    66, 251, 85,
+    250, 87, 249, 88, 251, 89, 250, 90, 249, 193, 251, 194, 251, 195, 251,
+    196, 251,
+    197, 251, 198, 251, 222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 100,
+    250, 0, 102,
+    250, 0, 122, 249, 20, 66, 251, 85, 250, 87, 249, 88, 251, 89, 250, 90,
+    249, 193, 251,
+    194, 251, 195, 251, 196, 251, 197, 251, 198, 251, 222, 249, 0, 2, 251, 0,
+    4, 251,
+    0, 6, 251, 0, 100, 250, 0, 102, 250, 0, 122, 249, 20, 66, 251, 85, 250,
+    87, 249, 88,
+    251, 89, 250, 90, 249, 193, 251, 194, 251, 195, 251, 196, 251, 197, 251,
+    198, 251,
+    222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0, 100, 250, 0, 102, 250, 0,
+    122, 249, 20,
+    66, 251, 85, 250, 87, 249, 88, 251, 89, 250, 90, 249, 193, 251, 194, 251,
+    195, 251,
+    196, 251, 197, 251, 198, 251, 222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251,
+    0, 100, 250,
+    0, 102, 250, 0, 122, 249, 20, 66, 251, 85, 250, 87, 249, 88, 251, 89, 250,
+    90, 249,
+    193, 251, 194, 251, 195, 251, 196, 251, 197, 251, 198, 251, 222, 249, 0,
+    2, 251,
+    0, 4, 251, 0, 6, 251, 0, 100, 250, 0, 102, 250, 0, 122, 249, 11, 66, 250,
+    193, 250,
+    194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0,
+    6, 250,
+    11, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250,
+    0, 2, 250,
+    0, 4, 250, 0, 6, 250, 11, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250,
+    197, 250,
+    198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 11, 66, 250, 193, 250, 194,
+    250, 195, 250,
+    196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 65, 45,
+    235, 46, 238,
+    47, 235, 59, 242, 60, 242, 66, 237, 80, 252, 98, 240, 102, 240, 106, 248,
+    112, 239,
+    118, 238, 193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211,
+    252,
+    212, 252, 213, 252, 214, 252, 215, 252, 217, 252, 225, 247, 226, 240, 227,
+    240,
+    228, 247, 229, 247, 230, 240, 233, 247, 234, 240, 235, 240, 236, 247, 238,
+    248,
+    243, 245, 244, 239, 245, 239, 246, 245, 247, 245, 249, 239, 250, 245, 251,
+    238,
+    252, 238, 253, 245, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 240, 0, 6, 237,
+    0, 7, 240,
+    0, 21, 247, 0, 25, 240, 0, 27, 240, 0, 29, 240, 0, 49, 248, 0, 78, 252, 0,
+    79, 245, 0,
+    82, 252, 0, 83, 239, 0, 109, 245, 0, 113, 238, 0, 115, 238, 0, 117, 238,
+    3, 119, 254,
+    120, 254, 3, 119, 254, 120, 254, 3, 119, 254, 120, 254, 3, 119, 254, 120,
+    254, 3,
+    119, 254, 120, 254, 3, 119, 254, 120, 254, 4, 122, 254, 254, 254, 0, 1,
+    254, 10, 104,
+    254, 119, 253, 120, 253, 121, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33,
+    254, 0, 37,
+    254, 10, 104, 254, 119, 253, 120, 253, 121, 254, 122, 254, 254, 254, 0, 1,
+    254, 0,
+    33, 254, 0, 37, 254, 10, 104, 254, 119, 253, 120, 253, 121, 254, 122, 254,
+    254, 254,
+    0, 1, 254, 0, 33, 254, 0, 37, 254, 10, 104, 254, 119, 253, 120, 253, 121,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 0, 33, 254, 0, 37, 254, 2, 119, 253, 2, 119,
+    253, 2, 119,
+    253, 2, 119, 253, 5, 119, 250, 122, 254, 254, 254, 0, 1, 254, 6, 119, 254,
+    120, 253,
+    122, 255, 254, 255, 0, 1, 255, 6, 119, 254, 120, 253, 122, 255, 254, 255,
+    0, 1, 255,
+    6, 119, 254, 120, 253, 122, 255, 254, 255, 0, 1, 255, 6, 119, 254, 120,
+    253, 122,
+    255, 254, 255, 0, 1, 255, 6, 119, 254, 120, 253, 122, 255, 254, 255, 0, 1,
+    255, 6,
+    119, 254, 120, 253, 122, 255, 254, 255, 0, 1, 255, 3, 45, 246, 47, 246, 3,
+    45, 246,
+    47, 246, 41, 68, 250, 72, 250, 80, 248, 82, 248, 85, 238, 86, 248, 87,
+    234, 88, 242,
+    90, 239, 119, 245, 120, 242, 122, 242, 200, 250, 211, 248, 212, 248, 213,
+    248, 214,
+    248, 215, 248, 217, 248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239,
+    254,
+    242, 0, 1, 242, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248,
+    0, 82, 248,
+    0, 100, 238, 0, 102, 238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116,
+    248, 0, 122,
+    239, 1, 32, 25, 238, 3, 119, 254, 120, 254, 41, 68, 250, 72, 250, 80, 248,
+    82, 248,
+    85, 238, 86, 248, 87, 234, 88, 242, 90, 239, 119, 245, 120, 242, 122, 242,
+    200, 250,
+    211, 248, 212, 248, 213, 248, 214, 248, 215, 248, 217, 248, 218, 248, 219,
+    248,
+    220, 248, 221, 248, 222, 239, 254, 242, 0, 1, 242, 0, 8, 250, 0, 14, 250,
+    0, 32, 250,
+    0, 36, 250, 0, 78, 248, 0, 82, 248, 0, 100, 238, 0, 102, 238, 0, 108, 248,
+    0, 112, 248,
+    0, 114, 248, 0, 116, 248, 0, 122, 239, 1, 32, 25, 238, 3, 119, 254, 120,
+    254, 41, 68,
+    250, 72, 250, 80, 248, 82, 248, 85, 238, 86, 248, 87, 234, 88, 242, 90,
+    239, 119,
+    245, 120, 248, 122, 248, 200, 250, 211, 248, 212, 248, 213, 248, 214, 248,
+    215,
+    248, 217, 248, 218, 248, 219, 248, 220, 248, 221, 248, 222, 239, 254, 248,
+    0, 1,
+    248, 0, 8, 250, 0, 14, 250, 0, 32, 250, 0, 36, 250, 0, 78, 248, 0, 82,
+    248, 0, 100, 238,
+    0, 102, 238, 0, 108, 248, 0, 112, 248, 0, 114, 248, 0, 116, 248, 0, 122,
+    239, 1, 32,
+    25, 238, 3, 119, 254, 120, 254, 4, 122, 254, 254, 254, 0, 1, 254, 4, 122,
+    254, 254,
+    254, 0, 1, 254, 16, 66, 250, 87, 250, 88, 252, 90, 248, 193, 250, 194,
+    250, 195, 250,
+    196, 250, 197, 250, 198, 250, 222, 248, 0, 2, 250, 0, 4, 250, 0, 6, 250,
+    0, 122, 248,
+    16, 66, 250, 87, 250, 88, 252, 90, 248, 193, 250, 194, 250, 195, 250, 196,
+    250, 197,
+    250, 198, 250, 222, 248, 0, 2, 250, 0, 4, 250, 0, 6, 250, 0, 122, 248, 10,
+    104, 254,
+    119, 253, 120, 253, 121, 254, 122, 254, 254, 254, 0, 1, 254, 0, 33, 254,
+    0, 37, 254,
+    10, 104, 254, 119, 253, 120, 253, 121, 254, 122, 254, 254, 254, 0, 1, 254,
+    0, 33,
+    254, 0, 37, 254, 10, 104, 254, 119, 253, 120, 253, 121, 254, 122, 254,
+    254, 254,
+    0, 1, 254, 0, 33, 254, 0, 37, 254, 10, 104, 254, 119, 253, 120, 253, 121,
+    254, 122,
+    254, 254, 254, 0, 1, 254, 0, 33, 254, 0, 37, 254, 2, 119, 253, 2, 119,
+    253, 40, 80,
+    252, 102, 253, 112, 251, 118, 254, 122, 253, 211, 252, 212, 252, 213, 252,
+    214,
+    252, 215, 252, 217, 252, 233, 253, 234, 253, 235, 253, 236, 253, 243, 251,
+    244,
+    251, 245, 251, 246, 251, 247, 251, 249, 251, 250, 254, 251, 254, 252, 254,
+    253,
+    254, 254, 253, 0, 1, 253, 0, 21, 253, 0, 25, 253, 0, 27, 253, 0, 29, 253,
+    0, 78, 252,
+    0, 79, 251, 0, 82, 252, 0, 83, 251, 0, 109, 254, 0, 113, 254, 0, 115, 254,
+    0, 117, 254,
+    22, 102, 255, 112, 255, 122, 254, 233, 255, 234, 255, 235, 255, 236, 255,
+    243, 255,
+    244, 255, 245, 255, 246, 255, 247, 255, 249, 255, 254, 254, 0, 1, 254, 0,
+    21, 255,
+    0, 25, 255, 0, 27, 255, 0, 29, 255, 0, 79, 255, 0, 83, 255, 13, 85, 242,
+    87, 240, 88,
+    245, 90, 240, 122, 248, 222, 240, 254, 248, 0, 1, 248, 0, 100, 242, 0,
+    102, 242, 0,
+    122, 240, 1, 32, 25, 242, 2, 120, 255, 13, 85, 242, 87, 240, 88, 245, 90,
+    240, 122,
+    248, 222, 240, 254, 248, 0, 1, 248, 0, 100, 242, 0, 102, 242, 0, 122, 240,
+    1, 32, 25,
+    242, 2, 120, 255, 5, 122, 248, 254, 248, 0, 1, 248, 1, 32, 25, 242, 13,
+    85, 242, 87,
+    240, 88, 245, 90, 240, 122, 248, 222, 240, 254, 248, 0, 1, 248, 0, 100,
+    242, 0, 102,
+    242, 0, 122, 240, 1, 32, 25, 242, 2, 120, 255, 11, 66, 251, 193, 251, 194,
+    251, 195,
+    251, 196, 251, 197, 251, 198, 251, 0, 2, 251, 0, 4, 251, 0, 6, 251, 5,
+    119, 250, 122,
+    254, 254, 254, 0, 1, 254, 11, 66, 251, 193, 251, 194, 251, 195, 251, 196,
+    251, 197,
+    251, 198, 251, 0, 2, 251, 0, 4, 251, 0, 6, 251, 5, 119, 250, 122, 254,
+    254, 254, 0,
+    1, 254, 11, 66, 251, 193, 251, 194, 251, 195, 251, 196, 251, 197, 251,
+    198, 251,
+    0, 2, 251, 0, 4, 251, 0, 6, 251, 5, 119, 250, 122, 254, 254, 254, 0, 1,
+    254, 20, 66,
+    251, 85, 250, 87, 249, 88, 251, 89, 250, 90, 249, 193, 251, 194, 251, 195,
+    251, 196,
+    251, 197, 251, 198, 251, 222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0,
+    100, 250, 0,
+    102, 250, 0, 122, 249, 6, 119, 254, 120, 253, 122, 255, 254, 255, 0, 1,
+    255, 20, 66,
+    251, 85, 250, 87, 249, 88, 251, 89, 250, 90, 249, 193, 251, 194, 251, 195,
+    251, 196,
+    251, 197, 251, 198, 251, 222, 249, 0, 2, 251, 0, 4, 251, 0, 6, 251, 0,
+    100, 250, 0,
+    102, 250, 0, 122, 249, 6, 119, 254, 120, 253, 122, 255, 254, 255, 0, 1,
+    255, 27, 80,
+    250, 85, 247, 86, 250, 87, 244, 88, 248, 90, 246, 211, 250, 212, 250, 213,
+    250, 214,
+    250, 215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250, 222, 246,
+    0, 78,
+    250, 0, 82, 250, 0, 100, 247, 0, 102, 247, 0, 108, 250, 0, 112, 250, 0,
+    114, 250, 0,
+    116, 250, 0, 122, 246, 7, 45, 250, 46, 254, 47, 248, 104, 254, 0, 33, 254,
+    0, 37, 254,
+    27, 80, 250, 85, 247, 86, 250, 87, 244, 88, 248, 90, 246, 211, 250, 212,
+    250, 213,
+    250, 214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220, 250, 221, 250,
+    222,
+    246, 0, 78, 250, 0, 82, 250, 0, 100, 247, 0, 102, 247, 0, 108, 250, 0,
+    112, 250, 0,
+    114, 250, 0, 116, 250, 0, 122, 246, 7, 45, 250, 46, 254, 47, 248, 104,
+    254, 0, 33,
+    254, 0, 37, 254, 27, 80, 250, 85, 247, 86, 250, 87, 244, 88, 248, 90, 246,
+    211, 250,
+    212, 250, 213, 250, 214, 250, 215, 250, 217, 250, 218, 250, 219, 250, 220,
+    250,
+    221, 250, 222, 246, 0, 78, 250, 0, 82, 250, 0, 100, 247, 0, 102, 247, 0,
+    108, 250,
+    0, 112, 250, 0, 114, 250, 0, 116, 250, 0, 122, 246, 7, 45, 250, 46, 254,
+    47, 248, 104,
+    254, 0, 33, 254, 0, 37, 254, 73, 45, 245, 46, 242, 47, 245, 59, 249, 60,
+    248, 66, 241,
+    80, 254, 98, 244, 102, 245, 106, 251, 112, 244, 115, 251, 118, 249, 120,
+    244, 122,
+    244, 193, 241, 194, 241, 195, 241, 196, 241, 197, 241, 198, 241, 211, 254,
+    212,
+    254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226, 244, 227, 244,
+    228,
+    250, 229, 250, 230, 244, 233, 252, 234, 245, 235, 252, 236, 252, 238, 251,
+    243,
+    244, 244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250, 249, 251, 249,
+    252,
+    249, 253, 249, 254, 244, 0, 1, 244, 0, 2, 241, 0, 3, 250, 0, 4, 241, 0, 5,
+    244, 0, 6,
+    241, 0, 7, 244, 0, 21, 245, 0, 25, 245, 0, 27, 245, 0, 29, 245, 0, 49,
+    251, 0, 78, 254,
+    0, 79, 244, 0, 82, 254, 0, 83, 244, 0, 87, 251, 0, 89, 251, 0, 91, 251, 0,
+    109, 249,
+    0, 113, 249, 0, 115, 249, 0, 117, 249, 73, 45, 245, 46, 242, 47, 245, 59,
+    249, 60,
+    248, 66, 241, 80, 254, 98, 244, 102, 245, 106, 251, 112, 244, 115, 251,
+    118, 249,
+    120, 244, 122, 244, 193, 241, 194, 241, 195, 241, 196, 241, 197, 241, 198,
+    241,
+    211, 254, 212, 254, 213, 254, 214, 254, 215, 254, 217, 254, 225, 250, 226,
+    244,
+    227, 244, 228, 250, 229, 250, 230, 244, 233, 245, 234, 245, 235, 252, 236,
+    252,
+    238, 251, 243, 244, 244, 244, 245, 244, 246, 244, 247, 244, 249, 244, 250,
+    249,
+    251, 249, 252, 249, 253, 249, 254, 244, 0, 1, 244, 0, 2, 241, 0, 3, 250,
+    0, 4, 241,
+    0, 5, 244, 0, 6, 241, 0, 7, 244, 0, 21, 252, 0, 25, 245, 0, 27, 245, 0,
+    29, 245, 0, 49,
+    251, 0, 78, 254, 0, 79, 244, 0, 82, 254, 0, 83, 244, 0, 87, 251, 0, 89,
+    251, 0, 91, 251,
+    0, 109, 249, 0, 113, 249, 0, 115, 249, 0, 117, 249, 11, 66, 250, 193, 250,
+    194, 250,
+    195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250,
+    11, 66, 250,
+    193, 250, 194, 250, 195, 250, 196, 250, 197, 250, 198, 250, 0, 2, 250, 0,
+    4, 250,
+    0, 6, 250, 11, 66, 250, 193, 250, 194, 250, 195, 250, 196, 250, 197, 250,
+    198, 250,
+    0, 2, 250, 0, 4, 250, 0, 6, 250, 11, 66, 250, 193, 250, 194, 250, 195,
+    250, 196, 250,
+    197, 250, 198, 250, 0, 2, 250, 0, 4, 250, 0, 6, 250, 65, 45, 235, 46, 238,
+    47, 235,
+    59, 242, 60, 242, 66, 237, 80, 252, 98, 240, 102, 240, 106, 248, 112, 239,
+    118, 238,
+    193, 237, 194, 237, 195, 237, 196, 237, 197, 237, 198, 237, 211, 252, 212,
+    252,
+    213, 252, 214, 252, 215, 252, 217, 252, 225, 247, 226, 240, 227, 240, 228,
+    240,
+    229, 247, 230, 240, 233, 247, 234, 240, 235, 240, 236, 247, 238, 248, 243,
+    245,
+    244, 239, 245, 239, 246, 245, 247, 245, 249, 239, 250, 245, 251, 238, 252,
+    238,
+    253, 245, 0, 2, 237, 0, 3, 247, 0, 4, 237, 0, 5, 240, 0, 6, 237, 0, 7,
+    240, 0, 21, 247,
+    0, 25, 240, 0, 27, 240, 0, 29, 240, 0, 49, 248, 0, 78, 252, 0, 79, 245, 0,
+    82, 252, 0,
+    83, 239, 0, 109, 245, 0, 113, 238, 0, 115, 238, 0, 117, 238, 12, 66, 244,
+    193, 244,
+    194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 0, 2, 244, 0, 4, 244, 0,
+    6, 244,
+    1, 32, 24, 245, 21, 33, 245, 101, 249, 109, 255, 115, 249, 116, 248, 117,
+    254, 119,
+    249, 0, 19, 249, 0, 60, 255, 0, 62, 255, 0, 68, 255, 0, 87, 249, 0, 89,
+    249, 0, 91, 249,
+    0, 93, 248, 0, 97, 248, 0, 99, 248, 0, 101, 254, 1, 2, 25, 248, 1, 32, 25,
+    245, 11, 66,
+    244, 193, 244, 194, 244, 195, 244, 196, 244, 197, 244, 198, 244, 0, 2,
+    244, 0, 4,
+    244, 0, 6, 244
 };
-static afm_cuint16 afm_Times_Roman_highchars_index[] = { /* 220 */
-  161,162,163,164,165,166,167,168,169,170,171,172,174,175,176,177,
-  178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
-  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
-  210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,
-  226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,
-  242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
-  258,259,260,261,262,263,268,269,270,271,272,273,274,275,278,279,
-  280,281,282,283,286,287,290,291,298,299,302,303,304,305,310,311,
-  313,314,315,316,317,318,321,322,323,324,325,326,327,328,332,333,
-  336,337,338,339,340,341,342,343,344,345,346,347,350,351,352,353,
-  354,355,356,357,362,363,366,367,368,369,370,371,376,377,378,379,
-  380,381,382,402,536,537,710,711,728,729,730,731,732,733,8211,8212,
-  8216,8217,8218,8220,8221,8222,8224,8225,8226,8230,8240,8249,8250,
-  8260,8364,8482,8706,8710,8721,8722,8730,8800,8804,8805,9674,63171,
-  64257,64258
+static afm_cuint16 afm_Times_Roman_highchars_index[] = {    /* 220 */
+    161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176,
+    177,
+    178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192,
+    193,
+    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
+    209,
+    210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
+    225,
+    226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240,
+    241,
+    242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256,
+    257,
+    258, 259, 260, 261, 262, 263, 268, 269, 270, 271, 272, 273, 274, 275, 278,
+    279,
+    280, 281, 282, 283, 286, 287, 290, 291, 298, 299, 302, 303, 304, 305, 310,
+    311,
+    313, 314, 315, 316, 317, 318, 321, 322, 323, 324, 325, 326, 327, 328, 332,
+    333,
+    336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 350, 351, 352,
+    353,
+    354, 355, 356, 357, 362, 363, 366, 367, 368, 369, 370, 371, 376, 377, 378,
+    379,
+    380, 381, 382, 402, 536, 537, 710, 711, 728, 729, 730, 731, 732, 733,
+    8211, 8212,
+    8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8249,
+    8250,
+    8260, 8364, 8482, 8706, 8710, 8721, 8722, 8730, 8800, 8804, 8805, 9674,
+    63171,
+    64257, 64258
 };
 static afm_cunicode afm_Times_Roman_ligatures[] = { /* 3 */
-  102,105,64257
+    102, 105, 64257
 };
 const afm_fontinfo afm_fontinfolist[] = {
-  { /* Courier.afm   761 bytes */
-      "Courier", "Courier",
-      629, -157,
-      afm_Courier_widths,
-      NULL,
-      NULL,
-      afm_Courier_highchars_index, 220,
-      afm_Courier_ligatures, 1},
-  { /* Courier-Bold.afm   761 bytes */
-      "Courier-Bold", "Courier Bold",
-      629, -157,
-      afm_Courier_Bold_widths,
-      NULL,
-      NULL,
-      afm_Courier_Bold_highchars_index, 220,
-      afm_Courier_Bold_ligatures, 1},
-  { /* Courier-BoldOblique.afm   761 bytes */
-      "Courier-BoldOblique", "Courier Bold Oblique",
-      629, -157,
-      afm_Courier_BoldOblique_widths,
-      NULL,
-      NULL,
-      afm_Courier_BoldOblique_highchars_index, 220,
-      afm_Courier_BoldOblique_ligatures, 1},
-  { /* Courier-Oblique.afm   761 bytes */
-      "Courier-Oblique", "Courier Oblique",
-      629, -157,
-      afm_Courier_Oblique_widths,
-      NULL,
-      NULL,
-      afm_Courier_Oblique_highchars_index, 220,
-      afm_Courier_Oblique_ligatures, 1},
-  { /* Helvetica.afm   7841 bytes */
-      "Helvetica", "Helvetica",
-      718, -207,
-      afm_Helvetica_widths,
-      afm_Helvetica_kerning_index,
-      afm_Helvetica_kerning_data,
-      afm_Helvetica_highchars_index, 220,
-      afm_Helvetica_ligatures, 1},
-  { /* Helvetica-Bold.afm   7336 bytes */
-      "Helvetica-Bold", "Helvetica Bold",
-      718, -207,
-      afm_Helvetica_Bold_widths,
-      afm_Helvetica_Bold_kerning_index,
-      afm_Helvetica_Bold_kerning_data,
-      afm_Helvetica_Bold_highchars_index, 220,
-      afm_Helvetica_Bold_ligatures, 1},
-  { /* Helvetica-BoldOblique.afm   7336 bytes */
-      "Helvetica-BoldOblique", "Helvetica Bold Oblique",
-      718, -207,
-      afm_Helvetica_BoldOblique_widths,
-      afm_Helvetica_BoldOblique_kerning_index,
-      afm_Helvetica_BoldOblique_kerning_data,
-      afm_Helvetica_BoldOblique_highchars_index, 220,
-      afm_Helvetica_BoldOblique_ligatures, 1},
-  { /* Helvetica-Oblique.afm   7841 bytes */
-      "Helvetica-Oblique", "Helvetica Oblique",
-      718, -207,
-      afm_Helvetica_Oblique_widths,
-      afm_Helvetica_Oblique_kerning_index,
-      afm_Helvetica_Oblique_kerning_data,
-      afm_Helvetica_Oblique_highchars_index, 220,
-      afm_Helvetica_Oblique_ligatures, 1},
-  { /* ZapfDingbats.afm   416 bytes */
-      "ZapfDingbats", "ITC Zapf Dingbats",
-      0, 0,
-      afm_ZapfDingbats_widths,
-      NULL,
-      NULL,
-      afm_ZapfDingbats_highchars_index, 107,
-      NULL, 0},
-  { /* Symbol.afm   563 bytes */
-      "Symbol", "Symbol",
-      0, 0,
-      afm_Symbol_widths,
-      NULL,
-      NULL,
-      afm_Symbol_highchars_index, 156,
-      NULL, 0},
-  { /* Times-Bold.afm   6761 bytes */
-      "Times-Bold", "Times Bold",
-      683, -217,
-      afm_Times_Bold_widths,
-      afm_Times_Bold_kerning_index,
-      afm_Times_Bold_kerning_data,
-      afm_Times_Bold_highchars_index, 220,
-      afm_Times_Bold_ligatures, 1},
-  { /* Times-BoldItalic.afm   6270 bytes */
-      "Times-BoldItalic", "Times Bold Italic",
-      683, -217,
-      afm_Times_BoldItalic_widths,
-      afm_Times_BoldItalic_kerning_index,
-      afm_Times_BoldItalic_kerning_data,
-      afm_Times_BoldItalic_highchars_index, 220,
-      afm_Times_BoldItalic_ligatures, 1},
-  { /* Times-Italic.afm   6975 bytes */
-      "Times-Italic", "Times Italic",
-      683, -217,
-      afm_Times_Italic_widths,
-      afm_Times_Italic_kerning_index,
-      afm_Times_Italic_kerning_data,
-      afm_Times_Italic_highchars_index, 220,
-      afm_Times_Italic_ligatures, 1},
-  { /* Times-Roman.afm   6287 bytes */
-      "Times-Roman", "Times Roman",
-      683, -217,
-      afm_Times_Roman_widths,
-      afm_Times_Roman_kerning_index,
-      afm_Times_Roman_kerning_data,
-      afm_Times_Roman_highchars_index, 220,
-      afm_Times_Roman_ligatures, 1},
-  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+    {                   /* Courier.afm   761 bytes */
+     "Courier", "Courier",
+     629, -157,
+     afm_Courier_widths,
+     NULL,
+     NULL,
+     afm_Courier_highchars_index, 220,
+     afm_Courier_ligatures, 1},
+    {                   /* Courier-Bold.afm   761 bytes */
+     "Courier-Bold", "Courier Bold",
+     629, -157,
+     afm_Courier_Bold_widths,
+     NULL,
+     NULL,
+     afm_Courier_Bold_highchars_index, 220,
+     afm_Courier_Bold_ligatures, 1},
+    {                   /* Courier-BoldOblique.afm   761 bytes */
+     "Courier-BoldOblique", "Courier Bold Oblique",
+     629, -157,
+     afm_Courier_BoldOblique_widths,
+     NULL,
+     NULL,
+     afm_Courier_BoldOblique_highchars_index, 220,
+     afm_Courier_BoldOblique_ligatures, 1},
+    {                   /* Courier-Oblique.afm   761 bytes */
+     "Courier-Oblique", "Courier Oblique",
+     629, -157,
+     afm_Courier_Oblique_widths,
+     NULL,
+     NULL,
+     afm_Courier_Oblique_highchars_index, 220,
+     afm_Courier_Oblique_ligatures, 1},
+    {                   /* Helvetica.afm   7841 bytes */
+     "Helvetica", "Helvetica",
+     718, -207,
+     afm_Helvetica_widths,
+     afm_Helvetica_kerning_index,
+     afm_Helvetica_kerning_data,
+     afm_Helvetica_highchars_index, 220,
+     afm_Helvetica_ligatures, 1},
+    {                   /* Helvetica-Bold.afm   7336 bytes */
+     "Helvetica-Bold", "Helvetica Bold",
+     718, -207,
+     afm_Helvetica_Bold_widths,
+     afm_Helvetica_Bold_kerning_index,
+     afm_Helvetica_Bold_kerning_data,
+     afm_Helvetica_Bold_highchars_index, 220,
+     afm_Helvetica_Bold_ligatures, 1},
+    {                   /* Helvetica-BoldOblique.afm   7336 bytes */
+     "Helvetica-BoldOblique", "Helvetica Bold Oblique",
+     718, -207,
+     afm_Helvetica_BoldOblique_widths,
+     afm_Helvetica_BoldOblique_kerning_index,
+     afm_Helvetica_BoldOblique_kerning_data,
+     afm_Helvetica_BoldOblique_highchars_index, 220,
+     afm_Helvetica_BoldOblique_ligatures, 1},
+    {                   /* Helvetica-Oblique.afm   7841 bytes */
+     "Helvetica-Oblique", "Helvetica Oblique",
+     718, -207,
+     afm_Helvetica_Oblique_widths,
+     afm_Helvetica_Oblique_kerning_index,
+     afm_Helvetica_Oblique_kerning_data,
+     afm_Helvetica_Oblique_highchars_index, 220,
+     afm_Helvetica_Oblique_ligatures, 1},
+    {                   /* ZapfDingbats.afm   416 bytes */
+     "ZapfDingbats", "ITC Zapf Dingbats",
+     0, 0,
+     afm_ZapfDingbats_widths,
+     NULL,
+     NULL,
+     afm_ZapfDingbats_highchars_index, 107,
+     NULL, 0},
+    {                   /* Symbol.afm   563 bytes */
+     "Symbol", "Symbol",
+     0, 0,
+     afm_Symbol_widths,
+     NULL,
+     NULL,
+     afm_Symbol_highchars_index, 156,
+     NULL, 0},
+    {                   /* Times-Bold.afm   6761 bytes */
+     "Times-Bold", "Times Bold",
+     683, -217,
+     afm_Times_Bold_widths,
+     afm_Times_Bold_kerning_index,
+     afm_Times_Bold_kerning_data,
+     afm_Times_Bold_highchars_index, 220,
+     afm_Times_Bold_ligatures, 1},
+    {                   /* Times-BoldItalic.afm   6270 bytes */
+     "Times-BoldItalic", "Times Bold Italic",
+     683, -217,
+     afm_Times_BoldItalic_widths,
+     afm_Times_BoldItalic_kerning_index,
+     afm_Times_BoldItalic_kerning_data,
+     afm_Times_BoldItalic_highchars_index, 220,
+     afm_Times_BoldItalic_ligatures, 1},
+    {                   /* Times-Italic.afm   6975 bytes */
+     "Times-Italic", "Times Italic",
+     683, -217,
+     afm_Times_Italic_widths,
+     afm_Times_Italic_kerning_index,
+     afm_Times_Italic_kerning_data,
+     afm_Times_Italic_highchars_index, 220,
+     afm_Times_Italic_ligatures, 1},
+    {                   /* Times-Roman.afm   6287 bytes */
+     "Times-Roman", "Times Roman",
+     683, -217,
+     afm_Times_Roman_widths,
+     afm_Times_Roman_kerning_index,
+     afm_Times_Roman_kerning_data,
+     afm_Times_Roman_highchars_index, 220,
+     afm_Times_Roman_ligatures, 1},
+    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
 };
 const int afm_fontinfo_count = 14;
index 84b1422..f2b9fa3 100644 (file)
@@ -153,36 +153,36 @@ Implementation design:
     and 490 Kb for a set of 276 Adobe fonts.
 */
 
-typedef unsigned char  afm_uint8;
-typedef signed   char  afm_sint8;
+typedef unsigned char afm_uint8;
+typedef signed char afm_sint8;
 typedef unsigned short afm_uint16;
-typedef signed   short afm_sint16;
+typedef signed short afm_sint16;
 typedef unsigned short afm_unicode;
 
-typedef const afm_uint8   afm_cuint8;
-typedef const afm_sint8   afm_csint8;
-typedef const afm_uint16  afm_cuint16;
-typedef const afm_sint16  afm_csint16;
+typedef const afm_uint8 afm_cuint8;
+typedef const afm_sint8 afm_csint8;
+typedef const afm_uint16 afm_cuint16;
+typedef const afm_sint16 afm_csint16;
 typedef const afm_unicode afm_cunicode;
 
 typedef struct afm_fontinfo {
-  const char   *fullname; /* e.g. "Futura Bold Oblique" */
-  const char   *postscript_name; /* e.g. "Futura-BoldOblique" */
-  afm_cuint16 ascender, descender;
-  afm_cuint8   *widths;
-  afm_csint16  *kerning_index;
-  afm_cuint8   *kerning_data;
-  afm_cuint16  *highchars_index;
-  afm_cuint16   highchars_count;
-  afm_cunicode *ligatures;
-  afm_cuint16   ligatures_count;
-}      afm_fontinfo;
+    const char *fullname;   /* e.g. "Futura Bold Oblique" */
+    const char *postscript_name;    /* e.g. "Futura-BoldOblique" */
+    afm_cuint16 ascender, descender;
+    afm_cuint8 *widths;
+    afm_csint16 *kerning_index;
+    afm_cuint8 *kerning_data;
+    afm_cuint16 *highchars_index;
+    afm_cuint16 highchars_count;
+    afm_cunicode *ligatures;
+    afm_cuint16 ligatures_count;
+} afm_fontinfo;
 
 typedef struct old_afm_fontinfo {
-  const char *fontname, *fullname;
-  const unsigned short *charinfo, *intarray;
-  const unsigned short charinfocount;
-  const unsigned short fixedpitch;
+    const char *fontname, *fullname;
+    const unsigned short *charinfo, *intarray;
+    const unsigned short charinfocount;
+    const unsigned short fixedpitch;
 } old_afm_fontinfo;
 
 extern const afm_fontinfo afm_fontinfolist[];
index 5c2aa1b..23567c5 100644 (file)
 #define DEBUG_VARS*/
 
 typedef struct var_s {
-       char    *name, *value;
+    char     *name, *value;
 } s_var;
 
 typedef struct cgi_s {
-       s_var **vars;
+    s_var   **vars;
 } s_cgi;
 
 /* in arg[0] find tags beginning with arg[1] call arg[2] on them
    and replace by result of arg[2] call */
-int parse(char **, long, char *, char *(*)(long , const char **));
+int       parse(
+    char **,
+    long,
+    char *,
+    char *    (*)(long,
+                  const char **));
 
 /**************************************************/
 /* tag replacers ... they are called from parse   */
 /* through function pointers                      */
 /**************************************************/
 
-/* return cgi var named arg[0] */ 
-char* cgiget(long , const char **);
+/* return cgi var named arg[0] */
+char     *cgiget(
+    long,
+    const char **);
 
-/* return a quoted cgi var named arg[0] */ 
-char* cgigetq(long , const char **);
+/* return a quoted cgi var named arg[0] */
+char     *cgigetq(
+    long,
+    const char **);
 
 /* return a quoted and sanitized cgi variable */
-char* cgigetqp(long , const char **);
+char     *cgigetqp(
+    long,
+    const char **);
 
 /* call rrd_graph and insert appropriate image tag */
-char* drawgraph(long, const char **);
+char     *drawgraph(
+    long,
+    const char **);
 
 /* return PRINT functions from last rrd_graph call */
-char* drawprint(long, const char **);
+char     *drawprint(
+    long,
+    const char **);
 
 /* pretty-print the <last></last> value for some.rrd via strftime() */
-char* printtimelast(long, const char **);
+char     *printtimelast(
+    long,
+    const char **);
 
 /* pretty-print current time */
-char* printtimenow(long, const char **);
+char     *printtimenow(
+    long,
+    const char **);
 
 /* set an environment variable */
-char* rrdsetenv(long, const char **);
+char     *rrdsetenv(
+    long,
+    const char **);
 
 /* get an environment variable */
-char* rrdgetenv(long, const char **);
+char     *rrdgetenv(
+    long,
+    const char **);
 
 /* include the named file at this point */
-char* includefile(long, const char **);
+char     *includefile(
+    long,
+    const char **);
 
 /* for how long is the output of the cgi valid ? */
-char* rrdgoodfor(long, const char **);
-
-/* return rrdcgi version string */ 
-char* rrdgetinternal(long, const char **);
-
-char* rrdstrip(char *buf);
-char* scanargs(char *line, int *argc, char ***args);
+char     *rrdgoodfor(
+    long,
+    const char **);
+
+/* return rrdcgi version string */
+char     *rrdgetinternal(
+    long,
+    const char **);
+
+char     *rrdstrip(
+    char *buf);
+char     *scanargs(
+    char *line,
+    int *argc,
+    char ***args);
 
 /* format at-time specified times using strftime */
-char* printstrftime(long, const char**);
+char     *printstrftime(
+    long,
+    const char **);
 
 /** HTTP protocol needs special format, and GMT time **/
-char *http_time(time_t *);
+char     *http_time(
+    time_t *);
 
 /* return a pointer to newly allocated copy of this string */
-char *stralloc(const char *);
+char     *stralloc(
+    const char *);
 
 /* global variable for rrdcgi */
-s_cgi *rrdcgiArg;
+s_cgi    *rrdcgiArg;
 
 /* rrdcgiHeader
  * 
  *  Prints a valid CGI Header (Content-type...) etc.
  */
-void rrdcgiHeader(void);
+void      rrdcgiHeader(
+    void);
 
 /* rrdcgiDecodeString
  * decode html escapes
  */
-char *rrdcgiDecodeString(char *text);
+
+char     *rrdcgiDecodeString(
+    char *text);
 
 /* rrdcgiDebug
  * 
  *  Set/unsets debugging
  */
-void rrdcgiDebug(int level, int where);
+void      rrdcgiDebug(
+    int level,
+    int where);
 
 /* rrdcgiInit
  *
  *  Reads in variables set via POST or stdin.
  */
-s_cgi *rrdcgiInit (void);
+s_cgi    *rrdcgiInit(
+    void);
 
 /* rrdcgiGetValue
  *
  *  Returns the value of the specified variable or NULL if it's empty
  *  or doesn't exist.
  */
-char *rrdcgiGetValue (s_cgi *parms, const char *name);
+char     *rrdcgiGetValue(
+    s_cgi * parms,
+    const char *name);
 
 /* rrdcgiFreeList
  *
  * Frees a list as returned by rrdcgiGetVariables()
  */
-void rrdcgiFreeList (char **list);
+void      rrdcgiFreeList(
+    char **list);
 
 /* rrdcgiFree
  *
  * Frees the internal data structures
  */
-void rrdcgiFree (s_cgi *parms);
+void      rrdcgiFree(
+    s_cgi * parms);
 
 /*  rrdcgiReadVariables()
  *
  *  Read from stdin if no string is provided via CGI.  Variables that
  *  doesn't have a value associated with it doesn't get stored.
  */
-s_var **rrdcgiReadVariables(void);
+s_var   **rrdcgiReadVariables(
+    void);
 
 
-int rrdcgiDebugLevel = 0;
-int rrdcgiDebugStderr = 1;
-char *rrdcgiHeaderString = NULL;
-char *rrdcgiType = NULL;
+int       rrdcgiDebugLevel = 0;
+int       rrdcgiDebugStderr = 1;
+char     *rrdcgiHeaderString = NULL;
+char     *rrdcgiType = NULL;
 
 /* rrd interface to the variable functions {put,get}var() */
-char* rrdgetvar(long argc, const char **args);
-char* rrdsetvar(long argc, const char **args);
-char* rrdsetvarconst(long argc, const char **args);
+char     *rrdgetvar(
+    long argc,
+    const char **args);
+char     *rrdsetvar(
+    long argc,
+    const char **args);
+char     *rrdsetvarconst(
+    long argc,
+    const char **args);
 
 
 /* variable store: put/get key-value pairs */
-static int   initvar();
-static void  donevar();
-static const char* getvar(const char* varname);
-static const char* putvar(const char* name, const char* value, int is_const);
+static int initvar(
+    );
+static void donevar(
+    );
+static const char *getvar(
+    const char *varname);
+static const char *putvar(
+    const char *name,
+    const char *value,
+    int is_const);
 
 /* key value pair that makes up an entry in the variable store */
-typedef struct
-{
-       int is_const;           /* const variable or not */
-       const char* name;       /* variable name */
-       const char* value;      /* variable value */
+typedef struct {
+    int       is_const; /* const variable or not */
+    const char *name;   /* variable name */
+    const char *value;  /* variable value */
 } vardata;
 
 /* the variable heap: 
    start with a heapsize of 10 variables */
 #define INIT_VARSTORE_SIZE     10
-static vardata* varheap    = NULL;
+static vardata *varheap = NULL;
 static size_t varheap_size = 0;
 
 /* allocate and initialize variable heap */
-static int
-initvar()
+static int initvar(
+    )
 {
-       varheap = (vardata*)malloc(sizeof(vardata) * INIT_VARSTORE_SIZE);
-       if (varheap == NULL) {
-               fprintf(stderr, "ERROR: unable to initialize variable store\n");
-               return -1;
-       }
-       memset(varheap, 0, sizeof(vardata) * INIT_VARSTORE_SIZE);
-       varheap_size = INIT_VARSTORE_SIZE;
-       return 0;
+    varheap = (vardata *) malloc(sizeof(vardata) * INIT_VARSTORE_SIZE);
+    if (varheap == NULL) {
+        fprintf(stderr, "ERROR: unable to initialize variable store\n");
+        return -1;
+    }
+    memset(varheap, 0, sizeof(vardata) * INIT_VARSTORE_SIZE);
+    varheap_size = INIT_VARSTORE_SIZE;
+    return 0;
 }
 
 /* cleanup: free allocated memory */
-static void
-donevar()
+static void donevar(
+    )
 {
-       int i;
-       if (varheap) {
-               for (i=0; i<(int)varheap_size; i++) {
-                       if (varheap[i].name) {
-                               free((char*)varheap[i].name);
-                       }
-                       if (varheap[i].value) {
-                               free((char*)varheap[i].value);
-                       }
-               }
-               free(varheap);
-       }
+    int       i;
+
+    if (varheap) {
+        for (i = 0; i < (int) varheap_size; i++) {
+            if (varheap[i].name) {
+                free((char *) varheap[i].name);
+            }
+            if (varheap[i].value) {
+                free((char *) varheap[i].value);
+            }
+        }
+        free(varheap);
+    }
 }
 
 /* Get a variable from the variable store.
    Return NULL in case the requested variable was not found. */
-static const char*
-getvar(const char* name)
+static const char *getvar(
+    const char *name)
 {
-       int i;
-       for (i=0; i<(int)varheap_size && varheap[i].name; i++) {
-               if (0 == strcmp(name, varheap[i].name)) {
+    int       i;
+
+    for (i = 0; i < (int) varheap_size && varheap[i].name; i++) {
+        if (0 == strcmp(name, varheap[i].name)) {
 #ifdef         DEBUG_VARS
-                       printf("<!-- getvar(%s) -> %s -->\n", name, varheap[i].value);
+            printf("<!-- getvar(%s) -> %s -->\n", name, varheap[i].value);
 #endif
-                       return varheap[i].value;
-               }
-       }
+            return varheap[i].value;
+        }
+    }
 #ifdef DEBUG_VARS
-       printf("<!-- getvar(%s) -> Not found-->\n", name);
+    printf("<!-- getvar(%s) -> Not found-->\n", name);
 #endif
-       return NULL;
+    return NULL;
 }
 
 /* Put a variable into the variable store. If a variable by that
    name exists, it's value is overwritten with the new value unless it was
    marked as 'const' (initialized by RRD::SETCONSTVAR).
    Returns a copy the newly allocated value on success, NULL on error. */
-static const char*
-putvar(const char* name, const char* value, int is_const)
+static const char *putvar(
+    const char *name,
+    const char *value,
+    int is_const)
 {
-       int i;
-       for (i=0; i < (int)varheap_size && varheap[i].name; i++) {
-               if (0 == strcmp(name, varheap[i].name)) {
-                       /* overwrite existing entry */
-                       if (varheap[i].is_const) {
+    int       i;
+
+    for (i = 0; i < (int) varheap_size && varheap[i].name; i++) {
+        if (0 == strcmp(name, varheap[i].name)) {
+            /* overwrite existing entry */
+            if (varheap[i].is_const) {
 #ifdef                 DEBUG_VARS
-                               printf("<!-- setver(%s, %s): not assigning: "
-                                               "const variable -->\n", name, value);
+                printf("<!-- setver(%s, %s): not assigning: "
+                       "const variable -->\n", name, value);
 #                              endif
-                               return varheap[i].value;
-                       }
+                return varheap[i].value;
+            }
 #ifdef         DEBUG_VARS
-                       printf("<!-- setvar(%s, %s): overwriting old value (%s) -->\n",
-                                       name, value, varheap[i].value);
+            printf("<!-- setvar(%s, %s): overwriting old value (%s) -->\n",
+                   name, value, varheap[i].value);
 #endif
-                       /* make it possible to promote a variable to readonly */
-                       varheap[i].is_const = is_const;
-                       free((char*)varheap[i].value);
-                       varheap[i].value = stralloc(value);
-                       return varheap[i].value;
-               }
-       }
-
-       /* no existing variable found by that name, add it */
-       if (i == (int)varheap_size) {
-               /* ran out of heap: resize heap to double size */
-               size_t new_size = varheap_size * 2;
-               varheap = (vardata*)(realloc(varheap, sizeof(vardata) * new_size));
-               if (!varheap) {
-                       fprintf(stderr, "ERROR: Unable to realloc variable heap\n");
-                       return NULL;
-               }
-               /* initialize newly allocated memory */;
-               memset(&varheap[varheap_size], 0, sizeof(vardata) * varheap_size);
-               varheap_size = new_size;
-       }
-       varheap[i].is_const = is_const;
-       varheap[i].name  = stralloc(name);
-       varheap[i].value = stralloc(value);
+            /* make it possible to promote a variable to readonly */
+            varheap[i].is_const = is_const;
+            free((char *) varheap[i].value);
+            varheap[i].value = stralloc(value);
+            return varheap[i].value;
+        }
+    }
+
+    /* no existing variable found by that name, add it */
+    if (i == (int) varheap_size) {
+        /* ran out of heap: resize heap to double size */
+        size_t    new_size = varheap_size * 2;
+
+        varheap = (vardata *) (realloc(varheap, sizeof(vardata) * new_size));
+        if (!varheap) {
+            fprintf(stderr, "ERROR: Unable to realloc variable heap\n");
+            return NULL;
+        }
+        /* initialize newly allocated memory */ ;
+        memset(&varheap[varheap_size], 0, sizeof(vardata) * varheap_size);
+        varheap_size = new_size;
+    }
+    varheap[i].is_const = is_const;
+    varheap[i].name = stralloc(name);
+    varheap[i].value = stralloc(value);
 
 #ifdef         DEBUG_VARS
-       printf("<!-- setvar(%s, %s): adding new variable -->\n", name, value);
+    printf("<!-- setvar(%s, %s): adding new variable -->\n", name, value);
 #endif
-       return varheap[i].value;
+    return varheap[i].value;
 }
 
 /* expand those RRD:* directives that can be used recursivly */
-static char*
-rrd_expand_vars(char* buffer)
+static char *rrd_expand_vars(
+    char *buffer)
 {
-       int i;
+    int       i;
 
 #ifdef DEBUG_PARSER
-       printf("expanding variables in '%s'\n", buffer);
+    printf("expanding variables in '%s'\n", buffer);
 #endif
 
-       for (i=0; buffer[i]; i++) {
-               if (buffer[i] != '<')
-                       continue;
-               parse(&buffer, i, "<RRD::CV", cgiget);
-               parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
-               parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
-               parse(&buffer, i, "<RRD::GETENV", rrdgetenv);    
-               parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);    
-                parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
-                parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
-                parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
-               parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
-       }
-       return buffer;
+    for (i = 0; buffer[i]; i++) {
+        if (buffer[i] != '<')
+            continue;
+        parse(&buffer, i, "<RRD::CV", cgiget);
+        parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
+        parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
+        parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
+        parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
+        parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
+        parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
+        parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+        parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
+    }
+    return buffer;
 }
 
-static long goodfor=0;
-static char **calcpr=NULL;
-static void calfree (void){
-  if (calcpr) {
-    long i;
-    for(i=0;calcpr[i];i++){
-      if (calcpr[i]){
-             free(calcpr[i]);
-      }
-    } 
+static long goodfor = 0;
+static char **calcpr = NULL;
+static void calfree(
+    void)
+{
     if (calcpr) {
-           free(calcpr);
+        long      i;
+
+        for (i = 0; calcpr[i]; i++) {
+            if (calcpr[i]) {
+                free(calcpr[i]);
+            }
+        }
+        if (calcpr) {
+            free(calcpr);
+        }
     }
-  }
 }
 
 /* create freeable version of the string */
-char * stralloc(const char *str){
-  char* nstr;
-  if (!str) {
-         return NULL;
-  }
-  nstr = malloc((strlen(str)+1));
-  strcpy(nstr,str);
-  return(nstr);
+char     *stralloc(
+    const char *str)
+{
+    char     *nstr;
+
+    if (!str) {
+        return NULL;
+    }
+    nstr = malloc((strlen(str) + 1));
+    strcpy(nstr, str);
+    return (nstr);
 }
 
-int main(int argc, char *argv[]) {
-       long length;
-       char *buffer;
-       char *server_url = NULL;
-       long i;
-       long filter=0;
+int main(
+    int argc,
+    char *argv[])
+{
+    long      length;
+    char     *buffer;
+    char     *server_url = NULL;
+    long      i;
+    long      filter = 0;
+
 #ifdef MUST_DISABLE_SIGFPE
-       signal(SIGFPE,SIG_IGN);
+    signal(SIGFPE, SIG_IGN);
 #endif
 #ifdef MUST_DISABLE_FPMASK
-       fpsetmask(0);
+    fpsetmask(0);
 #endif
-        optind = 0; opterr = 0;  /* initialize getopt */
-
-       /* what do we get for cmdline arguments?
-       for (i=0;i<argc;i++)
-       printf("%d-'%s'\n",i,argv[i]); */
-       while (1) {
-               static struct option long_options[] = {
-                       { "filter", no_argument, 0, 'f' },
-                       { 0, 0, 0, 0}
-               };
-               int option_index = 0;
-               int opt;
-               opt = getopt_long(argc, argv, "f", long_options, &option_index);
-               if (opt == EOF) {
-                       break;
-               }
-
-               switch(opt) {
-               case 'f':
-                               filter=1;
-                       break;
-               case '?':
-                       printf("unknown commandline option '%s'\n",argv[optind-1]);
-                       return -1;
-               }
-       }
-
-       if (!filter) {
-               rrdcgiDebug(0,0);
-               rrdcgiArg = rrdcgiInit();
-               server_url = getenv("SERVER_URL");
-       }
-
-       /* make sure we have one extra argument, 
-          if there are others, we do not care Apache gives several */
-
-       /* if ( (optind != argc-2 
-          && strstr( getenv("SERVER_SOFTWARE"),"Apache/2") != NULL) 
-          && optind != argc-1) { */
-
-       if ( optind >= argc ) { 
-               fprintf(stderr, "ERROR: expected a filename\n");
-               exit(1);
-       } else {
-               length = readfile(argv[optind], &buffer, 1);
-       }
-
-       if(rrd_test_error()) {
-               fprintf(stderr, "ERROR: %s\n",rrd_get_error());
-               exit(1);
-       }
-
-       /* initialize variable heap */
-       initvar();
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
+
+    /* what do we get for cmdline arguments?
+       for (i=0;i<argc;i++)
+       printf("%d-'%s'\n",i,argv[i]); */
+    while (1) {
+        static struct option long_options[] = {
+            {"filter", no_argument, 0, 'f'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "f", long_options, &option_index);
+        if (opt == EOF) {
+            break;
+        }
+
+        switch (opt) {
+        case 'f':
+            filter = 1;
+            break;
+        case '?':
+            printf("unknown commandline option '%s'\n", argv[optind - 1]);
+            return -1;
+        }
+    }
+
+    if (!filter) {
+        rrdcgiDebug(0, 0);
+        rrdcgiArg = rrdcgiInit();
+        server_url = getenv("SERVER_URL");
+    }
+
+    /* make sure we have one extra argument, 
+       if there are others, we do not care Apache gives several */
+
+    /* if ( (optind != argc-2 
+       && strstr( getenv("SERVER_SOFTWARE"),"Apache/2") != NULL) 
+       && optind != argc-1) { */
+
+    if (optind >= argc) {
+        fprintf(stderr, "ERROR: expected a filename\n");
+        exit(1);
+    } else {
+        length = readfile(argv[optind], &buffer, 1);
+    }
+
+    if (rrd_test_error()) {
+        fprintf(stderr, "ERROR: %s\n", rrd_get_error());
+        exit(1);
+    }
+
+    /* initialize variable heap */
+    initvar();
 
 #ifdef DEBUG_PARSER
-       /* some fake header for testing */
-       printf ("Content-Type: text/html\nContent-Length: 10000000\n\n\n");
+    /* some fake header for testing */
+    printf("Content-Type: text/html\nContent-Length: 10000000\n\n\n");
 #endif
 
 
-       /* expand rrd directives in buffer recursivly */
-       for (i=0; buffer[i]; i++) {
-               if (buffer[i] != '<')
-                       continue;
-               if (!filter) {
-                       parse(&buffer, i, "<RRD::CV", cgiget);
-                       parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
-                       parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
-                       parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
-               }
-               parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
-               parse(&buffer, i, "<RRD::GOODFOR", rrdgoodfor);
-               parse(&buffer, i, "<RRD::GRAPH", drawgraph);
-               parse(&buffer, i, "<RRD::INCLUDE", includefile);
-               parse(&buffer, i, "<RRD::PRINT", drawprint);
-               parse(&buffer, i, "<RRD::SETCONSTVAR", rrdsetvarconst);
-               parse(&buffer, i, "<RRD::SETENV", rrdsetenv);
-               parse(&buffer, i, "<RRD::SETVAR", rrdsetvar);
-               parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
-               parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
-               parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
-               parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
-       }
-
-       if (!filter) {
-               printf ("Content-Type: text/html\n" 
-                               "Content-Length: %d\n", 
-                               strlen(buffer));
-
-               if (labs(goodfor) > 0) {
-                       time_t now;
-                       now = time(NULL);
-                       printf("Last-Modified: %s\n", http_time(&now));
-                       now += labs(goodfor);
-                       printf("Expires: %s\n", http_time(&now));
-                       if (goodfor < 0) {
-                               printf("Refresh: %ld\n", labs(goodfor));
-                       }
-               }
-               printf("\n");
-       }
-
-       /* output result */
-       printf("%s", buffer);
-
-       /* cleanup */
-       calfree();
-       if (buffer){
-               free(buffer);
-       }
-       donevar();
-       exit(0);
+    /* expand rrd directives in buffer recursivly */
+    for (i = 0; buffer[i]; i++) {
+        if (buffer[i] != '<')
+            continue;
+        if (!filter) {
+            parse(&buffer, i, "<RRD::CV", cgiget);
+            parse(&buffer, i, "<RRD::CV::PATH", cgigetqp);
+            parse(&buffer, i, "<RRD::CV::QUOTE", cgigetq);
+            parse(&buffer, i, "<RRD::GETENV", rrdgetenv);
+        }
+        parse(&buffer, i, "<RRD::GETVAR", rrdgetvar);
+        parse(&buffer, i, "<RRD::GOODFOR", rrdgoodfor);
+        parse(&buffer, i, "<RRD::GRAPH", drawgraph);
+        parse(&buffer, i, "<RRD::INCLUDE", includefile);
+        parse(&buffer, i, "<RRD::PRINT", drawprint);
+        parse(&buffer, i, "<RRD::SETCONSTVAR", rrdsetvarconst);
+        parse(&buffer, i, "<RRD::SETENV", rrdsetenv);
+        parse(&buffer, i, "<RRD::SETVAR", rrdsetvar);
+        parse(&buffer, i, "<RRD::TIME::LAST", printtimelast);
+        parse(&buffer, i, "<RRD::TIME::NOW", printtimenow);
+        parse(&buffer, i, "<RRD::TIME::STRFTIME", printstrftime);
+        parse(&buffer, i, "<RRD::INTERNAL", rrdgetinternal);
+    }
+
+    if (!filter) {
+        printf("Content-Type: text/html\n"
+               "Content-Length: %d\n", strlen(buffer));
+
+        if (labs(goodfor) > 0) {
+            time_t    now;
+
+            now = time(NULL);
+            printf("Last-Modified: %s\n", http_time(&now));
+            now += labs(goodfor);
+            printf("Expires: %s\n", http_time(&now));
+            if (goodfor < 0) {
+                printf("Refresh: %ld\n", labs(goodfor));
+            }
+        }
+        printf("\n");
+    }
+
+    /* output result */
+    printf("%s", buffer);
+
+    /* cleanup */
+    calfree();
+    if (buffer) {
+        free(buffer);
+    }
+    donevar();
+    exit(0);
 }
 
 /* remove occurrences of .. this is a general measure to make
    paths which came in via cgi do not go UP ... */
 
-char* rrdsetenv(long argc, const char **args) {
-       if (argc >= 2) {
-               char *xyz = malloc((strlen(args[0]) + strlen(args[1]) + 2));
-               if (xyz == NULL) {
-                       return stralloc("[ERROR: allocating setenv buffer]");
-               };
-               sprintf(xyz, "%s=%s", args[0], args[1]);
-               if(putenv(xyz) == -1) {
-                       free(xyz);
-                       return stralloc("[ERROR: failed to do putenv]");
-               };
-               return stralloc("");
-       }
-       return stralloc("[ERROR: setenv failed because not enough "
-                                       "arguments were defined]");
+char     *rrdsetenv(
+    long argc,
+    const char **args)
+{
+    if (argc >= 2) {
+        char     *xyz = malloc((strlen(args[0]) + strlen(args[1]) + 2));
+
+        if (xyz == NULL) {
+            return stralloc("[ERROR: allocating setenv buffer]");
+        };
+        sprintf(xyz, "%s=%s", args[0], args[1]);
+        if (putenv(xyz) == -1) {
+            free(xyz);
+            return stralloc("[ERROR: failed to do putenv]");
+        };
+        return stralloc("");
+    }
+    return stralloc("[ERROR: setenv failed because not enough "
+                    "arguments were defined]");
 }
 
 /* rrd interface to the variable function putvar() */
-char*
-rrdsetvar(long argc, const char **args)
+char     *rrdsetvar(
+    long argc,
+    const char **args)
 {
-       if (argc >= 2)
-       {
-               const char* result = putvar(args[0], args[1], 0 /* not const */);
-               if (result) {
-                       /* setvar does not return the value set */
-                       return stralloc("");
-               }
-               return stralloc("[ERROR: putvar failed]");
-       }
-       return stralloc("[ERROR: putvar failed because not enough arguments "
-                                       "were defined]");
+    if (argc >= 2) {
+        const char *result = putvar(args[0], args[1], 0 /* not const */ );
+
+        if (result) {
+            /* setvar does not return the value set */
+            return stralloc("");
+        }
+        return stralloc("[ERROR: putvar failed]");
+    }
+    return stralloc("[ERROR: putvar failed because not enough arguments "
+                    "were defined]");
 }
 
 /* rrd interface to the variable function putvar() */
-char*
-rrdsetvarconst(long argc, const char **args)
+char     *rrdsetvarconst(
+    long argc,
+    const char **args)
 {
-       if (argc >= 2)
-       {
-               const char* result = putvar(args[0], args[1], 1 /* const */);
-               if (result) {
-                       /* setvar does not return the value set */
-                       return stralloc("");
-               }
-               return stralloc("[ERROR: putvar failed]");
-       }
-       return stralloc("[ERROR: putvar failed because not enough arguments "
-                                       "were defined]");
+    if (argc >= 2) {
+        const char *result = putvar(args[0], args[1], 1 /* const */ );
+
+        if (result) {
+            /* setvar does not return the value set */
+            return stralloc("");
+        }
+        return stralloc("[ERROR: putvar failed]");
+    }
+    return stralloc("[ERROR: putvar failed because not enough arguments "
+                    "were defined]");
 }
 
-char* rrdgetenv(long argc, const char **args) {
-       char buf[128];
-       const char* envvar;
-       if (argc != 1) {
-               return stralloc("[ERROR: getenv failed because it did not "
-                                               "get 1 argument only]");
-       };
-       envvar = getenv(args[0]);
-       if (envvar) {
-               return stralloc(envvar);
-       } else {
-                snprintf(buf, sizeof(buf), "[ERROR:_getenv_'%s'_failed", args[0]);
-                return stralloc(buf);
-       }
+char     *rrdgetenv(
+    long argc,
+    const char **args)
+{
+    char      buf[128];
+    const char *envvar;
+
+    if (argc != 1) {
+        return stralloc("[ERROR: getenv failed because it did not "
+                        "get 1 argument only]");
+    };
+    envvar = getenv(args[0]);
+    if (envvar) {
+        return stralloc(envvar);
+    } else {
+        snprintf(buf, sizeof(buf), "[ERROR:_getenv_'%s'_failed", args[0]);
+        return stralloc(buf);
+    }
 }
 
-char* rrdgetvar(long argc, const char **args) {
-       char buf[128];
-       const char* value;
-       if (argc != 1) {
-               return stralloc("[ERROR: getvar failed because it did not "
-                                               "get 1 argument only]");
-       };
-       value = getvar(args[0]);
-       if (value) {
-               return stralloc(value);
-       } else {
-                snprintf(buf, sizeof(buf), "[ERROR:_getvar_'%s'_failed", args[0]);
-               return stralloc(buf);
-       }
+char     *rrdgetvar(
+    long argc,
+    const char **args)
+{
+    char      buf[128];
+    const char *value;
+
+    if (argc != 1) {
+        return stralloc("[ERROR: getvar failed because it did not "
+                        "get 1 argument only]");
+    };
+    value = getvar(args[0]);
+    if (value) {
+        return stralloc(value);
+    } else {
+        snprintf(buf, sizeof(buf), "[ERROR:_getvar_'%s'_failed", args[0]);
+        return stralloc(buf);
+    }
 }
 
-char* rrdgoodfor(long argc, const char **args){
-  if (argc == 1) {
-      goodfor = atol(args[0]);
-  } else {
-    return stralloc("[ERROR: goodfor expected 1 argument]");
-  }
-   
-  if (goodfor == 0){
-     return stralloc("[ERROR: goodfor value must not be 0]");
-  }
-   
-  return stralloc("");
+char     *rrdgoodfor(
+    long argc,
+    const char **args)
+{
+    if (argc == 1) {
+        goodfor = atol(args[0]);
+    } else {
+        return stralloc("[ERROR: goodfor expected 1 argument]");
+    }
+
+    if (goodfor == 0) {
+        return stralloc("[ERROR: goodfor value must not be 0]");
+    }
+
+    return stralloc("");
 }
 
-char* rrdgetinternal(long argc, const char **args){
-  if (argc == 1) {
-    if( strcasecmp( args[0], "VERSION") == 0) {
-      return stralloc(PACKAGE_VERSION);
-    } else if( strcasecmp( args[0], "COMPILETIME") == 0) {
-      return stralloc(__DATE__ " " __TIME__);
+char     *rrdgetinternal(
+    long argc,
+    const char **args)
+{
+    if (argc == 1) {
+        if (strcasecmp(args[0], "VERSION") == 0) {
+            return stralloc(PACKAGE_VERSION);
+        } else if (strcasecmp(args[0], "COMPILETIME") == 0) {
+            return stralloc(__DATE__ " " __TIME__);
+        } else {
+            return stralloc("[ERROR: internal unknown argument]");
+        }
     } else {
-      return stralloc("[ERROR: internal unknown argument]");
+        return stralloc("[ERROR: internal expected 1 argument]");
     }
-  } else {
-    return stralloc("[ERROR: internal expected 1 argument]");
-  }
 }
 
 /* Format start or end times using strftime.  We always need both the
  * start and end times, because, either might be relative to the other.
  * */
 #define MAX_STRFTIME_SIZE 256
-char* printstrftime(long argc, const char **args){
-       struct  rrd_time_value start_tv, end_tv;
-       char    *parsetime_error = NULL;
-       char    formatted[MAX_STRFTIME_SIZE];
-       struct tm *the_tm;
-       time_t  start_tmp, end_tmp;
-
-       /* Make sure that we were given the right number of args */
-       if( argc != 4) {
-               rrd_set_error( "wrong number of args %d", argc);
-               return stralloc("");
-       }
-
-       /* Init start and end time */
-       parsetime("end-24h", &start_tv);
-       parsetime("now", &end_tv);
-
-       /* Parse the start and end times we were given */
-       if( (parsetime_error = parsetime( args[1], &start_tv))) {
-               rrd_set_error( "start time: %s", parsetime_error);
-               return stralloc("");
-       }
-       if( (parsetime_error = parsetime( args[2], &end_tv))) {
-               rrd_set_error( "end time: %s", parsetime_error);
-               return stralloc("");
-       }
-       if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
-               return stralloc("");
-       }
-
-       /* Do we do the start or end */
-       if( strcasecmp( args[0], "START") == 0) {
-               the_tm = localtime( &start_tmp);
-       }
-       else if( strcasecmp( args[0], "END") == 0) {
-               the_tm = localtime( &end_tmp);
-       }
-       else {
-               rrd_set_error( "start/end not found in '%s'", args[0]);
-               return stralloc("");
-       }
-
-       /* now format it */
-       if( strftime( formatted, MAX_STRFTIME_SIZE, args[3], the_tm)) {
-               return( stralloc( formatted));
-       }
-       else {
-               rrd_set_error( "strftime failed");
-               return stralloc("");
-       }
+char     *printstrftime(
+    long argc,
+    const char **args)
+{
+    struct rrd_time_value start_tv, end_tv;
+    char     *parsetime_error = NULL;
+    char      formatted[MAX_STRFTIME_SIZE];
+    struct tm *the_tm;
+    time_t    start_tmp, end_tmp;
+
+    /* Make sure that we were given the right number of args */
+    if (argc != 4) {
+        rrd_set_error("wrong number of args %d", argc);
+        return stralloc("");
+    }
+
+    /* Init start and end time */
+    parsetime("end-24h", &start_tv);
+    parsetime("now", &end_tv);
+
+    /* Parse the start and end times we were given */
+    if ((parsetime_error = parsetime(args[1], &start_tv))) {
+        rrd_set_error("start time: %s", parsetime_error);
+        return stralloc("");
+    }
+    if ((parsetime_error = parsetime(args[2], &end_tv))) {
+        rrd_set_error("end time: %s", parsetime_error);
+        return stralloc("");
+    }
+    if (proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+        return stralloc("");
+    }
+
+    /* Do we do the start or end */
+    if (strcasecmp(args[0], "START") == 0) {
+        the_tm = localtime(&start_tmp);
+    } else if (strcasecmp(args[0], "END") == 0) {
+        the_tm = localtime(&end_tmp);
+    } else {
+        rrd_set_error("start/end not found in '%s'", args[0]);
+        return stralloc("");
+    }
+
+    /* now format it */
+    if (strftime(formatted, MAX_STRFTIME_SIZE, args[3], the_tm)) {
+        return (stralloc(formatted));
+    } else {
+        rrd_set_error("strftime failed");
+        return stralloc("");
+    }
 }
 
-char* includefile(long argc, const char **args){
-  char *buffer;
-  if (argc >= 1) {
-      const char* filename = args[0];
-      readfile(filename, &buffer, 0);
-      if (rrd_test_error()) {
-               char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE));
-         sprintf(err, "[ERROR: %s]",rrd_get_error());
-         rrd_clear_error();
-         return err;
-      } else {
-       return buffer;
-      }
-  }
-  else
-  {
-      return stralloc("[ERROR: No Inclue file defined]");
-  }
+char     *includefile(
+    long argc,
+    const char **args)
+{
+    char     *buffer;
+
+    if (argc >= 1) {
+        const char *filename = args[0];
+
+        readfile(filename, &buffer, 0);
+        if (rrd_test_error()) {
+            char     *err = malloc((strlen(rrd_get_error()) + DS_NAM_SIZE));
+
+            sprintf(err, "[ERROR: %s]", rrd_get_error());
+            rrd_clear_error();
+            return err;
+        } else {
+            return buffer;
+        }
+    } else {
+        return stralloc("[ERROR: No Inclue file defined]");
+    }
 }
 
 /* make a copy of buf and replace open/close brackets with '_' */
-char* rrdstrip(char *buf) {
-  char* p;
-  if (buf == NULL) {
-         return NULL;
-  }
-  /* make a copy of the buffer */
-  buf = stralloc(buf);
-  if (buf == NULL) {
-         return NULL;
-  }
-
-  p = buf;
-  while (*p) {
-         if (*p == '<' || *p == '>') {
-                 *p = '_';
-         }
-         p++;
-  }
-  return buf;
+char     *rrdstrip(
+    char *buf)
+{
+    char     *p;
+
+    if (buf == NULL) {
+        return NULL;
+    }
+    /* make a copy of the buffer */
+    buf = stralloc(buf);
+    if (buf == NULL) {
+        return NULL;
+    }
+
+    p = buf;
+    while (*p) {
+        if (*p == '<' || *p == '>') {
+            *p = '_';
+        }
+        p++;
+    }
+    return buf;
 }
 
-char* cgigetq(long argc, const char **args){
-  if (argc>= 1){
-    char *buf = rrdstrip(rrdcgiGetValue(rrdcgiArg,args[0]));
-    char *buf2;
-    char *c,*d;
-    int  qc=0;
-    if (buf==NULL) return NULL;
-
-    for(c=buf;*c != '\0';c++)
-      if (*c == '"') qc++;
-    if ((buf2 = malloc((strlen(buf) + 4 * qc + 4))) == NULL) {
-       perror("Malloc Buffer");
-       exit(1);
-    };
-    c=buf;
-    d=buf2;
-    *(d++) = '"';
-    while(*c != '\0'){
-       if (*c == '"') {
-           *(d++) = '"';
-           *(d++) = '\'';
-           *(d++) = '"';
-           *(d++) = '\'';
-       } 
-       *(d++) = *(c++);
-    }
-    *(d++) = '"';
-    *(d) = '\0';
-    free(buf);
-    return buf2;
-  }
+char     *cgigetq(
+    long argc,
+    const char **args)
+{
+    if (argc >= 1) {
+        char     *buf = rrdstrip(rrdcgiGetValue(rrdcgiArg, args[0]));
+        char     *buf2;
+        char     *c, *d;
+        int       qc = 0;
+
+        if (buf == NULL)
+            return NULL;
+
+        for (c = buf; *c != '\0'; c++)
+            if (*c == '"')
+                qc++;
+        if ((buf2 = malloc((strlen(buf) + 4 * qc + 4))) == NULL) {
+            perror("Malloc Buffer");
+            exit(1);
+        };
+        c = buf;
+        d = buf2;
+        *(d++) = '"';
+        while (*c != '\0') {
+            if (*c == '"') {
+                *(d++) = '"';
+                *(d++) = '\'';
+                *(d++) = '"';
+                *(d++) = '\'';
+            }
+            *(d++) = *(c++);
+        }
+        *(d++) = '"';
+        *(d) = '\0';
+        free(buf);
+        return buf2;
+    }
 
-  return stralloc("[ERROR: not enough argument for RRD::CV::QUOTE]");
+    return stralloc("[ERROR: not enough argument for RRD::CV::QUOTE]");
 }
 
 /* remove occurrences of .. this is a general measure to make
    paths which came in via cgi do not go UP ... */
 
-char* cgigetqp(long argc, const char **args){
-       char* buf;
-    char* buf2;
-    char* p;
-        char* d;
+char     *cgigetqp(
+    long argc,
+    const char **args)
+{
+    char     *buf;
+    char     *buf2;
+    char     *p;
+    char     *d;
 
-        if (argc < 1)
-        {
-                return stralloc("[ERROR: not enough arguments for RRD::CV::PATH]");
-        }
+    if (argc < 1) {
+        return stralloc("[ERROR: not enough arguments for RRD::CV::PATH]");
+    }
 
-        buf = rrdstrip(rrdcgiGetValue(rrdcgiArg, args[0]));
-    if (!buf)
-        {
-                return NULL;
-        }
+    buf = rrdstrip(rrdcgiGetValue(rrdcgiArg, args[0]));
+    if (!buf) {
+        return NULL;
+    }
 
-        buf2 = malloc(strlen(buf)+1);
-    if (!buf2)
-        {
-                perror("cgigetqp(): Malloc Path Buffer");
-                exit(1);
+    buf2 = malloc(strlen(buf) + 1);
+    if (!buf2) {
+        perror("cgigetqp(): Malloc Path Buffer");
+        exit(1);
     };
 
     p = buf;
     d = buf2;
 
-    while (*p)
-        {
-                /* prevent mallicious paths from entering the system */
-                if (p[0] == '.' && p[1] == '.')
-                {
-                        p += 2;
-                        *d++ = '_';
-                        *d++ = '_';     
-                }
-                else
-                {
-                        *d++ = *p++;
-                }
+    while (*p) {
+        /* prevent mallicious paths from entering the system */
+        if (p[0] == '.' && p[1] == '.') {
+            p += 2;
+            *d++ = '_';
+            *d++ = '_';
+        } else {
+            *d++ = *p++;
+        }
     }
 
     *d = 0;
@@ -743,101 +848,127 @@ char* cgigetqp(long argc, const char **args){
 
     /* Make sure the path is relative, e.g. does not start with '/' */
     p = buf2;
-    while ('/' == *p)
-        {
-            *p++ = '_';
+    while ('/' == *p) {
+        *p++ = '_';
     }
 
     return buf2;
 }
 
 
-char* cgiget(long argc, const char **args){
-  if (argc>= 1)
-    return rrdstrip(rrdcgiGetValue(rrdcgiArg,args[0]));
-  else
-    return stralloc("[ERROR: not enough arguments for RRD::CV]");
+char     *cgiget(
+    long argc,
+    const char **args)
+{
+    if (argc >= 1)
+        return rrdstrip(rrdcgiGetValue(rrdcgiArg, args[0]));
+    else
+        return stralloc("[ERROR: not enough arguments for RRD::CV]");
 }
 
 
 
-char* drawgraph(long argc, const char **args){
-  int i,xsize, ysize;
-  double ymin,ymax;
-  for(i=0;i<argc;i++)
-    if(strcmp(args[i],"--imginfo")==0 || strcmp(args[i],"-g")==0) break;
-  if(i==argc) {
-    args[argc++] = "--imginfo";
-    args[argc++] = "<IMG SRC=\"./%s\" WIDTH=\"%lu\" HEIGHT=\"%lu\">";
-  }
-  calfree();
-  if( rrd_graph(argc+1, (char **) args-1, &calcpr, &xsize, &ysize,NULL,&ymin,&ymax) != -1 ) {
-    return stralloc(calcpr[0]);
-  } else {
-    if (rrd_test_error()) {
-      char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE)*sizeof(char));
-      sprintf(err, "[ERROR: %s]",rrd_get_error());
-      rrd_clear_error();
-      calfree();
-      return err;
-    }
-  }
-  return NULL;
+char     *drawgraph(
+    long argc,
+    const char **args)
+{
+    int       i, xsize, ysize;
+    double    ymin, ymax;
+
+    for (i = 0; i < argc; i++)
+        if (strcmp(args[i], "--imginfo") == 0 || strcmp(args[i], "-g") == 0)
+            break;
+    if (i == argc) {
+        args[argc++] = "--imginfo";
+        args[argc++] = "<IMG SRC=\"./%s\" WIDTH=\"%lu\" HEIGHT=\"%lu\">";
+    }
+    calfree();
+    if (rrd_graph
+        (argc + 1, (char **) args - 1, &calcpr, &xsize, &ysize, NULL, &ymin,
+         &ymax) != -1) {
+        return stralloc(calcpr[0]);
+    } else {
+        if (rrd_test_error()) {
+            char     *err =
+                malloc((strlen(rrd_get_error()) +
+                        DS_NAM_SIZE) * sizeof(char));
+            sprintf(err, "[ERROR: %s]", rrd_get_error());
+            rrd_clear_error();
+            calfree();
+            return err;
+        }
+    }
+    return NULL;
 }
 
-char* drawprint(long argc, const char **args){
-  if (argc==1 && calcpr){
-    long i=0;
-    while (calcpr[i] != NULL) i++; /*determine number lines in calcpr*/
-    if (atol(args[0])<i-1)
-      return stralloc(calcpr[atol(args[0])+1]);    
-  }
-  return stralloc("[ERROR: RRD::PRINT argument error]");
+char     *drawprint(
+    long argc,
+    const char **args)
+{
+    if (argc == 1 && calcpr) {
+        long      i = 0;
+
+        while (calcpr[i] != NULL)
+            i++;        /*determine number lines in calcpr */
+        if (atol(args[0]) < i - 1)
+            return stralloc(calcpr[atol(args[0]) + 1]);
+    }
+    return stralloc("[ERROR: RRD::PRINT argument error]");
 }
 
-char* printtimelast(long argc, const char **args) {
-  time_t last;
-  struct tm tm_last;
-  char *buf;
-  if ( argc == 2 ) {
-    buf = malloc(255);
-    if (buf == NULL){  
-       return stralloc("[ERROR: allocating strftime buffer]");
-    };
-    last = rrd_last(argc+1, (char **) args-1); 
-    if (rrd_test_error()) {
-      char *err = malloc((strlen(rrd_get_error())+DS_NAM_SIZE)*sizeof(char));
-      sprintf(err, "[ERROR: %s]",rrd_get_error());
-      rrd_clear_error();
-      return err;
+char     *printtimelast(
+    long argc,
+    const char **args)
+{
+    time_t    last;
+    struct tm tm_last;
+    char     *buf;
+
+    if (argc == 2) {
+        buf = malloc(255);
+        if (buf == NULL) {
+            return stralloc("[ERROR: allocating strftime buffer]");
+        };
+        last = rrd_last(argc + 1, (char **) args - 1);
+        if (rrd_test_error()) {
+            char     *err =
+                malloc((strlen(rrd_get_error()) +
+                        DS_NAM_SIZE) * sizeof(char));
+            sprintf(err, "[ERROR: %s]", rrd_get_error());
+            rrd_clear_error();
+            return err;
+        }
+        tm_last = *localtime(&last);
+        strftime(buf, 254, args[1], &tm_last);
+        return buf;
     }
-    tm_last = *localtime(&last);
-    strftime(buf,254,args[1],&tm_last);
-    return buf;
-  }
-  if ( argc < 2 ) {
-    return stralloc("[ERROR: too few arguments for RRD::TIME::LAST]");
-  }
-  return stralloc("[ERROR: not enough arguments for RRD::TIME::LAST]");
+    if (argc < 2) {
+        return stralloc("[ERROR: too few arguments for RRD::TIME::LAST]");
+    }
+    return stralloc("[ERROR: not enough arguments for RRD::TIME::LAST]");
 }
 
-char* printtimenow(long argc, const char **args) {
-  time_t now = time(NULL);
-  struct tm tm_now;
-  char *buf;
-  if ( argc == 1 ) {
-    buf = malloc(255);
-    if (buf == NULL){  
-       return stralloc("[ERROR: allocating strftime buffer]");
-    };
-    tm_now = *localtime(&now);
-    strftime(buf,254,args[0],&tm_now);
-    return buf;
-  }
-  if ( argc < 1 ) {
-    return stralloc("[ERROR: too few arguments for RRD::TIME::NOW]");
-  }
-  return stralloc("[ERROR: not enough arguments for RRD::TIME::NOW]");
+char     *printtimenow(
+    long argc,
+    const char **args)
+{
+    time_t    now = time(NULL);
+    struct tm tm_now;
+    char     *buf;
+
+    if (argc == 1) {
+        buf = malloc(255);
+        if (buf == NULL) {
+            return stralloc("[ERROR: allocating strftime buffer]");
+        };
+        tm_now = *localtime(&now);
+        strftime(buf, 254, args[0], &tm_now);
+        return buf;
+    }
+    if (argc < 1) {
+        return stralloc("[ERROR: too few arguments for RRD::TIME::NOW]");
+    }
+    return stralloc("[ERROR: not enough arguments for RRD::TIME::NOW]");
 }
 
 /* Scan buffer until an unescaped '>' arives.
@@ -849,164 +980,163 @@ char* printtimenow(long argc, const char **args) {
  * that contain RRD::x directives. These introduce a small memory leak
  * since we have to stralloc the arguments the way parse() works.
  */
-char*
-scanargs(char *line, int *argument_count, char ***arguments)
+char     *scanargs(
+    char *line,
+    int *argument_count,
+    char ***arguments)
 {
-       char    *getP;          /* read cursor */
-       char    *putP;          /* write cursor */
-       char    Quote;          /* type of quote if in quoted string, 0 otherwise */
-       int     tagcount;       /* open tag count */
-       int     in_arg;         /* if we currently are parsing an argument or not */
-       int     argsz;          /* argument array size */
-       int             curarg_contains_rrd_directives;
-
-       /* local array of arguments while parsing */
-       int argc = 0;
-       char** argv;
+    char     *getP;     /* read cursor */
+    char     *putP;     /* write cursor */
+    char      Quote;    /* type of quote if in quoted string, 0 otherwise */
+    int       tagcount; /* open tag count */
+    int       in_arg;   /* if we currently are parsing an argument or not */
+    int       argsz;    /* argument array size */
+    int       curarg_contains_rrd_directives;
+
+    /* local array of arguments while parsing */
+    int       argc = 0;
+    char    **argv;
 
 #ifdef DEBUG_PARSER
-       printf("<-- scanargs(%s) -->\n", line);
+    printf("<-- scanargs(%s) -->\n", line);
 #endif
 
-       *arguments = NULL;
-       *argument_count = 0;
-
-       /* create initial argument array of char pointers */
-       argsz = 32;
-       argv = (char **)malloc(argsz * sizeof(char *));
-       if (!argv) {
-               return NULL;
-       }
-
-       /* skip leading blanks */
-       while (isspace((int)*line)) {
-               line++;
-       }
-
-       getP = line;
-       putP = line;
-
-       Quote    = 0;
-       in_arg   = 0;
-       tagcount = 0;
-
-       curarg_contains_rrd_directives = 0;
-
-       /* start parsing 'line' for arguments */
-       while (*getP)
-       {
-               unsigned char c = *getP++;
-
-               if (c == '>' && !Quote && !tagcount) {
-                       /* this is our closing tag, quit scanning */
-                       break;
-               }
-
-               /* remove all special chars */
-               if (c < ' ') {
-                       c = ' ';
-               }
-
-               switch (c)
-               {
-               case ' ': 
-                       if (Quote || tagcount) {
-                               /* copy quoted/tagged (=RRD expanded) string */
-                               *putP++ = c;
-                       }
-                       else if (in_arg)
-                       {
-                               /* end argument string */
-                               *putP++ = 0;
-                               in_arg = 0;
-                               if (curarg_contains_rrd_directives) {
-                                       argv[argc-1] = rrd_expand_vars(stralloc(argv[argc-1]));
-                                       curarg_contains_rrd_directives = 0;
-                               }
-                       }
-                       break;
-
-               case '"': /* Fall through */
-               case '\'':
-                       if (Quote != 0) {
-                               if (Quote == c) {
-                                       Quote = 0;
-                               } else {
-                                       /* copy quoted string */
-                                       *putP++ = c;
-                               }
-                       } else {
-                               if (!in_arg) {
-                                       /* reference start of argument string in argument array */
-                                       argv[argc++] = putP;
-                                       in_arg=1;
-                               }
-                               Quote = c;
-                       }
-                       break;
-
-               default:
-                               if (!in_arg) {
-                                       /* start new argument */
-                                       argv[argc++] = putP;
-                                       in_arg = 1;
-                               }
-                               if (c == '>') {
-                                       if (tagcount) {
-                                               tagcount--;
-                                       }
-                               }
-                               if (c == '<') {
-                                       tagcount++;
-                                       if (0 == strncmp(getP, "RRD::", strlen("RRD::"))) {
-                                               curarg_contains_rrd_directives = 1;
-                                       }
-                               }
-                       *putP++ = c;
-                       break;
-               }
-
-               /* check if our argument array is still large enough */
-               if (argc == argsz) {
-                       /* resize argument array */
-                       argsz *= 2;
-                       argv = rrd_realloc(argv, argsz * sizeof(char *));
-                       if (*argv == NULL) {
-                               return NULL;
-                       }
-               }
-       }
-
-       /* terminate last argument found */
-       *putP = '\0';
-       if (curarg_contains_rrd_directives) {
-               argv[argc-1] = rrd_expand_vars(stralloc(argv[argc-1]));
-       }
+    *arguments = NULL;
+    *argument_count = 0;
+
+    /* create initial argument array of char pointers */
+    argsz = 32;
+    argv = (char **) malloc(argsz * sizeof(char *));
+    if (!argv) {
+        return NULL;
+    }
+
+    /* skip leading blanks */
+    while (isspace((int) *line)) {
+        line++;
+    }
+
+    getP = line;
+    putP = line;
+
+    Quote = 0;
+    in_arg = 0;
+    tagcount = 0;
+
+    curarg_contains_rrd_directives = 0;
+
+    /* start parsing 'line' for arguments */
+    while (*getP) {
+        unsigned char c = *getP++;
+
+        if (c == '>' && !Quote && !tagcount) {
+            /* this is our closing tag, quit scanning */
+            break;
+        }
+
+        /* remove all special chars */
+        if (c < ' ') {
+            c = ' ';
+        }
+
+        switch (c) {
+        case ' ':
+            if (Quote || tagcount) {
+                /* copy quoted/tagged (=RRD expanded) string */
+                *putP++ = c;
+            } else if (in_arg) {
+                /* end argument string */
+                *putP++ = 0;
+                in_arg = 0;
+                if (curarg_contains_rrd_directives) {
+                    argv[argc - 1] =
+                        rrd_expand_vars(stralloc(argv[argc - 1]));
+                    curarg_contains_rrd_directives = 0;
+                }
+            }
+            break;
+
+        case '"':      /* Fall through */
+        case '\'':
+            if (Quote != 0) {
+                if (Quote == c) {
+                    Quote = 0;
+                } else {
+                    /* copy quoted string */
+                    *putP++ = c;
+                }
+            } else {
+                if (!in_arg) {
+                    /* reference start of argument string in argument array */
+                    argv[argc++] = putP;
+                    in_arg = 1;
+                }
+                Quote = c;
+            }
+            break;
+
+        default:
+            if (!in_arg) {
+                /* start new argument */
+                argv[argc++] = putP;
+                in_arg = 1;
+            }
+            if (c == '>') {
+                if (tagcount) {
+                    tagcount--;
+                }
+            }
+            if (c == '<') {
+                tagcount++;
+                if (0 == strncmp(getP, "RRD::", strlen("RRD::"))) {
+                    curarg_contains_rrd_directives = 1;
+                }
+            }
+            *putP++ = c;
+            break;
+        }
+
+        /* check if our argument array is still large enough */
+        if (argc == argsz) {
+            /* resize argument array */
+            argsz *= 2;
+            argv = rrd_realloc(argv, argsz * sizeof(char *));
+            if (*argv == NULL) {
+                return NULL;
+            }
+        }
+    }
 
+    /* terminate last argument found */
+    *putP = '\0';
+    if (curarg_contains_rrd_directives) {
+        argv[argc - 1] = rrd_expand_vars(stralloc(argv[argc - 1]));
+    }
 #ifdef DEBUG_PARSER
-       if (argc > 0) {
-               int n;
-               printf("<-- arguments found [%d]\n", argc);
-               for (n=0; n<argc; n++) {
-                       printf("arg %02d: '%s'\n", n, argv[n]);
-               }
-               printf("-->\n");
-       } else {
-               printf("<!-- No arguments found -->\n");
-       }
+    if (argc > 0) {
+        int       n;
+
+        printf("<-- arguments found [%d]\n", argc);
+        for (n = 0; n < argc; n++) {
+            printf("arg %02d: '%s'\n", n, argv[n]);
+        }
+        printf("-->\n");
+    } else {
+        printf("<!-- No arguments found -->\n");
+    }
 #endif
 
-       /* update caller's notion of the argument array and it's size */
-       *arguments = argv;
-       *argument_count = argc;
+    /* update caller's notion of the argument array and it's size */
+    *arguments = argv;
+    *argument_count = argc;
 
-       if (Quote) {
-               return NULL;
-       }
+    if (Quote) {
+        return NULL;
+    }
 
-       /* Return new scanning cursor:
-          pointer to char after closing bracket */
-       return getP;
+    /* Return new scanning cursor:
+       pointer to char after closing bracket */
+    return getP;
 }
 
 
@@ -1016,155 +1146,161 @@ scanargs(char *line, int *argument_count, char ***arguments)
  * The result of func is inserted at the current position
  * in the buffer.
  */
-int
-parse(
-       char **buf,     /* buffer */
-       long i,                 /* offset in buffer */
-       char *tag,      /* tag to handle  */
-       char *(*func)(long , const char **) /* function to call for 'tag' */
-       )
+int parse(
+    char **buf,         /* buffer */
+    long i,             /* offset in buffer */
+    char *tag,          /* tag to handle  */
+    char *    (*func) (long,
+                       const char **)   /* function to call for 'tag' */
+    )
 {
-       /* the name of the vairable ... */
-       char *val;
-       long valln;  
-       char **args;
-       char *end;
-       long end_offset;
-       int  argc;
-       size_t taglen = strlen(tag);
-
-       /* Current position in buffer should start with 'tag' */
-       if (strncmp((*buf)+i, tag, taglen) != 0) {
-               return 0;
-       }
-       /* .. and match exactly (a whitespace following 'tag') */
-       if (! isspace(*((*buf) + i + taglen)) ) {
-               return 0;
-       }
-
+    /* the name of the vairable ... */
+    char     *val;
+    long      valln;
+    char    **args;
+    char     *end;
+    long      end_offset;
+    int       argc;
+    size_t    taglen = strlen(tag);
+
+    /* Current position in buffer should start with 'tag' */
+    if (strncmp((*buf) + i, tag, taglen) != 0) {
+        return 0;
+    }
+    /* .. and match exactly (a whitespace following 'tag') */
+    if (!isspace(*((*buf) + i + taglen))) {
+        return 0;
+    }
 #ifdef DEBUG_PARSER
-       printf("parse(): handling tag '%s'\n", tag);
+    printf("parse(): handling tag '%s'\n", tag);
 #endif
 
-       /* Scan for arguments following the tag;
-          scanargs() puts \0 into *buf ... so after scanargs it is probably
-          not a good time to use strlen on buf */
-       end = scanargs((*buf) + i + taglen, &argc, &args);
-       if (end)
-       {
-               /* got arguments, call function for 'tag' with arguments */
-               val = func(argc, (const char **) args);
-               free(args);
-       }
-       else
-       {
-               /* unable to parse arguments, undo 0-termination by scanargs */
-               for (; argc > 0; argc--) {
-                       *((args[argc-1])-1) = ' ';
-               }
-
-               /* next call, try parsing at current offset +1 */
-               end = (*buf) + i + 1;
-
-               val = stralloc("[ERROR: Parsing Problem with the following text\n"
-                                               " Check original file. This may have been altered "
-                                               "by parsing.]\n\n");
-       }
-
-       /* remember offset where we have to continue parsing */
-       end_offset = end - (*buf);
-
-       valln = 0;
-       if (val) {
-               valln = strlen(val);
-       }
-
-       /* Optionally resize buffer to hold the replacement value:
-          Calculating the new length of the buffer is simple. add current
-          buffer pos (i) to length of string after replaced tag to length
-          of replacement string and add 1 for the final zero ... */
-       if (end - (*buf) < (i + valln)) {
-               /* make sure we do not shrink the mallocd block */
-               size_t newbufsize = i + strlen(end) + valln + 1;
-               *buf = rrd_realloc(*buf, newbufsize);
-
-               if (*buf == NULL) {
-                       perror("Realoc buf:");
-                       exit(1);
-               };
-       }
-
-       /* Update new end pointer:
-          make sure the 'end' pointer gets moved along with the 
-          buf pointer when realloc moves memory ... */
-       end = (*buf) + end_offset; 
-
-       /* splice the variable:
-          step 1. Shift pending data to make room for 'val' */
-       memmove((*buf) + i + valln, end, strlen(end) + 1);
-
-       /* step 2. Insert val */
-       if (val) {
-               memmove((*buf)+i, val, valln);
-               free(val);
-       }
-       return (valln > 0 ? valln-1: valln);
+    /* Scan for arguments following the tag;
+       scanargs() puts \0 into *buf ... so after scanargs it is probably
+       not a good time to use strlen on buf */
+    end = scanargs((*buf) + i + taglen, &argc, &args);
+    if (end) {
+        /* got arguments, call function for 'tag' with arguments */
+        val = func(argc, (const char **) args);
+        free(args);
+    } else {
+        /* unable to parse arguments, undo 0-termination by scanargs */
+        for (; argc > 0; argc--) {
+            *((args[argc - 1]) - 1) = ' ';
+        }
+
+        /* next call, try parsing at current offset +1 */
+        end = (*buf) + i + 1;
+
+        val = stralloc("[ERROR: Parsing Problem with the following text\n"
+                       " Check original file. This may have been altered "
+                       "by parsing.]\n\n");
+    }
+
+    /* remember offset where we have to continue parsing */
+    end_offset = end - (*buf);
+
+    valln = 0;
+    if (val) {
+        valln = strlen(val);
+    }
+
+    /* Optionally resize buffer to hold the replacement value:
+       Calculating the new length of the buffer is simple. add current
+       buffer pos (i) to length of string after replaced tag to length
+       of replacement string and add 1 for the final zero ... */
+    if (end - (*buf) < (i + valln)) {
+        /* make sure we do not shrink the mallocd block */
+        size_t    newbufsize = i + strlen(end) + valln + 1;
+
+        *buf = rrd_realloc(*buf, newbufsize);
+
+        if (*buf == NULL) {
+            perror("Realoc buf:");
+            exit(1);
+        };
+    }
+
+    /* Update new end pointer:
+       make sure the 'end' pointer gets moved along with the 
+       buf pointer when realloc moves memory ... */
+    end = (*buf) + end_offset;
+
+    /* splice the variable:
+       step 1. Shift pending data to make room for 'val' */
+    memmove((*buf) + i + valln, end, strlen(end) + 1);
+
+    /* step 2. Insert val */
+    if (val) {
+        memmove((*buf) + i, val, valln);
+        free(val);
+    }
+    return (valln > 0 ? valln - 1 : valln);
 }
 
-char *
-http_time(time_t *now) {
-        struct tm *tmptime;
-        static char buf[60];
+char     *http_time(
+    time_t *now)
+{
+    struct tm *tmptime;
+    static char buf[60];
 
-        tmptime=gmtime(now);
-        strftime(buf,sizeof(buf),"%a, %d %b %Y %H:%M:%S GMT",tmptime);
-        return(buf);
+    tmptime = gmtime(now);
+    strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S GMT", tmptime);
+    return (buf);
 }
 
-void rrdcgiHeader(void)
+void rrdcgiHeader(
+    void)
 {
     if (rrdcgiType)
-       printf ("Content-type: %s\n", rrdcgiType);
+        printf("Content-type: %s\n", rrdcgiType);
     else
-       printf ("Content-type: text/html\n");
+        printf("Content-type: text/html\n");
     if (rrdcgiHeaderString)
-       printf ("%s", rrdcgiHeaderString);
-    printf ("\n");
+        printf("%s", rrdcgiHeaderString);
+    printf("\n");
 }
 
-void rrdcgiDebug(int level, int where)
+void rrdcgiDebug(
+    int level,
+    int where)
 {
     if (level > 0)
-       rrdcgiDebugLevel = level;
+        rrdcgiDebugLevel = level;
     else
-       rrdcgiDebugLevel = 0;
+        rrdcgiDebugLevel = 0;
     if (where)
-       rrdcgiDebugStderr = 0;
+        rrdcgiDebugStderr = 0;
     else
-       rrdcgiDebugStderr = 1;
+        rrdcgiDebugStderr = 1;
 }
 
-char *rrdcgiDecodeString(char *text)
+char     *rrdcgiDecodeString(
+    char *text)
 {
-    char *cp, *xp;
-
-    for (cp=text,xp=text; *cp; cp++) {
-       if (*cp == '%') {
-           if (strchr("0123456789ABCDEFabcdef", *(cp+1))
-               && strchr("0123456789ABCDEFabcdef", *(cp+2))) {
-               if (islower(*(cp+1)))
-                   *(cp+1) = toupper(*(cp+1));
-               if (islower(*(cp+2)))
-                   *(cp+2) = toupper(*(cp+2));
-               *(xp) = (*(cp+1) >= 'A' ? *(cp+1) - 'A' + 10 : *(cp+1) - '0' ) * 16
-                   + (*(cp+2) >= 'A' ? *(cp+2) - 'A' + 10 : *(cp+2) - '0');
-               xp++;cp+=2;
-           }
-       } else {
-           *(xp++) = *cp;
-       }
-    }
-    memset(xp, 0, cp-xp);
+    char     *cp, *xp;
+
+    for (cp = text, xp = text; *cp; cp++) {
+        if (*cp == '%') {
+            if (strchr("0123456789ABCDEFabcdef", *(cp + 1))
+                && strchr("0123456789ABCDEFabcdef", *(cp + 2))) {
+                if (islower(*(cp + 1)))
+                    *(cp + 1) = toupper(*(cp + 1));
+                if (islower(*(cp + 2)))
+                    *(cp + 2) = toupper(*(cp + 2));
+                *(xp) =
+                    (*(cp + 1) >=
+                     'A' ? *(cp + 1) - 'A' + 10 : *(cp + 1) - '0') * 16 +
+                    (*(cp + 2) >=
+                     'A' ? *(cp + 2) - 'A' + 10 : *(cp + 2) - '0');
+                xp++;
+                cp += 2;
+            }
+        } else {
+            *(xp++) = *cp;
+        }
+    }
+    memset(xp, 0, cp - xp);
     return text;
 }
 
@@ -1173,64 +1309,65 @@ char *rrdcgiDecodeString(char *text)
  *  Read from stdin if no string is provided via CGI.  Variables that
  *  doesn't have a value associated with it doesn't get stored.
  */
-s_var **rrdcgiReadVariables(void)
+s_var   **rrdcgiReadVariables(
+    void)
 {
-    int length;
-    char *line = NULL;
-    int numargs;
-    char *cp, *ip, *esp, *sptr;
-    s_var **result;
-    int i, k, len;
-    char tmp[101];
+    int       length;
+    char     *line = NULL;
+    int       numargs;
+    char     *cp, *ip, *esp, *sptr;
+    s_var   **result;
+    int       i, k, len;
+    char      tmp[101];
 
     cp = getenv("REQUEST_METHOD");
     ip = getenv("CONTENT_LENGTH");
 
     if (cp && !strcmp(cp, "POST")) {
-       if (ip) {
-           length = atoi(ip);
-           if ((line = (char *)malloc (length+2)) == NULL)
-               return NULL;
-           fgets(line, length+1, stdin);
-       } else
-           return NULL;
+        if (ip) {
+            length = atoi(ip);
+            if ((line = (char *) malloc(length + 2)) == NULL)
+                return NULL;
+            fgets(line, length + 1, stdin);
+        } else
+            return NULL;
     } else if (cp && !strcmp(cp, "GET")) {
-       esp = getenv("QUERY_STRING");
-       if (esp && strlen(esp)) {
-           if ((line = (char *)malloc (strlen(esp)+2)) == NULL)
-               return NULL;
-           sprintf (line, "%s", esp);
-       } else
-           return NULL;
+        esp = getenv("QUERY_STRING");
+        if (esp && strlen(esp)) {
+            if ((line = (char *) malloc(strlen(esp) + 2)) == NULL)
+                return NULL;
+            sprintf(line, "%s", esp);
+        } else
+            return NULL;
     } else {
         length = 0;
-       printf ("(offline mode: enter name=value pairs on standard input)\n");
-       memset (tmp, 0, sizeof(tmp));
-       while((cp = fgets (tmp, 100, stdin)) != NULL) {
-           if (strlen(tmp)) {
-               if (tmp[strlen(tmp)-1] == '\n')
-                   tmp[strlen(tmp)-1] = '&';
-               if (length) {
-                   length += strlen(tmp);
-                   len = (length+1) * sizeof(char);
-                   if ((line = (char *)realloc (line, len)) == NULL)
-                       return NULL;
-                   strcat (line, tmp);
-               } else {
-                   length = strlen(tmp);
-                   len = (length+1) * sizeof(char);
-                   if ((line = (char *)malloc (len)) == NULL)
-                       return NULL;
-                   memset (line, 0, len);
-                   strcpy (line, tmp);
-               }
-           }
-           memset (tmp, 0, sizeof(tmp));
-       }
-       if (!line)
-           return NULL;
-       if (line[strlen(line)-1] == '&')
-           line[strlen(line)-1] = '\0';
+        printf("(offline mode: enter name=value pairs on standard input)\n");
+        memset(tmp, 0, sizeof(tmp));
+        while ((cp = fgets(tmp, 100, stdin)) != NULL) {
+            if (strlen(tmp)) {
+                if (tmp[strlen(tmp) - 1] == '\n')
+                    tmp[strlen(tmp) - 1] = '&';
+                if (length) {
+                    length += strlen(tmp);
+                    len = (length + 1) * sizeof(char);
+                    if ((line = (char *) realloc(line, len)) == NULL)
+                        return NULL;
+                    strcat(line, tmp);
+                } else {
+                    length = strlen(tmp);
+                    len = (length + 1) * sizeof(char);
+                    if ((line = (char *) malloc(len)) == NULL)
+                        return NULL;
+                    memset(line, 0, len);
+                    strcpy(line, tmp);
+                }
+            }
+            memset(tmp, 0, sizeof(tmp));
+        }
+        if (!line)
+            return NULL;
+        if (line[strlen(line) - 1] == '&')
+            line[strlen(line) - 1] = '\0';
     }
 
     /*
@@ -1239,89 +1376,100 @@ s_var **rrdcgiReadVariables(void)
      */
 
     if (rrdcgiDebugLevel > 0) {
-       if (rrdcgiDebugStderr)
-           fprintf (stderr, "Received cgi input: %s\n", line);
-       else
-           printf ("<b>Received cgi input</b><br>\n<pre>\n--\n%s\n--\n</pre>\n\n", line);
+        if (rrdcgiDebugStderr)
+            fprintf(stderr, "Received cgi input: %s\n", line);
+        else
+            printf
+                ("<b>Received cgi input</b><br>\n<pre>\n--\n%s\n--\n</pre>\n\n",
+                 line);
     }
 
-    for (cp=line; *cp; cp++)
-       if (*cp == '+')
-           *cp = ' ';
+    for (cp = line; *cp; cp++)
+        if (*cp == '+')
+            *cp = ' ';
 
     if (strlen(line)) {
-       for (numargs=1,cp=line; *cp; cp++)
-           if (*cp == '&') numargs++;
+        for (numargs = 1, cp = line; *cp; cp++)
+            if (*cp == '&')
+                numargs++;
     } else
-       numargs = 0;
+        numargs = 0;
     if (rrdcgiDebugLevel > 0) {
-       if (rrdcgiDebugStderr)
-           fprintf (stderr, "%d cgi variables found.\n", numargs);
-       else
-           printf ("%d cgi variables found.<br>\n", numargs);
+        if (rrdcgiDebugStderr)
+            fprintf(stderr, "%d cgi variables found.\n", numargs);
+        else
+            printf("%d cgi variables found.<br>\n", numargs);
     }
 
-    len = (numargs+1) * sizeof(s_var *);
-    if ((result = (s_var **)malloc (len)) == NULL)
-       return NULL;
-    memset (result, 0, len);
+    len = (numargs + 1) * sizeof(s_var *);
+    if ((result = (s_var **) malloc(len)) == NULL)
+        return NULL;
+    memset(result, 0, len);
 
     cp = line;
-    i=0;
+    i = 0;
     while (*cp) {
-       if ((ip = (char *)strchr(cp, '&')) != NULL) {
-           *ip = '\0';
-       }else
-           ip = cp + strlen(cp);
-
-       if ((esp=(char *)strchr(cp, '=')) == NULL) {
-           cp = ++ip;
-           continue;
-       }
-
-       if (!strlen(esp)) {
-           cp = ++ip;
-           continue;
-       }
-
-       if (i<numargs) {
-
-           /* try to find out if there's already such a variable */
-           for (k=0; k<i && (strncmp (result[k]->name,cp, esp-cp) || !(strlen (result[k]->name) == esp-cp)); k++);
-
-           if (k == i) {       /* No such variable yet */
-               if ((result[i] = (s_var *)malloc(sizeof(s_var))) == NULL)
-                   return NULL;
-               if ((result[i]->name = (char *)malloc((esp-cp+1) * sizeof(char))) == NULL)
-                   return NULL;
-               memset (result[i]->name, 0, esp-cp+1);
-               strncpy(result[i]->name, cp, esp-cp);
-               cp = ++esp;
-               if ((result[i]->value = (char *)malloc((ip-esp+1) * sizeof(char))) == NULL)
-                   return NULL;
-               memset (result[i]->value, 0, ip-esp+1);
-               strncpy(result[i]->value, cp, ip-esp);
-               result[i]->value = rrdcgiDecodeString(result[i]->value);
-               if (rrdcgiDebugLevel) {
-                   if (rrdcgiDebugStderr)
-                       fprintf (stderr, "%s: %s\n", result[i]->name, result[i]->value);
-                   else
-                       printf ("<h3>Variable %s</h3>\n<pre>\n%s\n</pre>\n\n", result[i]->name, result[i]->value);
-               }
-               i++;
-           } else {    /* There is already such a name, suppose a mutiple field */
-               cp = ++esp;
-               len = (strlen(result[k]->value)+(ip-esp)+2) * sizeof (char);
-               if ((sptr = (char *)malloc(len)) == NULL)
-                   return NULL;
-               memset (sptr, 0, len);
-               sprintf (sptr, "%s\n", result[k]->value);
-               strncat(sptr, cp, ip-esp);
-               free(result[k]->value);
-               result[k]->value = rrdcgiDecodeString (sptr);
-           }
-       }
-       cp = ++ip;
+        if ((ip = (char *) strchr(cp, '&')) != NULL) {
+            *ip = '\0';
+        } else
+            ip = cp + strlen(cp);
+
+        if ((esp = (char *) strchr(cp, '=')) == NULL) {
+            cp = ++ip;
+            continue;
+        }
+
+        if (!strlen(esp)) {
+            cp = ++ip;
+            continue;
+        }
+
+        if (i < numargs) {
+
+            /* try to find out if there's already such a variable */
+            for (k = 0; k < i && (strncmp(result[k]->name, cp, esp - cp)
+                                  || !(strlen(result[k]->name) == esp - cp));
+                 k++);
+
+            if (k == i) {   /* No such variable yet */
+                if ((result[i] = (s_var *) malloc(sizeof(s_var))) == NULL)
+                    return NULL;
+                if ((result[i]->name =
+                     (char *) malloc((esp - cp + 1) * sizeof(char))) == NULL)
+                    return NULL;
+                memset(result[i]->name, 0, esp - cp + 1);
+                strncpy(result[i]->name, cp, esp - cp);
+                cp = ++esp;
+                if ((result[i]->value =
+                     (char *) malloc((ip - esp + 1) * sizeof(char))) == NULL)
+                    return NULL;
+                memset(result[i]->value, 0, ip - esp + 1);
+                strncpy(result[i]->value, cp, ip - esp);
+                result[i]->value = rrdcgiDecodeString(result[i]->value);
+                if (rrdcgiDebugLevel) {
+                    if (rrdcgiDebugStderr)
+                        fprintf(stderr, "%s: %s\n", result[i]->name,
+                                result[i]->value);
+                    else
+                        printf("<h3>Variable %s</h3>\n<pre>\n%s\n</pre>\n\n",
+                               result[i]->name, result[i]->value);
+                }
+                i++;
+            } else {    /* There is already such a name, suppose a mutiple field */
+                cp = ++esp;
+                len =
+                    (strlen(result[k]->value) + (ip - esp) +
+                     2) * sizeof(char);
+                if ((sptr = (char *) malloc(len)) == NULL)
+                    return NULL;
+                memset(sptr, 0, len);
+                sprintf(sptr, "%s\n", result[k]->value);
+                strncat(sptr, cp, ip - esp);
+                free(result[k]->value);
+                result[k]->value = rrdcgiDecodeString(sptr);
+            }
+        }
+        cp = ++ip;
     }
     return result;
 }
@@ -1331,82 +1479,88 @@ s_var **rrdcgiReadVariables(void)
  *  Read from stdin if no string is provided via CGI.  Variables that
  *  doesn't have a value associated with it doesn't get stored.
  */
-s_cgi *rrdcgiInit(void)
+s_cgi    *rrdcgiInit(
+    void)
 {
-    s_cgi *res;
-    s_var **vars;
+    s_cgi    *res;
+    s_var   **vars;
 
     vars = rrdcgiReadVariables();
 
     if (!vars)
-       return NULL;
+        return NULL;
 
-    if ((res = (s_cgi *)malloc (sizeof (s_cgi))) == NULL)
-       return NULL;
+    if ((res = (s_cgi *) malloc(sizeof(s_cgi))) == NULL)
+        return NULL;
     res->vars = vars;
 
     return res;
 }
 
-char *rrdcgiGetValue(s_cgi *parms, const char *name)
+char     *rrdcgiGetValue(
+    s_cgi * parms,
+    const char *name)
 {
-    int i;
+    int       i;
 
     if (!parms || !parms->vars)
-       return NULL;
-    for (i=0;parms->vars[i]; i++)
-       if (!strcmp(name,parms->vars[i]->name)) {
-           if (rrdcgiDebugLevel > 0) {
-               if (rrdcgiDebugStderr)
-                   fprintf (stderr, "%s found as %s\n", name, parms->vars[i]->value);
-               else
-                   printf ("%s found as %s<br>\n", name, parms->vars[i]->value);
-           }
-           return parms->vars[i]->value;
-       }
+        return NULL;
+    for (i = 0; parms->vars[i]; i++)
+        if (!strcmp(name, parms->vars[i]->name)) {
+            if (rrdcgiDebugLevel > 0) {
+                if (rrdcgiDebugStderr)
+                    fprintf(stderr, "%s found as %s\n", name,
+                            parms->vars[i]->value);
+                else
+                    printf("%s found as %s<br>\n", name,
+                           parms->vars[i]->value);
+            }
+            return parms->vars[i]->value;
+        }
     if (rrdcgiDebugLevel) {
-       if (rrdcgiDebugStderr)
-           fprintf (stderr, "%s not found\n", name);
-       else
-           printf ("%s not found<br>\n", name);
+        if (rrdcgiDebugStderr)
+            fprintf(stderr, "%s not found\n", name);
+        else
+            printf("%s not found<br>\n", name);
     }
     return NULL;
 }
 
-void rrdcgiFreeList (char **list)
+void rrdcgiFreeList(
+    char **list)
 {
-    int i;
+    int       i;
 
-    for (i=0; list[i] != NULL; i++)
-       free (list[i]);
-       free (list);
+    for (i = 0; list[i] != NULL; i++)
+        free(list[i]);
+    free(list);
 }
 
-void rrdcgiFree (s_cgi *parms)
+void rrdcgiFree(
+    s_cgi * parms)
 {
-    int i;
+    int       i;
 
     if (!parms)
-       return;
+        return;
     if (parms->vars) {
-               for (i=0;parms->vars[i]; i++) {
-                       if (parms->vars[i]->name)
-                               free (parms->vars[i]->name);
-                       if (parms->vars[i]->value)
-                               free (parms->vars[i]->value);
-           free (parms->vars[i]);
-               }
-               free (parms->vars);
+        for (i = 0; parms->vars[i]; i++) {
+            if (parms->vars[i]->name)
+                free(parms->vars[i]->name);
+            if (parms->vars[i]->value)
+                free(parms->vars[i]->value);
+            free(parms->vars[i]);
+        }
+        free(parms->vars);
     }
-    free (parms);
+    free(parms);
 
     if (rrdcgiHeaderString) {
-       free (rrdcgiHeaderString);
-       rrdcgiHeaderString = NULL;
+        free(rrdcgiHeaderString);
+        rrdcgiHeaderString = NULL;
     }
     if (rrdcgiType) {
-       free (rrdcgiType);
-       rrdcgiType = NULL;
+        free(rrdcgiType);
+        rrdcgiType = NULL;
     }
 }
-
index e9ac860..43d608e 100644 (file)
 
 #include "rrd_is_thread_safe.h"
 
-unsigned long FnvHash(const char *str);
-int create_hw_contingent_rras(rrd_t *rrd, unsigned short period, unsigned long hashed_name);
-void parseGENERIC_DS(const char *def,rrd_t *rrd, int ds_idx);
+unsigned long FnvHash(
+    const char *str);
+int       create_hw_contingent_rras(
+    rrd_t *rrd,
+    unsigned short period,
+    unsigned long hashed_name);
+void      parseGENERIC_DS(
+    const char *def,
+    rrd_t *rrd,
+    int ds_idx);
 
-int
-rrd_create(int argc, char **argv) 
+int rrd_create(
+    int argc,
+    char **argv)
 {
-    time_t            last_up = time(NULL)-10;
-    unsigned long     pdp_step = 300;
+    time_t    last_up = time(NULL) - 10;
+    unsigned long pdp_step = 300;
     struct rrd_time_value last_up_tv;
-    char *parsetime_error = NULL;
-    long              long_tmp;
-    int               rc;
-    optind = 0; opterr = 0;  /* initialize getopt */
-
-    while (1){
-       static struct option long_options[] =
-       {
-           {"start",      required_argument, 0, 'b'},
-           {"step",        required_argument,0,'s'},
-           {0,0,0,0}
-       };
-       int option_index = 0;
-       int opt;
-       opt = getopt_long(argc, argv, "b:s:", 
-                         long_options, &option_index);
-       
-       if (opt == EOF)
-           break;
-       
-       switch(opt) {
-       case 'b':
+    char     *parsetime_error = NULL;
+    long      long_tmp;
+    int       rc;
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
+
+    while (1) {
+        static struct option long_options[] = {
+            {"start", required_argument, 0, 'b'},
+            {"step", required_argument, 0, 's'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "b:s:", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 'b':
             if ((parsetime_error = parsetime(optarg, &last_up_tv))) {
-                rrd_set_error("start time: %s", parsetime_error );
-                return(-1);
-           }
-           if (last_up_tv.type == RELATIVE_TO_END_TIME ||
-               last_up_tv.type == RELATIVE_TO_START_TIME) {
-               rrd_set_error("specifying time relative to the 'start' "
+                rrd_set_error("start time: %s", parsetime_error);
+                return (-1);
+            }
+            if (last_up_tv.type == RELATIVE_TO_END_TIME ||
+                last_up_tv.type == RELATIVE_TO_START_TIME) {
+                rrd_set_error("specifying time relative to the 'start' "
                               "or 'end' makes no sense here");
-               return(-1);
-           }
-
-           last_up = mktime(&last_up_tv.tm) + last_up_tv.offset;
-           
-           if (last_up < 3600*24*365*10){
-               rrd_set_error("the first entry to the RRD should be after 1980");
-               return(-1);
-           }   
-           break;
-
-       case 's':
-           long_tmp = atol(optarg);
-           if (long_tmp < 1){
-               rrd_set_error("step size should be no less than one second");
-               return(-1);
-           }
-           pdp_step = long_tmp;
-           break;
-
-       case '?':
+                return (-1);
+            }
+
+            last_up = mktime(&last_up_tv.tm) + last_up_tv.offset;
+
+            if (last_up < 3600 * 24 * 365 * 10) {
+                rrd_set_error
+                    ("the first entry to the RRD should be after 1980");
+                return (-1);
+            }
+            break;
+
+        case 's':
+            long_tmp = atol(optarg);
+            if (long_tmp < 1) {
+                rrd_set_error("step size should be no less than one second");
+                return (-1);
+            }
+            pdp_step = long_tmp;
+            break;
+
+        case '?':
             if (optopt != 0)
                 rrd_set_error("unknown option '%c'", optopt);
             else
-                rrd_set_error("unknown option '%s'",argv[optind-1]);
-           return(-1);
-       }
+                rrd_set_error("unknown option '%s'", argv[optind - 1]);
+            return (-1);
+        }
     }
     if (optind == argc) {
-         rrd_set_error("what is the name of the rrd file you want to create?");
-         return -1;
+        rrd_set_error("what is the name of the rrd file you want to create?");
+        return -1;
     }
     rc = rrd_create_r(argv[optind],
-                     pdp_step, last_up,
-                     argc - optind - 1, (const char **)(argv + optind + 1));
-    
+                      pdp_step, last_up,
+                      argc - optind - 1, (const char **) (argv + optind + 1));
+
     return rc;
 }
 
 /* #define DEBUG */
-int
-rrd_create_r(const char *filename,
-            unsigned long pdp_step, time_t last_up,
-            int argc, const char **argv) 
+int rrd_create_r(
+    const char *filename,
+    unsigned long pdp_step,
+    time_t last_up,
+    int argc,
+    const char **argv)
 {
-    rrd_t             rrd;
-    long              i;
-    int               offset;
-    char *token;
-    char dummychar1[2], dummychar2[2];
-    unsigned short token_idx, error_flag, period=0;
+    rrd_t     rrd;
+    long      i;
+    int       offset;
+    char     *token;
+    char      dummychar1[2], dummychar2[2];
+    unsigned short token_idx, error_flag, period = 0;
     unsigned long hashed_name;
 
     /* init rrd clean */
     rrd_init(&rrd);
     /* static header */
-    if((rrd.stat_head = calloc(1,sizeof(stat_head_t)))==NULL){
-       rrd_set_error("allocating rrd.stat_head");
-       rrd_free(&rrd);
-       return(-1);
+    if ((rrd.stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
+        rrd_set_error("allocating rrd.stat_head");
+        rrd_free(&rrd);
+        return (-1);
     }
 
     /* live header */
-    if((rrd.live_head = calloc(1,sizeof(live_head_t)))==NULL){
-       rrd_set_error("allocating rrd.live_head");
-       rrd_free(&rrd);
-       return(-1);
+    if ((rrd.live_head = calloc(1, sizeof(live_head_t))) == NULL) {
+        rrd_set_error("allocating rrd.live_head");
+        rrd_free(&rrd);
+        return (-1);
     }
 
     /* set some defaults */
-    strcpy(rrd.stat_head->cookie,RRD_COOKIE);
-    strcpy(rrd.stat_head->version,RRD_VERSION);
+    strcpy(rrd.stat_head->cookie, RRD_COOKIE);
+    strcpy(rrd.stat_head->version, RRD_VERSION);
     rrd.stat_head->float_cookie = FLOAT_COOKIE;
-    rrd.stat_head->ds_cnt = 0; /* this will be adjusted later */
+    rrd.stat_head->ds_cnt = 0;  /* this will be adjusted later */
     rrd.stat_head->rra_cnt = 0; /* ditto */
     rrd.stat_head->pdp_step = pdp_step; /* 5 minute default */
 
@@ -132,241 +144,289 @@ rrd_create_r(const char *filename,
     rrd.rra_def = NULL;
 
     rrd.live_head->last_up = last_up;
-       
-       /* optind points to the first non-option command line arg,
-        * in this case, the file name. */
-       /* Compute the FNV hash value (used by SEASONAL and DEVSEASONAL
-        * arrays. */
+
+    /* optind points to the first non-option command line arg,
+     * in this case, the file name. */
+    /* Compute the FNV hash value (used by SEASONAL and DEVSEASONAL
+     * arrays. */
     hashed_name = FnvHash(filename);
-    for(i=0;i<argc;i++){
-       unsigned int ii;
-       if (strncmp(argv[i],"DS:",3)==0){
-           size_t old_size = sizeof(ds_def_t)*(rrd.stat_head->ds_cnt);
-           if((rrd.ds_def = rrd_realloc(rrd.ds_def,
-                                         old_size+sizeof(ds_def_t)))==NULL){
-               rrd_set_error("allocating rrd.ds_def");
-               rrd_free(&rrd);
-               return(-1);     
-           }
-           memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
+    for (i = 0; i < argc; i++) {
+        unsigned int ii;
+
+        if (strncmp(argv[i], "DS:", 3) == 0) {
+            size_t    old_size = sizeof(ds_def_t) * (rrd.stat_head->ds_cnt);
+
+            if ((rrd.ds_def = rrd_realloc(rrd.ds_def,
+                                          old_size + sizeof(ds_def_t))) ==
+                NULL) {
+                rrd_set_error("allocating rrd.ds_def");
+                rrd_free(&rrd);
+                return (-1);
+            }
+            memset(&rrd.ds_def[rrd.stat_head->ds_cnt], 0, sizeof(ds_def_t));
             /* extract the name and type */
-           switch (sscanf(&argv[i][3],
-                       DS_NAM_FMT "%1[:]" DST_FMT "%1[:]%n",
-                       rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
-                       dummychar1,
-                       rrd.ds_def[rrd.stat_head->ds_cnt].dst,
-                       dummychar2,
-                       &offset)) {
-               case 0:
-               case 1: rrd_set_error("Invalid DS name"); break;
-               case 2:
-               case 3: rrd_set_error("Invalid DS type"); break;
-               case 4: /* (%n may or may not be counted) */
-               case 5: /* check for duplicate datasource names */
-                   for (ii=0;ii<rrd.stat_head->ds_cnt;ii++)
-                       if(strcmp(rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
-                               rrd.ds_def[ii].ds_nam) == 0)
-                           rrd_set_error("Duplicate DS name: %s",
-                                       rrd.ds_def[ii].ds_nam);
-                   /* DS_type may be valid or not. Checked later */
-                   break;
-               default: rrd_set_error("invalid DS format");
+            switch (sscanf(&argv[i][3],
+                           DS_NAM_FMT "%1[:]" DST_FMT "%1[:]%n",
+                           rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
+                           dummychar1,
+                           rrd.ds_def[rrd.stat_head->ds_cnt].dst,
+                           dummychar2, &offset)) {
+            case 0:
+            case 1:
+                rrd_set_error("Invalid DS name");
+                break;
+            case 2:
+            case 3:
+                rrd_set_error("Invalid DS type");
+                break;
+            case 4:    /* (%n may or may not be counted) */
+            case 5:    /* check for duplicate datasource names */
+                for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++)
+                    if (strcmp(rrd.ds_def[rrd.stat_head->ds_cnt].ds_nam,
+                               rrd.ds_def[ii].ds_nam) == 0)
+                        rrd_set_error("Duplicate DS name: %s",
+                                      rrd.ds_def[ii].ds_nam);
+                /* DS_type may be valid or not. Checked later */
+                break;
+            default:
+                rrd_set_error("invalid DS format");
             }
-           if (rrd_test_error()) {
+            if (rrd_test_error()) {
                 rrd_free(&rrd);
                 return -1;
             }
-            
+
             /* parse the remainder of the arguments */
-            switch(dst_conv(rrd.ds_def[rrd.stat_head->ds_cnt].dst))
-           {
+            switch (dst_conv(rrd.ds_def[rrd.stat_head->ds_cnt].dst)) {
             case DST_COUNTER:
             case DST_ABSOLUTE:
             case DST_GAUGE:
             case DST_DERIVE:
-                parseGENERIC_DS(&argv[i][offset+3],&rrd, rrd.stat_head->ds_cnt);
+                parseGENERIC_DS(&argv[i][offset + 3], &rrd,
+                                rrd.stat_head->ds_cnt);
                 break;
             case DST_CDEF:
-                parseCDEF_DS(&argv[i][offset+3],&rrd, rrd.stat_head->ds_cnt);
+                parseCDEF_DS(&argv[i][offset + 3], &rrd,
+                             rrd.stat_head->ds_cnt);
                 break;
             default:
                 rrd_set_error("invalid DS type specified");
                 break;
             }
-            
+
             if (rrd_test_error()) {
                 rrd_free(&rrd);
                 return -1;
             }
-            rrd.stat_head -> ds_cnt++;
-       } else if (strncmp(argv[i],"RRA:",4)==0){
-            char *argvcopy;
-           char *tokptr;
-           size_t old_size = sizeof(rra_def_t)*(rrd.stat_head->rra_cnt);
-           if((rrd.rra_def = rrd_realloc(rrd.rra_def,
-                                          old_size+sizeof(rra_def_t)))==NULL)
-           {
+            rrd.stat_head->ds_cnt++;
+        } else if (strncmp(argv[i], "RRA:", 4) == 0) {
+            char     *argvcopy;
+            char     *tokptr;
+            size_t    old_size = sizeof(rra_def_t) * (rrd.stat_head->rra_cnt);
+
+            if ((rrd.rra_def = rrd_realloc(rrd.rra_def,
+                                           old_size + sizeof(rra_def_t))) ==
+                NULL) {
                 rrd_set_error("allocating rrd.rra_def");
                 rrd_free(&rrd);
-                return(-1);    
-           }
-           memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0, sizeof(rra_def_t));
+                return (-1);
+            }
+            memset(&rrd.rra_def[rrd.stat_head->rra_cnt], 0,
+                   sizeof(rra_def_t));
 
             argvcopy = strdup(argv[i]);
-           token = strtok_r(&argvcopy[4],":", &tokptr);
-           token_idx = error_flag = 0;
-           while (token != NULL)
-           {
-                switch(token_idx)
-                {
+            token = strtok_r(&argvcopy[4], ":", &tokptr);
+            token_idx = error_flag = 0;
+            while (token != NULL) {
+                switch (token_idx) {
                 case 0:
-                    if (sscanf(token,CF_NAM_FMT,
-                               rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) != 1)
+                    if (sscanf(token, CF_NAM_FMT,
+                               rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) !=
+                        1)
                         rrd_set_error("Failed to parse CF name");
-                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
-                    {
+                    switch (cf_conv
+                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_HWPREDICT:
                         /* initialize some parameters */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].u_val = 0.1;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].u_val = 1.0/288;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = 
-                            rrd.stat_head -> rra_cnt;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
+                            u_val = 0.1;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].
+                            u_val = 1.0 / 288;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt =
+                            rrd.stat_head->rra_cnt;
                         break;
                     case CF_DEVSEASONAL:
                     case CF_SEASONAL:
                         /* initialize some parameters */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_gamma].u_val = 0.1;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_seasonal_gamma].u_val = 0.1;
                         /* fall through */
                     case CF_DEVPREDICT:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = -1;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt = -1;
                         break;
                     case CF_FAILURES:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_pos].u_val = 2.0;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_delta_neg].u_val = 2.0;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt = 3;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt = 2;
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt = -1;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_delta_pos].u_val = 2.0;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_delta_neg].u_val = 2.0;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_window_len].u_cnt = 3;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_failure_threshold].u_cnt = 2;
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt = -1;
                         break;
                         /* invalid consolidation function */
                     case -1:
-                        rrd_set_error("Unrecognized consolidation function %s",
-                                      rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
+                        rrd_set_error
+                            ("Unrecognized consolidation function %s",
+                             rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
                     default:
                         break;
                     }
-                    /* default: 1 pdp per cdp */ 
+                    /* default: 1 pdp per cdp */
                     rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = 1;
                     break;
                 case 1:
-                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
-                    {
+                    switch (cf_conv
+                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_HWPREDICT:
                     case CF_DEVSEASONAL:
                     case CF_SEASONAL:
                     case CF_DEVPREDICT:
                     case CF_FAILURES:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = atoi(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt =
+                            atoi(token);
                         break;
                     default:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val = atof(token);
-                        if (rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val<0.0 ||
-                            rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_cdp_xff_val].u_val>=1.0)
-                            rrd_set_error("Invalid xff: must be between 0 and 1");
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_cdp_xff_val].u_val = atof(token);
+                        if (rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_cdp_xff_val].u_val < 0.0
+                            || rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_cdp_xff_val].u_val >= 1.0)
+                            rrd_set_error
+                                ("Invalid xff: must be between 0 and 1");
                         break;
                     }
                     break;
                 case 2:
-                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
-                    {
+                    switch (cf_conv
+                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_HWPREDICT:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].u_val = atof(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_alpha].
+                            u_val = atof(token);
                         if (atof(token) <= 0.0 || atof(token) >= 1.0)
-                            rrd_set_error("Invalid alpha: must be between 0 and 1");
+                            rrd_set_error
+                                ("Invalid alpha: must be between 0 and 1");
                         break;
                     case CF_DEVSEASONAL:
                     case CF_SEASONAL:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_gamma].u_val = 
-                            atof(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_seasonal_gamma].u_val = atof(token);
                         if (atof(token) <= 0.0 || atof(token) >= 1.0)
-                            rrd_set_error("Invalid gamma: must be between 0 and 1");
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_seasonal_smooth_idx].u_cnt
-                            = hashed_name % rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt; 
+                            rrd_set_error
+                                ("Invalid gamma: must be between 0 and 1");
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_seasonal_smooth_idx].u_cnt =
+                            hashed_name %
+                            rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt;
                         break;
                     case CF_FAILURES:
                         /* specifies the # of violations that constitutes the failure threshold */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt =
-                            atoi(token);
-                        if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
-                            rrd_set_error("Failure threshold is out of range %d, %d",1,
-                                          MAX_FAILURES_WINDOW_LEN);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_failure_threshold].u_cnt = atoi(token);
+                        if (atoi(token) < 1
+                            || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+                            rrd_set_error
+                                ("Failure threshold is out of range %d, %d",
+                                 1, MAX_FAILURES_WINDOW_LEN);
                         break;
                     case CF_DEVPREDICT:
                         /* specifies the index (1-based) of CF_DEVSEASONAL array
                          * associated with this CF_DEVPREDICT array. */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt =
                             atoi(token) - 1;
                         break;
                     default:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt = atoi(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].pdp_cnt =
+                            atoi(token);
                         break;
                     }
                     break;
                 case 3:
-                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
-                    {
+                    switch (cf_conv
+                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_HWPREDICT:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].u_val = atof(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_hw_beta].
+                            u_val = atof(token);
                         if (atof(token) < 0.0 || atof(token) > 1.0)
-                            rrd_set_error("Invalid beta: must be between 0 and 1");
+                            rrd_set_error
+                                ("Invalid beta: must be between 0 and 1");
                         break;
                     case CF_DEVSEASONAL:
                     case CF_SEASONAL:
                         /* specifies the index (1-based) of CF_HWPREDICT array
                          * associated with this CF_DEVSEASONAL or CF_SEASONAL array. 
                          * */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt =
                             atoi(token) - 1;
                         break;
                     case CF_FAILURES:
                         /* specifies the window length */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt =
-                            atoi(token);
-                        if (atoi(token) < 1 || atoi(token) > MAX_FAILURES_WINDOW_LEN)
-                            rrd_set_error("Window length is out of range %d, %d",1,
-                                          MAX_FAILURES_WINDOW_LEN);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_window_len].u_cnt = atoi(token);
+                        if (atoi(token) < 1
+                            || atoi(token) > MAX_FAILURES_WINDOW_LEN)
+                            rrd_set_error
+                                ("Window length is out of range %d, %d", 1,
+                                 MAX_FAILURES_WINDOW_LEN);
                         /* verify that window length exceeds the failure threshold */
-                        if (rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_window_len].u_cnt <
-                            rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_failure_threshold].u_cnt)
-                            rrd_set_error("Window length is shorter than the failure threshold");
+                        if (rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_window_len].u_cnt <
+                            rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_failure_threshold].u_cnt)
+                            rrd_set_error
+                                ("Window length is shorter than the failure threshold");
                         break;
                     case CF_DEVPREDICT:
                         /* shouldn't be any more arguments */
-                        rrd_set_error("Unexpected extra argument for consolidation function DEVPREDICT");
+                        rrd_set_error
+                            ("Unexpected extra argument for consolidation function DEVPREDICT");
                         break;
                     default:
-                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt = atoi(token);
+                        rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt =
+                            atoi(token);
                         break;
                     }
                     break;
                 case 4:
-                    switch(cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam))
-                    {
+                    switch (cf_conv
+                            (rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam)) {
                     case CF_FAILURES:
                         /* specifies the index (1-based) of CF_DEVSEASONAL array
                          * associated with this CF_DEVFAILURES array. */
-                        rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
+                        rrd.rra_def[rrd.stat_head->rra_cnt].
+                            par[RRA_dependent_rra_idx].u_cnt =
                             atoi(token) - 1;
                         break;
                     case CF_HWPREDICT:
                         /* length of the associated CF_SEASONAL and CF_DEVSEASONAL arrays. */
                         period = atoi(token);
-                        if (period > rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt)
-                            rrd_set_error("Length of seasonal cycle exceeds length of HW prediction array");
+                        if (period >
+                            rrd.rra_def[rrd.stat_head->rra_cnt].row_cnt)
+                            rrd_set_error
+                                ("Length of seasonal cycle exceeds length of HW prediction array");
                         break;
                     default:
                         /* shouldn't be any more arguments */
-                        rrd_set_error("Unexpected extra argument for consolidation function %s",
-                                      rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
+                        rrd_set_error
+                            ("Unexpected extra argument for consolidation function %s",
+                             rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam);
                         break;
                     }
                     break;
@@ -377,98 +437,102 @@ rrd_create_r(const char *filename,
                      * is missing, then the CF_SEASONAL, CF_DEVSEASONAL, CF_DEVPREDICT,
                      * CF_FAILURES.
                      * arrays are created automatically. */
-                    rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt =
-                        atoi(token) - 1;
+                    rrd.rra_def[rrd.stat_head->rra_cnt].
+                        par[RRA_dependent_rra_idx].u_cnt = atoi(token) - 1;
                     break;
                 default:
                     /* should never get here */
                     rrd_set_error("Unknown error");
                     break;
-                } /* end switch */
-                if (rrd_test_error())
-                {
+                }       /* end switch */
+                if (rrd_test_error()) {
                     /* all errors are unrecoverable */
                     free(argvcopy);
                     rrd_free(&rrd);
                     return (-1);
                 }
-                token = strtok_r(NULL,":", &tokptr);
+                token = strtok_r(NULL, ":", &tokptr);
                 token_idx++;
-           } /* end while */
-           free(argvcopy);
+            }           /* end while */
+            free(argvcopy);
 #ifdef DEBUG
-           fprintf(stderr,"Creating RRA CF: %s, dep idx %lu, current idx %lu\n",
-                   rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam,
-                   rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt, 
-                   rrd.stat_head -> rra_cnt);
+            fprintf(stderr,
+                    "Creating RRA CF: %s, dep idx %lu, current idx %lu\n",
+                    rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam,
+                    rrd.rra_def[rrd.stat_head->rra_cnt].
+                    par[RRA_dependent_rra_idx].u_cnt, rrd.stat_head->rra_cnt);
 #endif
-           /* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */
-           if (cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) == CF_HWPREDICT
-               && rrd.rra_def[rrd.stat_head->rra_cnt].par[RRA_dependent_rra_idx].u_cnt 
-               == rrd.stat_head -> rra_cnt)
-           {
+            /* should we create CF_SEASONAL, CF_DEVSEASONAL, and CF_DEVPREDICT? */
+            if (cf_conv(rrd.rra_def[rrd.stat_head->rra_cnt].cf_nam) ==
+                CF_HWPREDICT
+                && rrd.rra_def[rrd.stat_head->rra_cnt].
+                par[RRA_dependent_rra_idx].u_cnt == rrd.stat_head->rra_cnt) {
 #ifdef DEBUG
-                fprintf(stderr,"Creating HW contingent RRAs\n");
+                fprintf(stderr, "Creating HW contingent RRAs\n");
 #endif
-                if (create_hw_contingent_rras(&rrd,period,hashed_name) == -1) {
+                if (create_hw_contingent_rras(&rrd, period, hashed_name) ==
+                    -1) {
                     rrd_set_error("creating contingent RRA");
                     rrd_free(&rrd);
                     return -1;
                 }
-           }
-           rrd.stat_head->rra_cnt++;                   
-       } else {
-           rrd_set_error("can't parse argument '%s'",argv[i]);
-           rrd_free(&rrd);
+            }
+            rrd.stat_head->rra_cnt++;
+        } else {
+            rrd_set_error("can't parse argument '%s'", argv[i]);
+            rrd_free(&rrd);
             return -1;
-       }
+        }
     }
-    
-    
-    if (rrd.stat_head->rra_cnt < 1){
-       rrd_set_error("you must define at least one Round Robin Archive");
-       rrd_free(&rrd);
-       return(-1);
+
+
+    if (rrd.stat_head->rra_cnt < 1) {
+        rrd_set_error("you must define at least one Round Robin Archive");
+        rrd_free(&rrd);
+        return (-1);
     }
-    
-    if (rrd.stat_head->ds_cnt < 1){
-       rrd_set_error("you must define at least one Data Source");
-       rrd_free(&rrd);
-       return(-1);
+
+    if (rrd.stat_head->ds_cnt < 1) {
+        rrd_set_error("you must define at least one Data Source");
+        rrd_free(&rrd);
+        return (-1);
     }
     return rrd_create_fn(filename, &rrd);
 }
 
-void parseGENERIC_DS(const char *def,rrd_t *rrd, int ds_idx)
+void parseGENERIC_DS(
+    const char *def,
+    rrd_t *rrd,
+    int ds_idx)
 {
-    char minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];     
+    char      minstr[DS_NAM_SIZE], maxstr[DS_NAM_SIZE];
+
     /*
-      int temp;
-      
-      temp = sscanf(def,"%lu:%18[^:]:%18[^:]", 
-      &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
-      minstr,maxstr);
-    */
-    if (sscanf(def,"%lu:%18[^:]:%18[^:]",      
-               &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
-               minstr,maxstr) == 3)
-    {
+       int temp;
+
+       temp = sscanf(def,"%lu:%18[^:]:%18[^:]", 
+       &(rrd -> ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
+       minstr,maxstr);
+     */
+    if (sscanf(def, "%lu:%18[^:]:%18[^:]",
+               &(rrd->ds_def[ds_idx].par[DS_mrhb_cnt].u_cnt),
+               minstr, maxstr) == 3) {
         if (minstr[0] == 'U' && minstr[1] == 0)
-            rrd -> ds_def[ds_idx].par[DS_min_val].u_val = DNAN;
+            rrd->ds_def[ds_idx].par[DS_min_val].u_val = DNAN;
         else
-            rrd -> ds_def[ds_idx].par[DS_min_val].u_val = atof(minstr);
-        
+            rrd->ds_def[ds_idx].par[DS_min_val].u_val = atof(minstr);
+
         if (maxstr[0] == 'U' && maxstr[1] == 0)
-            rrd -> ds_def[ds_idx].par[DS_max_val].u_val = DNAN;
+            rrd->ds_def[ds_idx].par[DS_max_val].u_val = DNAN;
         else
-            rrd -> ds_def[ds_idx].par[DS_max_val].u_val  = atof(maxstr);
-        
-        if (! isnan(rrd -> ds_def[ds_idx].par[DS_min_val].u_val) &&
-            ! isnan(rrd -> ds_def[ds_idx].par[DS_max_val].u_val) &&
-            rrd -> ds_def[ds_idx].par[DS_min_val].u_val
-            >= rrd -> ds_def[ds_idx].par[DS_max_val].u_val ) {
+            rrd->ds_def[ds_idx].par[DS_max_val].u_val = atof(maxstr);
+
+        if (!isnan(rrd->ds_def[ds_idx].par[DS_min_val].u_val) &&
+            !isnan(rrd->ds_def[ds_idx].par[DS_max_val].u_val) &&
+            rrd->ds_def[ds_idx].par[DS_min_val].u_val
+            >= rrd->ds_def[ds_idx].par[DS_max_val].u_val) {
             rrd_set_error("min must be less than max in DS definition");
-            return;            
+            return;
         }
     } else {
         rrd_set_error("failed to parse data source %s", def);
@@ -477,219 +541,215 @@ void parseGENERIC_DS(const char *def,rrd_t *rrd, int ds_idx)
 
 /* Create the CF_DEVPREDICT, CF_DEVSEASONAL, CF_SEASONAL, and CF_FAILURES RRAs
  * associated with a CF_HWPREDICT RRA. */
-int
-create_hw_contingent_rras(rrd_t *rrd, unsigned short period, unsigned long hashed_name)
+int create_hw_contingent_rras(
+    rrd_t *rrd,
+    unsigned short period,
+    unsigned long hashed_name)
 {
-    size_t old_size;
-    rra_def_tcurrent_rra;
-    
+    size_t    old_size;
+    rra_def_t *current_rra;
+
     /* save index to CF_HWPREDICT */
-    unsigned long hw_index = rrd -> stat_head -> rra_cnt;
+    unsigned long hw_index = rrd->stat_head->rra_cnt;
+
     /* advance the pointer */
-    (rrd -> stat_head -> rra_cnt)++;                   
+    (rrd->stat_head->rra_cnt)++;
     /* allocate the memory for the 4 contingent RRAs */
-    old_size = sizeof(rra_def_t)*(rrd -> stat_head->rra_cnt);
-    if ((rrd -> rra_def = rrd_realloc(rrd -> rra_def,
-                                      old_size+4*sizeof(rra_def_t)))==NULL)
-    {
+    old_size = sizeof(rra_def_t) * (rrd->stat_head->rra_cnt);
+    if ((rrd->rra_def = rrd_realloc(rrd->rra_def,
+                                    old_size + 4 * sizeof(rra_def_t))) ==
+        NULL) {
         rrd_set_error("allocating rrd.rra_def");
-        return(-1);    
+        return (-1);
     }
     /* clear memory */
-    memset(&(rrd -> rra_def[rrd -> stat_head->rra_cnt]), 0, 4*sizeof(rra_def_t));
-    
+    memset(&(rrd->rra_def[rrd->stat_head->rra_cnt]), 0,
+           4 * sizeof(rra_def_t));
+
     /* create the CF_SEASONAL RRA */
-    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
-    strcpy(current_rra -> cf_nam,"SEASONAL");
-    current_rra -> row_cnt = period;
-    current_rra -> par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
-    current_rra -> pdp_cnt = 1;
-    current_rra -> par[RRA_seasonal_gamma].u_val = 
-        rrd -> rra_def[hw_index].par[RRA_hw_alpha].u_val;
-    current_rra -> par[RRA_dependent_rra_idx].u_cnt = hw_index; 
-    rrd -> rra_def[hw_index].par[RRA_dependent_rra_idx].u_cnt = rrd -> stat_head -> rra_cnt;
-    
+    current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
+    strcpy(current_rra->cf_nam, "SEASONAL");
+    current_rra->row_cnt = period;
+    current_rra->par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
+    current_rra->pdp_cnt = 1;
+    current_rra->par[RRA_seasonal_gamma].u_val =
+        rrd->rra_def[hw_index].par[RRA_hw_alpha].u_val;
+    current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index;
+    rrd->rra_def[hw_index].par[RRA_dependent_rra_idx].u_cnt =
+        rrd->stat_head->rra_cnt;
+
     /* create the CF_DEVSEASONAL RRA */
-    (rrd -> stat_head -> rra_cnt)++; 
-    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
-    strcpy(current_rra -> cf_nam,"DEVSEASONAL");
-    current_rra -> row_cnt = period;
-    current_rra -> par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
-    current_rra -> pdp_cnt = 1;
-    current_rra -> par[RRA_seasonal_gamma].u_val = 
-        rrd -> rra_def[hw_index].par[RRA_hw_alpha].u_val;
-    current_rra -> par[RRA_dependent_rra_idx].u_cnt = hw_index; 
-    
+    (rrd->stat_head->rra_cnt)++;
+    current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
+    strcpy(current_rra->cf_nam, "DEVSEASONAL");
+    current_rra->row_cnt = period;
+    current_rra->par[RRA_seasonal_smooth_idx].u_cnt = hashed_name % period;
+    current_rra->pdp_cnt = 1;
+    current_rra->par[RRA_seasonal_gamma].u_val =
+        rrd->rra_def[hw_index].par[RRA_hw_alpha].u_val;
+    current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index;
+
     /* create the CF_DEVPREDICT RRA */
-    (rrd -> stat_head -> rra_cnt)++; 
-    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
-    strcpy(current_rra -> cf_nam,"DEVPREDICT");
-    current_rra -> row_cnt = (rrd -> rra_def[hw_index]).row_cnt;
-    current_rra -> pdp_cnt = 1;
-    current_rra -> par[RRA_dependent_rra_idx].u_cnt 
-        = hw_index + 2; /* DEVSEASONAL */
-    
+    (rrd->stat_head->rra_cnt)++;
+    current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
+    strcpy(current_rra->cf_nam, "DEVPREDICT");
+    current_rra->row_cnt = (rrd->rra_def[hw_index]).row_cnt;
+    current_rra->pdp_cnt = 1;
+    current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index + 2;   /* DEVSEASONAL */
+
     /* create the CF_FAILURES RRA */
-    (rrd -> stat_head -> rra_cnt)++; 
-    current_rra = &(rrd -> rra_def[rrd -> stat_head -> rra_cnt]);
-    strcpy(current_rra -> cf_nam,"FAILURES");
-    current_rra -> row_cnt = period; 
-    current_rra -> pdp_cnt = 1;
-    current_rra -> par[RRA_delta_pos].u_val = 2.0;
-    current_rra -> par[RRA_delta_neg].u_val = 2.0;
-    current_rra -> par[RRA_failure_threshold].u_cnt = 7;
-    current_rra -> par[RRA_window_len].u_cnt = 9;
-    current_rra -> par[RRA_dependent_rra_idx].u_cnt = 
-        hw_index + 2; /* DEVSEASONAL */
+    (rrd->stat_head->rra_cnt)++;
+    current_rra = &(rrd->rra_def[rrd->stat_head->rra_cnt]);
+    strcpy(current_rra->cf_nam, "FAILURES");
+    current_rra->row_cnt = period;
+    current_rra->pdp_cnt = 1;
+    current_rra->par[RRA_delta_pos].u_val = 2.0;
+    current_rra->par[RRA_delta_neg].u_val = 2.0;
+    current_rra->par[RRA_failure_threshold].u_cnt = 7;
+    current_rra->par[RRA_window_len].u_cnt = 9;
+    current_rra->par[RRA_dependent_rra_idx].u_cnt = hw_index + 2;   /* DEVSEASONAL */
     return 0;
 }
 
 /* create and empty rrd file according to the specs given */
 
-int
-rrd_create_fn(const char *file_name, rrd_t *rrd)
+int rrd_create_fn(
+    const char *file_name,
+    rrd_t *rrd)
 {
-    unsigned long    i,ii;
-    FILE             *rrd_file;
-    rrd_value_t      *unknown;
-    int        unkn_cnt;
-
-    long rrd_head_size;
-
-    if ((rrd_file = fopen(file_name,"wb")) == NULL ) {
-       rrd_set_error("creating '%s': %s",file_name, rrd_strerror(errno));
-       free(rrd->stat_head);
-        rrd->stat_head = NULL; 
-       free(rrd->ds_def);
-        rrd->ds_def = NULL; 
-       free(rrd->rra_def);
+    unsigned long i, ii;
+    FILE     *rrd_file;
+    rrd_value_t *unknown;
+    int       unkn_cnt;
+
+    long      rrd_head_size;
+
+    if ((rrd_file = fopen(file_name, "wb")) == NULL) {
+        rrd_set_error("creating '%s': %s", file_name, rrd_strerror(errno));
+        free(rrd->stat_head);
+        rrd->stat_head = NULL;
+        free(rrd->ds_def);
+        rrd->ds_def = NULL;
+        free(rrd->rra_def);
         rrd->rra_def = NULL;
-       return(-1);
+        return (-1);
     }
-    
-    fwrite(rrd->stat_head,
-          sizeof(stat_head_t), 1, rrd_file);
-    
-    fwrite(rrd->ds_def,
-          sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
-    
+
+    fwrite(rrd->stat_head, sizeof(stat_head_t), 1, rrd_file);
+
+    fwrite(rrd->ds_def, sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
+
     fwrite(rrd->rra_def,
-          sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
-    
-    fwrite(rrd->live_head,
-          sizeof(live_head_t),1, rrd_file);
-
-    if((rrd->pdp_prep = calloc(1,sizeof(pdp_prep_t))) == NULL){
-       rrd_set_error("allocating pdp_prep");
-       rrd_free(rrd);
-       fclose(rrd_file);
-       return(-1);
+           sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
+
+    fwrite(rrd->live_head, sizeof(live_head_t), 1, rrd_file);
+
+    if ((rrd->pdp_prep = calloc(1, sizeof(pdp_prep_t))) == NULL) {
+        rrd_set_error("allocating pdp_prep");
+        rrd_free(rrd);
+        fclose(rrd_file);
+        return (-1);
     }
 
-    strcpy(rrd->pdp_prep->last_ds,"UNKN");
+    strcpy(rrd->pdp_prep->last_ds, "UNKN");
 
     rrd->pdp_prep->scratch[PDP_val].u_val = 0.0;
-    rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt = 
-       rrd->live_head->last_up % rrd->stat_head->pdp_step;
-
-    for(i=0; i < rrd->stat_head->ds_cnt; i++)
-       fwrite( rrd->pdp_prep,sizeof(pdp_prep_t),1,rrd_file);
-    
-    if((rrd->cdp_prep = calloc(1,sizeof(cdp_prep_t))) == NULL){
-       rrd_set_error("allocating cdp_prep");
-       rrd_free(rrd);
-       fclose(rrd_file);
-       return(-1);
+    rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt =
+        rrd->live_head->last_up % rrd->stat_head->pdp_step;
+
+    for (i = 0; i < rrd->stat_head->ds_cnt; i++)
+        fwrite(rrd->pdp_prep, sizeof(pdp_prep_t), 1, rrd_file);
+
+    if ((rrd->cdp_prep = calloc(1, sizeof(cdp_prep_t))) == NULL) {
+        rrd_set_error("allocating cdp_prep");
+        rrd_free(rrd);
+        fclose(rrd_file);
+        return (-1);
     }
 
 
-    for(i=0; i < rrd->stat_head->rra_cnt; i++) {
-       switch (cf_conv(rrd->rra_def[i].cf_nam))
-          {
-           case CF_HWPREDICT:
-               init_hwpredict_cdp(rrd->cdp_prep);
-               break;
-           case CF_SEASONAL:
-           case CF_DEVSEASONAL:
-               init_seasonal_cdp(rrd->cdp_prep);
-               break;
-           case CF_FAILURES:
-               /* initialize violation history to 0 */
-               for (ii = 0; ii < MAX_CDP_PAR_EN; ii++)
-               {
-                               /* We can zero everything out, by setting u_val to the
-                                * NULL address. Each array entry in scratch is 8 bytes
-                                * (a double), but u_cnt only accessed 4 bytes (long) */
-                   rrd->cdp_prep->scratch[ii].u_val = 0.0;
-               }
-               break;
-           default:
-               /* can not be zero because we don't know anything ... */
-               rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
-               /* startup missing pdp count */
-               rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt = 
-                   ((rrd->live_head->last_up -
-                rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
-                    % (rrd->stat_head->pdp_step 
-                       * rrd->rra_def[i].pdp_cnt)) / rrd->stat_head->pdp_step; 
-               break;
-          }
-       
-       for(ii=0; ii < rrd->stat_head->ds_cnt; ii++) 
-       {
-           fwrite( rrd->cdp_prep,sizeof(cdp_prep_t),1,rrd_file);
-       }
+    for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
+        switch (cf_conv(rrd->rra_def[i].cf_nam)) {
+        case CF_HWPREDICT:
+            init_hwpredict_cdp(rrd->cdp_prep);
+            break;
+        case CF_SEASONAL:
+        case CF_DEVSEASONAL:
+            init_seasonal_cdp(rrd->cdp_prep);
+            break;
+        case CF_FAILURES:
+            /* initialize violation history to 0 */
+            for (ii = 0; ii < MAX_CDP_PAR_EN; ii++) {
+                /* We can zero everything out, by setting u_val to the
+                 * NULL address. Each array entry in scratch is 8 bytes
+                 * (a double), but u_cnt only accessed 4 bytes (long) */
+                rrd->cdp_prep->scratch[ii].u_val = 0.0;
+            }
+            break;
+        default:
+            /* can not be zero because we don't know anything ... */
+            rrd->cdp_prep->scratch[CDP_val].u_val = DNAN;
+            /* startup missing pdp count */
+            rrd->cdp_prep->scratch[CDP_unkn_pdp_cnt].u_cnt =
+                ((rrd->live_head->last_up -
+                  rrd->pdp_prep->scratch[PDP_unkn_sec_cnt].u_cnt)
+                 % (rrd->stat_head->pdp_step
+                    * rrd->rra_def[i].pdp_cnt)) / rrd->stat_head->pdp_step;
+            break;
+        }
+
+        for (ii = 0; ii < rrd->stat_head->ds_cnt; ii++) {
+            fwrite(rrd->cdp_prep, sizeof(cdp_prep_t), 1, rrd_file);
+        }
     }
-    
+
     /* now, we must make sure that the rest of the rrd
        struct is properly initialized */
-    
-    if((rrd->rra_ptr = calloc(1,sizeof(rra_ptr_t))) == NULL) {
-       rrd_set_error("allocating rra_ptr");
-       rrd_free(rrd);
-       fclose(rrd_file);
-       return(-1);
+
+    if ((rrd->rra_ptr = calloc(1, sizeof(rra_ptr_t))) == NULL) {
+        rrd_set_error("allocating rra_ptr");
+        rrd_free(rrd);
+        fclose(rrd_file);
+        return (-1);
     }
-    
+
     /* changed this initialization to be consistent with
      * rrd_restore. With the old value (0), the first update
      * would occur for cur_row = 1 because rrd_update increments
      * the pointer a priori. */
-    for (i=0; i < rrd->stat_head->rra_cnt; i++)
-    {
+    for (i = 0; i < rrd->stat_head->rra_cnt; i++) {
         rrd->rra_ptr->cur_row = rrd->rra_def[i].row_cnt - 1;
-        fwrite( rrd->rra_ptr, sizeof(rra_ptr_t),1,rrd_file);
+        fwrite(rrd->rra_ptr, sizeof(rra_ptr_t), 1, rrd_file);
     }
     rrd_head_size = ftell(rrd_file);
 
     /* write the empty data area */
-    if ((unknown = (rrd_value_t *)malloc(512 * sizeof(rrd_value_t))) == NULL) {
-       rrd_set_error("allocating unknown");
-       rrd_free(rrd);
-       fclose(rrd_file);
-       return(-1);
+    if ((unknown = (rrd_value_t *) malloc(512 * sizeof(rrd_value_t))) == NULL) {
+        rrd_set_error("allocating unknown");
+        rrd_free(rrd);
+        fclose(rrd_file);
+        return (-1);
     }
     for (i = 0; i < 512; ++i)
-       unknown[i] = DNAN;
-    
+        unknown[i] = DNAN;
+
     unkn_cnt = 0;
     for (i = 0; i < rrd->stat_head->rra_cnt; i++)
         unkn_cnt += rrd->stat_head->ds_cnt * rrd->rra_def[i].row_cnt;
-                     
+
     while (unkn_cnt > 0) {
-       fwrite(unknown, sizeof(rrd_value_t), min(unkn_cnt, 512), rrd_file);
-       unkn_cnt -= 512;
-     }
+        fwrite(unknown, sizeof(rrd_value_t), min(unkn_cnt, 512), rrd_file);
+        unkn_cnt -= 512;
+    }
     free(unknown);
-    
+
     /* lets see if we had an error */
-    if(ferror(rrd_file)){
-       rrd_set_error("a file error occurred while creating '%s'",file_name);
-       fclose(rrd_file);       
-       rrd_free(rrd);
-       return(-1);
+    if (ferror(rrd_file)) {
+        rrd_set_error("a file error occurred while creating '%s'", file_name);
+        fclose(rrd_file);
+        rrd_free(rrd);
+        return (-1);
     }
-    
 #ifdef HAVE_POSIX_FADVISE
     /* this file is not going to be read again any time
        soon, so we drop everything except the header portion from
@@ -701,14 +761,17 @@ rrd_create_fn(const char *file_name, rrd_t *rrd)
        the unknown data. */
     fflush(rrd_file);
     fdatasync(fileno(rrd_file));
-    if (0 != posix_fadvise(fileno(rrd_file), rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
-        rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",file_name, rrd_strerror(errno));
+    if (0 !=
+        posix_fadvise(fileno(rrd_file), rrd_head_size, 0,
+                      POSIX_FADV_DONTNEED)) {
+        rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s", file_name,
+                      rrd_strerror(errno));
         fclose(rrd_file);
-        return(-1);
-    }    
+        return (-1);
+    }
 #endif
 
-    fclose(rrd_file);    
+    fclose(rrd_file);
     rrd_free(rrd);
     return (0);
 }
index 22cef90..5839040 100644 (file)
 
 #include "rrd_tool.h"
 
-double
-rrd_diff(char *a, char *b)
+double rrd_diff(
+    char *a,
+    char *b)
 {
-    char res[LAST_DS_LEN+1], *a1, *b1, *r1, *fix;
-    int c,x,m;
-    char a_neg=0, b_neg=0;
-    double result;
-   
-    while (!(isdigit((int)*a) || *a==0)) {
-        if(*a=='-') 
-           a_neg = 1;
+    char      res[LAST_DS_LEN + 1], *a1, *b1, *r1, *fix;
+    int       c, x, m;
+    char      a_neg = 0, b_neg = 0;
+    double    result;
+
+    while (!(isdigit((int) *a) || *a == 0)) {
+        if (*a == '-')
+            a_neg = 1;
         a++;
     }
-    fix=a;
-    while (isdigit((int)*fix)) 
-       fix++;
-    *fix = 0; /* maybe there is some non digit data in the string */ 
-    while (!(isdigit((int)*b) || *b==0)) {
-       if(*b=='-') 
-           b_neg = 1;  
+    fix = a;
+    while (isdigit((int) *fix))
+        fix++;
+    *fix = 0;           /* maybe there is some non digit data in the string */
+    while (!(isdigit((int) *b) || *b == 0)) {
+        if (*b == '-')
+            b_neg = 1;
         b++;
     }
-    fix=b;
-    while (isdigit((int)*fix)) 
-       fix++;
-    *fix = 0; /* maybe there is some non digit data in the string */ 
-    if(!isdigit((int)*a) || !isdigit((int)*b))
-       return DNAN;
-    if(a_neg+b_neg == 1) /* can not handle numbers with different signs yet */
-       return DNAN;
-    a1 = &a[strlen(a)-1];
-    m = max(strlen(a),strlen(b));
-    if (m > LAST_DS_LEN) return DNAN; /* result string too short */
+    fix = b;
+    while (isdigit((int) *fix))
+        fix++;
+    *fix = 0;           /* maybe there is some non digit data in the string */
+    if (!isdigit((int) *a) || !isdigit((int) *b))
+        return DNAN;
+    if (a_neg + b_neg == 1) /* can not handle numbers with different signs yet */
+        return DNAN;
+    a1 = &a[strlen(a) - 1];
+    m = max(strlen(a), strlen(b));
+    if (m > LAST_DS_LEN)
+        return DNAN;    /* result string too short */
 
-    r1 = &res[m+1];
-    for (b1 = res;b1 <= r1; b1++) *b1 = ' ';
-    b1 = &b[strlen(b)-1];
-    r1[1] = 0;  /* Null terminate result */
+    r1 = &res[m + 1];
+    for (b1 = res; b1 <= r1; b1++)
+        *b1 = ' ';
+    b1 = &b[strlen(b) - 1];
+    r1[1] = 0;          /* Null terminate result */
     c = 0;
-    for (x=0; x<m; x++) {
+    for (x = 0; x < m; x++) {
         if (a1 >= a && b1 >= b) {
             *r1 = ((*a1 - c) - *b1) + '0';
         } else if (a1 >= a) {
@@ -86,33 +89,34 @@ rrd_diff(char *a, char *b)
         }
         if (*r1 < '0') {
             *r1 += 10;
-            c=1;
-        } else
-         if (*r1 > '9') { /* 0 - 10 */
-           *r1 -= 10;
-           c=1;            
-         } else {
-            c=0;
+            c = 1;
+        } else if (*r1 > '9') { /* 0 - 10 */
+            *r1 -= 10;
+            c = 1;
+        } else {
+            c = 0;
         }
-        a1--;b1--;r1--;
+        a1--;
+        b1--;
+        r1--;
     }
     if (c) {
-        r1 = &res[m+1];
-        for (x=0; isdigit((int)*r1) && x<m; x++,r1--)  {
+        r1 = &res[m + 1];
+        for (x = 0; isdigit((int) *r1) && x < m; x++, r1--) {
             *r1 = ('9' - *r1 + c) + '0';
             if (*r1 > '9') {
                 *r1 -= 10;
-                c=1;
+                c = 1;
             } else {
-                c=0;
+                c = 0;
             }
         }
         result = -atof(res);
     } else
         result = atof(res);
 
-    if(a_neg+b_neg==2) /* both are negatives, reverse sign */
+    if (a_neg + b_neg == 2) /* both are negatives, reverse sign */
         result = -result;
-    
+
     return result;
-}                                                       
+}
index 5d76896..d839bf6 100644 (file)
 extern char *tzname[2];
 #endif
 
-int
-rrd_dump(int argc, char **argv) 
+int rrd_dump(
+    int argc,
+    char **argv)
 {
-    int                 rc;
+    int       rc;
 
     if (argc < 2) {
-       rrd_set_error("Not enough arguments");
-       return -1;
+        rrd_set_error("Not enough arguments");
+        return -1;
     }
 
-    if (argc == 3)
-    {
-      rc = rrd_dump_r(argv[1], argv[2]);
-    }
-    else
-    {
-      rc = rrd_dump_r(argv[1], NULL);                  
+    if (argc == 3) {
+        rc = rrd_dump_r(argv[1], argv[2]);
+    } else {
+        rc = rrd_dump_r(argv[1], NULL);
     }
 
     return rc;
 }
 
-int
-rrd_dump_r(const char *filename, char *outname)    
-{   
-    unsigned int i,ii,ix,iii=0;
-    time_t       now;
-    char         somestring[255];
-    rrd_value_t  my_cdp;
-    off_t         rra_base, rra_start, rra_next;
-    rrd_file_t  *rrd_file;
-               FILE                            *out_file;
-    rrd_t        rrd;
-    rrd_value_t  value;
-    struct tm    tm;
+int rrd_dump_r(
+    const char *filename,
+    char *outname)
+{
+    unsigned int i, ii, ix, iii = 0;
+    time_t    now;
+    char      somestring[255];
+    rrd_value_t my_cdp;
+    off_t     rra_base, rra_start, rra_next;
+    rrd_file_t *rrd_file;
+    FILE     *out_file;
+    rrd_t     rrd;
+    rrd_value_t value;
+    struct tm tm;
+
     rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL) {
-       rrd_free(&rrd);
-       return(-1);
+        rrd_free(&rrd);
+        return (-1);
     }
 
     out_file = NULL;
-    if (outname)
-    {
-      if (!(out_file = fopen(outname, "w")))
-      {
-        return (-1);     
-      }
-    }
-    else 
-    {
-      out_file = stdout;
+    if (outname) {
+        if (!(out_file = fopen(outname, "w"))) {
+            return (-1);
+        }
+    } else {
+        out_file = stdout;
     }
-               
+
     fputs("<!-- Round Robin Database Dump -->", out_file);
     fputs("<rrd>", out_file);
-    fprintf(out_file, "\t<version> %s </version>\n",RRD_VERSION);
-    fprintf(out_file, "\t<step> %lu </step> <!-- Seconds -->\n",rrd.stat_head->pdp_step);
+    fprintf(out_file, "\t<version> %s </version>\n", RRD_VERSION);
+    fprintf(out_file, "\t<step> %lu </step> <!-- Seconds -->\n",
+            rrd.stat_head->pdp_step);
 #if HAVE_STRFTIME
     localtime_r(&rrd.live_head->last_up, &tm);
-    strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z",
-            &tm);
+    strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z", &tm);
 #else
 # error "Need strftime"
 #endif
     fprintf(out_file, "\t<lastupdate> %ld </lastupdate> <!-- %s -->\n\n",
-          rrd.live_head->last_up,somestring);
-    for(i=0;i<rrd.stat_head->ds_cnt;i++){
-          fprintf(out_file, "\t<ds>\n");
-          fprintf(out_file, "\t\t<name> %s </name>\n",rrd.ds_def[i].ds_nam);
-          fprintf(out_file, "\t\t<type> %s </type>\n",rrd.ds_def[i].dst);
-       if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
-          fprintf(out_file, "\t\t<minimal_heartbeat> %lu </minimal_heartbeat>\n",rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
-             if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)){
-                 fprintf(out_file, "\t\t<min> NaN </min>\n");
-             } else {
-                 fprintf(out_file, "\t\t<min> %0.10e </min>\n",rrd.ds_def[i].par[DS_min_val].u_val);
-             }
-             if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)){
-                 fprintf(out_file, "\t\t<max> NaN </max>\n");
-             } else {
-                 fprintf(out_file, "\t\t<max> %0.10e </max>\n",rrd.ds_def[i].par[DS_max_val].u_val);
-             }
-       } else { /* DST_CDEF */
-             char *str=NULL;
-             rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),rrd.ds_def,&str);
-             fprintf(out_file, "\t\t<cdef> %s </cdef>\n", str);
-             free(str);
-          }
-          fprintf(out_file, "\n\t\t<!-- PDP Status -->\n");
-          fprintf(out_file, "\t\t<last_ds> %s </last_ds>\n",rrd.pdp_prep[i].last_ds);
-          if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)){
-             fprintf(out_file, "\t\t<value> NaN </value>\n");
-          } else {
-             fprintf(out_file, "\t\t<value> %0.10e </value>\n",rrd.pdp_prep[i].scratch[PDP_val].u_val);
-          }
-             fprintf(out_file, "\t\t<unknown_sec> %lu </unknown_sec>\n",
-                     rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
-       
-             fprintf(out_file, "\t</ds>\n\n");
-       }
+            rrd.live_head->last_up, somestring);
+    for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+        fprintf(out_file, "\t<ds>\n");
+        fprintf(out_file, "\t\t<name> %s </name>\n", rrd.ds_def[i].ds_nam);
+        fprintf(out_file, "\t\t<type> %s </type>\n", rrd.ds_def[i].dst);
+        if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
+            fprintf(out_file,
+                    "\t\t<minimal_heartbeat> %lu </minimal_heartbeat>\n",
+                    rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
+            if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)) {
+                fprintf(out_file, "\t\t<min> NaN </min>\n");
+            } else {
+                fprintf(out_file, "\t\t<min> %0.10e </min>\n",
+                        rrd.ds_def[i].par[DS_min_val].u_val);
+            }
+            if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)) {
+                fprintf(out_file, "\t\t<max> NaN </max>\n");
+            } else {
+                fprintf(out_file, "\t\t<max> %0.10e </max>\n",
+                        rrd.ds_def[i].par[DS_max_val].u_val);
+            }
+        } else {        /* DST_CDEF */
+            char     *str = NULL;
+
+            rpn_compact2str((rpn_cdefds_t *) & (rrd.ds_def[i].par[DS_cdef]),
+                            rrd.ds_def, &str);
+            fprintf(out_file, "\t\t<cdef> %s </cdef>\n", str);
+            free(str);
+        }
+        fprintf(out_file, "\n\t\t<!-- PDP Status -->\n");
+        fprintf(out_file, "\t\t<last_ds> %s </last_ds>\n",
+                rrd.pdp_prep[i].last_ds);
+        if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)) {
+            fprintf(out_file, "\t\t<value> NaN </value>\n");
+        } else {
+            fprintf(out_file, "\t\t<value> %0.10e </value>\n",
+                    rrd.pdp_prep[i].scratch[PDP_val].u_val);
+        }
+        fprintf(out_file, "\t\t<unknown_sec> %lu </unknown_sec>\n",
+                rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+
+        fprintf(out_file, "\t</ds>\n\n");
+    }
 
     fputs("<!-- Round Robin Archives -->", out_file);
 
     rra_base = rrd_file->header_len;
     rra_next = rra_base;
 
-    for(i=0;i<rrd.stat_head->rra_cnt;i++){
-       
-       long timer=0;
-       rra_start= rra_next;
-       rra_next +=  ( rrd.stat_head->ds_cnt
-                      * rrd.rra_def[i].row_cnt
-                      * sizeof(rrd_value_t));
-       fprintf(out_file, "\t<rra>\n");
-       fprintf(out_file, "\t\t<cf> %s </cf>\n",rrd.rra_def[i].cf_nam);
-       fprintf(out_file, "\t\t<pdp_per_row> %lu </pdp_per_row> <!-- %lu seconds -->\n\n",
-              rrd.rra_def[i].pdp_cnt, rrd.rra_def[i].pdp_cnt
-              *rrd.stat_head->pdp_step);
-       /* support for RRA parameters */
-       fprintf(out_file, "\t\t<params>\n");
-       switch(cf_conv(rrd.rra_def[i].cf_nam)) {
-       case CF_HWPREDICT:
-          fprintf(out_file, "\t\t<hw_alpha> %0.10e </hw_alpha>\n", 
-                 rrd.rra_def[i].par[RRA_hw_alpha].u_val);
-          fprintf(out_file, "\t\t<hw_beta> %0.10e </hw_beta>\n", 
-                 rrd.rra_def[i].par[RRA_hw_beta].u_val);
-          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
-                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
-          break;
-       case CF_SEASONAL:
-       case CF_DEVSEASONAL:
-          fprintf(out_file, "\t\t<seasonal_gamma> %0.10e </seasonal_gamma>\n", 
-                 rrd.rra_def[i].par[RRA_seasonal_gamma].u_val);
-          fprintf(out_file, "\t\t<seasonal_smooth_idx> %lu </seasonal_smooth_idx>\n",
-                 rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
-          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
-                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
-          break;
-       case CF_FAILURES:
-          fprintf(out_file, "\t\t<delta_pos> %0.10e </delta_pos>\n", 
-                 rrd.rra_def[i].par[RRA_delta_pos].u_val);
-          fprintf(out_file, "\t\t<delta_neg> %0.10e </delta_neg>\n", 
-                 rrd.rra_def[i].par[RRA_delta_neg].u_val);
-          fprintf(out_file, "\t\t<window_len> %lu </window_len>\n",
-                 rrd.rra_def[i].par[RRA_window_len].u_cnt);
-          fprintf(out_file, "\t\t<failure_threshold> %lu </failure_threshold>\n",
-                 rrd.rra_def[i].par[RRA_failure_threshold].u_cnt);
-                 /* fall thru */
-       case CF_DEVPREDICT:
-          fprintf(out_file, "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
-                 rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
-          break;
-       case CF_AVERAGE:
-       case CF_MAXIMUM:
-       case CF_MINIMUM:
-       case CF_LAST:
-       default:
-          fprintf(out_file, "\t\t<xff> %0.10e </xff>\n", rrd.rra_def[i].par[RRA_cdp_xff_val].u_val);
-          break;
-       }
-       fprintf(out_file, "\t\t</params>\n");
-       fprintf(out_file, "\t\t<cdp_prep>\n");
-       for(ii=0;ii<rrd.stat_head->ds_cnt;ii++){
-               unsigned long ivalue;
-               fprintf(out_file, "\t\t\t<ds>\n");
-               /* support for exporting all CDP parameters */
-               /* parameters common to all CFs */
-                   /* primary_val and secondary_val do not need to be saved between updates
-                        * so strictly speaking they could be omitted.
-                        * However, they can be useful for diagnostic purposes, so are included here. */
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt
-                          +ii].scratch[CDP_primary_val].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<primary_value> NaN </primary_value>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<primary_value> %0.10e </primary_value>\n", value);
-                       }
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_secondary_val].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<secondary_value> NaN </secondary_value>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<secondary_value> %0.10e </secondary_value>\n", value);
-                       }
-               switch(cf_conv(rrd.rra_def[i].cf_nam)) {
-               case CF_HWPREDICT:
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_intercept].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<intercept> NaN </intercept>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<intercept> %0.10e </intercept>\n", value);
-                       }
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_intercept].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<last_intercept> NaN </last_intercept>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<last_intercept> %0.10e </last_intercept>\n", value);
-                       }
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_slope].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<slope> NaN </slope>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<slope> %0.10e </slope>\n", value);
-                       }
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_slope].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<last_slope> NaN </last_slope>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<last_slope> %0.10e </last_slope>\n", value);
-                       }
-                       ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_null_count].u_cnt;
-                       fprintf(out_file, "\t\t\t<nan_count> %lu </nan_count>\n", ivalue);
-                       ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_last_null_count].u_cnt;
-                       fprintf(out_file, "\t\t\t<last_nan_count> %lu </last_nan_count>\n", ivalue);
-                       break;
-               case CF_SEASONAL:
-               case CF_DEVSEASONAL:
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_seasonal].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<seasonal> NaN </seasonal>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<seasonal> %0.10e </seasonal>\n", value);
-                       }
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_last_seasonal].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<last_seasonal> NaN </last_seasonal>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<last_seasonal> %0.10e </last_seasonal>\n", value);
-                       }
-               ivalue = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_init_seasonal].u_cnt;
-                       fprintf(out_file, "\t\t\t<init_flag> %lu </init_flag>\n", ivalue);
-                       break;
-               case CF_DEVPREDICT:
-                       break;
-               case CF_FAILURES:
-                   {
-            unsigned short vidx;
-                       char *violations_array = (char *) ((void*) 
-                          rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch);
-                       fprintf(out_file, "\t\t\t<history> ");
-                       for (vidx = 0; vidx < rrd.rra_def[i].par[RRA_window_len].u_cnt; ++vidx)
-                       {
-                               fprintf(out_file, "%d",violations_array[vidx]);
-                       }
-                       fprintf(out_file, " </history>\n");
-                       }
-                       break;
-               case CF_AVERAGE:
-               case CF_MAXIMUM:
-               case CF_MINIMUM:
-               case CF_LAST:
-               default:
-               value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_val].u_val;
-                       if (isnan(value)) {
-                          fprintf(out_file, "\t\t\t<value> NaN </value>\n");
-                       } else {
-                          fprintf(out_file, "\t\t\t<value> %0.10e </value>\n", value);
-                       }
-                   fprintf(out_file, "\t\t\t<unknown_datapoints> %lu </unknown_datapoints>\n",
-                      rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_unkn_pdp_cnt].u_cnt);
-                       break;
-               }
-        fprintf(out_file, "\t\t\t</ds>\n");     
-    }
-       fprintf(out_file, "\t\t</cdp_prep>\n");
+    for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
+
+        long      timer = 0;
 
-       fprintf(out_file, "\t\t<database>\n");
-       rrd_seek(rrd_file,(rra_start
-                      +(rrd.rra_ptr[i].cur_row+1)
-                      * rrd.stat_head->ds_cnt
-                      * sizeof(rrd_value_t)),SEEK_SET);
-       timer = - (rrd.rra_def[i].row_cnt-1);
-       ii=rrd.rra_ptr[i].cur_row;
-       for(ix=0;ix<rrd.rra_def[i].row_cnt;ix++){           
-           ii++;
-           if (ii>=rrd.rra_def[i].row_cnt) {
-               rrd_seek(rrd_file,rra_start,SEEK_SET);
-               ii=0; /* wrap if max row cnt is reached */
-           }
-           now = (rrd.live_head->last_up 
-                  - rrd.live_head->last_up 
-                  % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step)) 
-               + (timer*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
+        rra_start = rra_next;
+        rra_next += (rrd.stat_head->ds_cnt
+                     * rrd.rra_def[i].row_cnt * sizeof(rrd_value_t));
+        fprintf(out_file, "\t<rra>\n");
+        fprintf(out_file, "\t\t<cf> %s </cf>\n", rrd.rra_def[i].cf_nam);
+        fprintf(out_file,
+                "\t\t<pdp_per_row> %lu </pdp_per_row> <!-- %lu seconds -->\n\n",
+                rrd.rra_def[i].pdp_cnt,
+                rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step);
+        /* support for RRA parameters */
+        fprintf(out_file, "\t\t<params>\n");
+        switch (cf_conv(rrd.rra_def[i].cf_nam)) {
+        case CF_HWPREDICT:
+            fprintf(out_file, "\t\t<hw_alpha> %0.10e </hw_alpha>\n",
+                    rrd.rra_def[i].par[RRA_hw_alpha].u_val);
+            fprintf(out_file, "\t\t<hw_beta> %0.10e </hw_beta>\n",
+                    rrd.rra_def[i].par[RRA_hw_beta].u_val);
+            fprintf(out_file,
+                    "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                    rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+            break;
+        case CF_SEASONAL:
+        case CF_DEVSEASONAL:
+            fprintf(out_file,
+                    "\t\t<seasonal_gamma> %0.10e </seasonal_gamma>\n",
+                    rrd.rra_def[i].par[RRA_seasonal_gamma].u_val);
+            fprintf(out_file,
+                    "\t\t<seasonal_smooth_idx> %lu </seasonal_smooth_idx>\n",
+                    rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+            fprintf(out_file,
+                    "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                    rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+            break;
+        case CF_FAILURES:
+            fprintf(out_file, "\t\t<delta_pos> %0.10e </delta_pos>\n",
+                    rrd.rra_def[i].par[RRA_delta_pos].u_val);
+            fprintf(out_file, "\t\t<delta_neg> %0.10e </delta_neg>\n",
+                    rrd.rra_def[i].par[RRA_delta_neg].u_val);
+            fprintf(out_file, "\t\t<window_len> %lu </window_len>\n",
+                    rrd.rra_def[i].par[RRA_window_len].u_cnt);
+            fprintf(out_file,
+                    "\t\t<failure_threshold> %lu </failure_threshold>\n",
+                    rrd.rra_def[i].par[RRA_failure_threshold].u_cnt);
+            /* fall thru */
+        case CF_DEVPREDICT:
+            fprintf(out_file,
+                    "\t\t<dependent_rra_idx> %lu </dependent_rra_idx>\n",
+                    rrd.rra_def[i].par[RRA_dependent_rra_idx].u_cnt);
+            break;
+        case CF_AVERAGE:
+        case CF_MAXIMUM:
+        case CF_MINIMUM:
+        case CF_LAST:
+        default:
+            fprintf(out_file, "\t\t<xff> %0.10e </xff>\n",
+                    rrd.rra_def[i].par[RRA_cdp_xff_val].u_val);
+            break;
+        }
+        fprintf(out_file, "\t\t</params>\n");
+        fprintf(out_file, "\t\t<cdp_prep>\n");
+        for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) {
+            unsigned long ivalue;
 
-           timer++;
+            fprintf(out_file, "\t\t\t<ds>\n");
+            /* support for exporting all CDP parameters */
+            /* parameters common to all CFs */
+            /* primary_val and secondary_val do not need to be saved between updates
+             * so strictly speaking they could be omitted.
+             * However, they can be useful for diagnostic purposes, so are included here. */
+            value = rrd.cdp_prep[i * rrd.stat_head->ds_cnt
+                                 + ii].scratch[CDP_primary_val].u_val;
+            if (isnan(value)) {
+                fprintf(out_file,
+                        "\t\t\t<primary_value> NaN </primary_value>\n");
+            } else {
+                fprintf(out_file,
+                        "\t\t\t<primary_value> %0.10e </primary_value>\n",
+                        value);
+            }
+            value =
+                rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                             ii].scratch[CDP_secondary_val].u_val;
+            if (isnan(value)) {
+                fprintf(out_file,
+                        "\t\t\t<secondary_value> NaN </secondary_value>\n");
+            } else {
+                fprintf(out_file,
+                        "\t\t\t<secondary_value> %0.10e </secondary_value>\n",
+                        value);
+            }
+            switch (cf_conv(rrd.rra_def[i].cf_nam)) {
+            case CF_HWPREDICT:
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_intercept].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file, "\t\t\t<intercept> NaN </intercept>\n");
+                } else {
+                    fprintf(out_file,
+                            "\t\t\t<intercept> %0.10e </intercept>\n", value);
+                }
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_last_intercept].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file,
+                            "\t\t\t<last_intercept> NaN </last_intercept>\n");
+                } else {
+                    fprintf(out_file,
+                            "\t\t\t<last_intercept> %0.10e </last_intercept>\n",
+                            value);
+                }
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_slope].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file, "\t\t\t<slope> NaN </slope>\n");
+                } else {
+                    fprintf(out_file, "\t\t\t<slope> %0.10e </slope>\n",
+                            value);
+                }
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_last_slope].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file,
+                            "\t\t\t<last_slope> NaN </last_slope>\n");
+                } else {
+                    fprintf(out_file,
+                            "\t\t\t<last_slope> %0.10e </last_slope>\n",
+                            value);
+                }
+                ivalue =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_null_count].u_cnt;
+                fprintf(out_file, "\t\t\t<nan_count> %lu </nan_count>\n",
+                        ivalue);
+                ivalue =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_last_null_count].u_cnt;
+                fprintf(out_file,
+                        "\t\t\t<last_nan_count> %lu </last_nan_count>\n",
+                        ivalue);
+                break;
+            case CF_SEASONAL:
+            case CF_DEVSEASONAL:
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_seasonal].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file, "\t\t\t<seasonal> NaN </seasonal>\n");
+                } else {
+                    fprintf(out_file, "\t\t\t<seasonal> %0.10e </seasonal>\n",
+                            value);
+                }
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_last_seasonal].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file,
+                            "\t\t\t<last_seasonal> NaN </last_seasonal>\n");
+                } else {
+                    fprintf(out_file,
+                            "\t\t\t<last_seasonal> %0.10e </last_seasonal>\n",
+                            value);
+                }
+                ivalue =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_init_seasonal].u_cnt;
+                fprintf(out_file, "\t\t\t<init_flag> %lu </init_flag>\n",
+                        ivalue);
+                break;
+            case CF_DEVPREDICT:
+                break;
+            case CF_FAILURES:
+            {
+                unsigned short vidx;
+                char     *violations_array = (char *) ((void *)
+                                                       rrd.cdp_prep[i *
+                                                                    rrd.
+                                                                    stat_head->
+                                                                    ds_cnt +
+                                                                    ii].
+                                                       scratch);
+                fprintf(out_file, "\t\t\t<history> ");
+                for (vidx = 0;
+                     vidx < rrd.rra_def[i].par[RRA_window_len].u_cnt;
+                     ++vidx) {
+                    fprintf(out_file, "%d", violations_array[vidx]);
+                }
+                fprintf(out_file, " </history>\n");
+            }
+                break;
+            case CF_AVERAGE:
+            case CF_MAXIMUM:
+            case CF_MINIMUM:
+            case CF_LAST:
+            default:
+                value =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_val].u_val;
+                if (isnan(value)) {
+                    fprintf(out_file, "\t\t\t<value> NaN </value>\n");
+                } else {
+                    fprintf(out_file, "\t\t\t<value> %0.10e </value>\n",
+                            value);
+                }
+                fprintf(out_file,
+                        "\t\t\t<unknown_datapoints> %lu </unknown_datapoints>\n",
+                        rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                     ii].scratch[CDP_unkn_pdp_cnt].u_cnt);
+                break;
+            }
+            fprintf(out_file, "\t\t\t</ds>\n");
+        }
+        fprintf(out_file, "\t\t</cdp_prep>\n");
+
+        fprintf(out_file, "\t\t<database>\n");
+        rrd_seek(rrd_file, (rra_start + (rrd.rra_ptr[i].cur_row + 1)
+                            * rrd.stat_head->ds_cnt
+                            * sizeof(rrd_value_t)), SEEK_SET);
+        timer = -(rrd.rra_def[i].row_cnt - 1);
+        ii = rrd.rra_ptr[i].cur_row;
+        for (ix = 0; ix < rrd.rra_def[i].row_cnt; ix++) {
+            ii++;
+            if (ii >= rrd.rra_def[i].row_cnt) {
+                rrd_seek(rrd_file, rra_start, SEEK_SET);
+                ii = 0; /* wrap if max row cnt is reached */
+            }
+            now = (rrd.live_head->last_up
+                   - rrd.live_head->last_up
+                   % (rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step))
+                + (timer * rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step);
+
+            timer++;
 #if HAVE_STRFTIME
-           localtime_r(&now, &tm);
-           strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z", &tm);
+            localtime_r(&now, &tm);
+            strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z", &tm);
 #else
 # error "Need strftime"
 #endif
-           fprintf(out_file, "\t\t\t<!-- %s / %d --> <row>",somestring,(int)now);
-           for(iii=0;iii<rrd.stat_head->ds_cnt;iii++){
-               rrd_read(rrd_file, &my_cdp,sizeof(rrd_value_t)*1);
-               if (isnan(my_cdp)){
-                 fprintf(out_file, "<v> NaN </v>");
-               } else {
-                 fprintf(out_file, "<v> %0.10e </v>",my_cdp);
-               };
-           }
-           fprintf(out_file, "</row>\n");
-       }
-       fprintf(out_file, "\t\t</database>\n\t</rra>\n");
+            fprintf(out_file, "\t\t\t<!-- %s / %d --> <row>", somestring,
+                    (int) now);
+            for (iii = 0; iii < rrd.stat_head->ds_cnt; iii++) {
+                rrd_read(rrd_file, &my_cdp, sizeof(rrd_value_t) * 1);
+                if (isnan(my_cdp)) {
+                    fprintf(out_file, "<v> NaN </v>");
+                } else {
+                    fprintf(out_file, "<v> %0.10e </v>", my_cdp);
+                };
+            }
+            fprintf(out_file, "</row>\n");
+        }
+        fprintf(out_file, "\t\t</database>\n\t</rra>\n");
 
     }
     fprintf(out_file, "</rrd>\n");
     rrd_free(&rrd);
     close(rrd_file->fd);
-    if (out_file != stdout)
-    {
-      fclose(out_file);
+    if (out_file != stdout) {
+        fclose(out_file);
     }
-    return(0);
+    return (0);
 }
-
index 9f46a62..74055eb 100644 (file)
 #define ERRBUFLEN 256
 #define CTX (rrd_get_context())
 
-void
-rrd_set_error(char *fmt, ...)
+void rrd_set_error(
+    char *fmt,
+    ...)
 {
-    va_list argp;
+    va_list   argp;
+
     rrd_clear_error();
     va_start(argp, fmt);
 #ifdef HAVE_VSNPRINTF
@@ -51,18 +53,21 @@ rrd_set_error(char *fmt, ...)
     va_end(argp);
 }
 
-int
-rrd_test_error(void) {
+int rrd_test_error(
+    void)
+{
     return CTX->rrd_error[0] != '\0';
 }
 
-void
-rrd_clear_error(void){
+void rrd_clear_error(
+    void)
+{
     CTX->rrd_error[0] = '\0';
 }
 
-char *
-rrd_get_error(void){
+char     *rrd_get_error(
+    void)
+{
     return CTX->rrd_error;
 }
 
@@ -72,74 +77,88 @@ rrd_get_error(void){
    operations on them... Then a single thread may use more than one
    context. Using these functions would require to change each and
    every function containing any of the non _r versions... */
-void
-rrd_set_error_r(struct rrd_context *rrd_ctx, char *fmt, ...)
+void rrd_set_error_r(
+    struct rrd_context *rrd_ctx,
+    char *fmt,
+    ...)
 {
-    va_list argp;
+    va_list   argp;
+
     rrd_clear_error_r(rrd_ctx);
     va_start(argp, fmt);
 #ifdef HAVE_VSNPRINTF
-    vsnprintf((char *)rrd_ctx->rrd_error, rrd_ctx->len, fmt, argp);
-    rrd_ctx->rrd_error[rrd_ctx->len]='\0';
+    vsnprintf((char *) rrd_ctx->rrd_error, rrd_ctx->len, fmt, argp);
+    rrd_ctx->rrd_error[rrd_ctx->len] = '\0';
 #else
-    vsprintf((char *)rrd_ctx->rrd_error, fmt, argp);
+    vsprintf((char *) rrd_ctx->rrd_error, fmt, argp);
 #endif
     va_end(argp);
 }
 
-int
-rrd_test_error_r(struct rrd_context *rrd_ctx) {
+int rrd_test_error_r(
+    struct rrd_context *rrd_ctx)
+{
     return rrd_ctx->rrd_error[0] != '\0';
 }
 
-void
-rrd_clear_error_r(struct rrd_context *rrd_ctx) {
+void rrd_clear_error_r(
+    struct rrd_context *rrd_ctx)
+{
     rrd_ctx->rrd_error[0] = '\0';
 }
 
-char *
-rrd_get_error_r(struct rrd_context *rrd_ctx) {
-    return (char *)rrd_ctx->rrd_error;
+char     *rrd_get_error_r(
+    struct rrd_context *rrd_ctx)
+{
+    return (char *) rrd_ctx->rrd_error;
 }
 #endif
 
 /* PS: Should we move this to some other file? It is not really error
    related. */
-struct rrd_context *
-rrd_new_context(void) {
-    struct rrd_context *rrd_ctx = 
-       (struct rrd_context *) malloc(sizeof(struct rrd_context));
+struct rrd_context *rrd_new_context(
+    void)
+{
+    struct rrd_context *rrd_ctx =
+        (struct rrd_context *) malloc(sizeof(struct rrd_context));
 
     if (rrd_ctx) {
-       rrd_ctx->rrd_error = malloc(MAXLEN+10);
-       rrd_ctx->lib_errstr = malloc(ERRBUFLEN+10);
-       if (rrd_ctx->rrd_error && rrd_ctx->lib_errstr) {
-           *rrd_ctx->rrd_error = 0;
-           *rrd_ctx->lib_errstr = 0;
-           rrd_ctx->len = MAXLEN;
-           rrd_ctx->errlen = ERRBUFLEN;
-           return rrd_ctx;
-       }
-       if (rrd_ctx->rrd_error) free(rrd_ctx->rrd_error);
-       if (rrd_ctx->lib_errstr) free(rrd_ctx->lib_errstr);
-       free(rrd_ctx);
+        rrd_ctx->rrd_error = malloc(MAXLEN + 10);
+        rrd_ctx->lib_errstr = malloc(ERRBUFLEN + 10);
+        if (rrd_ctx->rrd_error && rrd_ctx->lib_errstr) {
+            *rrd_ctx->rrd_error = 0;
+            *rrd_ctx->lib_errstr = 0;
+            rrd_ctx->len = MAXLEN;
+            rrd_ctx->errlen = ERRBUFLEN;
+            return rrd_ctx;
+        }
+        if (rrd_ctx->rrd_error)
+            free(rrd_ctx->rrd_error);
+        if (rrd_ctx->lib_errstr)
+            free(rrd_ctx->lib_errstr);
+        free(rrd_ctx);
     }
     return NULL;
 }
 
-void
-rrd_free_context(struct rrd_context *rrd_ctx) {
+void rrd_free_context(
+    struct rrd_context *rrd_ctx)
+{
     if (rrd_ctx) {
-       if (rrd_ctx->rrd_error) free(rrd_ctx->rrd_error);
-       if (rrd_ctx->lib_errstr) free(rrd_ctx->lib_errstr);
-       free(rrd_ctx);
+        if (rrd_ctx->rrd_error)
+            free(rrd_ctx->rrd_error);
+        if (rrd_ctx->lib_errstr)
+            free(rrd_ctx->lib_errstr);
+        free(rrd_ctx);
     }
 }
 
 #if 0
-void rrd_globalize_error(struct rrd_context *rrd_ctx) {
+void rrd_globalize_error(
+    struct rrd_context *rrd_ctx)
+{
     if (rrd_ctx) {
-       rrd_set_error(rrd_ctx->rrd_error);
+        rrd_set_error(rrd_ctx->rrd_error);
     }
 }
 #endif
index 4b0f2b5..42ddceb 100644 (file)
 #include "rrd_is_thread_safe.h"
 /*#define DEBUG*/
 
-int
-rrd_fetch(int argc, 
-         char **argv,
-         time_t         *start,
-         time_t         *end,       /* which time frame do you want ?
-                                     * will be changed to represent reality */
-         unsigned long  *step,      /* which stepsize do you want? 
-                                     * will be changed to represent reality */
-         unsigned long  *ds_cnt,    /* number of data sources in file */
-         char           ***ds_namv,   /* names of data sources */
-         rrd_value_t    **data)     /* two dimensional array containing the data */
-{
-
-
-    long     step_tmp =1;
-    time_t   start_tmp=0, end_tmp=0;
+int rrd_fetch(
+    int argc,
+    char **argv,
+    time_t *start,
+    time_t *end,        /* which time frame do you want ?
+                         * will be changed to represent reality */
+    unsigned long *step,    /* which stepsize do you want? 
+                             * will be changed to represent reality */
+    unsigned long *ds_cnt,  /* number of data sources in file */
+    char ***ds_namv,    /* names of data sources */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
+
+
+    long      step_tmp = 1;
+    time_t    start_tmp = 0, end_tmp = 0;
     const char *cf;
 
     struct rrd_time_value start_tv, end_tv;
     char     *parsetime_error = NULL;
-    optind = 0; opterr = 0;  /* initialize getopt */
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
     /* init start and end time */
     parsetime("end-24h", &start_tv);
     parsetime("now", &end_tv);
 
-    while (1){
-       static struct option long_options[] =
-       {
-           {"resolution",      required_argument, 0, 'r'},
-           {"start",      required_argument, 0, 's'},
-           {"end",      required_argument, 0, 'e'},
-           {0,0,0,0}
-       };
-       int option_index = 0;
-       int opt;
-       opt = getopt_long(argc, argv, "r:s:e:", 
-                         long_options, &option_index);
-
-       if (opt == EOF)
-           break;
-
-       switch(opt) {
-       case 's':
+    while (1) {
+        static struct option long_options[] = {
+            {"resolution", required_argument, 0, 'r'},
+            {"start", required_argument, 0, 's'},
+            {"end", required_argument, 0, 'e'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "r:s:e:", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 's':
             if ((parsetime_error = parsetime(optarg, &start_tv))) {
-                rrd_set_error( "start time: %s", parsetime_error );
+                rrd_set_error("start time: %s", parsetime_error);
                 return -1;
-           }
-           break;
-       case 'e':
+            }
+            break;
+        case 'e':
             if ((parsetime_error = parsetime(optarg, &end_tv))) {
-                rrd_set_error( "end time: %s", parsetime_error );
+                rrd_set_error("end time: %s", parsetime_error);
                 return -1;
-           }
-           break;
-       case 'r':
-           step_tmp = atol(optarg);
-           break;
-       case '?':
-           rrd_set_error("unknown option '-%c'",optopt);
-           return(-1);
-       }
+            }
+            break;
+        case 'r':
+            step_tmp = atol(optarg);
+            break;
+        case '?':
+            rrd_set_error("unknown option '-%c'", optopt);
+            return (-1);
+        }
+    }
+
+
+    if (proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+        return -1;
     }
 
-    
-    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
-       return -1;
-    }  
 
-    
-    if (start_tmp < 3600*24*365*10){
-       rrd_set_error("the first entry to fetch should be after 1980");
-       return(-1);
+    if (start_tmp < 3600 * 24 * 365 * 10) {
+        rrd_set_error("the first entry to fetch should be after 1980");
+        return (-1);
     }
-    
+
     if (end_tmp < start_tmp) {
-       rrd_set_error("start (%ld) should be less than end (%ld)", start_tmp, end_tmp);
-       return(-1);
+        rrd_set_error("start (%ld) should be less than end (%ld)", start_tmp,
+                      end_tmp);
+        return (-1);
     }
-    
+
     *start = start_tmp;
     *end = end_tmp;
 
     if (step_tmp < 1) {
-       rrd_set_error("step must be >= 1 second");
-       return -1;
+        rrd_set_error("step must be >= 1 second");
+        return -1;
     }
     *step = step_tmp;
-    
-    if (optind + 1 >= argc){
-       rrd_set_error("not enough arguments");
-       return -1;
+
+    if (optind + 1 >= argc) {
+        rrd_set_error("not enough arguments");
+        return -1;
     }
 
-    cf = argv[optind+1];
+    cf = argv[optind + 1];
 
-    if (rrd_fetch_r(argv[optind],cf,start,end,step,ds_cnt,ds_namv,data) == -1)
-       return(-1);
+    if (rrd_fetch_r(argv[optind], cf, start, end, step, ds_cnt, ds_namv, data)
+        == -1)
+        return (-1);
     return (0);
 }
 
-int
-rrd_fetch_r(
-    const char           *filename,  /* name of the rrd */
-    const char           *cf,        /* which consolidation function ?*/
-    time_t         *start,
-    time_t         *end,       /* which time frame do you want ?
-                                * will be changed to represent reality */
-    unsigned long  *step,      /* which stepsize do you want? 
-                                * will be changed to represent reality */
-    unsigned long  *ds_cnt,    /* number of data sources in file */
-    char           ***ds_namv, /* names of data_sources */
-    rrd_value_t    **data)     /* two dimensional array containing the data */
-{
-    enum     cf_en cf_idx;
-
-    if ((int)(cf_idx=cf_conv(cf)) == -1 ){
+int rrd_fetch_r(
+    const char *filename,   /* name of the rrd */
+    const char *cf,     /* which consolidation function ? */
+    time_t *start,
+    time_t *end,        /* which time frame do you want ?
+                         * will be changed to represent reality */
+    unsigned long *step,    /* which stepsize do you want? 
+                             * will be changed to represent reality */
+    unsigned long *ds_cnt,  /* number of data sources in file */
+    char ***ds_namv,    /* names of data_sources */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
+    enum cf_en cf_idx;
+
+    if ((int) (cf_idx = cf_conv(cf)) == -1) {
         return -1;
     }
 
-    return (rrd_fetch_fn(filename,cf_idx,start,end,step,ds_cnt,ds_namv,data));
+    return (rrd_fetch_fn
+            (filename, cf_idx, start, end, step, ds_cnt, ds_namv, data));
 }
 
-int
-rrd_fetch_fn(
-    const char     *filename,  /* name of the rrd */
-    enum cf_en     cf_idx,         /* which consolidation function ?*/
-    time_t         *start,
-    time_t         *end,       /* which time frame do you want ?
-                               * will be changed to represent reality */
-    unsigned long  *step,      /* which stepsize do you want? 
-                               * will be changed to represent reality */
-    unsigned long  *ds_cnt,    /* number of data sources in file */
-    char           ***ds_namv,   /* names of data_sources */
-    rrd_value_t    **data)     /* two dimensional array containing the data */
-{
-    long           i,ii;
-    time_t         cal_start,cal_end, rra_start_time,rra_end_time;
-    long  best_full_rra=0, best_part_rra=0, chosen_rra=0, rra_pointer=0;
-    long  best_full_step_diff=0, best_part_step_diff=0, tmp_step_diff=0, tmp_match=0, best_match=0;
-    long  full_match, rra_base;
-    long           start_offset, end_offset;
-    int            first_full = 1;
-    int            first_part = 1;
+int rrd_fetch_fn(
+    const char *filename,   /* name of the rrd */
+    enum cf_en cf_idx,  /* which consolidation function ? */
+    time_t *start,
+    time_t *end,        /* which time frame do you want ?
+                         * will be changed to represent reality */
+    unsigned long *step,    /* which stepsize do you want? 
+                             * will be changed to represent reality */
+    unsigned long *ds_cnt,  /* number of data sources in file */
+    char ***ds_namv,    /* names of data_sources */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
+    long      i, ii;
+    time_t    cal_start, cal_end, rra_start_time, rra_end_time;
+    long      best_full_rra = 0, best_part_rra = 0, chosen_rra =
+        0, rra_pointer = 0;
+    long      best_full_step_diff = 0, best_part_step_diff =
+        0, tmp_step_diff = 0, tmp_match = 0, best_match = 0;
+    long      full_match, rra_base;
+    long      start_offset, end_offset;
+    int       first_full = 1;
+    int       first_part = 1;
     rrd_t     rrd;
-    rrd_file_t     *rrd_file;
-    rrd_value_t    *data_ptr;
-    unsigned long  rows;
+    rrd_file_t *rrd_file;
+    rrd_value_t *data_ptr;
+    unsigned long rows;
+
 #ifdef HAVE_POSIX_FADVISE
-    long  rrd_head_size;
+    long      rrd_head_size;
 #endif
 
 #ifdef DEBUG
-fprintf(stderr,"Entered rrd_fetch_fn() searching for the best match\n");
-fprintf(stderr,"Looking for: start %10lu end %10lu step %5lu\n",
-                                               *start,*end,*step);
+    fprintf(stderr, "Entered rrd_fetch_fn() searching for the best match\n");
+    fprintf(stderr, "Looking for: start %10lu end %10lu step %5lu\n",
+            *start, *end, *step);
 #endif
 
-    rrd_file = rrd_open(filename,&rrd, RRD_READONLY);
+    rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL)
-       return(-1);
+        return (-1);
 
 #ifdef HAVE_POSIX_FADVISE
     rrd_head_size = rrd_file->header_len;
 #endif
     /* when was the really last update of this file ? */
 
-    if (((*ds_namv) = (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
-       rrd_set_error("malloc fetch ds_namv array");
-       rrd_free(&rrd);
-       close(rrd_file->fd);
-       return(-1);
+    if (((*ds_namv) =
+         (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
+        rrd_set_error("malloc fetch ds_namv array");
+        rrd_free(&rrd);
+        close(rrd_file->fd);
+        return (-1);
     }
-    
-    for(i=0;(unsigned long)i<rrd.stat_head->ds_cnt;i++){
-       if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE))==NULL){
-           rrd_set_error("malloc fetch ds_namv entry");
-           rrd_free(&rrd);
-           free(*ds_namv);
-           close(rrd_file->fd);
-           return(-1);
-       }
-       strncpy((*ds_namv)[i],rrd.ds_def[i].ds_nam,DS_NAM_SIZE-1);
-       (*ds_namv)[i][DS_NAM_SIZE-1]='\0';
+
+    for (i = 0; (unsigned long) i < rrd.stat_head->ds_cnt; i++) {
+        if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE)) == NULL) {
+            rrd_set_error("malloc fetch ds_namv entry");
+            rrd_free(&rrd);
+            free(*ds_namv);
+            close(rrd_file->fd);
+            return (-1);
+        }
+        strncpy((*ds_namv)[i], rrd.ds_def[i].ds_nam, DS_NAM_SIZE - 1);
+        (*ds_namv)[i][DS_NAM_SIZE - 1] = '\0';
 
     }
-    
+
     /* find the rra which best matches the requirements */
-    for(i=0;(unsigned)i<rrd.stat_head->rra_cnt;i++){
-       if(cf_conv(rrd.rra_def[i].cf_nam) == cf_idx){
-           
-           cal_end = (rrd.live_head->last_up - (rrd.live_head->last_up 
-                         % (rrd.rra_def[i].pdp_cnt 
-                            * rrd.stat_head->pdp_step)));
-           cal_start = (cal_end 
-                        - (rrd.rra_def[i].pdp_cnt 
-                           * rrd.rra_def[i].row_cnt
-                           * rrd.stat_head->pdp_step));
-
-           full_match = *end -*start;
+    for (i = 0; (unsigned) i < rrd.stat_head->rra_cnt; i++) {
+        if (cf_conv(rrd.rra_def[i].cf_nam) == cf_idx) {
+
+            cal_end = (rrd.live_head->last_up - (rrd.live_head->last_up
+                                                 % (rrd.rra_def[i].pdp_cnt
+                                                    *
+                                                    rrd.stat_head->
+                                                    pdp_step)));
+            cal_start =
+                (cal_end -
+                 (rrd.rra_def[i].pdp_cnt * rrd.rra_def[i].row_cnt *
+                  rrd.stat_head->pdp_step));
+
+            full_match = *end - *start;
 #ifdef DEBUG
-fprintf(stderr,"Considering: start %10lu end %10lu step %5lu ",
-                                                       cal_start,cal_end,
-                       rrd.stat_head->pdp_step * rrd.rra_def[i].pdp_cnt);
+            fprintf(stderr, "Considering: start %10lu end %10lu step %5lu ",
+                    cal_start, cal_end,
+                    rrd.stat_head->pdp_step * rrd.rra_def[i].pdp_cnt);
 #endif
-           /* we need step difference in either full or partial case */
-           tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
-                                          * rrd.rra_def[i].pdp_cnt));
-           /* best full match */
-           if(cal_end >= *end 
-              && cal_start <= *start){
-               if (first_full || (tmp_step_diff < best_full_step_diff)){
-                   first_full=0;
-                   best_full_step_diff = tmp_step_diff;
-                   best_full_rra=i;
+            /* we need step difference in either full or partial case */
+            tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
+                                          * rrd.rra_def[i].pdp_cnt));
+            /* best full match */
+            if (cal_end >= *end && cal_start <= *start) {
+                if (first_full || (tmp_step_diff < best_full_step_diff)) {
+                    first_full = 0;
+                    best_full_step_diff = tmp_step_diff;
+                    best_full_rra = i;
 #ifdef DEBUG
-fprintf(stderr,"best full match so far\n");
+                    fprintf(stderr, "best full match so far\n");
 #endif
-               } else {
+                } else {
 #ifdef DEBUG
-fprintf(stderr,"full match, not best\n");
+                    fprintf(stderr, "full match, not best\n");
 #endif
-               }
-               
-           } else {
-               /* best partial match */
-               tmp_match = full_match;
-               if (cal_start>*start)
-                   tmp_match -= (cal_start-*start);
-               if (cal_end<*end)
-                   tmp_match -= (*end-cal_end);                
-               if (first_part ||
+                }
+
+            } else {
+                /* best partial match */
+                tmp_match = full_match;
+                if (cal_start > *start)
+                    tmp_match -= (cal_start - *start);
+                if (cal_end < *end)
+                    tmp_match -= (*end - cal_end);
+                if (first_part ||
                     (best_match < tmp_match) ||
-                    (best_match == tmp_match && 
-                     tmp_step_diff < best_part_step_diff))
+                    (best_match == tmp_match &&
+                     tmp_step_diff < best_part_step_diff)) {
 #ifdef DEBUG
-fprintf(stderr,"best partial so far\n");
+                    fprintf(stderr, "best partial so far\n");
 #endif
-                   first_part=0;
-                   best_match = tmp_match;
-                   best_part_step_diff = tmp_step_diff;
-                   best_part_rra =i;
-               } else {
+                    first_part = 0;
+                    best_match = tmp_match;
+                    best_part_step_diff = tmp_step_diff;
+                    best_part_rra = i;
+                } else {
 #ifdef DEBUG
-fprintf(stderr,"partial match, not best\n");
+                    fprintf(stderr, "partial match, not best\n");
 #endif
-               }
-           }
-       }
+                }
+            }
+        }
     }
 
     /* lets see how the matching went. */
-    if (first_full==0)
-       chosen_rra = best_full_rra;
-    else if (first_part==0)
-       chosen_rra = best_part_rra;
+    if (first_full == 0)
+        chosen_rra = best_full_rra;
+    else if (first_part == 0)
+        chosen_rra = best_part_rra;
     else {
-       rrd_set_error("the RRD does not contain an RRA matching the chosen CF");
-       rrd_free(&rrd);
-       close(rrd_file->fd);
-       return(-1);
+        rrd_set_error
+            ("the RRD does not contain an RRA matching the chosen CF");
+        rrd_free(&rrd);
+        close(rrd_file->fd);
+        return (-1);
     }
-       
+
     /* set the wish parameters to their real values */
     *step = rrd.stat_head->pdp_step * rrd.rra_def[chosen_rra].pdp_cnt;
     *start -= (*start % *step);
@@ -327,8 +335,9 @@ fprintf(stderr,"partial match, not best\n");
     rows = (*end - *start) / *step + 1;
 
 #ifdef DEBUG
-    fprintf(stderr,"We found:    start %10lu end %10lu step %5lu rows  %lu\n",
-                                               *start,*end,*step,rows);
+    fprintf(stderr,
+            "We found:    start %10lu end %10lu step %5lu rows  %lu\n",
+            *start, *end, *step, rows);
 #endif
 
 /* Start and end are now multiples of the step size.  The amount of
@@ -337,161 +346,165 @@ fprintf(stderr,"partial match, not best\n");
 ** we need exactly ((t+s)-t)/s rows.  The row to collect from the
 ** database is the one with time stamp (t+s) which means t to t+s.
 */
-    *ds_cnt =   rrd.stat_head->ds_cnt; 
-    if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t)))==NULL){
-       rrd_set_error("malloc fetch data area");
-       for (i=0;(unsigned long)i<*ds_cnt;i++)
-             free((*ds_namv)[i]);
-       free(*ds_namv);
-       rrd_free(&rrd);
-       close(rrd_file->fd);
-       return(-1);
+    *ds_cnt = rrd.stat_head->ds_cnt;
+    if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t))) == NULL) {
+        rrd_set_error("malloc fetch data area");
+        for (i = 0; (unsigned long) i < *ds_cnt; i++)
+            free((*ds_namv)[i]);
+        free(*ds_namv);
+        rrd_free(&rrd);
+        close(rrd_file->fd);
+        return (-1);
     }
-    
-    data_ptr=(*data);
-    
+
+    data_ptr = (*data);
+
     /* find base address of rra */
     rra_base = rrd_file->header_len;
-    for(i=0;i<chosen_rra;i++)
-       rra_base += ( *ds_cnt
-                     * rrd.rra_def[i].row_cnt
-                     * sizeof(rrd_value_t));
+    for (i = 0; i < chosen_rra; i++)
+        rra_base += (*ds_cnt * rrd.rra_def[i].row_cnt * sizeof(rrd_value_t));
 
     /* find start and end offset */
-    rra_end_time = (rrd.live_head->last_up 
-                   - (rrd.live_head->last_up % *step));
+    rra_end_time = (rrd.live_head->last_up
+                    - (rrd.live_head->last_up % *step));
     rra_start_time = (rra_end_time
-                - ( *step * (rrd.rra_def[chosen_rra].row_cnt-1)));
+                      - (*step * (rrd.rra_def[chosen_rra].row_cnt - 1)));
     /* here's an error by one if we don't be careful */
-    start_offset =(long)(*start + *step - rra_start_time) / (long)*step;
-    end_offset = (long)(rra_end_time - *end ) / (long)*step; 
+    start_offset = (long) (*start + *step - rra_start_time) / (long) *step;
+    end_offset = (long) (rra_end_time - *end) / (long) *step;
 #ifdef DEBUG
-    fprintf(stderr,"rra_start %lu, rra_end %lu, start_off %li, end_off %li\n",
-           rra_start_time,rra_end_time,start_offset,end_offset);
+    fprintf(stderr,
+            "rra_start %lu, rra_end %lu, start_off %li, end_off %li\n",
+            rra_start_time, rra_end_time, start_offset, end_offset);
 #endif
 
     /* fill the gap at the start if needs be */
 
     if (start_offset <= 0)
-       rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1;
-    else 
-       rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1+start_offset;
-    
-    if(rrd_seek(rrd_file,(rra_base 
-                  + (rra_pointer
-                     * *ds_cnt
-                     * sizeof(rrd_value_t))),SEEK_SET) != 0){
-       rrd_set_error("seek error in RRA");
-       for (i=0;(unsigned)i<*ds_cnt;i++)
-             free((*ds_namv)[i]);
-       free(*ds_namv);
-       rrd_free(&rrd);
-       free(*data);
-       *data = NULL;
-       close(rrd_file->fd);
-       return(-1);
+        rra_pointer = rrd.rra_ptr[chosen_rra].cur_row + 1;
+    else
+        rra_pointer = rrd.rra_ptr[chosen_rra].cur_row + 1 + start_offset;
+
+    if (rrd_seek(rrd_file, (rra_base
+                            + (rra_pointer
+                               * *ds_cnt
+                               * sizeof(rrd_value_t))), SEEK_SET) != 0) {
+        rrd_set_error("seek error in RRA");
+        for (i = 0; (unsigned) i < *ds_cnt; i++)
+            free((*ds_namv)[i]);
+        free(*ds_namv);
+        rrd_free(&rrd);
+        free(*data);
+        *data = NULL;
+        close(rrd_file->fd);
+        return (-1);
 
     }
 #ifdef DEBUG
-    fprintf(stderr,"First Seek: rra_base %lu rra_pointer %lu\n",
-           rra_base, rra_pointer);
+    fprintf(stderr, "First Seek: rra_base %lu rra_pointer %lu\n",
+            rra_base, rra_pointer);
 #endif
     /* step trough the array */
 
-    for (i=start_offset;
-        i< (signed)rrd.rra_def[chosen_rra].row_cnt - end_offset;
-        i++){
-       /* no valid data yet */
-       if (i<0) {
+    for (i = start_offset;
+         i < (signed) rrd.rra_def[chosen_rra].row_cnt - end_offset; i++) {
+        /* no valid data yet */
+        if (i < 0) {
 #ifdef DEBUG
-           fprintf(stderr,"pre fetch %li -- ",i);
+            fprintf(stderr, "pre fetch %li -- ", i);
 #endif
-           for(ii=0;(unsigned)ii<*ds_cnt;ii++){
-               *(data_ptr++) = DNAN;
+            for (ii = 0; (unsigned) ii < *ds_cnt; ii++) {
+                *(data_ptr++) = DNAN;
 #ifdef DEBUG
-               fprintf(stderr,"%10.2f ",*(data_ptr-1));
+                fprintf(stderr, "%10.2f ", *(data_ptr - 1));
 #endif
-           }
-       } 
-       /* past the valid data area */
-       else if (i >= (signed)rrd.rra_def[chosen_rra].row_cnt) {
+            }
+        }
+        /* past the valid data area */
+        else if (i >= (signed) rrd.rra_def[chosen_rra].row_cnt) {
 #ifdef DEBUG
-           fprintf(stderr,"post fetch %li -- ",i);
+            fprintf(stderr, "post fetch %li -- ", i);
 #endif
-           for(ii=0;(unsigned)ii<*ds_cnt;ii++){
-               *(data_ptr++) = DNAN;
+            for (ii = 0; (unsigned) ii < *ds_cnt; ii++) {
+                *(data_ptr++) = DNAN;
 #ifdef DEBUG
-               fprintf(stderr,"%10.2f ",*(data_ptr-1));
+                fprintf(stderr, "%10.2f ", *(data_ptr - 1));
 #endif
-           }
-       } else {
-           /* OK we are inside the valid area but the pointer has to 
-            * be wrapped*/
-           if (rra_pointer >= (signed)rrd.rra_def[chosen_rra].row_cnt) {
-               rra_pointer -= rrd.rra_def[chosen_rra].row_cnt;
-               if(rrd_seek(rrd_file,(rra_base+rra_pointer
-                              * *ds_cnt
-                              * sizeof(rrd_value_t)),SEEK_SET) != 0){
-                   rrd_set_error("wrap seek in RRA did fail");
-                   for (ii=0;(unsigned)ii<*ds_cnt;ii++)
-                       free((*ds_namv)[ii]);
-                   free(*ds_namv);
-                   rrd_free(&rrd);
-                   free(*data);
-                   *data = NULL;
-                   close(rrd_file->fd);
-                   return(-1);
-               }
+            }
+        } else {
+            /* OK we are inside the valid area but the pointer has to 
+             * be wrapped*/
+            if (rra_pointer >= (signed) rrd.rra_def[chosen_rra].row_cnt) {
+                rra_pointer -= rrd.rra_def[chosen_rra].row_cnt;
+                if (rrd_seek(rrd_file, (rra_base + rra_pointer
+                                        * *ds_cnt
+                                        * sizeof(rrd_value_t)),
+                             SEEK_SET) != 0) {
+                    rrd_set_error("wrap seek in RRA did fail");
+                    for (ii = 0; (unsigned) ii < *ds_cnt; ii++)
+                        free((*ds_namv)[ii]);
+                    free(*ds_namv);
+                    rrd_free(&rrd);
+                    free(*data);
+                    *data = NULL;
+                    close(rrd_file->fd);
+                    return (-1);
+                }
 #ifdef DEBUG
-               fprintf(stderr,"wrap seek ...\n");
+                fprintf(stderr, "wrap seek ...\n");
 #endif
-           }
-
-           if(rrd_read(rrd_file,data_ptr,
-                    sizeof(rrd_value_t)* (*ds_cnt))
-                   != (ssize_t)(sizeof(rrd_value_t)*(*ds_cnt)*rrd.stat_head->ds_cnt)){
-               rrd_set_error("fetching cdp from rra");
-               for (ii=0;(unsigned)ii<*ds_cnt;ii++)
-                   free((*ds_namv)[ii]);
-               free(*ds_namv);
-               rrd_free(&rrd);
-               free(*data);
-               *data = NULL;
-               close(rrd_file->fd);
-               return(-1);
-           }
+            }
+
+            if (rrd_read(rrd_file, data_ptr, sizeof(rrd_value_t) * (*ds_cnt))
+                != (ssize_t) (sizeof(rrd_value_t) * (*ds_cnt) *
+                              rrd.stat_head->ds_cnt)) {
+                rrd_set_error("fetching cdp from rra");
+                for (ii = 0; (unsigned) ii < *ds_cnt; ii++)
+                    free((*ds_namv)[ii]);
+                free(*ds_namv);
+                rrd_free(&rrd);
+                free(*data);
+                *data = NULL;
+                close(rrd_file->fd);
+                return (-1);
+            }
 #ifdef HAVE_POSIX_FADVISE
-       /* don't pollute the buffer cache with data read from the file. We do this while reading to 
-          keep damage minimal */
-       if (0 != posix_fadvise(rrd_file->fd, rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
-           rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));
-           close(rrd_file->fd);
-           return(-1);
-       } 
+            /* don't pollute the buffer cache with data read from the file. We do this while reading to 
+               keep damage minimal */
+            if (0 !=
+                posix_fadvise(rrd_file->fd, rrd_head_size, 0,
+                              POSIX_FADV_DONTNEED)) {
+                rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",
+                              filename, rrd_strerror(errno));
+                close(rrd_file->fd);
+                return (-1);
+            }
 #endif
 
 #ifdef DEBUG
-           fprintf(stderr,"post fetch %li -- ",i);
-           for(ii=0;ii<*ds_cnt;ii++)
-               fprintf(stderr,"%10.2f ",*(data_ptr+ii));
+            fprintf(stderr, "post fetch %li -- ", i);
+            for (ii = 0; ii < *ds_cnt; ii++)
+                fprintf(stderr, "%10.2f ", *(data_ptr + ii));
 #endif
-           data_ptr += *ds_cnt;
-           rra_pointer ++;
-       }
+            data_ptr += *ds_cnt;
+            rra_pointer++;
+        }
 #ifdef DEBUG
-           fprintf(stderr,"\n");
-#endif     
-       
+        fprintf(stderr, "\n");
+#endif
+
     }
     rrd_free(&rrd);
 #ifdef HAVE_POSIX_FADVISE
     /* and just to be sure we drop everything except the header at the end */
-    if (0 != posix_fadvise(rrd_file->fd, rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
-           rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));
-           close(rrd_file->fd);
-           return(-1);
-    } 
-#endif     
+    if (0 !=
+        posix_fadvise(rrd_file->fd, rrd_head_size, 0, POSIX_FADV_DONTNEED)) {
+        rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s", filename,
+                      rrd_strerror(errno));
+        close(rrd_file->fd);
+        return (-1);
+    }
+#endif
     close(rrd_file->fd);
-    return(0);
+    return (0);
 }
index 3782d4a..0bd3f45 100644 (file)
@@ -9,91 +9,91 @@
 #include "rrd_tool.h"
 
 
-time_t
-rrd_first(int argc, char **argv)
+time_t rrd_first(
+    int argc,
+    char **argv)
 {
-    int target_rraindex=0;
-    char *endptr;
-    optind = 0; opterr = 0;  /* initialize getopt */
+    int       target_rraindex = 0;
+    char     *endptr;
 
-    while (1){
-        static struct option long_options[] =
-        {
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
+
+    while (1) {
+        static struct option long_options[] = {
             {"rraindex", required_argument, 0, 129},
-            {0,0,0,0}
+            {0, 0, 0, 0}
         };
-        int option_index = 0;
-        int opt;
+        int       option_index = 0;
+        int       opt;
+
         opt = getopt_long(argc, argv, "", long_options, &option_index);
 
-        if(opt == EOF)
+        if (opt == EOF)
             break;
 
-        switch(opt) {
-          case 129:
-            target_rraindex=strtol(optarg,&endptr,0);
-            if(target_rraindex < 0) {
+        switch (opt) {
+        case 129:
+            target_rraindex = strtol(optarg, &endptr, 0);
+            if (target_rraindex < 0) {
                 rrd_set_error("invalid rraindex number");
-                return(-1);
+                return (-1);
             }
             break;
-          default:
-            rrd_set_error("usage rrdtool %s [--rraindex number] file.rrd", argv[0]);
-            return(-1);
+        default:
+            rrd_set_error("usage rrdtool %s [--rraindex number] file.rrd",
+                          argv[0]);
+            return (-1);
         }
     }
 
-    if(optind >= argc){
+    if (optind >= argc) {
         rrd_set_error("not enough arguments");
-        return -1;       
-    }     
+        return -1;
+    }
 
-    return(rrd_first_r(argv[optind], target_rraindex));
+    return (rrd_first_r(argv[optind], target_rraindex));
 }
 
 
-time_t
-rrd_first_r(const char *filename, const int rraindex)
+time_t rrd_first_r(
+    const char *filename,
+    const int rraindex)
 {
-    off_t rra_start,
-         timer;
-    time_t then;
-    rrd_t rrd;
+    off_t     rra_start, timer;
+    time_t    then;
+    rrd_t     rrd;
     rrd_file_t *rrd_file;
 
-    rrd_file = rrd_open(filename,&rrd, RRD_READONLY);
+    rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL) {
         rrd_set_error("could not open RRD");
-        return(-1);
+        return (-1);
     }
 
-    if((rraindex < 0) || (rraindex >= (int)rrd.stat_head->rra_cnt)) {
+    if ((rraindex < 0) || (rraindex >= (int) rrd.stat_head->rra_cnt)) {
         rrd_set_error("invalid rraindex number");
         rrd_free(&rrd);
         close(rrd_file->fd);
-        return(-1);
+        return (-1);
     }
 
     rra_start = rrd_file->header_len;
     rrd_seek(rrd_file,
-          (rra_start +
-           (rrd.rra_ptr[rraindex].cur_row+1) *
-           rrd.stat_head->ds_cnt *
-           sizeof(rrd_value_t)),
-          SEEK_SET);
-    timer = - (rrd.rra_def[rraindex].row_cnt-1);
+             (rra_start +
+              (rrd.rra_ptr[rraindex].cur_row + 1) *
+              rrd.stat_head->ds_cnt * sizeof(rrd_value_t)), SEEK_SET);
+    timer = -(rrd.rra_def[rraindex].row_cnt - 1);
     if (rrd.rra_ptr[rraindex].cur_row + 1 > rrd.rra_def[rraindex].row_cnt) {
-      rrd_seek(rrd_file,rra_start,SEEK_SET);
+        rrd_seek(rrd_file, rra_start, SEEK_SET);
     }
     then = (rrd.live_head->last_up -
             rrd.live_head->last_up %
-            (rrd.rra_def[rraindex].pdp_cnt*rrd.stat_head->pdp_step)) +
-           (timer * 
-            rrd.rra_def[rraindex].pdp_cnt*rrd.stat_head->pdp_step);
+            (rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step)) +
+        (timer * rrd.rra_def[rraindex].pdp_cnt * rrd.stat_head->pdp_step);
 
     rrd_free(&rrd);
     close(rrd_file->fd);
     rrd_close(rrd_file);
-    return(then);
+    return (then);
 }
-
index 990f94a..6002495 100644 (file)
    if (strcmp(#VV, string) == 0) return VVV;
 
 /* conversion functions to allow symbolic entry of enumerations */
-enum dst_en dst_conv(char *string)
+enum dst_en dst_conv(
+    char *string)
 {
-    converter(COUNTER,DST_COUNTER)
-    converter(ABSOLUTE,DST_ABSOLUTE)
-    converter(GAUGE,DST_GAUGE)
-    converter(DERIVE,DST_DERIVE)
-    converter(COMPUTE,DST_CDEF)
-    rrd_set_error("unknown data acquisition function '%s'",string);
-    return(-1);
+    converter(COUNTER, DST_COUNTER)
+        converter(ABSOLUTE, DST_ABSOLUTE)
+        converter(GAUGE, DST_GAUGE)
+        converter(DERIVE, DST_DERIVE)
+        converter(COMPUTE, DST_CDEF)
+        rrd_set_error("unknown data acquisition function '%s'", string);
+    return (-1);
 }
 
 
-enum cf_en cf_conv(const char *string)
+enum cf_en cf_conv(
+    const char *string)
 {
 
-    converter(AVERAGE,CF_AVERAGE)
-    converter(MIN,CF_MINIMUM)
-    converter(MAX,CF_MAXIMUM)
-    converter(LAST,CF_LAST)
-    converter(HWPREDICT,CF_HWPREDICT)
-    converter(DEVPREDICT,CF_DEVPREDICT)
-    converter(SEASONAL,CF_SEASONAL)
-    converter(DEVSEASONAL,CF_DEVSEASONAL)
-    converter(FAILURES,CF_FAILURES)
-    rrd_set_error("unknown consolidation function '%s'",string);
-    return(-1);
+    converter(AVERAGE, CF_AVERAGE)
+        converter(MIN, CF_MINIMUM)
+        converter(MAX, CF_MAXIMUM)
+        converter(LAST, CF_LAST)
+        converter(HWPREDICT, CF_HWPREDICT)
+        converter(DEVPREDICT, CF_DEVPREDICT)
+        converter(SEASONAL, CF_SEASONAL)
+        converter(DEVSEASONAL, CF_DEVSEASONAL)
+        converter(FAILURES, CF_FAILURES)
+        rrd_set_error("unknown consolidation function '%s'", string);
+    return (-1);
 }
 
-#undef converter       
+#undef converter
 
-long
-ds_match(rrd_t *rrd,char *ds_nam){
+long ds_match(
+    rrd_t *rrd,
+    char *ds_nam)
+{
     unsigned long i;
-    for(i=0;i<rrd->stat_head->ds_cnt;i++)
-       if ((strcmp(ds_nam,rrd->ds_def[i].ds_nam))==0)
-           return i;
-    rrd_set_error("unknown data source name '%s'",ds_nam);
+
+    for (i = 0; i < rrd->stat_head->ds_cnt; i++)
+        if ((strcmp(ds_nam, rrd->ds_def[i].ds_nam)) == 0)
+            return i;
+    rrd_set_error("unknown data source name '%s'", ds_nam);
     return -1;
 }
index 6f94438..c841a6d 100644 (file)
@@ -26,9 +26,9 @@
 
 #include "rrd_nan_inf.h"
 
-typedef union unival { 
-    unsigned long u_cnt; 
-    rrd_value_t   u_val;
+typedef union unival {
+    unsigned long u_cnt;
+    rrd_value_t u_val;
 } unival;
 
 
@@ -101,21 +101,21 @@ typedef union unival {
 
 typedef struct stat_head_t {
 
-    /* Data Base Identification Section ***/
-    char             cookie[4];          /* RRD */
-    char             version[5];         /* version of the format */
-    double           float_cookie;       /* is it the correct double
-                                         * representation ?  */
-
-    /* Data Base Structure Definition *****/
-    unsigned long    ds_cnt;             /* how many different ds provide
-                                         * input to the rrd */
-    unsigned long    rra_cnt;            /* how many rras will be maintained
-                                         * in the rrd */
-    unsigned long    pdp_step;           /* pdp interval in seconds */
-
-    unival           par[10];            /* global parameters ... unused
-                                           at the moment */
+    /* Data Base Identification Section ** */
+    char      cookie[4];    /* RRD */
+    char      version[5];   /* version of the format */
+    double    float_cookie; /* is it the correct double
+                             * representation ?  */
+
+    /* Data Base Structure Definition **** */
+    unsigned long ds_cnt;   /* how many different ds provide
+                             * input to the rrd */
+    unsigned long rra_cnt;  /* how many rras will be maintained
+                             * in the rrd */
+    unsigned long pdp_step; /* pdp interval in seconds */
+
+    unival    par[10];  /* global parameters ... unused
+                           at the moment */
 } stat_head_t;
 
 
@@ -123,24 +123,26 @@ typedef struct stat_head_t {
  * POS 2: ds_def_t  (* ds_cnt)                        Data Source definitions
  ****************************************************************************/
 
-enum dst_en          { DST_COUNTER=0,     /* data source types available */
-                       DST_ABSOLUTE, 
-                       DST_GAUGE,
-                       DST_DERIVE,
-                                          DST_CDEF};
-
-enum ds_param_en {   DS_mrhb_cnt=0,       /* minimum required heartbeat. A
-                                          * data source must provide input at
-                                          * least every ds_mrhb seconds,
-                                          * otherwise it is regarded dead and
-                                          * will be set to UNKNOWN */             
-                    DS_min_val,          /* the processed input of a ds must */
-                     DS_max_val,      /* be between max_val and min_val
-                                          * both can be set to UNKNOWN if you
-                                          * do not care. Data outside the limits
-                                          * set to UNKNOWN */
-                     DS_cdef = DS_mrhb_cnt}; /* pointer to encoded rpn
-                                          * expression only applies to DST_CDEF */
+enum dst_en { DST_COUNTER = 0,  /* data source types available */
+    DST_ABSOLUTE,
+    DST_GAUGE,
+    DST_DERIVE,
+    DST_CDEF
+};
+
+enum ds_param_en { DS_mrhb_cnt = 0, /* minimum required heartbeat. A
+                                     * data source must provide input at
+                                     * least every ds_mrhb seconds,
+                                     * otherwise it is regarded dead and
+                                     * will be set to UNKNOWN */
+    DS_min_val,         /* the processed input of a ds must */
+    DS_max_val,         /* be between max_val and min_val
+                         * both can be set to UNKNOWN if you
+                         * do not care. Data outside the limits
+                         * set to UNKNOWN */
+    DS_cdef = DS_mrhb_cnt
+};                      /* pointer to encoded rpn
+                         * expression only applies to DST_CDEF */
 
 /* The magic number here is one less than DS_NAM_SIZE */
 #define DS_NAM_FMT    "%19[a-zA-Z0-9_-]"
@@ -150,89 +152,93 @@ enum ds_param_en {   DS_mrhb_cnt=0,       /* minimum required heartbeat. A
 #define DST_SIZE   20
 
 typedef struct ds_def_t {
-    char             ds_nam[DS_NAM_SIZE]; /* Name of the data source (null terminated)*/
-    char             dst[DST_SIZE];       /* Type of data source (null terminated)*/
-    unival           par[10];             /* index of this array see ds_param_en */
+    char      ds_nam[DS_NAM_SIZE];  /* Name of the data source (null terminated) */
+    char      dst[DST_SIZE];    /* Type of data source (null terminated) */
+    unival    par[10];  /* index of this array see ds_param_en */
 } ds_def_t;
 
 /****************************************************************************
  * POS 3: rra_def_t ( *  rra_cnt)         one for each store to be maintained
  ****************************************************************************/
-enum cf_en           { CF_AVERAGE=0,     /* data consolidation functions */ 
-                       CF_MINIMUM, 
-                       CF_MAXIMUM,
-                       CF_LAST,
-                      CF_HWPREDICT, 
-                                          /* An array of predictions using the seasonal 
-                                               * Holt-Winters algorithm. Requires an RRA of type
-                                               * CF_SEASONAL for this data source. */
-                                          CF_SEASONAL,
-                                          /* An array of seasonal effects. Requires an RRA of
-                                               * type CF_HWPREDICT for this data source. */
-                                          CF_DEVPREDICT,
-                                          /* An array of deviation predictions based upon
-                                               * smoothed seasonal deviations. Requires an RRA of
-                                               * type CF_DEVSEASONAL for this data source. */
-                                          CF_DEVSEASONAL,
-                                          /* An array of smoothed seasonal deviations. Requires
-                                               * an RRA of type CF_HWPREDICT for this data source.
-                                               * */
-                                          CF_FAILURES};
-                                          /* A binary array of failure indicators: 1 indicates
-                                               * that the number of violations in the prescribed
-                                               * window exceeded the prescribed threshold. */
+enum cf_en { CF_AVERAGE = 0,    /* data consolidation functions */
+    CF_MINIMUM,
+    CF_MAXIMUM,
+    CF_LAST,
+    CF_HWPREDICT,
+    /* An array of predictions using the seasonal 
+     * Holt-Winters algorithm. Requires an RRA of type
+     * CF_SEASONAL for this data source. */
+    CF_SEASONAL,
+    /* An array of seasonal effects. Requires an RRA of
+     * type CF_HWPREDICT for this data source. */
+    CF_DEVPREDICT,
+    /* An array of deviation predictions based upon
+     * smoothed seasonal deviations. Requires an RRA of
+     * type CF_DEVSEASONAL for this data source. */
+    CF_DEVSEASONAL,
+    /* An array of smoothed seasonal deviations. Requires
+     * an RRA of type CF_HWPREDICT for this data source.
+     * */
+    CF_FAILURES
+};
+
+                       /* A binary array of failure indicators: 1 indicates
+                        * that the number of violations in the prescribed
+                        * window exceeded the prescribed threshold. */
 
 #define MAX_RRA_PAR_EN 10
-enum rra_par_en {   RRA_cdp_xff_val=0,  /* what part of the consolidated
-                     * datapoint must be known, to produce a
-                                        * valid entry in the rra */
-                                       RRA_hw_alpha,
-                                       /* exponential smoothing parameter for the intercept in
-                                        * the Holt-Winters prediction algorithm. */
-                                       RRA_hw_beta,
-                                       /* exponential smoothing parameter for the slope in
-                                        * the Holt-Winters prediction algorithm. */
-                                       RRA_dependent_rra_idx,
-                                       /* For CF_HWPREDICT: index of the RRA with the seasonal 
-                                        * effects of the Holt-Winters algorithm (of type
-                                        * CF_SEASONAL).
-                                        * For CF_DEVPREDICT: index of the RRA with the seasonal
-                                        * deviation predictions (of type CF_DEVSEASONAL).
-                                        * For CF_SEASONAL: index of the RRA with the Holt-Winters
-                                        * intercept and slope coefficient (of type CF_HWPREDICT).
-                                        * For CF_DEVSEASONAL: index of the RRA with the 
-                                        * Holt-Winters prediction (of type CF_HWPREDICT).
-                                        * For CF_FAILURES: index of the CF_DEVSEASONAL array.
-                                        * */
-                                       RRA_seasonal_smooth_idx,
-                                       /* For CF_SEASONAL and CF_DEVSEASONAL:
-                                        * an integer between 0 and row_count - 1 which
-                                        * is index in the seasonal cycle for applying
-                                        * the period smoother. */
-                                   RRA_failure_threshold,
-                                       /* For CF_FAILURES, number of violations within the last
-                                        * window required to mark a failure. */
-                    RRA_seasonal_gamma = RRA_hw_alpha,
-                                       /* exponential smoothing parameter for seasonal effects.
-                                        * */
-                    RRA_delta_pos = RRA_hw_alpha,
-                    RRA_delta_neg = RRA_hw_beta,
-                                       /* confidence bound scaling parameters for the
-                                        * the FAILURES RRA. */
-                    RRA_window_len = RRA_seasonal_smooth_idx};
-                                       /* For CF_FAILURES, the length of the window for measuring
-                                        * failures. */
-                       
+enum rra_par_en { RRA_cdp_xff_val = 0,  /* what part of the consolidated
+                                         * datapoint must be known, to produce a
+                                         * valid entry in the rra */
+    RRA_hw_alpha,
+    /* exponential smoothing parameter for the intercept in
+     * the Holt-Winters prediction algorithm. */
+    RRA_hw_beta,
+    /* exponential smoothing parameter for the slope in
+     * the Holt-Winters prediction algorithm. */
+    RRA_dependent_rra_idx,
+    /* For CF_HWPREDICT: index of the RRA with the seasonal 
+     * effects of the Holt-Winters algorithm (of type
+     * CF_SEASONAL).
+     * For CF_DEVPREDICT: index of the RRA with the seasonal
+     * deviation predictions (of type CF_DEVSEASONAL).
+     * For CF_SEASONAL: index of the RRA with the Holt-Winters
+     * intercept and slope coefficient (of type CF_HWPREDICT).
+     * For CF_DEVSEASONAL: index of the RRA with the 
+     * Holt-Winters prediction (of type CF_HWPREDICT).
+     * For CF_FAILURES: index of the CF_DEVSEASONAL array.
+     * */
+    RRA_seasonal_smooth_idx,
+    /* For CF_SEASONAL and CF_DEVSEASONAL:
+     * an integer between 0 and row_count - 1 which
+     * is index in the seasonal cycle for applying
+     * the period smoother. */
+    RRA_failure_threshold,
+    /* For CF_FAILURES, number of violations within the last
+     * window required to mark a failure. */
+    RRA_seasonal_gamma = RRA_hw_alpha,
+    /* exponential smoothing parameter for seasonal effects.
+     * */
+    RRA_delta_pos = RRA_hw_alpha,
+    RRA_delta_neg = RRA_hw_beta,
+    /* confidence bound scaling parameters for the
+     * the FAILURES RRA. */
+    RRA_window_len = RRA_seasonal_smooth_idx
+};
+
+                    /* For CF_FAILURES, the length of the window for measuring
+                     * failures. */
+
 #define CF_NAM_FMT    "%19[A-Z]"
 #define CF_NAM_SIZE   20
 
 typedef struct rra_def_t {
-    char             cf_nam[CF_NAM_SIZE];/* consolidation function (null term) */
-    unsigned long    row_cnt;            /* number of entries in the store */
-    unsigned long    pdp_cnt;            /* how many primary data points are
-                                         * required for a consolidated data
-                                         * point?*/
-    unival           par[MAX_RRA_PAR_EN];            /* index see rra_param_en */
+    char      cf_nam[CF_NAM_SIZE];  /* consolidation function (null term) */
+    unsigned long row_cnt;  /* number of entries in the store */
+    unsigned long pdp_cnt;  /* how many primary data points are
+                             * required for a consolidated data
+                             * point?*/
+    unival    par[MAX_RRA_PAR_EN];  /* index see rra_param_en */
 
 } rra_def_t;
 
@@ -249,30 +255,31 @@ typedef struct rra_def_t {
  ****************************************************************************/
 
 typedef struct live_head_t {
-    time_t           last_up;            /* when was rrd last updated */
-    long            last_up_usec;       /* micro seconds part of the
-                                           update timestamp. Always >= 0 */
+    time_t    last_up;  /* when was rrd last updated */
+    long      last_up_usec; /* micro seconds part of the
+                               update timestamp. Always >= 0 */
 } live_head_t;
 
 
 /****************************************************************************
  * POS 5: pdp_prep_t  (* ds_cnt)                     here we prepare the pdps 
  ****************************************************************************/
-#define LAST_DS_LEN 30 /* DO NOT CHANGE THIS ... */
-
-enum pdp_par_en {   PDP_unkn_sec_cnt=0,  /* how many seconds of the current
-                                         * pdp value is unknown data? */
-
-                   PDP_val};            /* current value of the pdp.
-                                           this depends on dst */
-
-typedef struct pdp_prep_t{    
-    char last_ds[LAST_DS_LEN];           /* the last reading from the data
-                                         * source.  this is stored in ASCII
-                                         * to cater for very large counters
-                                         * we might encounter in connection
-                                         * with SNMP. */
-    unival          scratch[10];         /* contents according to pdp_par_en */
+#define LAST_DS_LEN 30  /* DO NOT CHANGE THIS ... */
+
+enum pdp_par_en { PDP_unkn_sec_cnt = 0, /* how many seconds of the current
+                                         * pdp value is unknown data? */
+
+    PDP_val
+};                      /* current value of the pdp.
+                           this depends on dst */
+
+typedef struct pdp_prep_t {
+    char      last_ds[LAST_DS_LEN]; /* the last reading from the data
+                                     * source.  this is stored in ASCII
+                                     * to cater for very large counters
+                                     * we might encounter in connection
+                                     * with SNMP. */
+    unival    scratch[10];  /* contents according to pdp_par_en */
 } pdp_prep_t;
 
 /* data is passed from pdp to cdp when seconds since epoch modulo pdp_step == 0
@@ -291,56 +298,58 @@ typedef struct pdp_prep_t{
  * POS 6: cdp_prep_t (* rra_cnt * ds_cnt )      data prep area for cdp values
  ****************************************************************************/
 #define MAX_CDP_PAR_EN 10
-#define MAX_CDP_FAILURES_IDX 8 
+#define MAX_CDP_FAILURES_IDX 8
 /* max CDP scratch entries avail to record violations for a FAILURES RRA */
 #define MAX_FAILURES_WINDOW_LEN 28
-enum cdp_par_en {  CDP_val=0,          
-                   /* the base_interval is always an
-                                       * average */
-                          CDP_unkn_pdp_cnt,       
-                                  /* how many unknown pdp were
-                           * integrated. This and the cdp_xff
-                                       * will decide if this is going to
-                                       * be a UNKNOWN or a valid value */
-                                  CDP_hw_intercept,
-                                  /* Current intercept coefficient for the Holt-Winters
-                                       * prediction algorithm. */
-                                  CDP_hw_last_intercept,
-                                  /* Last iteration intercept coefficient for the Holt-Winters
-                                       * prediction algorihtm. */
-                                  CDP_hw_slope,
-                                  /* Current slope coefficient for the Holt-Winters
-                                       * prediction algorithm. */
-                                  CDP_hw_last_slope,
-                                  /* Last iteration slope coeffient. */
-                                  CDP_null_count,
-                                  /* Number of sequential Unknown (DNAN) values + 1 preceding
-                                   * the current prediction.
-                                       * */
-                                  CDP_last_null_count,
-                                  /* Last iteration count of Unknown (DNAN) values. */
-                                  CDP_primary_val = 8,
-                                  /* optimization for bulk updates: the value of the first CDP
-                                       * value to be written in the bulk update. */
-                                  CDP_secondary_val = 9,
-                                  /* optimization for bulk updates: the value of subsequent
-                                       * CDP values to be written in the bulk update. */
-                   CDP_hw_seasonal = CDP_hw_intercept,
-                   /* Current seasonal coefficient for the Holt-Winters
-                    * prediction algorithm. This is stored in CDP prep to avoid
-                    * redundant seek operations. */
-                   CDP_hw_last_seasonal = CDP_hw_last_intercept,
-                   /* Last iteration seasonal coeffient. */
-                   CDP_seasonal_deviation = CDP_hw_intercept,
-                   CDP_last_seasonal_deviation = CDP_hw_last_intercept,
-                   CDP_init_seasonal = CDP_null_count};
+enum cdp_par_en { CDP_val = 0,
+    /* the base_interval is always an
+     * average */
+    CDP_unkn_pdp_cnt,
+    /* how many unknown pdp were
+     * integrated. This and the cdp_xff
+     * will decide if this is going to
+     * be a UNKNOWN or a valid value */
+    CDP_hw_intercept,
+    /* Current intercept coefficient for the Holt-Winters
+     * prediction algorithm. */
+    CDP_hw_last_intercept,
+    /* Last iteration intercept coefficient for the Holt-Winters
+     * prediction algorihtm. */
+    CDP_hw_slope,
+    /* Current slope coefficient for the Holt-Winters
+     * prediction algorithm. */
+    CDP_hw_last_slope,
+    /* Last iteration slope coeffient. */
+    CDP_null_count,
+    /* Number of sequential Unknown (DNAN) values + 1 preceding
+     * the current prediction.
+     * */
+    CDP_last_null_count,
+    /* Last iteration count of Unknown (DNAN) values. */
+    CDP_primary_val = 8,
+    /* optimization for bulk updates: the value of the first CDP
+     * value to be written in the bulk update. */
+    CDP_secondary_val = 9,
+    /* optimization for bulk updates: the value of subsequent
+     * CDP values to be written in the bulk update. */
+    CDP_hw_seasonal = CDP_hw_intercept,
+    /* Current seasonal coefficient for the Holt-Winters
+     * prediction algorithm. This is stored in CDP prep to avoid
+     * redundant seek operations. */
+    CDP_hw_last_seasonal = CDP_hw_last_intercept,
+    /* Last iteration seasonal coeffient. */
+    CDP_seasonal_deviation = CDP_hw_intercept,
+    CDP_last_seasonal_deviation = CDP_hw_last_intercept,
+    CDP_init_seasonal = CDP_null_count
+};
+
                    /* init_seasonal is a flag which when > 0, forces smoothing updates
                     * to occur when rra_ptr.cur_row == 0 */
 
-typedef struct cdp_prep_t{
-    unival         scratch[MAX_CDP_PAR_EN];          
-                                                                                /* contents according to cdp_par_en *
-                                          * init state should be NAN */
+typedef struct cdp_prep_t {
+    unival    scratch[MAX_CDP_PAR_EN];
+    /* contents according to cdp_par_en *
+     * init state should be NAN */
 
 } cdp_prep_t;
 
@@ -349,7 +358,7 @@ typedef struct cdp_prep_t{
  ****************************************************************************/
 
 typedef struct rra_ptr_t {
-    unsigned long    cur_row;            /* current row in the rra*/
+    unsigned long cur_row;  /* current row in the rra */
 } rra_ptr_t;
 
 
@@ -359,14 +368,14 @@ typedef struct rra_ptr_t {
  ****************************************************************************
  ****************************************************************************/
 typedef struct rrd_t {
-    stat_head_t      *stat_head;          /* the static header */
-    ds_def_t         *ds_def;             /* list of data source definitions */
-    rra_def_t        *rra_def;            /* list of round robin archive def */
-    live_head_t      *live_head;
-    pdp_prep_t       *pdp_prep;           /* pdp data prep area */  
-    cdp_prep_t       *cdp_prep;           /* cdp prep area */
-    rra_ptr_t        *rra_ptr;            /* list of rra pointers */
-    rrd_value_t      *rrd_value;          /* list of rrd values */
+    stat_head_t *stat_head; /* the static header */
+    ds_def_t *ds_def;   /* list of data source definitions */
+    rra_def_t *rra_def; /* list of round robin archive def */
+    live_head_t *live_head;
+    pdp_prep_t *pdp_prep;   /* pdp data prep area */
+    cdp_prep_t *cdp_prep;   /* cdp prep area */
+    rra_ptr_t *rra_ptr; /* list of rra pointers */
+    rrd_value_t *rrd_value; /* list of rrd values */
 } rrd_t;
 
 /****************************************************************************
@@ -392,7 +401,3 @@ typedef struct rrd_t {
 
 
 #endif
-
-
-
-
index b715ab0..706a67a 100644 (file)
@@ -70,7 +70,7 @@
    contain conflicting prototypes for getopt.  */
 #include <stdlib.h>
 #include <unistd.h>
-#endif /* GNU C library.  */
+#endif                          /* GNU C library.  */
 
 #ifdef VMS
 #include <unixlib.h>
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-char *optarg = NULL;
+char     *optarg = NULL;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -133,13 +133,13 @@ char *optarg = NULL;
    how much of ARGV has been scanned so far.  */
 
 /* 1003.2 says this must be 1 before any call.  */
-int optind = 1;
+int       optind = 1;
 
 /* Formerly, initialization of getopt depended on optind==0, which
    causes problems with re-calling getopt as programs generally don't
    know that. */
 
-int __getopt_initialized = 0;
+int       __getopt_initialized = 0;
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.
@@ -153,13 +153,13 @@ static char *nextchar;
 /* Callers store zero here to inhibit the error message
    for unrecognized options.  */
 
-int opterr = 1;
+int       opterr = 1;
 
 /* Set to an option character which was unrecognized.
    This must be initialized on some systems to avoid linking in the
    system's own getopt implementation.  */
 
-int optopt = '?';
+int       optopt = '?';
 
 /* Describe how to deal with options that follow non-option ARGV-elements.
 
@@ -190,9 +190,8 @@ int optopt = '?';
    of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
    `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
 
-static enum
-{
-  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+static enum {
+    REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
 } ordering;
 
 /* Value of POSIXLY_CORRECT environment variable.  */
@@ -212,20 +211,21 @@ static char *posixly_correct;
 /* Avoid depending on library functions or files
    whose names are inconsistent.  */
 
-char *getenv ();
+char     *getenv(
+    );
 
-static char *
-my_index (str, chr)
-     const char *str;
-     int chr;
+static char *my_index(
+    str,
+    chr)
+    const char *str;
+    int chr;
 {
-  while (*str)
-    {
-      if (*str == chr)
-       return (char *) str;
-      str++;
+    while (*str) {
+        if (*str == chr)
+            return (char *) str;
+        str++;
     }
-  return 0;
+    return 0;
 }
 
 /* If using GCC, we can safely declare strlen this way.
@@ -236,11 +236,12 @@ my_index (str, chr)
 #if !defined (__STDC__) || !__STDC__
 /* gcc with -traditional declares the built-in strlen to return int,
    and has done so at least since version 2.4.5. -- rms.  */
-extern int strlen (const char *);
-#endif /* not __STDC__ */
-#endif /* __GNUC__ */
+extern int strlen(
+    const char *);
+#endif                          /* not __STDC__ */
+#endif                          /* __GNUC__ */
 
-#endif /* not __GNU_LIBRARY__ */
+#endif                          /* not __GNU_LIBRARY__ */
 \f
 /* Handle permutation of arguments.  */
 
@@ -264,16 +265,20 @@ static char *const *original_argv;
 /* Make sure the environment variable bash 2.0 puts in the environment
    is valid for the getopt call we must make sure that the ARGV passed
    to getopt is that one passed to the process.  */
-static void store_args (int argc, char *const *argv) __attribute__ ((unused));
-static void
-store_args (int argc, char *const *argv)
+static void store_args(
+    int argc,
+    char *const *argv) __attribute__ ((unused));
+static void store_args(
+    int argc,
+    char *const *argv)
 {
-  /* XXX This is no good solution.  We should rather copy the args so
-     that we can compare them later.  But we must not use malloc(3).  */
-  original_argc = argc;
-  original_argv = argv;
+    /* XXX This is no good solution.  We should rather copy the args so
+       that we can compare them later.  But we must not use malloc(3).  */
+    original_argc = argc;
+    original_argv = argv;
 }
-text_set_element (__libc_subinit, store_args);
+
+text_set_element(__libc_subinit, store_args);
 #endif
 
 /* Exchange two adjacent subsequences of ARGV.
@@ -286,124 +291,119 @@ text_set_element (__libc_subinit, store_args);
    the new indices of the non-options in ARGV after they are moved.  */
 
 #if defined (__STDC__) && __STDC__
-static void exchange (char **);
+static void exchange(
+    char **);
 #endif
 
-static void
-exchange (argv)
-     char **argv;
+static void exchange(
+    argv)
+    char    **argv;
 {
-  int bottom = first_nonopt;
-  int middle = last_nonopt;
-  int top = optind;
-  char *tem;
-
-  /* Exchange the shorter segment with the far end of the longer segment.
-     That puts the shorter segment into the right place.
-     It leaves the longer segment in the right place overall,
-     but it consists of two parts that need to be swapped next.  */
-
-  while (top > middle && middle > bottom)
-    {
-      if (top - middle > middle - bottom)
-       {
-         /* Bottom segment is the short one.  */
-         int len = middle - bottom;
-         register int i;
-
-         /* Swap it with the top part of the top segment.  */
-         for (i = 0; i < len; i++)
-           {
-             tem = argv[bottom + i];
-             argv[bottom + i] = argv[top - (middle - bottom) + i];
-             argv[top - (middle - bottom) + i] = tem;
-           }
-         /* Exclude the moved bottom segment from further swapping.  */
-         top -= len;
-       }
-      else
-       {
-         /* Top segment is the short one.  */
-         int len = top - middle;
-         register int i;
-
-         /* Swap it with the bottom part of the bottom segment.  */
-         for (i = 0; i < len; i++)
-           {
-             tem = argv[bottom + i];
-             argv[bottom + i] = argv[middle + i];
-             argv[middle + i] = tem;
-           }
-         /* Exclude the moved top segment from further swapping.  */
-         bottom += len;
-       }
+    int       bottom = first_nonopt;
+    int       middle = last_nonopt;
+    int       top = optind;
+    char     *tem;
+
+    /* Exchange the shorter segment with the far end of the longer segment.
+       That puts the shorter segment into the right place.
+       It leaves the longer segment in the right place overall,
+       but it consists of two parts that need to be swapped next.  */
+
+    while (top > middle && middle > bottom) {
+        if (top - middle > middle - bottom) {
+            /* Bottom segment is the short one.  */
+            int       len = middle - bottom;
+            register int i;
+
+            /* Swap it with the top part of the top segment.  */
+            for (i = 0; i < len; i++) {
+                tem = argv[bottom + i];
+                argv[bottom + i] = argv[top - (middle - bottom) + i];
+                argv[top - (middle - bottom) + i] = tem;
+            }
+            /* Exclude the moved bottom segment from further swapping.  */
+            top -= len;
+        } else {
+            /* Top segment is the short one.  */
+            int       len = top - middle;
+            register int i;
+
+            /* Swap it with the bottom part of the bottom segment.  */
+            for (i = 0; i < len; i++) {
+                tem = argv[bottom + i];
+                argv[bottom + i] = argv[middle + i];
+                argv[middle + i] = tem;
+            }
+            /* Exclude the moved top segment from further swapping.  */
+            bottom += len;
+        }
     }
 
-  /* Update records for the slots the non-options now occupy.  */
+    /* Update records for the slots the non-options now occupy.  */
 
-  first_nonopt += (optind - last_nonopt);
-  last_nonopt = optind;
+    first_nonopt += (optind - last_nonopt);
+    last_nonopt = optind;
 }
 
 /* Initialize the internal data when the first call is made.  */
 
 #if defined (__STDC__) && __STDC__
-static const char *_getopt_initialize (int, char *const *, const char *);
+static const char *_getopt_initialize(
+    int,
+    char *const *,
+    const char *);
 #endif
-static const char *
-_getopt_initialize (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
+static const char *_getopt_initialize(
+    argc,
+    argv,
+    optstring)
+    int argc;
+    char     *const *argv;
+    const char *optstring;
 {
-  /* Start processing options with ARGV-element 1 (since ARGV-element 0
-     is the program name); the sequence of previously skipped
-     non-option ARGV-elements is empty.  */
+    /* Start processing options with ARGV-element 1 (since ARGV-element 0
+       is the program name); the sequence of previously skipped
+       non-option ARGV-elements is empty.  */
 
-  first_nonopt = last_nonopt = optind = 1;
+    first_nonopt = last_nonopt = optind = 1;
 
-  nextchar = NULL;
+    nextchar = NULL;
 
-  posixly_correct = getenv ("POSIXLY_CORRECT");
+    posixly_correct = getenv("POSIXLY_CORRECT");
 
-  /* Determine how to handle the ordering of options and nonoptions.  */
+    /* Determine how to handle the ordering of options and nonoptions.  */
 
-  if (optstring[0] == '-')
-    {
-      ordering = RETURN_IN_ORDER;
-      ++optstring;
-    }
-  else if (optstring[0] == '+')
-    {
-      ordering = REQUIRE_ORDER;
-      ++optstring;
-    }
-  else if (posixly_correct != NULL)
-    ordering = REQUIRE_ORDER;
-  else
-    ordering = PERMUTE;
+    if (optstring[0] == '-') {
+        ordering = RETURN_IN_ORDER;
+        ++optstring;
+    } else if (optstring[0] == '+') {
+        ordering = REQUIRE_ORDER;
+        ++optstring;
+    } else if (posixly_correct != NULL)
+        ordering = REQUIRE_ORDER;
+    else
+        ordering = PERMUTE;
 
 #ifdef _LIBC
-  if (posixly_correct == NULL
-      && argc == original_argc && argv == original_argv)
-    {
-      /* Bash 2.0 puts a special variable in the environment for each
-        command it runs, specifying which ARGV elements are the results of
-        file name wildcard expansion and therefore should not be
-        considered as options.  */
-      char var[100];
-      sprintf (var, "_%d_GNU_nonoption_argv_flags_", getpid ());
-      nonoption_flags = getenv (var);
-      if (nonoption_flags == NULL)
-       nonoption_flags_len = 0;
-      else
-       nonoption_flags_len = strlen (nonoption_flags);
-    }
-  else
-    nonoption_flags_len = 0;
+    if (posixly_correct == NULL
+        && argc == original_argc && argv == original_argv) {
+        /* Bash 2.0 puts a special variable in the environment for each
+           command it runs, specifying which ARGV elements are the results of
+           file name wildcard expansion and therefore should not be
+           considered as options.  */
+        char      var[100];
+
+        sprintf(var, "_%d_GNU_nonoption_argv_flags_", getpid());
+        nonoption_flags = getenv(var);
+        if (nonoption_flags == NULL)
+            nonoption_flags_len = 0;
+        else
+            nonoption_flags_len = strlen(nonoption_flags);
+    } else
+        nonoption_flags_len = 0;
 #endif
 
-  return optstring;
+    return optstring;
 }
 \f
 /* Scan elements of ARGV (whose length is ARGC) for option characters
@@ -462,28 +462,32 @@ _getopt_initialize (argc, argv, optstring)
    If LONG_ONLY is nonzero, '-' as well as '--' can introduce
    long-named options.  */
 
-int
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
-     int argc;
-     char *const *argv;
-     const char *optstring;
-     const struct option *longopts;
-     int *longind;
-     int long_only;
+int _getopt_internal(
+    argc,
+    argv,
+    optstring,
+    longopts,
+    longind,
+    long_only)
+    int argc;
+    char     *const *argv;
+    const char *optstring;
+    const struct option *longopts;
+    int      *longind;
+    int long_only;
 {
-  optarg = NULL;
+    optarg = NULL;
 
-  if (!__getopt_initialized || optind == 0)
-    {
-      optstring = _getopt_initialize (argc, argv, optstring);
-      optind = 1;              /* Don't scan ARGV[0], the program name.  */
-      __getopt_initialized = 1;
+    if (!__getopt_initialized || optind == 0) {
+        optstring = _getopt_initialize(argc, argv, optstring);
+        optind = 1;     /* Don't scan ARGV[0], the program name.  */
+        __getopt_initialized = 1;
     }
 
-  /* Test whether ARGV[optind] points to a non-option argument.
-     Either it does not have option syntax, or there is an environment flag
-     from the shell indicating it is not an option.  The later information
-     is only used when the used in the GNU libc.  */
+    /* Test whether ARGV[optind] points to a non-option argument.
+       Either it does not have option syntax, or there is an environment flag
+       from the shell indicating it is not an option.  The later information
+       is only used when the used in the GNU libc.  */
 #ifdef _LIBC
 #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'       \
                     || (optind < nonoption_flags_len                         \
@@ -492,511 +496,464 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 #define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
 #endif
 
-  if (nextchar == NULL || *nextchar == '\0')
-    {
-      /* Advance to the next ARGV-element.  */
-
-      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
-        moved back by the user (who may also have changed the arguments).  */
-      if (last_nonopt > optind)
-       last_nonopt = optind;
-      if (first_nonopt > optind)
-       first_nonopt = optind;
-
-      if (ordering == PERMUTE)
-       {
-         /* If we have just processed some options following some non-options,
-            exchange them so that the options come first.  */
-
-         if (first_nonopt != last_nonopt && last_nonopt != optind)
-           exchange ((char **) argv);
-         else if (last_nonopt != optind)
-           first_nonopt = optind;
-
-         /* Skip any additional non-options
-            and extend the range of non-options previously skipped.  */
-
-         while (optind < argc && NONOPTION_P)
-           optind++;
-         last_nonopt = optind;
-       }
-
-      /* The special ARGV-element `--' means premature end of options.
-        Skip it like a null option,
-        then exchange with previous non-options as if it were an option,
-        then skip everything else like a non-option.  */
-
-      if (optind != argc && !strcmp (argv[optind], "--"))
-       {
-         optind++;
-
-         if (first_nonopt != last_nonopt && last_nonopt != optind)
-           exchange ((char **) argv);
-         else if (first_nonopt == last_nonopt)
-           first_nonopt = optind;
-         last_nonopt = argc;
-
-         optind = argc;
-       }
-
-      /* If we have done all the ARGV-elements, stop the scan
-        and back over any non-options that we skipped and permuted.  */
-
-      if (optind == argc)
-       {
-         /* Set the next-arg-index to point at the non-options
-            that we previously skipped, so the caller will digest them.  */
-         if (first_nonopt != last_nonopt)
-           optind = first_nonopt;
-         return -1;
-       }
-
-      /* If we have come to a non-option and did not permute it,
-        either stop the scan or describe it to the caller and pass it by.  */
-
-      if (NONOPTION_P)
-       {
-         if (ordering == REQUIRE_ORDER)
-           return -1;
-         optarg = argv[optind++];
-         return 1;
-       }
-
-      /* We have found another option-ARGV-element.
-        Skip the initial punctuation.  */
-
-      nextchar = (argv[optind] + 1
-                 + (longopts != NULL && argv[optind][1] == '-'));
+    if (nextchar == NULL || *nextchar == '\0') {
+        /* Advance to the next ARGV-element.  */
+
+        /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+           moved back by the user (who may also have changed the arguments).  */
+        if (last_nonopt > optind)
+            last_nonopt = optind;
+        if (first_nonopt > optind)
+            first_nonopt = optind;
+
+        if (ordering == PERMUTE) {
+            /* If we have just processed some options following some non-options,
+               exchange them so that the options come first.  */
+
+            if (first_nonopt != last_nonopt && last_nonopt != optind)
+                exchange((char **) argv);
+            else if (last_nonopt != optind)
+                first_nonopt = optind;
+
+            /* Skip any additional non-options
+               and extend the range of non-options previously skipped.  */
+
+            while (optind < argc && NONOPTION_P)
+                optind++;
+            last_nonopt = optind;
+        }
+
+        /* The special ARGV-element `--' means premature end of options.
+           Skip it like a null option,
+           then exchange with previous non-options as if it were an option,
+           then skip everything else like a non-option.  */
+
+        if (optind != argc && !strcmp(argv[optind], "--")) {
+            optind++;
+
+            if (first_nonopt != last_nonopt && last_nonopt != optind)
+                exchange((char **) argv);
+            else if (first_nonopt == last_nonopt)
+                first_nonopt = optind;
+            last_nonopt = argc;
+
+            optind = argc;
+        }
+
+        /* If we have done all the ARGV-elements, stop the scan
+           and back over any non-options that we skipped and permuted.  */
+
+        if (optind == argc) {
+            /* Set the next-arg-index to point at the non-options
+               that we previously skipped, so the caller will digest them.  */
+            if (first_nonopt != last_nonopt)
+                optind = first_nonopt;
+            return -1;
+        }
+
+        /* If we have come to a non-option and did not permute it,
+           either stop the scan or describe it to the caller and pass it by.  */
+
+        if (NONOPTION_P) {
+            if (ordering == REQUIRE_ORDER)
+                return -1;
+            optarg = argv[optind++];
+            return 1;
+        }
+
+        /* We have found another option-ARGV-element.
+           Skip the initial punctuation.  */
+
+        nextchar = (argv[optind] + 1
+                    + (longopts != NULL && argv[optind][1] == '-'));
     }
 
-  /* Decode the current option-ARGV-element.  */
-
-  /* Check whether the ARGV-element is a long option.
-
-     If long_only and the ARGV-element has the form "-f", where f is
-     a valid short option, don't consider it an abbreviated form of
-     a long option that starts with f.  Otherwise there would be no
-     way to give the -f short option.
-
-     On the other hand, if there's a long option "fubar" and
-     the ARGV-element is "-fu", do consider that an abbreviation of
-     the long option, just like "--fu", and not "-f" with arg "u".
+    /* Decode the current option-ARGV-element.  */
+
+    /* Check whether the ARGV-element is a long option.
+
+       If long_only and the ARGV-element has the form "-f", where f is
+       a valid short option, don't consider it an abbreviated form of
+       a long option that starts with f.  Otherwise there would be no
+       way to give the -f short option.
+
+       On the other hand, if there's a long option "fubar" and
+       the ARGV-element is "-fu", do consider that an abbreviation of
+       the long option, just like "--fu", and not "-f" with arg "u".
+
+       This distinction seems to be the most useful approach.  */
+
+    if (longopts != NULL
+        && (argv[optind][1] == '-' || (long_only && (argv[optind][2]
+                                                     || !my_index(optstring,
+                                                                  argv[optind]
+                                                                  [1]))))) {
+        char     *nameend;
+        const struct option *p;
+        const struct option *pfound = NULL;
+        int       exact = 0;
+        int       ambig = 0;
+        int       indfound = -1;
+        int       option_index;
+
+        for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+            /* Do nothing.  */ ;
+
+        /* Test all long options for either exact match
+           or abbreviated matches.  */
+        for (p = longopts, option_index = 0; p->name; p++, option_index++)
+            if (!strncmp(p->name, nextchar, nameend - nextchar)) {
+                if ((unsigned int) (nameend - nextchar)
+                    == (unsigned int) strlen(p->name)) {
+                    /* Exact match found.  */
+                    pfound = p;
+                    indfound = option_index;
+                    exact = 1;
+                    break;
+                } else if (pfound == NULL) {
+                    /* First nonexact match found.  */
+                    pfound = p;
+                    indfound = option_index;
+                } else
+                    /* Second or later nonexact match found.  */
+                    ambig = 1;
+            }
+
+        if (ambig && !exact) {
+            if (opterr)
+                fprintf(stderr, _("%s: option `%s' is ambiguous\n"),
+                        argv[0], argv[optind]);
+            nextchar += strlen(nextchar);
+            optind++;
+            optopt = 0;
+            return '?';
+        }
+
+        if (pfound != NULL) {
+            option_index = indfound;
+            optind++;
+            if (*nameend) {
+                /* Don't test has_arg with >, because some C compilers don't
+                   allow it to be used on enums.  */
+                if (pfound->has_arg)
+                    optarg = nameend + 1;
+                else {
+                    if (opterr) {
+                        if (argv[optind - 1][1] == '-')
+                            /* --option */
+                            fprintf(stderr,
+                                    _
+                                    ("%s: option `--%s' doesn't allow an argument\n"),
+                                    argv[0], pfound->name);
+                        else
+                            /* +option or -option */
+                            fprintf(stderr,
+                                    _
+                                    ("%s: option `%c%s' doesn't allow an argument\n"),
+                                    argv[0], argv[optind - 1][0],
+                                    pfound->name);
+                    }
+                    nextchar += strlen(nextchar);
+
+                    optopt = pfound->val;
+                    return '?';
+                }
+            } else if (pfound->has_arg == 1) {
+                if (optind < argc)
+                    optarg = argv[optind++];
+                else {
+                    if (opterr)
+                        fprintf(stderr,
+                                _("%s: option `%s' requires an argument\n"),
+                                argv[0], argv[optind - 1]);
+                    nextchar += strlen(nextchar);
+                    optopt = pfound->val;
+                    return optstring[0] == ':' ? ':' : '?';
+                }
+            }
+            nextchar += strlen(nextchar);
+            if (longind != NULL)
+                *longind = option_index;
+            if (pfound->flag) {
+                *(pfound->flag) = pfound->val;
+                return 0;
+            }
+            return pfound->val;
+        }
+
+        /* Can't find it as a long option.  If this is not getopt_long_only,
+           or the option starts with '--' or is not a valid short
+           option, then it's an error.
+           Otherwise interpret it as a short option.  */
+        if (!long_only || argv[optind][1] == '-'
+            || my_index(optstring, *nextchar) == NULL) {
+            if (opterr) {
+                if (argv[optind][1] == '-')
+                    /* --option */
+                    fprintf(stderr, _("%s: unrecognized option `--%s'\n"),
+                            argv[0], nextchar);
+                else
+                    /* +option or -option */
+                    fprintf(stderr, _("%s: unrecognized option `%c%s'\n"),
+                            argv[0], argv[optind][0], nextchar);
+            }
+            nextchar = (char *) "";
+            optind++;
+            optopt = 0;
+            return '?';
+        }
+    }
 
-     This distinction seems to be the most useful approach.  */
+    /* Look at and handle the next short option-character.  */
 
-  if (longopts != NULL
-      && (argv[optind][1] == '-'
-         || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
     {
-      char *nameend;
-      const struct option *p;
-      const struct option *pfound = NULL;
-      int exact = 0;
-      int ambig = 0;
-      int indfound = -1;
-      int option_index;
-
-      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
-       /* Do nothing.  */ ;
-
-      /* Test all long options for either exact match
-        or abbreviated matches.  */
-      for (p = longopts, option_index = 0; p->name; p++, option_index++)
-       if (!strncmp (p->name, nextchar, nameend - nextchar))
-         {
-           if ((unsigned int) (nameend - nextchar)
-               == (unsigned int) strlen (p->name))
-             {
-               /* Exact match found.  */
-               pfound = p;
-               indfound = option_index;
-               exact = 1;
-               break;
-             }
-           else if (pfound == NULL)
-             {
-               /* First nonexact match found.  */
-               pfound = p;
-               indfound = option_index;
-             }
-           else
-             /* Second or later nonexact match found.  */
-             ambig = 1;
-         }
-
-      if (ambig && !exact)
-       {
-         if (opterr)
-           fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
-                    argv[0], argv[optind]);
-         nextchar += strlen (nextchar);
-         optind++;
-         optopt = 0;
-         return '?';
-       }
-
-      if (pfound != NULL)
-       {
-         option_index = indfound;
-         optind++;
-         if (*nameend)
-           {
-             /* Don't test has_arg with >, because some C compilers don't
-                allow it to be used on enums.  */
-             if (pfound->has_arg)
-               optarg = nameend + 1;
-             else
-               {
-                 if (opterr) {
-                  if (argv[optind - 1][1] == '-')
-                   /* --option */
-                   fprintf (stderr,
-                    _("%s: option `--%s' doesn't allow an argument\n"),
-                    argv[0], pfound->name);
-                  else
-                   /* +option or -option */
-                   fprintf (stderr,
-                    _("%s: option `%c%s' doesn't allow an argument\n"),
-                    argv[0], argv[optind - 1][0], pfound->name);
-                 }
-                 nextchar += strlen (nextchar);
-
-                 optopt = pfound->val;
-                 return '?';
-               }
-           }
-         else if (pfound->has_arg == 1)
-           {
-             if (optind < argc)
-               optarg = argv[optind++];
-             else
-               {
-                 if (opterr)
-                   fprintf (stderr,
-                          _("%s: option `%s' requires an argument\n"),
-                          argv[0], argv[optind - 1]);
-                 nextchar += strlen (nextchar);
-                 optopt = pfound->val;
-                 return optstring[0] == ':' ? ':' : '?';
-               }
-           }
-         nextchar += strlen (nextchar);
-         if (longind != NULL)
-           *longind = option_index;
-         if (pfound->flag)
-           {
-             *(pfound->flag) = pfound->val;
-             return 0;
-           }
-         return pfound->val;
-       }
-
-      /* Can't find it as a long option.  If this is not getopt_long_only,
-        or the option starts with '--' or is not a valid short
-        option, then it's an error.
-        Otherwise interpret it as a short option.  */
-      if (!long_only || argv[optind][1] == '-'
-         || my_index (optstring, *nextchar) == NULL)
-       {
-         if (opterr)
-           {
-             if (argv[optind][1] == '-')
-               /* --option */
-               fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
-                        argv[0], nextchar);
-             else
-               /* +option or -option */
-               fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
-                        argv[0], argv[optind][0], nextchar);
-           }
-         nextchar = (char *) "";
-         optind++;
-         optopt = 0;
-         return '?';
-       }
+        char      c = *nextchar++;
+        char     *temp = my_index(optstring, c);
+
+        /* Increment `optind' when we start to process its last character.  */
+        if (*nextchar == '\0')
+            ++optind;
+
+        if (temp == NULL || c == ':') {
+            if (opterr) {
+                if (posixly_correct)
+                    /* 1003.2 specifies the format of this message.  */
+                    fprintf(stderr, _("%s: illegal option -- %c\n"),
+                            argv[0], c);
+                else
+                    fprintf(stderr, _("%s: invalid option -- %c\n"),
+                            argv[0], c);
+            }
+            optopt = c;
+            return '?';
+        }
+        /* Convenience. Treat POSIX -W foo same as long option --foo */
+        if (temp[0] == 'W' && temp[1] == ';') {
+            char     *nameend;
+            const struct option *p;
+            const struct option *pfound = NULL;
+            int       exact = 0;
+            int       ambig = 0;
+            int       indfound = 0;
+            int       option_index;
+
+            /* This is an option that requires an argument.  */
+            if (*nextchar != '\0') {
+                optarg = nextchar;
+                /* If we end this ARGV-element by taking the rest as an arg,
+                   we must advance to the next element now.  */
+                optind++;
+            } else if (optind == argc) {
+                if (opterr) {
+                    /* 1003.2 specifies the format of this message.  */
+                    fprintf(stderr,
+                            _("%s: option requires an argument -- %c\n"),
+                            argv[0], c);
+                }
+                optopt = c;
+                if (optstring[0] == ':')
+                    c = ':';
+                else
+                    c = '?';
+                return c;
+            } else
+                /* We already incremented `optind' once;
+                   increment it again when taking next ARGV-elt as argument.  */
+                optarg = argv[optind++];
+
+            /* optarg is now the argument, see if it's in the
+               table of longopts.  */
+
+            for (nextchar = nameend = optarg; *nameend && *nameend != '=';
+                 nameend++)
+                /* Do nothing.  */ ;
+
+            /* Test all long options for either exact match
+               or abbreviated matches.  */
+            for (p = longopts, option_index = 0; p->name; p++, option_index++)
+                if (!strncmp(p->name, nextchar, nameend - nextchar)) {
+                    if ((unsigned int) (nameend - nextchar) ==
+                        strlen(p->name)) {
+                        /* Exact match found.  */
+                        pfound = p;
+                        indfound = option_index;
+                        exact = 1;
+                        break;
+                    } else if (pfound == NULL) {
+                        /* First nonexact match found.  */
+                        pfound = p;
+                        indfound = option_index;
+                    } else
+                        /* Second or later nonexact match found.  */
+                        ambig = 1;
+                }
+            if (ambig && !exact) {
+                if (opterr)
+                    fprintf(stderr, _("%s: option `-W %s' is ambiguous\n"),
+                            argv[0], argv[optind]);
+                nextchar += strlen(nextchar);
+                optind++;
+                return '?';
+            }
+            if (pfound != NULL) {
+                option_index = indfound;
+                if (*nameend) {
+                    /* Don't test has_arg with >, because some C compilers don't
+                       allow it to be used on enums.  */
+                    if (pfound->has_arg)
+                        optarg = nameend + 1;
+                    else {
+                        if (opterr)
+                            fprintf(stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"), argv[0], pfound->name);
+
+                        nextchar += strlen(nextchar);
+                        return '?';
+                    }
+                } else if (pfound->has_arg == 1) {
+                    if (optind < argc)
+                        optarg = argv[optind++];
+                    else {
+                        if (opterr)
+                            fprintf(stderr,
+                                    _
+                                    ("%s: option `%s' requires an argument\n"),
+                                    argv[0], argv[optind - 1]);
+                        nextchar += strlen(nextchar);
+                        return optstring[0] == ':' ? ':' : '?';
+                    }
+                }
+                nextchar += strlen(nextchar);
+                if (longind != NULL)
+                    *longind = option_index;
+                if (pfound->flag) {
+                    *(pfound->flag) = pfound->val;
+                    return 0;
+                }
+                return pfound->val;
+            }
+            nextchar = NULL;
+            return 'W'; /* Let the application handle it.   */
+        }
+        if (temp[1] == ':') {
+            if (temp[2] == ':') {
+                /* This is an option that accepts an argument optionally.  */
+                if (*nextchar != '\0') {
+                    optarg = nextchar;
+                    optind++;
+                } else
+                    optarg = NULL;
+                nextchar = NULL;
+            } else {
+                /* This is an option that requires an argument.  */
+                if (*nextchar != '\0') {
+                    optarg = nextchar;
+                    /* If we end this ARGV-element by taking the rest as an arg,
+                       we must advance to the next element now.  */
+                    optind++;
+                } else if (optind == argc) {
+                    if (opterr) {
+                        /* 1003.2 specifies the format of this message.  */
+                        fprintf(stderr,
+                                _("%s: option requires an argument -- %c\n"),
+                                argv[0], c);
+                    }
+                    optopt = c;
+                    if (optstring[0] == ':')
+                        c = ':';
+                    else
+                        c = '?';
+                } else
+                    /* We already incremented `optind' once;
+                       increment it again when taking next ARGV-elt as argument.  */
+                    optarg = argv[optind++];
+                nextchar = NULL;
+            }
+        }
+        return c;
     }
-
-  /* Look at and handle the next short option-character.  */
-
-  {
-    char c = *nextchar++;
-    char *temp = my_index (optstring, c);
-
-    /* Increment `optind' when we start to process its last character.  */
-    if (*nextchar == '\0')
-      ++optind;
-
-    if (temp == NULL || c == ':')
-      {
-       if (opterr)
-         {
-           if (posixly_correct)
-             /* 1003.2 specifies the format of this message.  */
-             fprintf (stderr, _("%s: illegal option -- %c\n"),
-                      argv[0], c);
-           else
-             fprintf (stderr, _("%s: invalid option -- %c\n"),
-                      argv[0], c);
-         }
-       optopt = c;
-       return '?';
-      }
-    /* Convenience. Treat POSIX -W foo same as long option --foo */
-    if (temp[0] == 'W' && temp[1] == ';')
-      {
-       char *nameend;
-       const struct option *p;
-       const struct option *pfound = NULL;
-       int exact = 0;
-       int ambig = 0;
-       int indfound = 0;
-       int option_index;
-
-       /* This is an option that requires an argument.  */
-       if (*nextchar != '\0')
-         {
-           optarg = nextchar;
-           /* If we end this ARGV-element by taking the rest as an arg,
-              we must advance to the next element now.  */
-           optind++;
-         }
-       else if (optind == argc)
-         {
-           if (opterr)
-             {
-               /* 1003.2 specifies the format of this message.  */
-               fprintf (stderr, _("%s: option requires an argument -- %c\n"),
-                        argv[0], c);
-             }
-           optopt = c;
-           if (optstring[0] == ':')
-             c = ':';
-           else
-             c = '?';
-           return c;
-         }
-       else
-         /* We already incremented `optind' once;
-            increment it again when taking next ARGV-elt as argument.  */
-         optarg = argv[optind++];
-
-       /* optarg is now the argument, see if it's in the
-          table of longopts.  */
-
-       for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
-         /* Do nothing.  */ ;
-
-       /* Test all long options for either exact match
-          or abbreviated matches.  */
-       for (p = longopts, option_index = 0; p->name; p++, option_index++)
-         if (!strncmp (p->name, nextchar, nameend - nextchar))
-           {
-             if ((unsigned int) (nameend - nextchar) == strlen (p->name))
-               {
-                 /* Exact match found.  */
-                 pfound = p;
-                 indfound = option_index;
-                 exact = 1;
-                 break;
-               }
-             else if (pfound == NULL)
-               {
-                 /* First nonexact match found.  */
-                 pfound = p;
-                 indfound = option_index;
-               }
-             else
-               /* Second or later nonexact match found.  */
-               ambig = 1;
-           }
-       if (ambig && !exact)
-         {
-           if (opterr)
-             fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
-                      argv[0], argv[optind]);
-           nextchar += strlen (nextchar);
-           optind++;
-           return '?';
-         }
-       if (pfound != NULL)
-         {
-           option_index = indfound;
-           if (*nameend)
-             {
-               /* Don't test has_arg with >, because some C compilers don't
-                  allow it to be used on enums.  */
-               if (pfound->has_arg)
-                 optarg = nameend + 1;
-               else
-                 {
-                   if (opterr)
-                     fprintf (stderr, _("\
-%s: option `-W %s' doesn't allow an argument\n"),
-                              argv[0], pfound->name);
-
-                   nextchar += strlen (nextchar);
-                   return '?';
-                 }
-             }
-           else if (pfound->has_arg == 1)
-             {
-               if (optind < argc)
-                 optarg = argv[optind++];
-               else
-                 {
-                   if (opterr)
-                     fprintf (stderr,
-                              _("%s: option `%s' requires an argument\n"),
-                              argv[0], argv[optind - 1]);
-                   nextchar += strlen (nextchar);
-                   return optstring[0] == ':' ? ':' : '?';
-                 }
-             }
-           nextchar += strlen (nextchar);
-           if (longind != NULL)
-             *longind = option_index;
-           if (pfound->flag)
-             {
-               *(pfound->flag) = pfound->val;
-               return 0;
-             }
-           return pfound->val;
-         }
-         nextchar = NULL;
-         return 'W';   /* Let the application handle it.   */
-      }
-    if (temp[1] == ':')
-      {
-       if (temp[2] == ':')
-         {
-           /* This is an option that accepts an argument optionally.  */
-           if (*nextchar != '\0')
-             {
-               optarg = nextchar;
-               optind++;
-             }
-           else
-             optarg = NULL;
-           nextchar = NULL;
-         }
-       else
-         {
-           /* This is an option that requires an argument.  */
-           if (*nextchar != '\0')
-             {
-               optarg = nextchar;
-               /* If we end this ARGV-element by taking the rest as an arg,
-                  we must advance to the next element now.  */
-               optind++;
-             }
-           else if (optind == argc)
-             {
-               if (opterr)
-                 {
-                   /* 1003.2 specifies the format of this message.  */
-                   fprintf (stderr,
-                          _("%s: option requires an argument -- %c\n"),
-                          argv[0], c);
-                 }
-               optopt = c;
-               if (optstring[0] == ':')
-                 c = ':';
-               else
-                 c = '?';
-             }
-           else
-             /* We already incremented `optind' once;
-                increment it again when taking next ARGV-elt as argument.  */
-             optarg = argv[optind++];
-           nextchar = NULL;
-         }
-      }
-    return c;
-  }
 }
 
-int
-getopt (argc, argv, optstring)
-     int argc;
-     char *const *argv;
-     const char *optstring;
+int getopt(
+    argc,
+    argv,
+    optstring)
+    int argc;
+    char     *const *argv;
+    const char *optstring;
 {
-  return _getopt_internal (argc, argv, optstring,
-                          (const struct option *) 0,
-                          (int *) 0,
-                          0);
+    return _getopt_internal(argc, argv, optstring,
+                            (const struct option *) 0, (int *) 0, 0);
 }
 
-#endif /* Not ELIDE_CODE.  */
+#endif                          /* Not ELIDE_CODE.  */
 \f
 #ifdef TEST
 
 /* Compile with -DTEST to make an executable for use in testing
    the above definition of `getopt'.  */
 
-int
-main (argc, argv)
-     int argc;
-     char **argv;
+int main(
+    argc,
+    argv)
+    int argc;
+    char    **argv;
 {
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-
-      c = getopt (argc, argv, "abc:d:0123456789");
-      if (c == -1)
-       break;
-
-      switch (c)
-       {
-       case '0':
-       case '1':
-       case '2':
-       case '3':
-       case '4':
-       case '5':
-       case '6':
-       case '7':
-       case '8':
-       case '9':
-         if (digit_optind != 0 && digit_optind != this_option_optind)
-           printf ("digits occur in two different argv-elements.\n");
-         digit_optind = this_option_optind;
-         printf ("option %c\n", c);
-         break;
-
-       case 'a':
-         printf ("option a\n");
-         break;
-
-       case 'b':
-         printf ("option b\n");
-         break;
-
-       case 'c':
-         printf ("option c with value `%s'\n", optarg);
-         break;
-
-       case '?':
-         break;
-
-       default:
-         printf ("?? getopt returned character code 0%o ??\n", c);
-       }
+    int       c;
+    int       digit_optind = 0;
+
+    while (1) {
+        int       this_option_optind = optind ? optind : 1;
+
+        c = getopt(argc, argv, "abc:d:0123456789");
+        if (c == -1)
+            break;
+
+        switch (c) {
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+            if (digit_optind != 0 && digit_optind != this_option_optind)
+                printf("digits occur in two different argv-elements.\n");
+            digit_optind = this_option_optind;
+            printf("option %c\n", c);
+            break;
+
+        case 'a':
+            printf("option a\n");
+            break;
+
+        case 'b':
+            printf("option b\n");
+            break;
+
+        case 'c':
+            printf("option c with value `%s'\n", optarg);
+            break;
+
+        case '?':
+            break;
+
+        default:
+            printf("?? getopt returned character code 0%o ??\n", c);
+        }
     }
 
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-       printf ("%s ", argv[optind++]);
-      printf ("\n");
+    if (optind < argc) {
+        printf("non-option ARGV-elements: ");
+        while (optind < argc)
+            printf("%s ", argv[optind++]);
+        printf("\n");
     }
 
-  exit (0);
+    exit(0);
 }
 
-#endif /* TEST */
+#endif                          /* TEST */
index 7dad11b..91906ef 100644 (file)
@@ -23,7 +23,7 @@
 #define _GETOPT_H 1
 
 #ifdef __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 /* For communication from `getopt' to the caller.
@@ -32,7 +32,7 @@ extern "C" {
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-extern char *optarg;
+    extern char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -46,16 +46,16 @@ extern char *optarg;
    Otherwise, `optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
-extern int optind;
+    extern int optind;
 
 /* Callers store zero here to inhibit the error message `getopt' prints
    for unrecognized options.  */
 
-extern int opterr;
+    extern int opterr;
 
 /* Set to an option character which was unrecognized.  */
 
-extern int optopt;
+    extern int optopt;
 
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
@@ -78,19 +78,18 @@ extern int optopt;
    one).  For long options that have a zero `flag' field, `getopt'
    returns the contents of the `val' field.  */
 
-struct option
-{
+    struct option {
 #if defined (__STDC__) && __STDC__
-  const char *name;
+        const char *name;
 #else
-  char *name;
+        char     *name;
 #endif
-  /* has_arg can't be an enum because some compilers complain about
-     type mismatches in all the code that assumes it is an int.  */
-  int has_arg;
-  int *flag;
-  int val;
-};
+        /* has_arg can't be an enum because some compilers complain about
+           type mismatches in all the code that assumes it is an int.  */
+        int       has_arg;
+        int      *flag;
+        int       val;
+    };
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
@@ -103,31 +102,48 @@ struct option
 /* Many other libraries have conflicting prototypes for getopt, with
    differences in the consts, in stdlib.h.  To avoid compilation
    errors, only prototype getopt for the GNU C library.  */
-extern int getopt (int argc, char *const *argv, const char *shortopts);
-#else /* not __GNU_LIBRARY__ */
-extern int getopt ();
-#endif /* __GNU_LIBRARY__ */
-extern int getopt_long (int argc, char *const *argv, const char *shortopts,
-                       const struct option *longopts, int *longind);
-extern int getopt_long_only (int argc, char *const *argv,
-                            const char *shortopts,
-                            const struct option *longopts, int *longind);
+    extern int getopt(
+    int argc,
+    char *const *argv,
+    const char *shortopts);
+#else                   /* not __GNU_LIBRARY__ */
+    extern int getopt(
+        );
+#endif                  /* __GNU_LIBRARY__ */
+    extern int getopt_long(
+    int argc,
+    char *const *argv,
+    const char *shortopts,
+    const struct option *longopts,
+    int *longind);
+    extern int getopt_long_only(
+    int argc,
+    char *const *argv,
+    const char *shortopts,
+    const struct option *longopts,
+    int *longind);
 
 /* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int argc, char *const *argv,
-                            const char *shortopts,
-                            const struct option *longopts, int *longind,
-                            int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* __STDC__ */
+    extern int _getopt_internal(
+    int argc,
+    char *const *argv,
+    const char *shortopts,
+    const struct option *longopts,
+    int *longind,
+    int long_only);
+#else                   /* not __STDC__ */
+    extern int getopt(
+        );
+    extern int getopt_long(
+        );
+    extern int getopt_long_only(
+        );
+
+    extern int _getopt_internal(
+        );
+#endif                  /* __STDC__ */
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _GETOPT_H */
+#endif                  /* _GETOPT_H */
index 14e1e88..6ace794 100644 (file)
 #define NULL 0
 #endif
 
-int
-getopt_long (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
+int getopt_long(
+    argc,
+    argv,
+    options,
+    long_options,
+    opt_index)
+    int argc;
+    char     *const *argv;
+    const char *options;
+    const struct option *long_options;
+    int      *opt_index;
 {
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+    return _getopt_internal(argc, argv, options, long_options, opt_index, 0);
 }
 
 /* Like getopt_long, but '-' as well as '--' can indicate a long option.
@@ -80,110 +84,111 @@ getopt_long (argc, argv, options, long_options, opt_index)
    but does match a short option, it is parsed as a short option
    instead.  */
 
-int
-getopt_long_only (argc, argv, options, long_options, opt_index)
-     int argc;
-     char *const *argv;
-     const char *options;
-     const struct option *long_options;
-     int *opt_index;
+int getopt_long_only(
+    argc,
+    argv,
+    options,
+    long_options,
+    opt_index)
+    int argc;
+    char     *const *argv;
+    const char *options;
+    const struct option *long_options;
+    int      *opt_index;
 {
-  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+    return _getopt_internal(argc, argv, options, long_options, opt_index, 1);
 }
 
 
-#endif /* Not ELIDE_CODE.  */
+#endif                          /* Not ELIDE_CODE.  */
 \f
 #ifdef TEST
 
 #include <stdio.h>
 
-int
-main (argc, argv)
-     int argc;
-     char **argv;
+int main(
+    argc,
+    argv)
+    int argc;
+    char    **argv;
 {
-  int c;
-  int digit_optind = 0;
-
-  while (1)
-    {
-      int this_option_optind = optind ? optind : 1;
-      int option_index = 0;
-      static struct option long_options[] =
-      {
-       {"add", 1, 0, 0},
-       {"append", 0, 0, 0},
-       {"delete", 1, 0, 0},
-       {"verbose", 0, 0, 0},
-       {"create", 0, 0, 0},
-       {"file", 1, 0, 0},
-       {0, 0, 0, 0}
-      };
-
-      c = getopt_long (argc, argv, "abc:d:0123456789",
-                      long_options, &option_index);
-      if (c == -1)
-       break;
-
-      switch (c)
-       {
-       case 0:
-         printf ("option %s", long_options[option_index].name);
-         if (optarg)
-           printf (" with arg %s", optarg);
-         printf ("\n");
-         break;
-
-       case '0':
-       case '1':
-       case '2':
-       case '3':
-       case '4':
-       case '5':
-       case '6':
-       case '7':
-       case '8':
-       case '9':
-         if (digit_optind != 0 && digit_optind != this_option_optind)
-           printf ("digits occur in two different argv-elements.\n");
-         digit_optind = this_option_optind;
-         printf ("option %c\n", c);
-         break;
-
-       case 'a':
-         printf ("option a\n");
-         break;
-
-       case 'b':
-         printf ("option b\n");
-         break;
-
-       case 'c':
-         printf ("option c with value `%s'\n", optarg);
-         break;
-
-       case 'd':
-         printf ("option d with value `%s'\n", optarg);
-         break;
-
-       case '?':
-         break;
-
-       default:
-         printf ("?? getopt returned character code 0%o ??\n", c);
-       }
+    int       c;
+    int       digit_optind = 0;
+
+    while (1) {
+        int       this_option_optind = optind ? optind : 1;
+        int       option_index = 0;
+        static struct option long_options[] = {
+            {"add", 1, 0, 0},
+            {"append", 0, 0, 0},
+            {"delete", 1, 0, 0},
+            {"verbose", 0, 0, 0},
+            {"create", 0, 0, 0},
+            {"file", 1, 0, 0},
+            {0, 0, 0, 0}
+        };
+
+        c = getopt_long(argc, argv, "abc:d:0123456789",
+                        long_options, &option_index);
+        if (c == -1)
+            break;
+
+        switch (c) {
+        case 0:
+            printf("option %s", long_options[option_index].name);
+            if (optarg)
+                printf(" with arg %s", optarg);
+            printf("\n");
+            break;
+
+        case '0':
+        case '1':
+        case '2':
+        case '3':
+        case '4':
+        case '5':
+        case '6':
+        case '7':
+        case '8':
+        case '9':
+            if (digit_optind != 0 && digit_optind != this_option_optind)
+                printf("digits occur in two different argv-elements.\n");
+            digit_optind = this_option_optind;
+            printf("option %c\n", c);
+            break;
+
+        case 'a':
+            printf("option a\n");
+            break;
+
+        case 'b':
+            printf("option b\n");
+            break;
+
+        case 'c':
+            printf("option c with value `%s'\n", optarg);
+            break;
+
+        case 'd':
+            printf("option d with value `%s'\n", optarg);
+            break;
+
+        case '?':
+            break;
+
+        default:
+            printf("?? getopt returned character code 0%o ??\n", c);
+        }
     }
 
-  if (optind < argc)
-    {
-      printf ("non-option ARGV-elements: ");
-      while (optind < argc)
-       printf ("%s ", argv[optind++]);
-      printf ("\n");
+    if (optind < argc) {
+        printf("non-option ARGV-elements: ");
+        while (optind < argc)
+            printf("%s ", argv[optind++]);
+        printf("\n");
     }
 
-  exit (0);
+    exit(0);
 }
 
-#endif /* TEST */
+#endif                          /* TEST */
index 2cdf20c..872c02c 100644 (file)
@@ -9,13 +9,13 @@
 /* stupid MSVC doesnt support variadic macros = no debug for now! */
 #ifdef _MSC_VER
 # define RRDPRINTF()
-#else 
+#else
 # ifdef DEBUG
 #  define RRDPRINTF(...)  fprintf(stderr, __VA_ARGS__);
 # else
 #  define RRDPRINTF(...)
-# endif /* DEBUG */
-#endif /* _MSC_VER */
+# endif                         /* DEBUG */
+#endif                          /* _MSC_VER */
 #include "rrd_tool.h"
 #include <png.h>
 #include <ft2build.h>
 
 typedef struct gfx_char_s *gfx_char;
 struct gfx_char_s {
-  FT_UInt     index;    /* glyph index */
-  FT_Vector   pos;      /* location from baseline in 26.6 */
-  FT_Glyph    image;    /* glyph bitmap */
+    FT_UInt   index;    /* glyph index */
+    FT_Vector pos;      /* location from baseline in 26.6 */
+    FT_Glyph  image;    /* glyph bitmap */
 };
 
 typedef struct gfx_string_s *gfx_string;
 struct gfx_string_s {
-  unsigned int    width;
-  unsigned int    height;
-  int            count;  /* number of characters */
-  gfx_char        glyphs;
-  size_t          num_glyphs;
-  FT_BBox         bbox;
-  FT_Matrix       transform;
+    unsigned int width;
+    unsigned int height;
+    int       count;    /* number of characters */
+    gfx_char  glyphs;
+    size_t    num_glyphs;
+    FT_BBox   bbox;
+    FT_Matrix transform;
 };
 
 /* compute string bbox */
-static void compute_string_bbox(gfx_string string);
+static void compute_string_bbox(
+    gfx_string string);
 
 /* create a freetype glyph string */
-gfx_string gfx_string_create ( gfx_canvas_t *canvas, FT_Face face,
-                               const char *text, int rotation, double tabwidth, double size);
+gfx_string gfx_string_create(
+    gfx_canvas_t * canvas,
+    FT_Face face,
+    const char *text,
+    int rotation,
+    double tabwidth,
+    double size);
 
 /* create a freetype glyph string */
-static void gfx_string_destroy ( gfx_string string );
+static void gfx_string_destroy(
+    gfx_string string);
 
 static
-gfx_node_t *gfx_new_node( gfx_canvas_t *canvas,enum gfx_en type){
-  gfx_node_t *node = art_new(gfx_node_t,1);
-  if (node == NULL) return NULL;
-  node->type = type;
-  node->color = 0x0;        /* color of element  0xRRGGBBAA  alpha 0xff is solid*/
-  node->size =0.0;         /* font size, line width */
-  node->path = NULL;        /* path */
-  node->points = 0;
-  node->points_max =0;
-  node->closed_path = 0;
-  node->filename = NULL;             /* font or image filename */
-  node->text = NULL;
-  node->x = 0.0;
-  node->y = 0.0;          /* position */
-  node->angle = 0;  
-  node->halign = GFX_H_NULL; /* text alignement */
-  node->valign = GFX_V_NULL; /* text alignement */
-  node->tabwidth = 0.0; 
-  node->next = NULL; 
-  if (canvas->lastnode != NULL){
-      canvas->lastnode->next = node;
-  }
-  if (canvas->firstnode == NULL){
-      canvas->firstnode = node;
-  }  
-  canvas->lastnode = node;
-  return node;
-}
-
-gfx_canvas_t *gfx_new_canvas (void) {
-    gfx_canvas_t *canvas = art_new(gfx_canvas_t,1);
+gfx_node_t *gfx_new_node(
+    gfx_canvas_t * canvas,
+    enum gfx_en type)
+{
+    gfx_node_t *node = art_new(gfx_node_t, 1);
+
+    if (node == NULL)
+        return NULL;
+    node->type = type;
+    node->color = 0x0;  /* color of element  0xRRGGBBAA  alpha 0xff is solid */
+    node->size = 0.0;   /* font size, line width */
+    node->path = NULL;  /* path */
+    node->points = 0;
+    node->points_max = 0;
+    node->closed_path = 0;
+    node->filename = NULL;  /* font or image filename */
+    node->text = NULL;
+    node->x = 0.0;
+    node->y = 0.0;      /* position */
+    node->angle = 0;
+    node->halign = GFX_H_NULL;  /* text alignement */
+    node->valign = GFX_V_NULL;  /* text alignement */
+    node->tabwidth = 0.0;
+    node->next = NULL;
+    if (canvas->lastnode != NULL) {
+        canvas->lastnode->next = node;
+    }
+    if (canvas->firstnode == NULL) {
+        canvas->firstnode = node;
+    }
+    canvas->lastnode = node;
+    return node;
+}
+
+gfx_canvas_t *gfx_new_canvas(
+    void)
+{
+    gfx_canvas_t *canvas = art_new(gfx_canvas_t, 1);
+
     canvas->firstnode = NULL;
     canvas->lastnode = NULL;
     canvas->imgformat = IF_PNG; /* we default to PNG output */
@@ -103,581 +118,697 @@ gfx_canvas_t *gfx_new_canvas (void) {
 }
 
 /* create a new line */
-gfx_node_t  *gfx_new_line(gfx_canvas_t *canvas, 
-                          double X0, double Y0, 
-                          double X1, double Y1,
-                          double width, gfx_color_t color){
-  return gfx_new_dashed_line(canvas, X0, Y0, X1, Y1, width, color, 0, 0);
-}
-
-gfx_node_t  *gfx_new_dashed_line(gfx_canvas_t *canvas, 
-                          double X0, double Y0, 
-                          double X1, double Y1,
-                          double width, gfx_color_t color,
-                          double dash_on, double dash_off){
-
-  gfx_node_t *node;
-  ArtVpath *vec;
-  node = gfx_new_node(canvas,GFX_LINE);
-  if (node == NULL) return NULL;
-  vec = art_new(ArtVpath, 3);
-  if (vec == NULL) return NULL;
-  vec[0].code = ART_MOVETO_OPEN; vec[0].x=X0+LINEOFFSET; vec[0].y=Y0+LINEOFFSET;
-  vec[1].code = ART_LINETO; vec[1].x=X1+LINEOFFSET; vec[1].y=Y1+LINEOFFSET;
-  vec[2].code = ART_END; vec[2].x=0;vec[2].y=0;
-  
-  node->points = 3;
-  node->points_max = 3;
-  node->color = color;
-  node->size  = width;
-  node->dash_on = dash_on;
-  node->dash_off = dash_off;
-  node->path  = vec;
-  return node;
+gfx_node_t *gfx_new_line(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double width,
+    gfx_color_t color)
+{
+    return gfx_new_dashed_line(canvas, X0, Y0, X1, Y1, width, color, 0, 0);
+}
+
+gfx_node_t *gfx_new_dashed_line(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double width,
+    gfx_color_t color,
+    double dash_on,
+    double dash_off)
+{
+
+    gfx_node_t *node;
+    ArtVpath *vec;
+
+    node = gfx_new_node(canvas, GFX_LINE);
+    if (node == NULL)
+        return NULL;
+    vec = art_new(ArtVpath, 3);
+    if (vec == NULL)
+        return NULL;
+    vec[0].code = ART_MOVETO_OPEN;
+    vec[0].x = X0 + LINEOFFSET;
+    vec[0].y = Y0 + LINEOFFSET;
+    vec[1].code = ART_LINETO;
+    vec[1].x = X1 + LINEOFFSET;
+    vec[1].y = Y1 + LINEOFFSET;
+    vec[2].code = ART_END;
+    vec[2].x = 0;
+    vec[2].y = 0;
+
+    node->points = 3;
+    node->points_max = 3;
+    node->color = color;
+    node->size = width;
+    node->dash_on = dash_on;
+    node->dash_off = dash_off;
+    node->path = vec;
+    return node;
 }
 
 /* create a new area */
-gfx_node_t   *gfx_new_area   (gfx_canvas_t *canvas, 
-                             double X0, double Y0,
-                             double X1, double Y1,
-                             double X2, double Y2,
-                             gfx_color_t color) {
-
-  gfx_node_t *node;
-  ArtVpath *vec;
-  node = gfx_new_node(canvas,GFX_AREA);
-  if (node == NULL) return NULL;
-  vec = art_new(ArtVpath, 5);
-  if (vec == NULL) return NULL;
-  vec[0].code = ART_MOVETO; vec[0].x=X0; vec[0].y=Y0;
-  vec[1].code = ART_LINETO; vec[1].x=X1; vec[1].y=Y1;
-  vec[2].code = ART_LINETO; vec[2].x=X2; vec[2].y=Y2;
-  vec[3].code = ART_LINETO; vec[3].x=X0; vec[3].y=Y0;
-  vec[4].code = ART_END; vec[4].x=0; vec[4].y=0;
-  
-  node->points = 5;
-  node->points_max = 5;
-  node->color = color;
-  node->path  = vec;
-
-  return node;
+gfx_node_t *gfx_new_area(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double X2,
+    double Y2,
+    gfx_color_t color)
+{
+
+    gfx_node_t *node;
+    ArtVpath *vec;
+
+    node = gfx_new_node(canvas, GFX_AREA);
+    if (node == NULL)
+        return NULL;
+    vec = art_new(ArtVpath, 5);
+    if (vec == NULL)
+        return NULL;
+    vec[0].code = ART_MOVETO;
+    vec[0].x = X0;
+    vec[0].y = Y0;
+    vec[1].code = ART_LINETO;
+    vec[1].x = X1;
+    vec[1].y = Y1;
+    vec[2].code = ART_LINETO;
+    vec[2].x = X2;
+    vec[2].y = Y2;
+    vec[3].code = ART_LINETO;
+    vec[3].x = X0;
+    vec[3].y = Y0;
+    vec[4].code = ART_END;
+    vec[4].x = 0;
+    vec[4].y = 0;
+
+    node->points = 5;
+    node->points_max = 5;
+    node->color = color;
+    node->path = vec;
+
+    return node;
 }
 
 /* add a point to a line or to an area */
-int           gfx_add_point  (gfx_node_t *node, 
-                             double x, double y){
-  if (node == NULL) return 1;
-  if (node->type == GFX_AREA) {
-    double X0 = node->path[0].x;
-    double Y0 = node->path[0].y;
-    node->points -= 2;
-    art_vpath_add_point (&(node->path),
-                         &(node->points),
-                         &(node->points_max),
-                         ART_LINETO,
-                         x,y);
-    art_vpath_add_point (&(node->path),
-                         &(node->points),
-                         &(node->points_max),
-                         ART_LINETO,
-                         X0,Y0);
-    art_vpath_add_point (&(node->path),
-                         &(node->points),
-                         &(node->points_max),
-                         ART_END,
-                         0,0);
-  } else if (node->type == GFX_LINE) {
-    node->points -= 1;
-    art_vpath_add_point (&(node->path),
-                         &(node->points),
-                         &(node->points_max),
-                         ART_LINETO,
-                         x+LINEOFFSET,y+LINEOFFSET);
-    art_vpath_add_point (&(node->path),
-                         &(node->points),
-                         &(node->points_max),
-                         ART_END,
-                         0,0);
-    
-  } else {
-    /* can only add point to areas and lines */
-    return 1;
-  }
-  return 0;
+int gfx_add_point(
+    gfx_node_t * node,
+    double x,
+    double y)
+{
+    if (node == NULL)
+        return 1;
+    if (node->type == GFX_AREA) {
+        double    X0 = node->path[0].x;
+        double    Y0 = node->path[0].y;
+
+        node->points -= 2;
+        art_vpath_add_point(&(node->path),
+                            &(node->points),
+                            &(node->points_max), ART_LINETO, x, y);
+        art_vpath_add_point(&(node->path),
+                            &(node->points),
+                            &(node->points_max), ART_LINETO, X0, Y0);
+        art_vpath_add_point(&(node->path),
+                            &(node->points),
+                            &(node->points_max), ART_END, 0, 0);
+    } else if (node->type == GFX_LINE) {
+        node->points -= 1;
+        art_vpath_add_point(&(node->path),
+                            &(node->points),
+                            &(node->points_max),
+                            ART_LINETO, x + LINEOFFSET, y + LINEOFFSET);
+        art_vpath_add_point(&(node->path),
+                            &(node->points),
+                            &(node->points_max), ART_END, 0, 0);
+
+    } else {
+        /* can only add point to areas and lines */
+        return 1;
+    }
+    return 0;
 }
 
-void           gfx_close_path  (gfx_node_t *node) {
+void gfx_close_path(
+    gfx_node_t * node)
+{
     node->closed_path = 1;
     if (node->path[0].code == ART_MOVETO_OPEN)
-       node->path[0].code = ART_MOVETO;
+        node->path[0].code = ART_MOVETO;
 }
 
 /* create a text node */
-gfx_node_t   *gfx_new_text   (gfx_canvas_t *canvas,  
-                             double x, double y, gfx_color_t color,
-                             char* font, double size,                        
-                             double tabwidth, double angle,
-                             enum gfx_h_align_en h_align,
-                             enum gfx_v_align_en v_align,
-                              char* text){
-   gfx_node_t *node = gfx_new_node(canvas,GFX_TEXT);
-   
-   node->text = strdup(text);
-   node->size = size;
-   node->filename = strdup(font);
-   node->x = x;
-   node->y = y;
-   node->angle = angle;   
-   node->color = color;
-   node->tabwidth = tabwidth;
-   node->halign = h_align;
-   node->valign = v_align;
+gfx_node_t *gfx_new_text(
+    gfx_canvas_t * canvas,
+    double x,
+    double y,
+    gfx_color_t color,
+    char *font,
+    double size,
+    double tabwidth,
+    double angle,
+    enum gfx_h_align_en h_align,
+    enum gfx_v_align_en v_align,
+    char *text)
+{
+    gfx_node_t *node = gfx_new_node(canvas, GFX_TEXT);
+
+    node->text = strdup(text);
+    node->size = size;
+    node->filename = strdup(font);
+    node->x = x;
+    node->y = y;
+    node->angle = angle;
+    node->color = color;
+    node->tabwidth = tabwidth;
+    node->halign = h_align;
+    node->valign = v_align;
 #if 0
-  /* debugging: show text anchor
-     green is along x-axis, red is downward y-axis */
-   if (1) {
-     double a = 2 * M_PI * -node->angle / 360.0;
-     double cos_a = cos(a);
-     double sin_a = sin(a);
-     double len = 3;
-     gfx_new_line(canvas,
-        x, y,
-        x + len * cos_a, y - len * sin_a,
-        0.2, 0x00FF0000);
-     gfx_new_line(canvas,
-        x, y,
-        x + len * sin_a, y + len * cos_a,
-        0.2, 0xFF000000);
-   }
+    /* debugging: show text anchor
+       green is along x-axis, red is downward y-axis */
+    if (1) {
+        double    a = 2 * M_PI * -node->angle / 360.0;
+        double    cos_a = cos(a);
+        double    sin_a = sin(a);
+        double    len = 3;
+
+        gfx_new_line(canvas,
+                     x, y, x + len * cos_a, y - len * sin_a, 0.2, 0x00FF0000);
+        gfx_new_line(canvas,
+                     x, y, x + len * sin_a, y + len * cos_a, 0.2, 0xFF000000);
+    }
 #endif
-   return node;
-}
-
-int           gfx_render(gfx_canvas_t *canvas, 
-                             art_u32 width, art_u32 height, 
-                             gfx_color_t background, FILE *fp){
-  switch (canvas->imgformat) {
-  case IF_PNG: 
-    return gfx_render_png (canvas, width, height, background, fp);
-  case IF_SVG: 
-    return gfx_render_svg (canvas, width, height, background, fp);
-  case IF_EPS:
-    return gfx_render_eps (canvas, width, height, background, fp);
-  case IF_PDF:
-    return gfx_render_pdf (canvas, width, height, background, fp);
-  default:
-    return -1;
-  }
-}
-
-static void gfx_string_destroy ( gfx_string string ) {
-  unsigned int n;
-  if (string->glyphs) {
-    for (n=0; n<string->num_glyphs; ++n)
-      FT_Done_Glyph (string->glyphs[n].image);
-    free (string->glyphs);
-  }
-  free (string);
-}
-
-
-double gfx_get_text_width ( gfx_canvas_t *canvas,
-                           double start, char* font, double size,
-                           double tabwidth, char* text, int rotation){
-  switch (canvas->imgformat) {
-  case IF_PNG: 
-    return gfx_get_text_width_libart (canvas, start, font, size, tabwidth, text, rotation);
-  case IF_SVG: /* fall through */ 
-  case IF_EPS:
-  case IF_PDF:
-    return afm_get_text_width(start, font, size, tabwidth, text);
-  default:
-    return size * strlen(text);
-  }
-}
-
-double gfx_get_text_width_libart (
-                           gfx_canvas_t *canvas, double UNUSED(start), char* font, double size,
-                           double tabwidth, char* text, int rotation ){
-
-  int           error;
-  double        text_width=0;
-  FT_Face       face;
-  FT_Library    library=NULL;  
-  gfx_string    string;
-
-  FT_Init_FreeType( &library );
-  error = FT_New_Face( library, font, 0, &face );
-  if ( error ) {
-    FT_Done_FreeType(library);
-    return -1;
-  }
-  error = FT_Set_Char_Size(face,  size*64,size*64,  100,100);
-  if ( error ) {
+    return node;
+}
+
+int gfx_render(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fp)
+{
+    switch (canvas->imgformat) {
+    case IF_PNG:
+        return gfx_render_png(canvas, width, height, background, fp);
+    case IF_SVG:
+        return gfx_render_svg(canvas, width, height, background, fp);
+    case IF_EPS:
+        return gfx_render_eps(canvas, width, height, background, fp);
+    case IF_PDF:
+        return gfx_render_pdf(canvas, width, height, background, fp);
+    default:
+        return -1;
+    }
+}
+
+static void gfx_string_destroy(
+    gfx_string string)
+{
+    unsigned int n;
+
+    if (string->glyphs) {
+        for (n = 0; n < string->num_glyphs; ++n)
+            FT_Done_Glyph(string->glyphs[n].image);
+        free(string->glyphs);
+    }
+    free(string);
+}
+
+
+double gfx_get_text_width(
+    gfx_canvas_t * canvas,
+    double start,
+    char *font,
+    double size,
+    double tabwidth,
+    char *text,
+    int rotation)
+{
+    switch (canvas->imgformat) {
+    case IF_PNG:
+        return gfx_get_text_width_libart(canvas, start, font, size, tabwidth,
+                                         text, rotation);
+    case IF_SVG:       /* fall through */
+    case IF_EPS:
+    case IF_PDF:
+        return afm_get_text_width(start, font, size, tabwidth, text);
+    default:
+        return size * strlen(text);
+    }
+}
+
+double gfx_get_text_width_libart(
+    gfx_canvas_t * canvas,
+    double UNUSED(start),
+    char *font,
+    double size,
+    double tabwidth,
+    char *text,
+    int rotation)
+{
+
+    int       error;
+    double    text_width = 0;
+    FT_Face   face;
+    FT_Library library = NULL;
+    gfx_string string;
+
+    FT_Init_FreeType(&library);
+    error = FT_New_Face(library, font, 0, &face);
+    if (error) {
+        FT_Done_FreeType(library);
+        return -1;
+    }
+    error = FT_Set_Char_Size(face, size * 64, size * 64, 100, 100);
+    if (error) {
+        FT_Done_FreeType(library);
+        return -1;
+    }
+    string = gfx_string_create(canvas, face, text, rotation, tabwidth, size);
+    text_width = string->width;
+    gfx_string_destroy(string);
     FT_Done_FreeType(library);
-    return -1;
-  }
-  string = gfx_string_create( canvas, face, text, rotation, tabwidth, size );
-  text_width = string->width;
-  gfx_string_destroy(string);
-  FT_Done_FreeType(library);
-  return text_width/64;
+    return text_width / 64;
 }
 
-static void gfx_libart_close_path(gfx_node_t *node, ArtVpath **vec)
+static void gfx_libart_close_path(
+    gfx_node_t * node,
+    ArtVpath ** vec)
 {
     /* libart must have end==start for closed paths,
        even if using ART_MOVETO and not ART_MOVETO_OPEN
        so add extra point which is the same as the starting point */
-    int points_max = node->points; /* scaled array has exact size */
-    int points = node->points - 1;
-    art_vpath_add_point (vec, &points, &points_max, ART_LINETO,
-           (**vec).x, (**vec).y);
-    art_vpath_add_point (vec, &points, &points_max, ART_END, 0, 0);
+    int       points_max = node->points;    /* scaled array has exact size */
+    int       points = node->points - 1;
+
+    art_vpath_add_point(vec, &points, &points_max, ART_LINETO,
+                        (**vec).x, (**vec).y);
+    art_vpath_add_point(vec, &points, &points_max, ART_END, 0, 0);
 }
 
 
 /* find bbox of a string */
-static void compute_string_bbox(gfx_string string) {
+static void compute_string_bbox(
+    gfx_string string)
+{
     unsigned int n;
-    FT_BBox bbox;
+    FT_BBox   bbox;
 
     bbox.xMin = bbox.yMin = 32000;
     bbox.xMax = bbox.yMax = -32000;
-    for ( n = 0; n < string->num_glyphs; n++ ) {
-      FT_BBox glyph_bbox;
-      FT_Glyph_Get_CBox( string->glyphs[n].image, ft_glyph_bbox_gridfit,
-       &glyph_bbox );
-      if (glyph_bbox.xMin < bbox.xMin) {
-         bbox.xMin = glyph_bbox.xMin;
-      }
-      if (glyph_bbox.yMin < bbox.yMin) {
-        bbox.yMin = glyph_bbox.yMin;
-      }
-      if (glyph_bbox.xMax > bbox.xMax) {
-         bbox.xMax = glyph_bbox.xMax;
-      }
-      if (glyph_bbox.yMax > bbox.yMax) {
-         bbox.yMax = glyph_bbox.yMax;
-      }
-    }
-    if ( bbox.xMin > bbox.xMax ) { 
-      bbox.xMin = 0;
-      bbox.yMin = 0;
-      bbox.xMax = 0;
-      bbox.yMax = 0;
+    for (n = 0; n < string->num_glyphs; n++) {
+        FT_BBox   glyph_bbox;
+
+        FT_Glyph_Get_CBox(string->glyphs[n].image, ft_glyph_bbox_gridfit,
+                          &glyph_bbox);
+        if (glyph_bbox.xMin < bbox.xMin) {
+            bbox.xMin = glyph_bbox.xMin;
+        }
+        if (glyph_bbox.yMin < bbox.yMin) {
+            bbox.yMin = glyph_bbox.yMin;
+        }
+        if (glyph_bbox.xMax > bbox.xMax) {
+            bbox.xMax = glyph_bbox.xMax;
+        }
+        if (glyph_bbox.yMax > bbox.yMax) {
+            bbox.yMax = glyph_bbox.yMax;
+        }
+    }
+    if (bbox.xMin > bbox.xMax) {
+        bbox.xMin = 0;
+        bbox.yMin = 0;
+        bbox.xMax = 0;
+        bbox.yMax = 0;
     }
     string->bbox.xMin = bbox.xMin;
     string->bbox.xMax = bbox.xMax;
     string->bbox.yMin = bbox.yMin;
     string->bbox.yMax = bbox.yMax;
-} 
+}
 
 /* create a free type glyph string */
-gfx_string gfx_string_create(gfx_canvas_t *canvas, FT_Face face,const char *text,
-        int rotation, double tabwidth, double size )
+gfx_string gfx_string_create(
+    gfx_canvas_t * canvas,
+    FT_Face face,
+    const char *text,
+    int rotation,
+    double tabwidth,
+    double size)
 {
 
-  FT_GlyphSlot  slot = face->glyph;  /* a small shortcut */
-  FT_Bool       use_kerning;
-  FT_UInt       previous;
-  FT_Vector     ft_pen;
+    FT_GlyphSlot slot = face->glyph;    /* a small shortcut */
+    FT_Bool   use_kerning;
+    FT_UInt   previous;
+    FT_Vector ft_pen;
 
-  gfx_string    string = (gfx_string) malloc (sizeof(struct gfx_string_s));
+    gfx_string string = (gfx_string) malloc(sizeof(struct gfx_string_s));
 
-  gfx_char      glyph;          /* current glyph in table */
-  int          n;
-  int           error;
-  int        gottab = 0;    
+    gfx_char  glyph;    /* current glyph in table */
+    int       n;
+    int       error;
+    int       gottab = 0;
 
 #ifdef HAVE_MBSTOWCS
-  wchar_t      *cstr;
-  size_t       clen = strlen(text)+1;
-  cstr = malloc(sizeof(wchar_t) * clen); /* yes we are allocating probably too much here, I know */
-  string->count=mbstowcs(cstr,text,clen);
-  if ( string->count == -1){
-  /* conversion did not work, so lets fall back to just use what we got */
-       string->count=clen-1;
-        for(n=0;text[n] != '\0';n++){
-            cstr[n]=(unsigned char)text[n];
+    wchar_t  *cstr;
+    size_t    clen = strlen(text) + 1;
+
+    cstr = malloc(sizeof(wchar_t) * clen);  /* yes we are allocating probably too much here, I know */
+    string->count = mbstowcs(cstr, text, clen);
+    if (string->count == -1) {
+        /* conversion did not work, so lets fall back to just use what we got */
+        string->count = clen - 1;
+        for (n = 0; text[n] != '\0'; n++) {
+            cstr[n] = (unsigned char) text[n];
         }
-  }
+    }
 #else
-  char         *cstr = strdup(text);
-  string->count = strlen (text);
+    char     *cstr = strdup(text);
+
+    string->count = strlen(text);
 #endif
 
-  ft_pen.x = 0;   /* start at (0,0) !! */
-  ft_pen.y = 0;
-
-
-  string->width = 0;
-  string->height = 0;
-  string->glyphs = (gfx_char) calloc (string->count,sizeof(struct gfx_char_s));
-  string->num_glyphs = 0;
-  string->transform.xx = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000);
-  string->transform.xy = (FT_Fixed)(-sin(M_PI*(rotation)/180.0)*0x10000);
-  string->transform.yx = (FT_Fixed)( sin(M_PI*(rotation)/180.0)*0x10000);
-  string->transform.yy = (FT_Fixed)( cos(M_PI*(rotation)/180.0)*0x10000);
-
-  use_kerning = FT_HAS_KERNING(face);
-  previous    = 0;
-  glyph = string->glyphs;
-  for (n=0; n<string->count;glyph++,n++) {
-    FT_Vector   vec;
-    /* handle the tabs ...
-       have a witespace glyph inserted, but set its width such that the distance
-    of the new right edge is x times tabwidth from 0,0 where x is an integer. */    
-    unsigned int letter = cstr[n];
-       letter = afm_fix_osx_charset(letter); /* unsafe macro */
-          
-    gottab = 0;
-    if (letter == '\\' && n+1 < string->count && cstr[n+1] == 't'){
+    ft_pen.x = 0;       /* start at (0,0) !! */
+    ft_pen.y = 0;
+
+
+    string->width = 0;
+    string->height = 0;
+    string->glyphs =
+        (gfx_char) calloc(string->count, sizeof(struct gfx_char_s));
+    string->num_glyphs = 0;
+    string->transform.xx =
+        (FT_Fixed) (cos(M_PI * (rotation) / 180.0) * 0x10000);
+    string->transform.xy =
+        (FT_Fixed) (-sin(M_PI * (rotation) / 180.0) * 0x10000);
+    string->transform.yx =
+        (FT_Fixed) (sin(M_PI * (rotation) / 180.0) * 0x10000);
+    string->transform.yy =
+        (FT_Fixed) (cos(M_PI * (rotation) / 180.0) * 0x10000);
+
+    use_kerning = FT_HAS_KERNING(face);
+    previous = 0;
+    glyph = string->glyphs;
+    for (n = 0; n < string->count; glyph++, n++) {
+        FT_Vector vec;
+
+        /* handle the tabs ...
+           have a witespace glyph inserted, but set its width such that the distance
+           of the new right edge is x times tabwidth from 0,0 where x is an integer. */
+        unsigned int letter = cstr[n];
+
+        letter = afm_fix_osx_charset(letter);   /* unsafe macro */
+
+        gottab = 0;
+        if (letter == '\\' && n + 1 < string->count && cstr[n + 1] == 't') {
             /* we have a tab here so skip the backslash and
                set t to ' ' so that we get a white space */
             gottab = 1;
             n++;
-            letter  = ' ';            
-    }            
-    if (letter == '\t'){
-       letter = ' ';
-        gottab = 1 ;
-    }            
-    /* initialize each struct gfx_char_s */
-    glyph->index = 0;
-    glyph->pos.x = 0;
-    glyph->pos.y = 0;
-    glyph->image = NULL;
-    glyph->index = FT_Get_Char_Index( face, letter );
-
-    /* compute glyph origin */
-    if ( use_kerning && previous && glyph->index ) {
-      FT_Vector kerning;
-      FT_Get_Kerning (face, previous, glyph->index,
-          ft_kerning_default, &kerning);
-      ft_pen.x += kerning.x;
-      ft_pen.y += kerning.y;
-    }
-
-    /* load the glyph image (in its native format) */
-    /* for now, we take a monochrome glyph bitmap */
-    error = FT_Load_Glyph (face, glyph->index, size > canvas->font_aa_threshold ?
-                            canvas->aa_type == AA_NORMAL ? FT_LOAD_TARGET_NORMAL :
-                            canvas->aa_type == AA_LIGHT ? FT_LOAD_TARGET_LIGHT :
-                            FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_MONO);
-    if (error) {
-      RRDPRINTF("couldn't load glyph:  %c\n", letter)
-      continue;
-    }
-    error = FT_Get_Glyph (slot, &glyph->image);
-    if (error) {
-      RRDPRINTF("couldn't get glyph %c from slot %d\n", letter, (int)slot)
-      continue;
-    }
-    /* if we are in tabbing mode, we replace the tab with a space and shift the position
-       of the space so that its left edge is where the tab was supposed to land us */
-    if (gottab){
-       /* we are in gridfitting mode so the calculations happen in 1/64 pixles */
-        ft_pen.x = tabwidth*64.0 * (float)(1 + (long)(ft_pen.x / (tabwidth * 64.0))) - slot->advance.x;
-    }
-    /* store current pen position */
-    glyph->pos.x = ft_pen.x;
-    glyph->pos.y = ft_pen.y;
+            letter = ' ';
+        }
+        if (letter == '\t') {
+            letter = ' ';
+            gottab = 1;
+        }
+        /* initialize each struct gfx_char_s */
+        glyph->index = 0;
+        glyph->pos.x = 0;
+        glyph->pos.y = 0;
+        glyph->image = NULL;
+        glyph->index = FT_Get_Char_Index(face, letter);
+
+        /* compute glyph origin */
+        if (use_kerning && previous && glyph->index) {
+            FT_Vector kerning;
+
+            FT_Get_Kerning(face, previous, glyph->index,
+                           ft_kerning_default, &kerning);
+            ft_pen.x += kerning.x;
+            ft_pen.y += kerning.y;
+        }
 
+        /* load the glyph image (in its native format) */
+        /* for now, we take a monochrome glyph bitmap */
+        error =
+            FT_Load_Glyph(face, glyph->index,
+                          size >
+                          canvas->font_aa_threshold ? canvas->aa_type ==
+                          AA_NORMAL ? FT_LOAD_TARGET_NORMAL : canvas->
+                          aa_type ==
+                          AA_LIGHT ? FT_LOAD_TARGET_LIGHT :
+                          FT_LOAD_TARGET_MONO : FT_LOAD_TARGET_MONO);
+        if (error) {
+            RRDPRINTF("couldn't load glyph:  %c\n", letter)
+                continue;
+        }
+        error = FT_Get_Glyph(slot, &glyph->image);
+        if (error) {
+            RRDPRINTF("couldn't get glyph %c from slot %d\n", letter,
+                      (int) slot)
+                continue;
+        }
+        /* if we are in tabbing mode, we replace the tab with a space and shift the position
+           of the space so that its left edge is where the tab was supposed to land us */
+        if (gottab) {
+            /* we are in gridfitting mode so the calculations happen in 1/64 pixles */
+            ft_pen.x =
+                tabwidth * 64.0 * (float) (1 +
+                                           (long) (ft_pen.x /
+                                                   (tabwidth * 64.0))) -
+                slot->advance.x;
+        }
+        /* store current pen position */
+        glyph->pos.x = ft_pen.x;
+        glyph->pos.y = ft_pen.y;
 
-    ft_pen.x   += slot->advance.x;    
-    ft_pen.y   += slot->advance.y;
 
-    /* rotate glyph */
-    vec = glyph->pos;
-    FT_Vector_Transform (&vec, &string->transform);
-    error = FT_Glyph_Transform (glyph->image, &string->transform, &vec);
-    if (error) {
-      RRDPRINTF("couldn't transform glyph id %d\n", letter)
-      continue;
-    }
+        ft_pen.x += slot->advance.x;
+        ft_pen.y += slot->advance.y;
 
-    /* convert to a bitmap - destroy native image */
-    error = FT_Glyph_To_Bitmap (&glyph->image, size > canvas->font_aa_threshold ?
-                            canvas->aa_type == AA_NORMAL ? FT_RENDER_MODE_NORMAL :
-                            canvas->aa_type == AA_LIGHT ? FT_RENDER_MODE_LIGHT :
-                            FT_RENDER_MODE_MONO : FT_RENDER_MODE_MONO, 0, 1);
-    if (error) {
-      RRDPRINTF("couldn't convert glyph id %d to bitmap\n", letter)
-      continue;
-    }
+        /* rotate glyph */
+        vec = glyph->pos;
+        FT_Vector_Transform(&vec, &string->transform);
+        error = FT_Glyph_Transform(glyph->image, &string->transform, &vec);
+        if (error) {
+            RRDPRINTF("couldn't transform glyph id %d\n", letter)
+                continue;
+        }
+
+        /* convert to a bitmap - destroy native image */
+        error =
+            FT_Glyph_To_Bitmap(&glyph->image,
+                               size >
+                               canvas->font_aa_threshold ? canvas->aa_type ==
+                               AA_NORMAL ? FT_RENDER_MODE_NORMAL : canvas->
+                               aa_type ==
+                               AA_LIGHT ? FT_RENDER_MODE_LIGHT :
+                               FT_RENDER_MODE_MONO : FT_RENDER_MODE_MONO, 0,
+                               1);
+        if (error) {
+            RRDPRINTF("couldn't convert glyph id %d to bitmap\n", letter)
+                continue;
+        }
 
-    /* increment number of glyphs */
-    previous = glyph->index;
-    string->num_glyphs++;
-  }
-  free(cstr);
+        /* increment number of glyphs */
+        previous = glyph->index;
+        string->num_glyphs++;
+    }
+    free(cstr);
 /*  printf ("number of glyphs = %d\n", string->num_glyphs);*/
-  compute_string_bbox( string );
-  /* the last character was a tab */  
-  /* if (gottab) { */
-      string->width = ft_pen.x;
-  /* } else {
-      string->width = string->bbox.xMax - string->bbox.xMin;
-  } */
-  string->height = string->bbox.yMax - string->bbox.yMin;
-  return string;
+    compute_string_bbox(string);
+    /* the last character was a tab */
+    /* if (gottab) { */
+    string->width = ft_pen.x;
+    /* } else {
+       string->width = string->bbox.xMax - string->bbox.xMin;
+       } */
+    string->height = string->bbox.yMax - string->bbox.yMin;
+    return string;
 }
 
 
-static int gfx_save_png (art_u8 *buffer, FILE *fp,
-                     long width, long height, long bytes_per_pixel);
+static int gfx_save_png(
+    art_u8 * buffer,
+    FILE * fp,
+    long width,
+    long height,
+    long bytes_per_pixel);
+
 /* render grafics into png image */
 
-int           gfx_render_png (gfx_canvas_t *canvas, 
-                             art_u32 width, art_u32 height, 
-                             gfx_color_t background, FILE *fp){
-    
-    
-    FT_Library    library;
-    gfx_node_t *node = canvas->firstnode;    
+int gfx_render_png(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fp)
+{
+
+
+    FT_Library library;
+    gfx_node_t *node = canvas->firstnode;
+
     /*
-    art_u8 red = background >> 24, green = (background >> 16) & 0xff;
-    art_u8 blue = (background >> 8) & 0xff, alpha = ( background & 0xff );
-    */
+       art_u8 red = background >> 24, green = (background >> 16) & 0xff;
+       art_u8 blue = (background >> 8) & 0xff, alpha = ( background & 0xff );
+     */
     unsigned long pys_width = width * canvas->zoom;
     unsigned long pys_height = height * canvas->zoom;
     const int bytes_per_pixel = 4;
-    unsigned long rowstride = pys_width*bytes_per_pixel; /* bytes per pixel */
-    
+    unsigned long rowstride = pys_width * bytes_per_pixel;  /* bytes per pixel */
+
     /* fill that buffer with out background color */
-    gfx_color_t *buffp = art_new (gfx_color_t, pys_width*pys_height);
-    art_u8 *buffer = (art_u8 *)buffp;
+    gfx_color_t *buffp = art_new(gfx_color_t, pys_width * pys_height);
+    art_u8   *buffer = (art_u8 *) buffp;
     unsigned long i;
-    for (i=0;i<pys_width*pys_height;
-        i++){
-       *(buffp++)=background;
+
+    for (i = 0; i < pys_width * pys_height; i++) {
+        *(buffp++) = background;
     }
-    FT_Init_FreeType( &library );
-    while(node){
+    FT_Init_FreeType(&library);
+    while (node) {
         switch (node->type) {
         case GFX_LINE:
-        case GFX_AREA: {   
+        case GFX_AREA:{
             ArtVpath *vec;
-            double dst[6];     
-            ArtSVP *svp;
-            art_affine_scale(dst,canvas->zoom,canvas->zoom);
-            vec = art_vpath_affine_transform(node->path,dst);
-           if (node->closed_path)
-               gfx_libart_close_path(node, &vec);
-           /* gfx_round_scaled_coordinates(vec); */
+            double    dst[6];
+            ArtSVP   *svp;
+
+            art_affine_scale(dst, canvas->zoom, canvas->zoom);
+            vec = art_vpath_affine_transform(node->path, dst);
+            if (node->closed_path)
+                gfx_libart_close_path(node, &vec);
+            /* gfx_round_scaled_coordinates(vec); */
             /* pvec = art_vpath_perturb(vec);
-              art_free(vec); */
-            if(node->type == GFX_LINE){
-                svp = art_svp_vpath_stroke ( vec, ART_PATH_STROKE_JOIN_ROUND,
-                                             ART_PATH_STROKE_CAP_ROUND,
-                                             node->size*canvas->zoom,4,0.25);
+               art_free(vec); */
+            if (node->type == GFX_LINE) {
+                svp = art_svp_vpath_stroke(vec, ART_PATH_STROKE_JOIN_ROUND,
+                                           ART_PATH_STROKE_CAP_ROUND,
+                                           node->size * canvas->zoom, 4,
+                                           0.25);
             } else {
-                svp  = art_svp_from_vpath ( vec );
-               /* this takes time and is unnecessary since we make
-                  sure elsewhere that the areas are going clock-whise */
-               /*  svpt = art_svp_uncross( svp );
-                    art_svp_free(svp);
-                   svp  = art_svp_rewind_uncrossed(svpt,ART_WIND_RULE_NONZERO); 
-                    art_svp_free(svpt);
+                svp = art_svp_from_vpath(vec);
+                /* this takes time and is unnecessary since we make
+                   sure elsewhere that the areas are going clock-whise */
+                /*  svpt = art_svp_uncross( svp );
+                   art_svp_free(svp);
+                   svp  = art_svp_rewind_uncrossed(svpt,ART_WIND_RULE_NONZERO); 
+                   art_svp_free(svpt);
                  */
             }
             art_free(vec);
-           /* this is from gnome since libart does not have this yet */
-            gnome_print_art_rgba_svp_alpha (svp ,0,0, pys_width, pys_height,
-                                node->color, buffer, rowstride, NULL);
+            /* this is from gnome since libart does not have this yet */
+            gnome_print_art_rgba_svp_alpha(svp, 0, 0, pys_width, pys_height,
+                                           node->color, buffer, rowstride,
+                                           NULL);
             art_svp_free(svp);
             break;
         }
-        case GFX_TEXT: {
-            unsigned int  n;
-            int  error;
-            art_u8 fcolor[4],falpha;
-            FT_Face       face;
-            gfx_char      glyph;
-            gfx_string    string;
-            FT_Vector     vec;  /* 26.6 */
-
-            float pen_x = 0.0 , pen_y = 0.0;
+        case GFX_TEXT:{
+            unsigned int n;
+            int       error;
+            art_u8    fcolor[4], falpha;
+            FT_Face   face;
+            gfx_char  glyph;
+            gfx_string string;
+            FT_Vector vec;  /* 26.6 */
+
+            float     pen_x = 0.0, pen_y = 0.0;
+
             /* double x,y; */
-            long   ix,iy;
-            
+            long      ix, iy;
+
             fcolor[0] = node->color >> 24;
             fcolor[1] = (node->color >> 16) & 0xff;
             fcolor[2] = (node->color >> 8) & 0xff;
             falpha = node->color & 0xff;
-            error = FT_New_Face( library,
-                                 (char *)node->filename,
-                                 0,
-                                 &face );
-           if ( error ) {
-               rrd_set_error("failed to load %s",node->filename);
-               
-               break;
-           }
-            error = FT_Set_Char_Size(face,   /* handle to face object            */
-                                     (long)(node->size*64),
-                                     (long)(node->size*64),
-                                     (long)(100*canvas->zoom),
-                                     (long)(100*canvas->zoom));
-            if ( error ) {
+            error = FT_New_Face(library, (char *) node->filename, 0, &face);
+            if (error) {
+                rrd_set_error("failed to load %s", node->filename);
+
+                break;
+            }
+            error = FT_Set_Char_Size(face,  /* handle to face object            */
+                                     (long) (node->size * 64),
+                                     (long) (node->size * 64),
+                                     (long) (100 * canvas->zoom),
+                                     (long) (100 * canvas->zoom));
+            if (error) {
                 FT_Done_Face(face);
                 break;
             }
             pen_x = node->x * canvas->zoom;
             pen_y = node->y * canvas->zoom;
 
-            string = gfx_string_create (canvas, face, node->text, node->angle, node->tabwidth, node->size);
+            string =
+                gfx_string_create(canvas, face, node->text, node->angle,
+                                  node->tabwidth, node->size);
             FT_Done_Face(face);
 
-            switch(node->halign){
-            case GFX_H_RIGHT:  vec.x = -string->bbox.xMax;
-                               break;          
-            case GFX_H_CENTER: vec.x = abs(string->bbox.xMax) >= abs(string->bbox.xMin) ?
-                                       -string->bbox.xMax/2:-string->bbox.xMin/2;
-                               break;          
-            case GFX_H_LEFT:   vec.x = -string->bbox.xMin;
-                              break;
-            case GFX_H_NULL:   vec.x = 0;
-                               break;          
+            switch (node->halign) {
+            case GFX_H_RIGHT:
+                vec.x = -string->bbox.xMax;
+                break;
+            case GFX_H_CENTER:
+                vec.x = abs(string->bbox.xMax) >= abs(string->bbox.xMin) ?
+                    -string->bbox.xMax / 2 : -string->bbox.xMin / 2;
+                break;
+            case GFX_H_LEFT:
+                vec.x = -string->bbox.xMin;
+                break;
+            case GFX_H_NULL:
+                vec.x = 0;
+                break;
             }
 
-            switch(node->valign){
-            case GFX_V_TOP:    vec.y = string->bbox.yMax;
-                               break;
-            case GFX_V_CENTER: vec.y = abs(string->bbox.yMax) >= abs(string->bbox.yMin) ?
-                                       string->bbox.yMax/2:string->bbox.yMin/2;
-                               break;
-            case GFX_V_BOTTOM: vec.y = 0;
-                               break;
-            case GFX_V_NULL:   vec.y = 0;
-                               break;
+            switch (node->valign) {
+            case GFX_V_TOP:
+                vec.y = string->bbox.yMax;
+                break;
+            case GFX_V_CENTER:
+                vec.y = abs(string->bbox.yMax) >= abs(string->bbox.yMin) ?
+                    string->bbox.yMax / 2 : string->bbox.yMin / 2;
+                break;
+            case GFX_V_BOTTOM:
+                vec.y = 0;
+                break;
+            case GFX_V_NULL:
+                vec.y = 0;
+                break;
             }
-           pen_x += vec.x/64;
-           pen_y += vec.y/64;
+            pen_x += vec.x / 64;
+            pen_y += vec.y / 64;
             glyph = string->glyphs;
-            for(n=0; n<string->num_glyphs; n++, glyph++) {
-                int gr;
-                FT_Glyph        image;
-                FT_BitmapGlyph  bit;
-               /* long buf_x,comp_n; */
-               /* make copy to transform */
-                if (! glyph->image) {
-                  RRDPRINTF("no image\n")
-                  continue;
+            for (n = 0; n < string->num_glyphs; n++, glyph++) {
+                int       gr;
+                FT_Glyph  image;
+                FT_BitmapGlyph bit;
+
+                /* long buf_x,comp_n; */
+                /* make copy to transform */
+                if (!glyph->image) {
+                    RRDPRINTF("no image\n")
+                        continue;
                 }
-                error = FT_Glyph_Copy (glyph->image, &image);
+                error = FT_Glyph_Copy(glyph->image, &image);
                 if (error) {
-                  RRDPRINTF("couldn't copy image\n")
-                  continue;
+                    RRDPRINTF("couldn't copy image\n")
+                        continue;
                 }
 
                 /* transform it */
                 vec = glyph->pos;
-                FT_Vector_Transform (&vec, &string->transform);
+                FT_Vector_Transform(&vec, &string->transform);
 
                 bit = (FT_BitmapGlyph) image;
-                gr = bit->bitmap.num_grays -1;
+                gr = bit->bitmap.num_grays - 1;
 /* 
                buf_x = (pen_x + 0.5) + (double)bit->left;
                comp_n = buf_x + bit->bitmap.width > pys_width ? pys_width - buf_x : bit->bitmap.width;
@@ -694,46 +825,68 @@ int           gfx_render_png (gfx_canvas_t *canvas,
                 }
                 art_free(letter);
 */
-                switch ( bit->bitmap.pixel_mode ) {
-                    case FT_PIXEL_MODE_GRAY:
-                        for (iy=0; iy < bit->bitmap.rows; iy++){
-                            long buf_y = iy+(pen_y+0.5)-bit->top;
-                            if (buf_y < 0 || buf_y >= (long)pys_height) continue;
-                            buf_y *= rowstride;
-                            for (ix=0;ix < bit->bitmap.width;ix++){
-                                long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
-                                art_u8 font_alpha;
-
-                                if (buf_x < 0 || buf_x >= (long)pys_width) continue;
-                                buf_x *=  bytes_per_pixel ;
-                                font_alpha =  *(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix);
-                    if (font_alpha > 0){
-                                    fcolor[3] =  (art_u8)((double)font_alpha / gr * falpha);
-                        art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
-                                }
+                switch (bit->bitmap.pixel_mode) {
+                case FT_PIXEL_MODE_GRAY:
+                    for (iy = 0; iy < bit->bitmap.rows; iy++) {
+                        long      buf_y = iy + (pen_y + 0.5) - bit->top;
+
+                        if (buf_y < 0 || buf_y >= (long) pys_height)
+                            continue;
+                        buf_y *= rowstride;
+                        for (ix = 0; ix < bit->bitmap.width; ix++) {
+                            long      buf_x =
+                                ix + (pen_x + 0.5) + (double) bit->left;
+                            art_u8    font_alpha;
+
+                            if (buf_x < 0 || buf_x >= (long) pys_width)
+                                continue;
+                            buf_x *= bytes_per_pixel;
+                            font_alpha =
+                                *(bit->bitmap.buffer +
+                                  iy * bit->bitmap.pitch + ix);
+                            if (font_alpha > 0) {
+                                fcolor[3] =
+                                    (art_u8) ((double) font_alpha / gr *
+                                              falpha);
+                                art_rgba_rgba_composite(buffer + buf_y +
+                                                        buf_x, fcolor, 1);
                             }
                         }
-                        break;
-
-                    case FT_PIXEL_MODE_MONO:
-                        for (iy=0; iy < bit->bitmap.rows; iy++){
-                            long buf_y = iy+(pen_y+0.5)-bit->top;
-                            if (buf_y < 0 || buf_y >= (long)pys_height) continue;
-                            buf_y *= rowstride;
-                            for (ix=0;ix < bit->bitmap.width;ix++){
-                                long buf_x = ix + (pen_x + 0.5) + (double)bit->left ;
-
-                                if (buf_x < 0 || buf_x >= (long)pys_width) continue;
-                                buf_x *=  bytes_per_pixel ;
-                                if ( (fcolor[3] = falpha * ((*(bit->bitmap.buffer + iy * bit->bitmap.pitch + ix/8) >> (7 - (ix % 8))) & 1)) > 0 )
-                                    art_rgba_rgba_composite(buffer + buf_y + buf_x ,fcolor,1);
-                            }
+                    }
+                    break;
+
+                case FT_PIXEL_MODE_MONO:
+                    for (iy = 0; iy < bit->bitmap.rows; iy++) {
+                        long      buf_y = iy + (pen_y + 0.5) - bit->top;
+
+                        if (buf_y < 0 || buf_y >= (long) pys_height)
+                            continue;
+                        buf_y *= rowstride;
+                        for (ix = 0; ix < bit->bitmap.width; ix++) {
+                            long      buf_x =
+                                ix + (pen_x + 0.5) + (double) bit->left;
+
+                            if (buf_x < 0 || buf_x >= (long) pys_width)
+                                continue;
+                            buf_x *= bytes_per_pixel;
+                            if ((fcolor[3] =
+                                 falpha *
+                                 ((*
+                                   (bit->bitmap.buffer +
+                                    iy * bit->bitmap.pitch + ix / 8) >> (7 -
+                                                                         (ix %
+                                                                          8)))
+                                  & 1)) > 0)
+                                art_rgba_rgba_composite(buffer + buf_y +
+                                                        buf_x, fcolor, 1);
                         }
-                        break;
+                    }
+                    break;
 
-                        default:
-                            rrd_set_error("unknown freetype pixel mode: %d", bit->bitmap.pixel_mode);
-                            break;
+                default:
+                    rrd_set_error("unknown freetype pixel mode: %d",
+                                  bit->bitmap.pixel_mode);
+                    break;
                 }
 
 /*
@@ -757,237 +910,273 @@ int           gfx_render_png (gfx_canvas_t *canvas,
                     }
                 }
 */
-                FT_Done_Glyph (image);
+                FT_Done_Glyph(image);
             }
             gfx_string_destroy(string);
         }
         }
         node = node->next;
-    }  
-    gfx_save_png(buffer,fp , pys_width,pys_height,bytes_per_pixel);
+    }
+    gfx_save_png(buffer, fp, pys_width, pys_height, bytes_per_pixel);
     art_free(buffer);
-    FT_Done_FreeType( library );
-    return 0;    
+    FT_Done_FreeType(library);
+    return 0;
 }
 
 /* free memory used by nodes this will also remove memory required for
    associated paths and svcs ... but not for text strings */
-int
-gfx_destroy    (gfx_canvas_t *canvas){  
-  gfx_node_t *next,*node = canvas->firstnode;
-  while(node){
-    next = node->next;
-    art_free(node->path);
-    free(node->text);
-    free(node->filename);
-    art_free(node);
-    node = next;
-  }
-  art_free(canvas);
-  return 0;
-}
-static int gfx_save_png (art_u8 *buffer, FILE *fp,  long width, long height, long bytes_per_pixel){
-  png_structp png_ptr = NULL;
-  png_infop   info_ptr = NULL;
-  int i;
-  png_bytep *row_pointers;
-  int rowstride = width * bytes_per_pixel;
-  png_text text[2];
-  
-  if (fp == NULL)
-    return (1);
-
-  png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,NULL,NULL,NULL);
-  if (png_ptr == NULL)
-   {
-      return (1);
-   }
-   row_pointers = (png_bytepp)png_malloc(png_ptr,
-                                     height*sizeof(png_bytep));
-
-  info_ptr = png_create_info_struct(png_ptr);
-
-  if (info_ptr == NULL)
-    {
-      png_free(png_ptr,row_pointers);
-      png_destroy_write_struct(&png_ptr,  (png_infopp)NULL);
-      return (1);
-    }
-
-  if (setjmp(png_jmpbuf(png_ptr)))
-    {
-      /* If we get here, we had a problem writing the file */
-      png_destroy_write_struct(&png_ptr, &info_ptr);
-      return (1);
-    }
-
-  png_init_io(png_ptr, fp);
-  png_set_IHDR (png_ptr, info_ptr,width, height,
-                8, PNG_COLOR_TYPE_RGB_ALPHA,
-                PNG_INTERLACE_NONE,
-                PNG_COMPRESSION_TYPE_DEFAULT,
-                PNG_FILTER_TYPE_DEFAULT);
-
-  text[0].key = "Software";
-  text[0].text = "RRDtool, Tobias Oetiker <tobi@oetike.ch>, http://tobi.oetiker.ch";
-  text[0].compression = PNG_TEXT_COMPRESSION_NONE;
-  png_set_text (png_ptr, info_ptr, text, 1);
-
-  /* lets make this fast while ending up with some increass in image size */
-  png_set_filter(png_ptr,0,PNG_FILTER_NONE);
-  /* png_set_filter(png_ptr,0,PNG_FILTER_SUB); */
-  png_set_compression_level(png_ptr,1);
-  /* png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); */
-  /* 
-  png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_FILTER_SUB);
-  png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY);
-  png_set_compression_level(png_ptr,Z_BEST_SPEED); */
-  
-  /* Write header data */
-  png_write_info (png_ptr, info_ptr);
-  for (i = 0; i < height; i++)
-    row_pointers[i] = (png_bytep) (buffer + i*rowstride);
-  
-  png_write_image(png_ptr, row_pointers);
-  png_write_end(png_ptr, info_ptr);
-  png_free(png_ptr,row_pointers);
-  png_destroy_write_struct(&png_ptr, &info_ptr);
-  return 1;
-}
-
+int gfx_destroy(
+    gfx_canvas_t * canvas)
+{
+    gfx_node_t *next, *node = canvas->firstnode;
+
+    while (node) {
+        next = node->next;
+        art_free(node->path);
+        free(node->text);
+        free(node->filename);
+        art_free(node);
+        node = next;
+    }
+    art_free(canvas);
+    return 0;
+}
+
+static int gfx_save_png(
+    art_u8 * buffer,
+    FILE * fp,
+    long width,
+    long height,
+    long bytes_per_pixel)
+{
+    png_structp png_ptr = NULL;
+    png_infop info_ptr = NULL;
+    int       i;
+    png_bytep *row_pointers;
+    int       rowstride = width * bytes_per_pixel;
+    png_text  text[2];
+
+    if (fp == NULL)
+        return (1);
+
+    png_ptr =
+        png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+    if (png_ptr == NULL) {
+        return (1);
+    }
+    row_pointers = (png_bytepp) png_malloc(png_ptr,
+                                           height * sizeof(png_bytep));
+
+    info_ptr = png_create_info_struct(png_ptr);
+
+    if (info_ptr == NULL) {
+        png_free(png_ptr, row_pointers);
+        png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
+        return (1);
+    }
+
+    if (setjmp(png_jmpbuf(png_ptr))) {
+        /* If we get here, we had a problem writing the file */
+        png_destroy_write_struct(&png_ptr, &info_ptr);
+        return (1);
+    }
+
+    png_init_io(png_ptr, fp);
+    png_set_IHDR(png_ptr, info_ptr, width, height,
+                 8, PNG_COLOR_TYPE_RGB_ALPHA,
+                 PNG_INTERLACE_NONE,
+                 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+
+    text[0].key = "Software";
+    text[0].text =
+        "RRDtool, Tobias Oetiker <tobi@oetike.ch>, http://tobi.oetiker.ch";
+    text[0].compression = PNG_TEXT_COMPRESSION_NONE;
+    png_set_text(png_ptr, info_ptr, text, 1);
+
+    /* lets make this fast while ending up with some increass in image size */
+    png_set_filter(png_ptr, 0, PNG_FILTER_NONE);
+    /* png_set_filter(png_ptr,0,PNG_FILTER_SUB); */
+    png_set_compression_level(png_ptr, 1);
+    /* png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY); */
+    /* 
+       png_set_filter(png_ptr,PNG_FILTER_TYPE_BASE,PNG_FILTER_SUB);
+       png_set_compression_strategy(png_ptr,Z_HUFFMAN_ONLY);
+       png_set_compression_level(png_ptr,Z_BEST_SPEED); */
+
+    /* Write header data */
+    png_write_info(png_ptr, info_ptr);
+    for (i = 0; i < height; i++)
+        row_pointers[i] = (png_bytep) (buffer + i * rowstride);
+
+    png_write_image(png_ptr, row_pointers);
+    png_write_end(png_ptr, info_ptr);
+    png_free(png_ptr, row_pointers);
+    png_destroy_write_struct(&png_ptr, &info_ptr);
+    return 1;
+}
+
+
 /* ----- COMMON ROUTINES for pdf, svg and eps */
 #define min3(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
 #define max3(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
 
 #define PDF_CALC_DEBUG 0
 
-typedef struct pdf_point
-{
-       double x, y;
+typedef struct pdf_point {
+    double    x, y;
 } pdf_point;
 
-typedef struct
-{
-       double ascender, descender, baselineY;
-       pdf_point sizep, minp, maxp;
-       double x, y, tdx, tdy;
-       double r, cos_r, sin_r;
-       double ma, mb, mc, md, mx, my; /* pdf coord matrix */
-       double tmx, tmy; /* last 2 coords of text coord matrix */
+typedef struct {
+    double    ascender, descender, baselineY;
+    pdf_point sizep, minp, maxp;
+    double    x, y, tdx, tdy;
+    double    r, cos_r, sin_r;
+    double    ma, mb, mc, md, mx, my;   /* pdf coord matrix */
+    double    tmx, tmy; /* last 2 coords of text coord matrix */
 #if PDF_CALC_DEBUG
-       int debug;
+    int       debug;
 #endif
 } pdf_coords;
 
 #if PDF_CALC_DEBUG
-static void pdf_dump_calc(gfx_node_t *node, pdf_coords *g)
-{
-       fprintf(stderr, "PDF CALC =============================\n");
-       fprintf(stderr, "   '%s' at %f pt\n", node->text, node->size);
-       fprintf(stderr, "   align h = %s, v = %s,  sizep = %f, %f\n",
-               (node->halign == GFX_H_RIGHT ? "r" :
-                       (node->halign == GFX_H_CENTER ? "c" :
-                               (node->halign == GFX_H_LEFT ? "l" : "N"))),
-               (node->valign == GFX_V_TOP ? "t" :
-                       (node->valign == GFX_V_CENTER ? "c" :
-                               (node->valign == GFX_V_BOTTOM ? "b" : "N"))),
-                       g->sizep.x, g->sizep.y);
-       fprintf(stderr, "   r = %f = %f, cos = %f, sin = %f\n",
-                       g->r, node->angle, g->cos_r, g->sin_r);
-       fprintf(stderr, "   ascender = %f, descender = %f, baselineY = %f\n",
-               g->ascender, g->descender, g->baselineY);
-       fprintf(stderr, "   sizep: %f, %f\n", g->sizep.x, g->sizep.y);
-       fprintf(stderr, "   minp: %f, %f     maxp = %f, %f\n", 
-                       g->minp.x, g->minp.y, g->maxp.x, g->maxp.y);
-       fprintf(stderr, "   x = %f, y = %f\n", g->x, g->y);
-       fprintf(stderr, "   tdx = %f, tdy = %f\n", g->tdx, g->tdy);
-       fprintf(stderr, "   GM = %f, %f, %f, %f, %f, %f\n",
-                       g->ma, g->mb, g->mc, g->md, g->mx, g->my);
-       fprintf(stderr, "   TM = %f, %f, %f, %f, %f, %f\n",
-                       g->ma, g->mb, g->mc, g->md, g->tmx, g->tmy);
+static void pdf_dump_calc(
+    gfx_node_t * node,
+    pdf_coords * g)
+{
+    fprintf(stderr, "PDF CALC =============================\n");
+    fprintf(stderr, "   '%s' at %f pt\n", node->text, node->size);
+    fprintf(stderr, "   align h = %s, v = %s,  sizep = %f, %f\n",
+            (node->halign == GFX_H_RIGHT ? "r" :
+             (node->halign == GFX_H_CENTER ? "c" :
+              (node->halign == GFX_H_LEFT ? "l" : "N"))),
+            (node->valign == GFX_V_TOP ? "t" :
+             (node->valign == GFX_V_CENTER ? "c" :
+              (node->valign == GFX_V_BOTTOM ? "b" : "N"))),
+            g->sizep.x, g->sizep.y);
+    fprintf(stderr, "   r = %f = %f, cos = %f, sin = %f\n",
+            g->r, node->angle, g->cos_r, g->sin_r);
+    fprintf(stderr, "   ascender = %f, descender = %f, baselineY = %f\n",
+            g->ascender, g->descender, g->baselineY);
+    fprintf(stderr, "   sizep: %f, %f\n", g->sizep.x, g->sizep.y);
+    fprintf(stderr, "   minp: %f, %f     maxp = %f, %f\n",
+            g->minp.x, g->minp.y, g->maxp.x, g->maxp.y);
+    fprintf(stderr, "   x = %f, y = %f\n", g->x, g->y);
+    fprintf(stderr, "   tdx = %f, tdy = %f\n", g->tdx, g->tdy);
+    fprintf(stderr, "   GM = %f, %f, %f, %f, %f, %f\n",
+            g->ma, g->mb, g->mc, g->md, g->mx, g->my);
+    fprintf(stderr, "   TM = %f, %f, %f, %f, %f, %f\n",
+            g->ma, g->mb, g->mc, g->md, g->tmx, g->tmy);
 }
 #endif
+
 #if PDF_CALC_DEBUG
 #define PDF_DD(x) if (g->debug) x;
 #else
 #define PDF_DD(x)
 #endif
 
-static void pdf_rotate(pdf_coords *g, pdf_point *p)
+static void pdf_rotate(
+    pdf_coords * g,
+    pdf_point * p)
 {
-    double x2 = g->cos_r * p->x - g->sin_r * p->y;
-    double y2 = g->sin_r * p->x + g->cos_r * p->y;
-       PDF_DD( fprintf(stderr, "  rotate(%f, %f) -> %f, %f\n", p->x, p->y, x2, y2))
-    p->x = x2;
-       p->y = y2;
+    double    x2 = g->cos_r * p->x - g->sin_r * p->y;
+    double    y2 = g->sin_r * p->x + g->cos_r * p->y;
+
+    PDF_DD(fprintf
+           (stderr, "  rotate(%f, %f) -> %f, %f\n", p->x, p->y, x2, y2))
+        p->x = x2;
+    p->y = y2;
 }
 
 
-static void pdf_calc(int page_height, gfx_node_t *node, pdf_coords *g)
+static void pdf_calc(
+    int page_height,
+    gfx_node_t * node,
+    pdf_coords * g)
 {
-       pdf_point a, b, c;
+    pdf_point a, b, c;
+
 #if PDF_CALC_DEBUG
-       /* g->debug = !!strstr(node->text, "RevProxy-1") || !!strstr(node->text, "08:00"); */
-       g->debug = !!strstr(node->text, "sekunder") || !!strstr(node->text, "Web");
+    /* g->debug = !!strstr(node->text, "RevProxy-1") || !!strstr(node->text, "08:00"); */
+    g->debug = !!strstr(node->text, "sekunder")
+        || !!strstr(node->text, "Web");
 #endif
-       g->x = node->x;
-       g->y = page_height - node->y;
-       if (node->angle) {
-               g->r = 2 * M_PI * node->angle / 360.0;
-               g->cos_r = cos(g->r);
-               g->sin_r = sin(g->r);
-       } else {
-               g->r = 0;
-               g->cos_r = 1;
-               g->sin_r = 0;
-       }
-       g->ascender = afm_get_ascender(node->filename, node->size);
-       g->descender = afm_get_descender(node->filename, node->size);
-       g->sizep.x = afm_get_text_width(0, node->filename, node->size, node->tabwidth, node->text);
-       /* seems like libart ignores the descender when doing vertial-align = bottom,
-          so we do that too, to get labels v-aligning properly */
-       g->sizep.y = -g->ascender; /* + afm_get_descender(font->ps_font, node->size); */
-       g->baselineY = -g->ascender - g->sizep.y / 2;
-       a.x = g->sizep.x; a.y = g->sizep.y;
-       b.x = g->sizep.x; b.y = 0;
-       c.x = 0; c.y = g->sizep.y;
-       if (node->angle) {
-               pdf_rotate(g, &a);
-               pdf_rotate(g, &b);
-               pdf_rotate(g, &c);
-       }
-       g->minp.x = min3(a.x, b.x, c.x);
-       g->minp.y = min3(a.y, b.y, c.y);
-       g->maxp.x = max3(a.x, b.x, c.x);
-       g->maxp.y = max3(a.y, b.y, c.y);
-  /* The alignment parameters in node->valign and node->halign
-     specifies the alignment in the non-rotated coordinate system
-     (very unlike pdf/postscript), which complicates matters.
-  */
-       switch (node->halign) {
-       case GFX_H_RIGHT:  g->tdx = -g->maxp.x; break;
-       case GFX_H_CENTER: g->tdx = -(g->maxp.x + g->minp.x) / 2; break;
-       case GFX_H_LEFT:   g->tdx = -g->minp.x; break;
-       case GFX_H_NULL:   g->tdx = 0; break;
-       }
-       switch(node->valign){
-       case GFX_V_TOP:    g->tdy = -g->maxp.y; break;
-       case GFX_V_CENTER: g->tdy = -(g->maxp.y + g->minp.y) / 2; break;
-       case GFX_V_BOTTOM: g->tdy = -g->minp.y; break;
-       case GFX_V_NULL:   g->tdy = 0; break;          
-       }
-       g->ma = g->cos_r;
-       g->mb = g->sin_r;
-       g->mc = -g->sin_r;
-       g->md = g->cos_r;
-       g->mx = g->x + g->tdx;
-       g->my = g->y + g->tdy;
-       g->tmx = g->mx - g->ascender * g->mc;
-       g->tmy = g->my - g->ascender * g->md;
-       PDF_DD(pdf_dump_calc(node, g))
+    g->x = node->x;
+    g->y = page_height - node->y;
+    if (node->angle) {
+        g->r = 2 * M_PI * node->angle / 360.0;
+        g->cos_r = cos(g->r);
+        g->sin_r = sin(g->r);
+    } else {
+        g->r = 0;
+        g->cos_r = 1;
+        g->sin_r = 0;
+    }
+    g->ascender = afm_get_ascender(node->filename, node->size);
+    g->descender = afm_get_descender(node->filename, node->size);
+    g->sizep.x =
+        afm_get_text_width(0, node->filename, node->size, node->tabwidth,
+                           node->text);
+    /* seems like libart ignores the descender when doing vertial-align = bottom,
+       so we do that too, to get labels v-aligning properly */
+    g->sizep.y = -g->ascender;  /* + afm_get_descender(font->ps_font, node->size); */
+    g->baselineY = -g->ascender - g->sizep.y / 2;
+    a.x = g->sizep.x;
+    a.y = g->sizep.y;
+    b.x = g->sizep.x;
+    b.y = 0;
+    c.x = 0;
+    c.y = g->sizep.y;
+    if (node->angle) {
+        pdf_rotate(g, &a);
+        pdf_rotate(g, &b);
+        pdf_rotate(g, &c);
+    }
+    g->minp.x = min3(a.x, b.x, c.x);
+    g->minp.y = min3(a.y, b.y, c.y);
+    g->maxp.x = max3(a.x, b.x, c.x);
+    g->maxp.y = max3(a.y, b.y, c.y);
+    /* The alignment parameters in node->valign and node->halign
+       specifies the alignment in the non-rotated coordinate system
+       (very unlike pdf/postscript), which complicates matters.
+     */
+    switch (node->halign) {
+    case GFX_H_RIGHT:
+        g->tdx = -g->maxp.x;
+        break;
+    case GFX_H_CENTER:
+        g->tdx = -(g->maxp.x + g->minp.x) / 2;
+        break;
+    case GFX_H_LEFT:
+        g->tdx = -g->minp.x;
+        break;
+    case GFX_H_NULL:
+        g->tdx = 0;
+        break;
+    }
+    switch (node->valign) {
+    case GFX_V_TOP:
+        g->tdy = -g->maxp.y;
+        break;
+    case GFX_V_CENTER:
+        g->tdy = -(g->maxp.y + g->minp.y) / 2;
+        break;
+    case GFX_V_BOTTOM:
+        g->tdy = -g->minp.y;
+        break;
+    case GFX_V_NULL:
+        g->tdy = 0;
+        break;
+    }
+    g->ma = g->cos_r;
+    g->mb = g->sin_r;
+    g->mc = -g->sin_r;
+    g->md = g->cos_r;
+    g->mx = g->x + g->tdx;
+    g->my = g->y + g->tdy;
+    g->tmx = g->mx - g->ascender * g->mc;
+    g->tmy = g->my - g->ascender * g->md;
+    PDF_DD(pdf_dump_calc(node, g))
 }
 
 /* ------- SVG -------
@@ -997,500 +1186,578 @@ static void pdf_calc(int page_height, gfx_node_t *node, pdf_coords *g)
 static int svg_indent = 0;
 static int svg_single_line = 0;
 static const char *svg_default_font = "-dummy-";
-typedef struct svg_dash
-{
-  int dash_enable;
-  double dash_adjust, dash_len, dash_offset;
-  double adjusted_on, adjusted_off;
+typedef struct svg_dash {
+    int       dash_enable;
+    double    dash_adjust, dash_len, dash_offset;
+    double    adjusted_on, adjusted_off;
 } svg_dash;
 
 
-static void svg_print_indent(FILE *fp)
+static void svg_print_indent(
+    FILE * fp)
 {
-  int i;
-   for (i = svg_indent - svg_single_line; i > 0; i--) {
-     putc(' ', fp);
-     putc(' ', fp);
-   }
+    int       i;
+
+    for (i = svg_indent - svg_single_line; i > 0; i--) {
+        putc(' ', fp);
+        putc(' ', fp);
+    }
 }
-static void svg_start_tag(FILE *fp, const char *name)
+
+static void svg_start_tag(
+    FILE * fp,
+    const char *name)
 {
-   svg_print_indent(fp);
-   putc('<', fp);
-   fputs(name, fp);
-   svg_indent++;
+    svg_print_indent(fp);
+    putc('<', fp);
+    fputs(name, fp);
+    svg_indent++;
 }
-static void svg_close_tag_single_line(FILE *fp)
+
+static void svg_close_tag_single_line(
+    FILE * fp)
 {
-   svg_single_line++;
-   putc('>', fp);
+    svg_single_line++;
+    putc('>', fp);
 }
-static void svg_close_tag(FILE *fp)
+
+static void svg_close_tag(
+    FILE * fp)
 {
-   putc('>', fp);
-   if (!svg_single_line)
-     putc('\n', fp);
+    putc('>', fp);
+    if (!svg_single_line)
+        putc('\n', fp);
 }
-static void svg_end_tag(FILE *fp, const char *name)
+
+static void svg_end_tag(
+    FILE * fp,
+    const char *name)
 {
-   /* name is NULL if closing empty-node tag */
-   svg_indent--;
-   if (svg_single_line)
-     svg_single_line--;
-   else if (name)
-     svg_print_indent(fp);
-   if (name != NULL) {
-     fputs("</", fp);
-     fputs(name, fp);
-   } else {
-     putc('/', fp);
-   }
-   svg_close_tag(fp);
+    /* name is NULL if closing empty-node tag */
+    svg_indent--;
+    if (svg_single_line)
+        svg_single_line--;
+    else if (name)
+        svg_print_indent(fp);
+    if (name != NULL) {
+        fputs("</", fp);
+        fputs(name, fp);
+    } else {
+        putc('/', fp);
+    }
+    svg_close_tag(fp);
 }
-static void svg_close_tag_empty_node(FILE *fp)
+
+static void svg_close_tag_empty_node(
+    FILE * fp)
 {
-   svg_end_tag(fp, NULL);
+    svg_end_tag(fp, NULL);
 }
-static void svg_write_text(FILE *fp, const char *text)
+
+static void svg_write_text(
+    FILE * fp,
+    const char *text)
 {
 #ifdef HAVE_MBSTOWCS
-    size_t clen;
-    wchar_t *p, *cstr, ch;
-    int text_count;
+    size_t    clen;
+    wchar_t  *p, *cstr, ch;
+    int       text_count;
+
     if (!text)
-       return;
+        return;
     clen = strlen(text) + 1;
     cstr = malloc(sizeof(wchar_t) * clen);
     text_count = mbstowcs(cstr, text, clen);
     if (text_count == -1)
-       text_count = mbstowcs(cstr, "Enc-Err", 6);
+        text_count = mbstowcs(cstr, "Enc-Err", 6);
     p = cstr;
 #else
     unsigned char *p = text;
     unsigned char *cstr;
-    char ch;
+    char      ch;
+
     if (!p)
-       return;
+        return;
 #endif
-  while (1) {
-    ch = *p++;
-    ch = afm_fix_osx_charset(ch); /* unsafe macro */
-    switch (ch) {
-    case 0:
+    while (1) {
+        ch = *p++;
+        ch = afm_fix_osx_charset(ch);   /* unsafe macro */
+        switch (ch) {
+        case 0:
 #ifdef HAVE_MBSTOWCS
-    free(cstr);
+            free(cstr);
 #endif
-    return;
-    case '&': fputs("&amp;", fp); break;
-    case '<': fputs("&lt;", fp); break;
-    case '>': fputs("&gt;", fp); break;
-    case '"': fputs("&quot;", fp); break;
-    default:
-        if (ch == 32) {
+            return;
+        case '&':
+            fputs("&amp;", fp);
+            break;
+        case '<':
+            fputs("&lt;", fp);
+            break;
+        case '>':
+            fputs("&gt;", fp);
+            break;
+        case '"':
+            fputs("&quot;", fp);
+            break;
+        default:
+            if (ch == 32) {
 #ifdef HAVE_MBSTOWCS
-            if (p <= cstr + 1 || !*p || *p == 32)
-                fputs("&#160;", fp); /* non-breaking space in unicode */
-            else
+                if (p <= cstr + 1 || !*p || *p == 32)
+                    fputs("&#160;", fp);    /* non-breaking space in unicode */
+                else
 #endif
-                fputc(32, fp);
-        } else if (ch < 32 || ch >= 127)
-       fprintf(fp, "&#%d;", (int)ch);
-      else
-       putc((char)ch, fp);
-     }
-   }
-}
-static void svg_format_number(char *buf, int bufsize, double d)
-{
-   /* omit decimals if integer to reduce filesize */
-   char *p;
-   snprintf(buf, bufsize, "%.2f", d);
-   p = buf; /* doesn't trust snprintf return value */
-   while (*p)
-     p++;
-   while (--p > buf) {
-     char ch = *p;
-     if (ch == '0') {
-       *p = '\0'; /* zap trailing zeros */
-       continue;
-     }
-     if (ch == '.')
-       *p = '\0'; /* zap trailing dot */
-     break;
-   }
-}
-static void svg_write_number(FILE *fp, double d)
-{
-   char buf[60];
-   svg_format_number(buf, sizeof(buf), d);
-   fputs(buf, fp);
-}
-
-static int svg_color_is_black(int c)
-{
-  /* gfx_color_t is RRGGBBAA */
-  return c == 0x000000FF;
-}
-static void svg_write_color(FILE *fp, gfx_color_t c, const char *attr)
-{
-  /* gfx_color_t is RRGGBBAA, svg can use #RRGGBB and #RGB like html */
-  gfx_color_t rrggbb = (int)((c >> 8) & 0xFFFFFF);
-  gfx_color_t opacity = c & 0xFF;
-  fprintf(fp, " %s=\"", attr);
-  if ((rrggbb & 0x0F0F0F) == ((rrggbb >> 4) & 0x0F0F0F)) {
-     /* css2 short form, #rgb is #rrggbb, not #r0g0b0 */
-    fprintf(fp, "#%03lX",
-          ( ((rrggbb >> 8) & 0xF00)
-          | ((rrggbb >> 4) & 0x0F0)
-          | ( rrggbb       & 0x00F)));
-   } else {
-    fprintf(fp, "#%06lX", rrggbb);
-   }
-  fputs("\"", fp);
-  if (opacity != 0xFF) {
-    fprintf(fp, " opacity=\"");
-    svg_write_number(fp, opacity / 255.0);
+                    fputc(32, fp);
+            } else if (ch < 32 || ch >= 127)
+                fprintf(fp, "&#%d;", (int) ch);
+            else
+                putc((char) ch, fp);
+        }
+    }
+}
+
+static void svg_format_number(
+    char *buf,
+    int bufsize,
+    double d)
+{
+    /* omit decimals if integer to reduce filesize */
+    char     *p;
+
+    snprintf(buf, bufsize, "%.2f", d);
+    p = buf;            /* doesn't trust snprintf return value */
+    while (*p)
+        p++;
+    while (--p > buf) {
+        char      ch = *p;
+
+        if (ch == '0') {
+            *p = '\0';  /* zap trailing zeros */
+            continue;
+        }
+        if (ch == '.')
+            *p = '\0';  /* zap trailing dot */
+        break;
+    }
+}
+
+static void svg_write_number(
+    FILE * fp,
+    double d)
+{
+    char      buf[60];
+
+    svg_format_number(buf, sizeof(buf), d);
+    fputs(buf, fp);
+}
+
+static int svg_color_is_black(
+    int c)
+{
+    /* gfx_color_t is RRGGBBAA */
+    return c == 0x000000FF;
+}
+
+static void svg_write_color(
+    FILE * fp,
+    gfx_color_t c,
+    const char *attr)
+{
+    /* gfx_color_t is RRGGBBAA, svg can use #RRGGBB and #RGB like html */
+    gfx_color_t rrggbb = (int) ((c >> 8) & 0xFFFFFF);
+    gfx_color_t opacity = c & 0xFF;
+
+    fprintf(fp, " %s=\"", attr);
+    if ((rrggbb & 0x0F0F0F) == ((rrggbb >> 4) & 0x0F0F0F)) {
+        /* css2 short form, #rgb is #rrggbb, not #r0g0b0 */
+        fprintf(fp, "#%03lX", (((rrggbb >> 8) & 0xF00)
+                               | ((rrggbb >> 4) & 0x0F0)
+                               | (rrggbb & 0x00F)));
+    } else {
+        fprintf(fp, "#%06lX", rrggbb);
+    }
     fputs("\"", fp);
- }
-}
-static void svg_get_dash(gfx_node_t *node, svg_dash *d)
-{
-  double offset;
-  int mult;
-  if (node->dash_on <= 0 || node->dash_off <= 0) {
-    d->dash_enable = 0;
-    return;
-  }
-  d->dash_enable = 1;
-  d->dash_len = node->dash_on + node->dash_off;
-  /* dash on/off adjustment due to round caps */
-  d->dash_adjust = 0.8 * node->size;
-  d->adjusted_on = node->dash_on - d->dash_adjust;
-  if (d->adjusted_on < 0.01)
-      d->adjusted_on = 0.01;
-  d->adjusted_off = d->dash_len - d->adjusted_on;
-  /* dash offset calc */
-  if (node->path[0].x == node->path[1].x) /* only good for horz/vert lines */
-    offset = node->path[0].y;
-  else
-    offset = node->path[0].x;
-  mult = (int)fabs(offset / d->dash_len);
-  d->dash_offset = offset - mult * d->dash_len;
-  if (node->path[0].x < node->path[1].x || node->path[0].y < node->path[1].y)
-    d->dash_offset = d->dash_len - d->dash_offset;
-}
-
-static int svg_dash_equal(svg_dash *a, svg_dash *b)
-{
-  if (a->dash_enable != b->dash_enable)
-    return 0;
-  if (a->adjusted_on != b->adjusted_on)
-    return 0;
-  if (a->adjusted_off != b->adjusted_off)
+    if (opacity != 0xFF) {
+        fprintf(fp, " opacity=\"");
+        svg_write_number(fp, opacity / 255.0);
+        fputs("\"", fp);
+    }
+}
+
+static void svg_get_dash(
+    gfx_node_t * node,
+    svg_dash * d)
+{
+    double    offset;
+    int       mult;
+
+    if (node->dash_on <= 0 || node->dash_off <= 0) {
+        d->dash_enable = 0;
+        return;
+    }
+    d->dash_enable = 1;
+    d->dash_len = node->dash_on + node->dash_off;
+    /* dash on/off adjustment due to round caps */
+    d->dash_adjust = 0.8 * node->size;
+    d->adjusted_on = node->dash_on - d->dash_adjust;
+    if (d->adjusted_on < 0.01)
+        d->adjusted_on = 0.01;
+    d->adjusted_off = d->dash_len - d->adjusted_on;
+    /* dash offset calc */
+    if (node->path[0].x == node->path[1].x) /* only good for horz/vert lines */
+        offset = node->path[0].y;
+    else
+        offset = node->path[0].x;
+    mult = (int) fabs(offset / d->dash_len);
+    d->dash_offset = offset - mult * d->dash_len;
+    if (node->path[0].x < node->path[1].x
+        || node->path[0].y < node->path[1].y)
+        d->dash_offset = d->dash_len - d->dash_offset;
+}
+
+static int svg_dash_equal(
+    svg_dash * a,
+    svg_dash * b)
+{
+    if (a->dash_enable != b->dash_enable)
+        return 0;
+    if (a->adjusted_on != b->adjusted_on)
+        return 0;
+    if (a->adjusted_off != b->adjusted_off)
+        return 0;
+    /* rest of properties will be the same when on+off are */
+    return 1;
+}
+
+static void svg_common_path_attributes(
+    FILE * fp,
+    gfx_node_t * node)
+{
+    svg_dash  dash_info;
+
+    svg_get_dash(node, &dash_info);
+    fputs(" stroke-width=\"", fp);
+    svg_write_number(fp, node->size);
+    fputs("\"", fp);
+    svg_write_color(fp, node->color, "stroke");
+    fputs(" fill=\"none\"", fp);
+    if (dash_info.dash_enable) {
+        if (dash_info.dash_offset != 0) {
+            fputs(" stroke-dashoffset=\"", fp);
+            svg_write_number(fp, dash_info.dash_offset);
+            fputs("\"", fp);
+        }
+        fputs(" stroke-dasharray=\"", fp);
+        svg_write_number(fp, dash_info.adjusted_on);
+        fputs(",", fp);
+        svg_write_number(fp, dash_info.adjusted_off);
+        fputs("\"", fp);
+    }
+}
+
+static int svg_is_int_step(
+    double a,
+    double b)
+{
+    double    diff = fabs(a - b);
+
+    return floor(diff) == diff;
+}
+
+static int svg_path_straight_segment(
+    FILE * fp,
+    double lastA,
+    double currentA,
+    double currentB,
+    gfx_node_t * node,
+    int segment_idx,
+    int isx,
+    char absChar,
+    char relChar)
+{
+    if (!svg_is_int_step(lastA, currentA)) {
+        putc(absChar, fp);
+        svg_write_number(fp, currentA);
+        return 0;
+    }
+    if (segment_idx < node->points - 1) {
+        ArtVpath *vec = node->path + segment_idx + 1;
+
+        if (vec->code == ART_LINETO) {
+            double    nextA = (isx ? vec->x : vec->y) - LINEOFFSET;
+            double    nextB = (isx ? vec->y : vec->x) - LINEOFFSET;
+
+            if (nextB == currentB
+                && ((currentA >= lastA) == (nextA >= currentA))
+                && svg_is_int_step(currentA, nextA)) {
+                return 1;   /* skip to next as it is a straight line  */
+            }
+        }
+    }
+    putc(relChar, fp);
+    svg_write_number(fp, currentA - lastA);
     return 0;
-  /* rest of properties will be the same when on+off are */
-  return 1;
-}
-
-static void svg_common_path_attributes(FILE *fp, gfx_node_t *node)
-{
-  svg_dash dash_info;
-  svg_get_dash(node, &dash_info);
-  fputs(" stroke-width=\"", fp);
-  svg_write_number(fp, node->size);
-  fputs("\"", fp);
-  svg_write_color(fp, node->color, "stroke");
-  fputs(" fill=\"none\"", fp);
-  if (dash_info.dash_enable) {
-    if (dash_info.dash_offset != 0) {
-      fputs(" stroke-dashoffset=\"", fp);
-      svg_write_number(fp, dash_info.dash_offset);
-      fputs("\"", fp);
-    }
-    fputs(" stroke-dasharray=\"", fp);
-    svg_write_number(fp, dash_info.adjusted_on);
-    fputs(",", fp);
-    svg_write_number(fp, dash_info.adjusted_off);
+}
+
+static void svg_path(
+    FILE * fp,
+    gfx_node_t * node,
+    int multi)
+{
+    int       i;
+    double    lastX = 0, lastY = 0;
+
+    /* for straight lines <path..> tags take less space than
+       <line..> tags because of the efficient packing
+       in the 'd' attribute */
+    svg_start_tag(fp, "path");
+    if (!multi)
+        svg_common_path_attributes(fp, node);
+    fputs(" d=\"", fp);
+    /* specification of the 'd' attribute: */
+    /* http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation */
+    for (i = 0; i < node->points; i++) {
+        ArtVpath *vec = node->path + i;
+        double    x = vec->x - LINEOFFSET;
+        double    y = vec->y - LINEOFFSET;
+
+        switch (vec->code) {
+        case ART_MOVETO_OPEN:  /* fall-through */
+        case ART_MOVETO:
+            putc('M', fp);
+            svg_write_number(fp, x);
+            putc(',', fp);
+            svg_write_number(fp, y);
+            break;
+        case ART_LINETO:
+            /* try optimize filesize by using minimal lineto commands */
+            /* without introducing rounding errors. */
+            if (x == lastX) {
+                if (svg_path_straight_segment
+                    (fp, lastY, y, x, node, i, 0, 'V', 'v'))
+                    continue;
+            } else if (y == lastY) {
+                if (svg_path_straight_segment
+                    (fp, lastX, x, y, node, i, 1, 'H', 'h'))
+                    continue;
+            } else {
+                putc('L', fp);
+                svg_write_number(fp, x);
+                putc(',', fp);
+                svg_write_number(fp, y);
+            }
+            break;
+        case ART_CURVETO:
+            break;      /* unsupported */
+        case ART_END:
+            break;      /* nop */
+        }
+        lastX = x;
+        lastY = y;
+    }
+    if (node->closed_path)
+        fputs(" Z", fp);
     fputs("\"", fp);
-  }
-}
-
-static int svg_is_int_step(double a, double b)
-{
-   double diff = fabs(a - b);
-   return floor(diff) == diff;
-}
-static int svg_path_straight_segment(FILE *fp,
-     double lastA, double currentA, double currentB,
-     gfx_node_t *node,
-     int segment_idx, int isx, char absChar, char relChar)
-{
-   if (!svg_is_int_step(lastA, currentA)) {
-     putc(absChar, fp);
-     svg_write_number(fp, currentA);
-     return 0;
-   }
-   if (segment_idx < node->points - 1) {
-     ArtVpath *vec = node->path + segment_idx + 1;
-     if (vec->code == ART_LINETO) {
-       double nextA = (isx ? vec->x : vec->y) - LINEOFFSET;
-       double nextB = (isx ? vec->y : vec->x) - LINEOFFSET;
-       if (nextB == currentB
-           && ((currentA >= lastA) == (nextA >= currentA))
-           && svg_is_int_step(currentA, nextA)) {
-         return 1; /* skip to next as it is a straight line  */
-       }
-     }
-   }
-   putc(relChar, fp);
-   svg_write_number(fp, currentA - lastA);
-   return 0;
-}
-static void svg_path(FILE *fp, gfx_node_t *node, int multi)
-{
-   int i;
-   double lastX = 0, lastY = 0;
-   /* for straight lines <path..> tags take less space than
-      <line..> tags because of the efficient packing
-      in the 'd' attribute */
-   svg_start_tag(fp, "path");
-  if (!multi)
+    svg_close_tag_empty_node(fp);
+}
+
+static void svg_multi_path(
+    FILE * fp,
+    gfx_node_t ** nodeR)
+{
+    /* optimize for multiple paths with the same color, penwidth, etc. */
+    int       num = 1;
+    gfx_node_t *node = *nodeR;
+    gfx_node_t *next = node->next;
+
+    while (next) {
+        if (next->type != node->type
+            || next->size != node->size
+            || next->color != node->color
+            || next->dash_on != node->dash_on
+            || next->dash_off != node->dash_off)
+            break;
+        next = next->next;
+        num++;
+    }
+    if (num == 1) {
+        svg_path(fp, node, 0);
+        return;
+    }
+    svg_start_tag(fp, "g");
     svg_common_path_attributes(fp, node);
-   fputs(" d=\"", fp);
-   /* specification of the 'd' attribute: */
-   /* http://www.w3.org/TR/SVG/paths.html#PathDataGeneralInformation */
-   for (i = 0; i < node->points; i++) {
-     ArtVpath *vec = node->path + i;
-     double x = vec->x - LINEOFFSET;
-     double y = vec->y - LINEOFFSET;
-     switch (vec->code) {
-     case ART_MOVETO_OPEN: /* fall-through */
-     case ART_MOVETO:
-       putc('M', fp);
-       svg_write_number(fp, x);
-       putc(',', fp);
-       svg_write_number(fp, y);
-       break;
-     case ART_LINETO:
-       /* try optimize filesize by using minimal lineto commands */
-       /* without introducing rounding errors. */
-       if (x == lastX) {
-         if (svg_path_straight_segment(fp, lastY, y, x, node, i, 0, 'V', 'v'))
-           continue;
-       } else if (y == lastY) {
-         if (svg_path_straight_segment(fp, lastX, x, y, node, i, 1, 'H', 'h'))
-           continue;
-       } else {
-         putc('L', fp);
-         svg_write_number(fp, x);
-         putc(',', fp);
-         svg_write_number(fp, y);
-       }
-       break;
-     case ART_CURVETO: break; /* unsupported */
-     case ART_END: break; /* nop */
-     }
-     lastX = x;
-     lastY = y;
-   }
-  if (node->closed_path)
-    fputs(" Z", fp);
-   fputs("\"", fp);
-   svg_close_tag_empty_node(fp);
-}
-static void svg_multi_path(FILE *fp, gfx_node_t **nodeR)
-{
-   /* optimize for multiple paths with the same color, penwidth, etc. */
-   int num = 1;
-   gfx_node_t *node = *nodeR;
-   gfx_node_t *next = node->next;
-   while (next) {
-     if (next->type != node->type
-         || next->size != node->size
-        || next->color != node->color
-        || next->dash_on != node->dash_on
-        || next->dash_off != node->dash_off)
-       break;
-     next = next->next;
-     num++;
-   }
-   if (num == 1) {
-     svg_path(fp, node, 0);
-     return;
-   }
-   svg_start_tag(fp, "g");
-  svg_common_path_attributes(fp, node);
-   svg_close_tag(fp);
-   while (num && node) {
-     svg_path(fp, node, 1);
-     if (!--num)
-       break;
-     node = node->next;
-     *nodeR = node;
-   }
-   svg_end_tag(fp, "g");
-}
-static void svg_area(FILE *fp, gfx_node_t *node)
-{
-   int i;
-   double startX = 0, startY = 0;
-   svg_start_tag(fp, "polygon");
-  fputs(" ", fp);
-  svg_write_color(fp, node->color, "fill");
-  fputs(" points=\"", fp);
-   for (i = 0; i < node->points; i++) {
-     ArtVpath *vec = node->path + i;
-     double x = vec->x - LINEOFFSET;
-     double y = vec->y - LINEOFFSET;
-     switch (vec->code) {
-       case ART_MOVETO_OPEN: /* fall-through */
-       case ART_MOVETO:
-         svg_write_number(fp, x);
-         putc(',', fp);
-         svg_write_number(fp, y);
-         startX = x;
-         startY = y;
-         break;
-       case ART_LINETO:
-         if (i == node->points - 2
-                       && node->path[i + 1].code == ART_END
-             && fabs(x - startX) < 0.001 && fabs(y - startY) < 0.001) {
-           break; /* poly area always closed, no need for last point */
-         }
-         putc(' ', fp);
-         svg_write_number(fp, x);
-         putc(',', fp);
-         svg_write_number(fp, y);
-         break;
-       case ART_CURVETO: break; /* unsupported */
-       case ART_END: break; /* nop */
-     }
-   }
-   fputs("\"", fp);
-   svg_close_tag_empty_node(fp);
-}
-static void svg_text(FILE *fp, gfx_node_t *node)
-{
-   pdf_coords g;
-   const char *fontname;
-   /* as svg has 0,0 in top-left corner (like most screens) instead of
-         bottom-left corner like pdf and eps, we have to fake the coords
-         using offset and inverse sin(r) value */
-   int page_height = 1000;
-   pdf_calc(page_height, node, &g);
-   if (node->angle != 0) {
-     svg_start_tag(fp, "g");
-        /* can't use svg_write_number as 2 decimals is far from enough to avoid
-               skewed text */
-     fprintf(fp, " transform=\"matrix(%f,%f,%f,%f,%f,%f)\"",
-                        g.ma, -g.mb, -g.mc, g.md, g.tmx, page_height - g.tmy);
-     svg_close_tag(fp);
-   }
-   svg_start_tag(fp, "text");
-   if (!node->angle) {
-     fputs(" x=\"", fp);
-     svg_write_number(fp, g.tmx);
-     fputs("\" y=\"", fp);
-     svg_write_number(fp, page_height - g.tmy);
-     fputs("\"", fp);
-   }
-   fontname = afm_get_font_name(node->filename);
-   if (strcmp(fontname, svg_default_font))
-     fprintf(fp, " font-family=\"%s\"", fontname);
-   fputs(" font-size=\"", fp);
-   svg_write_number(fp, node->size);
-   fputs("\"", fp);
-  if (!svg_color_is_black(node->color))
+    svg_close_tag(fp);
+    while (num && node) {
+        svg_path(fp, node, 1);
+        if (!--num)
+            break;
+        node = node->next;
+        *nodeR = node;
+    }
+    svg_end_tag(fp, "g");
+}
+
+static void svg_area(
+    FILE * fp,
+    gfx_node_t * node)
+{
+    int       i;
+    double    startX = 0, startY = 0;
+
+    svg_start_tag(fp, "polygon");
+    fputs(" ", fp);
     svg_write_color(fp, node->color, "fill");
-   svg_close_tag_single_line(fp);
-   /* support for node->tabwidth missing */
-   svg_write_text(fp, node->text);
-   svg_end_tag(fp, "text");
-   if (node->angle != 0)
-     svg_end_tag(fp, "g");
-}
-int       gfx_render_svg (gfx_canvas_t *canvas,
-                 art_u32 width, art_u32 height,
-                 gfx_color_t background, FILE *fp){
-   gfx_node_t *node = canvas->firstnode;
-   /* Find the first font used, and assume it is the mostly used
-         one. It reduces the number of font-familty attributes. */
-   while (node) {
-          if (node->type == GFX_TEXT && node->filename) {
-                  svg_default_font = afm_get_font_name(node->filename);
-                  break;
-          }
-          node = node->next;
-   }
-   fputs(
-"<?xml version=\"1.0\" standalone=\"no\"?>\n"
-"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n"
-"   \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n"
-"<!--\n"
-"   SVG file created by\n"
-"        RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch\n"
-"\n"
-"   The width/height attributes in the outhermost svg node\n"
-"   are just default sizes for the browser which is used\n"
-"   if the svg file is openened directly without being\n"
-"   embedded in an html file.\n"
-"   The viewBox is the local coord system for rrdtool.\n"
-"-->\n", fp);
-   svg_start_tag(fp, "svg");
-   fputs(" width=\"", fp);
-   svg_write_number(fp, width * canvas->zoom);
-   fputs("\" height=\"", fp);
-   svg_write_number(fp, height * canvas->zoom);
-   fputs("\" x=\"0\" y=\"0\" viewBox=\"", fp);
-   svg_write_number(fp, -LINEOFFSET);
-   fputs(" ", fp);
-   svg_write_number(fp, -LINEOFFSET);
-   fputs(" ", fp);
-   svg_write_number(fp, width - LINEOFFSET);
-   fputs(" ", fp);
-   svg_write_number(fp, height - LINEOFFSET);
-   fputs("\" preserveAspectRatio=\"xMidYMid\"", fp);
-   fprintf(fp, " font-family=\"%s\"", svg_default_font); /* default font */
-   fputs(" stroke-linecap=\"round\" stroke-linejoin=\"round\"", fp);
-   fputs(" xmlns=\"http://www.w3.org/2000/svg\"", fp);
-   fputs(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"", fp);
-   svg_close_tag(fp);
-   svg_start_tag(fp, "rect");
-   fprintf(fp, " x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"", width, height);
-  svg_write_color(fp, background, "fill");
-   svg_close_tag_empty_node(fp);
-   node = canvas->firstnode;
-   while (node) {
-     switch (node->type) {
-     case GFX_LINE:
-       svg_multi_path(fp, &node);
-       break;
-     case GFX_AREA:
-       svg_area(fp, node);
-       break;
-     case GFX_TEXT:
-       svg_text(fp, node);
-     }
-     node = node->next;
-   }
-   svg_end_tag(fp, "svg");
-   return 0;
+    fputs(" points=\"", fp);
+    for (i = 0; i < node->points; i++) {
+        ArtVpath *vec = node->path + i;
+        double    x = vec->x - LINEOFFSET;
+        double    y = vec->y - LINEOFFSET;
+
+        switch (vec->code) {
+        case ART_MOVETO_OPEN:  /* fall-through */
+        case ART_MOVETO:
+            svg_write_number(fp, x);
+            putc(',', fp);
+            svg_write_number(fp, y);
+            startX = x;
+            startY = y;
+            break;
+        case ART_LINETO:
+            if (i == node->points - 2
+                && node->path[i + 1].code == ART_END
+                && fabs(x - startX) < 0.001 && fabs(y - startY) < 0.001) {
+                break;  /* poly area always closed, no need for last point */
+            }
+            putc(' ', fp);
+            svg_write_number(fp, x);
+            putc(',', fp);
+            svg_write_number(fp, y);
+            break;
+        case ART_CURVETO:
+            break;      /* unsupported */
+        case ART_END:
+            break;      /* nop */
+        }
+    }
+    fputs("\"", fp);
+    svg_close_tag_empty_node(fp);
+}
+
+static void svg_text(
+    FILE * fp,
+    gfx_node_t * node)
+{
+    pdf_coords g;
+    const char *fontname;
+
+    /* as svg has 0,0 in top-left corner (like most screens) instead of
+       bottom-left corner like pdf and eps, we have to fake the coords
+       using offset and inverse sin(r) value */
+    int       page_height = 1000;
+
+    pdf_calc(page_height, node, &g);
+    if (node->angle != 0) {
+        svg_start_tag(fp, "g");
+        /* can't use svg_write_number as 2 decimals is far from enough to avoid
+           skewed text */
+        fprintf(fp, " transform=\"matrix(%f,%f,%f,%f,%f,%f)\"",
+                g.ma, -g.mb, -g.mc, g.md, g.tmx, page_height - g.tmy);
+        svg_close_tag(fp);
+    }
+    svg_start_tag(fp, "text");
+    if (!node->angle) {
+        fputs(" x=\"", fp);
+        svg_write_number(fp, g.tmx);
+        fputs("\" y=\"", fp);
+        svg_write_number(fp, page_height - g.tmy);
+        fputs("\"", fp);
+    }
+    fontname = afm_get_font_name(node->filename);
+    if (strcmp(fontname, svg_default_font))
+        fprintf(fp, " font-family=\"%s\"", fontname);
+    fputs(" font-size=\"", fp);
+    svg_write_number(fp, node->size);
+    fputs("\"", fp);
+    if (!svg_color_is_black(node->color))
+        svg_write_color(fp, node->color, "fill");
+    svg_close_tag_single_line(fp);
+    /* support for node->tabwidth missing */
+    svg_write_text(fp, node->text);
+    svg_end_tag(fp, "text");
+    if (node->angle != 0)
+        svg_end_tag(fp, "g");
+}
+
+int gfx_render_svg(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fp)
+{
+    gfx_node_t *node = canvas->firstnode;
+
+    /* Find the first font used, and assume it is the mostly used
+       one. It reduces the number of font-familty attributes. */
+    while (node) {
+        if (node->type == GFX_TEXT && node->filename) {
+            svg_default_font = afm_get_font_name(node->filename);
+            break;
+        }
+        node = node->next;
+    }
+    fputs("<?xml version=\"1.0\" standalone=\"no\"?>\n"
+          "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\"\n"
+          "   \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n"
+          "<!--\n"
+          "   SVG file created by\n"
+          "        RRDtool " PACKAGE_VERSION
+          " Tobias Oetiker, http://tobi.oetiker.ch\n" "\n"
+          "   The width/height attributes in the outhermost svg node\n"
+          "   are just default sizes for the browser which is used\n"
+          "   if the svg file is openened directly without being\n"
+          "   embedded in an html file.\n"
+          "   The viewBox is the local coord system for rrdtool.\n" "-->\n",
+          fp);
+    svg_start_tag(fp, "svg");
+    fputs(" width=\"", fp);
+    svg_write_number(fp, width * canvas->zoom);
+    fputs("\" height=\"", fp);
+    svg_write_number(fp, height * canvas->zoom);
+    fputs("\" x=\"0\" y=\"0\" viewBox=\"", fp);
+    svg_write_number(fp, -LINEOFFSET);
+    fputs(" ", fp);
+    svg_write_number(fp, -LINEOFFSET);
+    fputs(" ", fp);
+    svg_write_number(fp, width - LINEOFFSET);
+    fputs(" ", fp);
+    svg_write_number(fp, height - LINEOFFSET);
+    fputs("\" preserveAspectRatio=\"xMidYMid\"", fp);
+    fprintf(fp, " font-family=\"%s\"", svg_default_font);   /* default font */
+    fputs(" stroke-linecap=\"round\" stroke-linejoin=\"round\"", fp);
+    fputs(" xmlns=\"http://www.w3.org/2000/svg\"", fp);
+    fputs(" xmlns:xlink=\"http://www.w3.org/1999/xlink\"", fp);
+    svg_close_tag(fp);
+    svg_start_tag(fp, "rect");
+    fprintf(fp, " x=\"0\" y=\"0\" width=\"%d\" height=\"%d\"", width, height);
+    svg_write_color(fp, background, "fill");
+    svg_close_tag_empty_node(fp);
+    node = canvas->firstnode;
+    while (node) {
+        switch (node->type) {
+        case GFX_LINE:
+            svg_multi_path(fp, &node);
+            break;
+        case GFX_AREA:
+            svg_area(fp, node);
+            break;
+        case GFX_TEXT:
+            svg_text(fp, node);
+        }
+        node = node->next;
+    }
+    svg_end_tag(fp, "svg");
+    return 0;
 }
 
 /* ------- EPS -------
@@ -1498,388 +1765,413 @@ int       gfx_render_svg (gfx_canvas_t *canvas,
    http://partners.adobe.com/asn/developer/technotes/postscript.html
 */
 
-typedef struct eps_font
-{
-  const char *ps_font;
-  int id;
-  struct eps_font *next;
+typedef struct eps_font {
+    const char *ps_font;
+    int       id;
+    struct eps_font *next;
 } eps_font;
 
-typedef struct eps_state
-{
-  FILE *fp;
-  gfx_canvas_t *canvas;
-  art_u32 page_width, page_height;
-  eps_font *font_list;
+typedef struct eps_state {
+    FILE     *fp;
+    gfx_canvas_t *canvas;
+    art_u32   page_width, page_height;
+    eps_font *font_list;
   /*--*/
-  gfx_color_t color;
-  const char *font;
-  double font_size;
-  double line_width;
-  int linecap, linejoin;
-  int has_dash;
+    gfx_color_t color;
+    const char *font;
+    double    font_size;
+    double    line_width;
+    int       linecap, linejoin;
+    int       has_dash;
 } eps_state;
 
-static void eps_set_color(eps_state *state, gfx_color_t color)
+static void eps_set_color(
+    eps_state * state,
+    gfx_color_t color)
 {
 #if USE_EPS_FAKE_ALPHA
-   double a1, a2;
+    double    a1, a2;
 #endif
-   /* gfx_color_t is RRGGBBAA */
-  if (state->color == color)
-    return;
+    /* gfx_color_t is RRGGBBAA */
+    if (state->color == color)
+        return;
 #if USE_EPS_FAKE_ALPHA
-  a1 = (color & 255) / 255.0;
-  a2 = 255 * (1 - a1);
+    a1 = (color & 255) / 255.0;
+    a2 = 255 * (1 - a1);
 #define eps_color_calc(x) (int)( ((x) & 255) * a1 + a2)
 #else
 #define eps_color_calc(x) (int)( (x) & 255)
 #endif
-   /* gfx_color_t is RRGGBBAA */
-  if (state->color == color)
-    return;
-  fprintf(state->fp, "%d %d %d Rgb\n",
-      eps_color_calc(color >> 24),
-      eps_color_calc(color >> 16),
-      eps_color_calc(color >>  8));
-  state->color = color;
-}
-
-static int eps_add_font(eps_state *state, gfx_node_t *node)
-{
-  /* The fonts list could be postponed to the end using
-     (atend), but let's be nice and have them in the header. */
-  const char *ps_font = afm_get_font_postscript_name(node->filename);
-  eps_font *ef;
-  for (ef = state->font_list; ef; ef = ef->next) {
-    if (!strcmp(ps_font, ef->ps_font))
-      return 0;
-  }
-  ef = malloc(sizeof(eps_font));
-  if (ef == NULL) {
-    rrd_set_error("malloc for eps_font");
-    return -1;
-  }
-  ef->next = state->font_list;
-  ef->ps_font = ps_font;
-  state->font_list = ef;
-  return 0;
-}
-
-static void eps_list_fonts(eps_state *state, const char *dscName)
-{
-  eps_font *ef;
-  int lineLen = strlen(dscName);
-  if (!state->font_list)
-    return;
-  fputs(dscName, state->fp);
-  for (ef = state->font_list; ef; ef = ef->next) {
-    int nameLen = strlen(ef->ps_font);
-    if (lineLen + nameLen > 100 && lineLen) {
-      fputs("\n", state->fp);
-      fputs("%%- \n", state->fp);
-      lineLen = 5;
-    } else {
-      fputs(" ", state->fp);
-      lineLen++;
-    }
-    fputs(ef->ps_font, state->fp);
-    lineLen += nameLen;
-  }
-  fputs("\n", state->fp);
-}
-
-static void eps_define_fonts(eps_state *state)
-{
-  eps_font *ef;
-  if (!state->font_list)
-    return;
-  for (ef = state->font_list; ef; ef = ef->next) {
-    /* PostScript¨ LANGUAGE REFERENCE third edition
-       page 349 */
-    fprintf(state->fp,
-        "%%\n"
-        "/%s findfont dup length dict begin\n"
-        "{ 1 index /FID ne {def} {pop pop} ifelse } forall\n"
-        "/Encoding ISOLatin1Encoding def\n"
-        "currentdict end\n"
-        "/%s-ISOLatin1 exch definefont pop\n"
-        "/SetFont-%s { /%s-ISOLatin1 findfont exch scalefont setfont } bd\n",
-        ef->ps_font, ef->ps_font, ef->ps_font, ef->ps_font);
-  }
-}
-
-static int eps_prologue(eps_state *state)
-{
-  gfx_node_t *node;
-  fputs(
-    "%!PS-Adobe-3.0 EPSF-3.0\n"
-    "%%Creator: RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch\n"
-    /* can't like weird chars here */
-    "%%Title: (RRDtool output)\n"
-    "%%DocumentData: Clean7Bit\n"
-    "", state->fp);
-  fprintf(state->fp, "%%%%BoundingBox: 0 0 %d %d\n",
-    state->page_width, state->page_height);
-  for (node = state->canvas->firstnode; node; node = node->next) {
-    if (node->type == GFX_TEXT && eps_add_font(state, node) == -1)
-      return -1;
-  }
-  eps_list_fonts(state, "%%DocumentFonts:");
-  eps_list_fonts(state, "%%DocumentNeededFonts:");
-  fputs(
-      "%%EndComments\n"
-      "%%BeginProlog\n"
-      "%%EndProlog\n" /* must have, or BoundingBox is ignored */
-      "/bd { bind def } bind def\n"
-      "", state->fp);
-  fprintf(state->fp, "/X { %.2f add } bd\n", LINEOFFSET);
-  fputs(
-      "/X2 {X exch X exch} bd\n"
-      "/M {X2 moveto} bd\n"
-      "/L {X2 lineto} bd\n"
-      "/m {moveto} bd\n"
-      "/l {lineto} bd\n"
-      "/S {stroke} bd\n"
-      "/CP {closepath} bd\n"
-      "/WS {setlinewidth stroke} bd\n"
-      "/F {fill} bd\n"
-      "/T1 {gsave} bd\n"
-      "/T2 {concat 0 0 moveto show grestore} bd\n"
-      "/T   {moveto show} bd\n"
-      "/Rgb { 255.0 div 3 1 roll\n"
-      "       255.0 div 3 1 roll \n"
-      "       255.0 div 3 1 roll setrgbcolor } bd\n"
-      "", state->fp);
-  eps_define_fonts(state);
-  return 0;
-}
-
-static void eps_clear_dash(eps_state *state)
-{
-  if (!state->has_dash)
-    return;
-  state->has_dash = 0;
-  fputs("[1 0] 0 setdash\n", state->fp);
-}
-
-static void eps_write_linearea(eps_state *state, gfx_node_t *node)
-{
-  int i;
-  FILE *fp = state->fp;
-  int useOffset = 0;
-  int clearDashIfAny = 1;
-  eps_set_color(state, node->color);
-  if (node->type == GFX_LINE) {
-    svg_dash dash_info;
-    if (state->linecap != 1) {
-      fputs("1 setlinecap\n", fp);
-      state->linecap = 1;
-    }
-    if (state->linejoin != 1) {
-      fputs("1 setlinejoin\n", fp);
-      state->linejoin = 1;
+    /* gfx_color_t is RRGGBBAA */
+    if (state->color == color)
+        return;
+    fprintf(state->fp, "%d %d %d Rgb\n",
+            eps_color_calc(color >> 24),
+            eps_color_calc(color >> 16), eps_color_calc(color >> 8));
+    state->color = color;
+}
+
+static int eps_add_font(
+    eps_state * state,
+    gfx_node_t * node)
+{
+    /* The fonts list could be postponed to the end using
+       (atend), but let's be nice and have them in the header. */
+    const char *ps_font = afm_get_font_postscript_name(node->filename);
+    eps_font *ef;
+
+    for (ef = state->font_list; ef; ef = ef->next) {
+        if (!strcmp(ps_font, ef->ps_font))
+            return 0;
     }
-    svg_get_dash(node, &dash_info);
-    if (dash_info.dash_enable) {
-      clearDashIfAny = 0;
-      state->has_dash = 1;
-      fputs("[", fp);
-      svg_write_number(fp, dash_info.adjusted_on);
-      fputs(" ", fp);
-      svg_write_number(fp, dash_info.adjusted_off);
-      fputs("] ", fp);
-      svg_write_number(fp, dash_info.dash_offset);
-      fputs(" setdash\n", fp);
-    }
-  }
-  if (clearDashIfAny)
-    eps_clear_dash(state);
-  for (i = 0; i < node->points; i++) {
-    ArtVpath *vec = node->path + i;
-    double x = vec->x;
-    double y = state->page_height - vec->y;
-    if (vec->code == ART_MOVETO_OPEN || vec->code == ART_MOVETO)
-      useOffset = (fabs(x - floor(x) - 0.5) < 0.01 && fabs(y - floor(y) - 0.5) < 0.01);
-    if (useOffset) {
-      x -= LINEOFFSET;
-      y -= LINEOFFSET;
-    }
-    switch (vec->code) {
-    case ART_MOVETO_OPEN: /* fall-through */
-    case ART_MOVETO:
-      svg_write_number(fp, x);
-      fputc(' ', fp);
-      svg_write_number(fp, y);
-      fputc(' ', fp);
-      fputs(useOffset ? "M\n" : "m\n", fp);
-      break;
-    case ART_LINETO:
-      svg_write_number(fp, x);
-      fputc(' ', fp);
-      svg_write_number(fp, y);
-      fputc(' ', fp);
-      fputs(useOffset ? "L\n" : "l\n", fp);
-      break;
-    case ART_CURVETO: break; /* unsupported */
-    case ART_END: break; /* nop */
-    }
-  }
-  if (node->type == GFX_LINE) {
-    if (node->closed_path)
-      fputs("CP ", fp);
-    if (node->size != state->line_width) {
-      state->line_width = node->size;
-      svg_write_number(fp, state->line_width);
-      fputs(" WS\n", fp);
+    ef = malloc(sizeof(eps_font));
+    if (ef == NULL) {
+        rrd_set_error("malloc for eps_font");
+        return -1;
+    }
+    ef->next = state->font_list;
+    ef->ps_font = ps_font;
+    state->font_list = ef;
+    return 0;
+}
+
+static void eps_list_fonts(
+    eps_state * state,
+    const char *dscName)
+{
+    eps_font *ef;
+    int       lineLen = strlen(dscName);
+
+    if (!state->font_list)
+        return;
+    fputs(dscName, state->fp);
+    for (ef = state->font_list; ef; ef = ef->next) {
+        int       nameLen = strlen(ef->ps_font);
+
+        if (lineLen + nameLen > 100 && lineLen) {
+            fputs("\n", state->fp);
+            fputs("%%- \n", state->fp);
+            lineLen = 5;
+        } else {
+            fputs(" ", state->fp);
+            lineLen++;
+        }
+        fputs(ef->ps_font, state->fp);
+        lineLen += nameLen;
+    }
+    fputs("\n", state->fp);
+}
+
+static void eps_define_fonts(
+    eps_state * state)
+{
+    eps_font *ef;
+
+    if (!state->font_list)
+        return;
+    for (ef = state->font_list; ef; ef = ef->next) {
+        /* PostScript¨ LANGUAGE REFERENCE third edition
+           page 349 */
+        fprintf(state->fp,
+                "%%\n"
+                "/%s findfont dup length dict begin\n"
+                "{ 1 index /FID ne {def} {pop pop} ifelse } forall\n"
+                "/Encoding ISOLatin1Encoding def\n"
+                "currentdict end\n"
+                "/%s-ISOLatin1 exch definefont pop\n"
+                "/SetFont-%s { /%s-ISOLatin1 findfont exch scalefont setfont } bd\n",
+                ef->ps_font, ef->ps_font, ef->ps_font, ef->ps_font);
+    }
+}
+
+static int eps_prologue(
+    eps_state * state)
+{
+    gfx_node_t *node;
+
+    fputs("%!PS-Adobe-3.0 EPSF-3.0\n"
+          "%%Creator: RRDtool " PACKAGE_VERSION
+          " Tobias Oetiker, http://tobi.oetiker.ch\n"
+          /* can't like weird chars here */
+          "%%Title: (RRDtool output)\n"
+          "%%DocumentData: Clean7Bit\n" "", state->fp);
+    fprintf(state->fp, "%%%%BoundingBox: 0 0 %d %d\n",
+            state->page_width, state->page_height);
+    for (node = state->canvas->firstnode; node; node = node->next) {
+        if (node->type == GFX_TEXT && eps_add_font(state, node) == -1)
+            return -1;
+    }
+    eps_list_fonts(state, "%%DocumentFonts:");
+    eps_list_fonts(state, "%%DocumentNeededFonts:");
+    fputs("%%EndComments\n" "%%BeginProlog\n" "%%EndProlog\n"   /* must have, or BoundingBox is ignored */
+          "/bd { bind def } bind def\n" "", state->fp);
+    fprintf(state->fp, "/X { %.2f add } bd\n", LINEOFFSET);
+    fputs("/X2 {X exch X exch} bd\n"
+          "/M {X2 moveto} bd\n"
+          "/L {X2 lineto} bd\n"
+          "/m {moveto} bd\n"
+          "/l {lineto} bd\n"
+          "/S {stroke} bd\n"
+          "/CP {closepath} bd\n"
+          "/WS {setlinewidth stroke} bd\n"
+          "/F {fill} bd\n"
+          "/T1 {gsave} bd\n"
+          "/T2 {concat 0 0 moveto show grestore} bd\n"
+          "/T   {moveto show} bd\n"
+          "/Rgb { 255.0 div 3 1 roll\n"
+          "       255.0 div 3 1 roll \n"
+          "       255.0 div 3 1 roll setrgbcolor } bd\n" "", state->fp);
+    eps_define_fonts(state);
+    return 0;
+}
+
+static void eps_clear_dash(
+    eps_state * state)
+{
+    if (!state->has_dash)
+        return;
+    state->has_dash = 0;
+    fputs("[1 0] 0 setdash\n", state->fp);
+}
+
+static void eps_write_linearea(
+    eps_state * state,
+    gfx_node_t * node)
+{
+    int       i;
+    FILE     *fp = state->fp;
+    int       useOffset = 0;
+    int       clearDashIfAny = 1;
+
+    eps_set_color(state, node->color);
+    if (node->type == GFX_LINE) {
+        svg_dash  dash_info;
+
+        if (state->linecap != 1) {
+            fputs("1 setlinecap\n", fp);
+            state->linecap = 1;
+        }
+        if (state->linejoin != 1) {
+            fputs("1 setlinejoin\n", fp);
+            state->linejoin = 1;
+        }
+        svg_get_dash(node, &dash_info);
+        if (dash_info.dash_enable) {
+            clearDashIfAny = 0;
+            state->has_dash = 1;
+            fputs("[", fp);
+            svg_write_number(fp, dash_info.adjusted_on);
+            fputs(" ", fp);
+            svg_write_number(fp, dash_info.adjusted_off);
+            fputs("] ", fp);
+            svg_write_number(fp, dash_info.dash_offset);
+            fputs(" setdash\n", fp);
+        }
+    }
+    if (clearDashIfAny)
+        eps_clear_dash(state);
+    for (i = 0; i < node->points; i++) {
+        ArtVpath *vec = node->path + i;
+        double    x = vec->x;
+        double    y = state->page_height - vec->y;
+
+        if (vec->code == ART_MOVETO_OPEN || vec->code == ART_MOVETO)
+            useOffset = (fabs(x - floor(x) - 0.5) < 0.01
+                         && fabs(y - floor(y) - 0.5) < 0.01);
+        if (useOffset) {
+            x -= LINEOFFSET;
+            y -= LINEOFFSET;
+        }
+        switch (vec->code) {
+        case ART_MOVETO_OPEN:  /* fall-through */
+        case ART_MOVETO:
+            svg_write_number(fp, x);
+            fputc(' ', fp);
+            svg_write_number(fp, y);
+            fputc(' ', fp);
+            fputs(useOffset ? "M\n" : "m\n", fp);
+            break;
+        case ART_LINETO:
+            svg_write_number(fp, x);
+            fputc(' ', fp);
+            svg_write_number(fp, y);
+            fputc(' ', fp);
+            fputs(useOffset ? "L\n" : "l\n", fp);
+            break;
+        case ART_CURVETO:
+            break;      /* unsupported */
+        case ART_END:
+            break;      /* nop */
+        }
+    }
+    if (node->type == GFX_LINE) {
+        if (node->closed_path)
+            fputs("CP ", fp);
+        if (node->size != state->line_width) {
+            state->line_width = node->size;
+            svg_write_number(fp, state->line_width);
+            fputs(" WS\n", fp);
+        } else {
+            fputs("S\n", fp);
+        }
     } else {
-      fputs("S\n", fp);
+        fputs("F\n", fp);
     }
-   } else {
-    fputs("F\n", fp);
-   }
 }
 
-static void eps_write_text(eps_state *state, gfx_node_t *node)
+static void eps_write_text(
+    eps_state * state,
+    gfx_node_t * node)
 {
-  FILE *fp = state->fp;
-  const char *ps_font = afm_get_font_postscript_name(node->filename);
-  int lineLen = 0;
-  pdf_coords g;
+    FILE     *fp = state->fp;
+    const char *ps_font = afm_get_font_postscript_name(node->filename);
+    int       lineLen = 0;
+    pdf_coords g;
+
 #ifdef HAVE_MBSTOWCS
-    size_t clen;
-    wchar_t *p, *cstr, ch;
-    int text_count;
+    size_t    clen;
+    wchar_t  *p, *cstr, ch;
+    int       text_count;
+
     if (!node->text)
-       return;
+        return;
     clen = strlen(node->text) + 1;
     cstr = malloc(sizeof(wchar_t) * clen);
     text_count = mbstowcs(cstr, node->text, clen);
     if (text_count == -1)
-       text_count = mbstowcs(cstr, "Enc-Err", 6);
+        text_count = mbstowcs(cstr, "Enc-Err", 6);
     p = cstr;
 #else
     const unsigned char *p = node->text;
     unsigned char ch;
+
     if (!p)
-       return;
+        return;
 #endif
-  pdf_calc(state->page_height, node, &g);
-  eps_set_color(state, node->color);
-  if (strcmp(ps_font, state->font) || node->size != state->font_size) {
-    state->font = ps_font;
-    state->font_size = node->size;
-    svg_write_number(fp, state->font_size);
-    fprintf(fp, " SetFont-%s\n", state->font);
-  }
-  if (node->angle)
-         fputs("T1 ", fp);
-  fputs("(", fp);
-  lineLen = 20;
-  while (1) {
-    ch = *p;
-    if (!ch)
-      break;
-       ch = afm_fix_osx_charset(ch); /* unsafe macro */
-    if (++lineLen > 70) {
-      fputs("\\\n", fp); /* backslash and \n */
-      lineLen = 0;
-    }
-    switch (ch) {
-      case '%':
-      case '(':
-      case ')':
-      case '\\':
-        fputc('\\', fp);
-        fputc(ch, fp);
-        break;
-      case '\n':
-        fputs("\\n", fp);
-        break;
-      case '\r':
-        fputs("\\r", fp);
-        break;
-      case '\t':
-        fputs("\\t", fp);
-        break;
-      default:
-        if (ch > 255) {
-            fputc('?', fp);
-        } else if (ch >= 126 || ch < 32) {
-          fprintf(fp, "\\%03o", (unsigned int)ch);
-          lineLen += 3;
-        } else {
-          fputc(ch, fp);
+    pdf_calc(state->page_height, node, &g);
+    eps_set_color(state, node->color);
+    if (strcmp(ps_font, state->font) || node->size != state->font_size) {
+        state->font = ps_font;
+        state->font_size = node->size;
+        svg_write_number(fp, state->font_size);
+        fprintf(fp, " SetFont-%s\n", state->font);
+    }
+    if (node->angle)
+        fputs("T1 ", fp);
+    fputs("(", fp);
+    lineLen = 20;
+    while (1) {
+        ch = *p;
+        if (!ch)
+            break;
+        ch = afm_fix_osx_charset(ch);   /* unsafe macro */
+        if (++lineLen > 70) {
+            fputs("\\\n", fp);  /* backslash and \n */
+            lineLen = 0;
+        }
+        switch (ch) {
+        case '%':
+        case '(':
+        case ')':
+        case '\\':
+            fputc('\\', fp);
+            fputc(ch, fp);
+            break;
+        case '\n':
+            fputs("\\n", fp);
+            break;
+        case '\r':
+            fputs("\\r", fp);
+            break;
+        case '\t':
+            fputs("\\t", fp);
+            break;
+        default:
+            if (ch > 255) {
+                fputc('?', fp);
+            } else if (ch >= 126 || ch < 32) {
+                fprintf(fp, "\\%03o", (unsigned int) ch);
+                lineLen += 3;
+            } else {
+                fputc(ch, fp);
+            }
         }
-      }
-      p++;
-  }
+        p++;
+    }
 #ifdef HAVE_MBSTOWCS
-  free(cstr);
+    free(cstr);
 #endif
-  if (node->angle) {
-        /* can't use svg_write_number as 2 decimals is far from enough to avoid
-               skewed text */
-         fprintf(fp, ") [%f %f %f %f %f %f] T2\n",
-                         g.ma, g.mb, g.mc, g.md, g.tmx, g.tmy);
-  } else {
-         fputs(") ", fp);
-         svg_write_number(fp, g.tmx);
-         fputs(" ", fp);
-         svg_write_number(fp, g.tmy);
-         fputs(" T\n", fp);
-  }
-}
-
-static int eps_write_content(eps_state *state)
-{
-  gfx_node_t *node;
-  fputs("%\n", state->fp);
-  for (node = state->canvas->firstnode; node; node = node->next) {
-    switch (node->type) {
-    case GFX_LINE:
-    case GFX_AREA:
-      eps_write_linearea(state, node);
-      break;
-    case GFX_TEXT:
-      eps_write_text(state, node);
-      break;
-    }
-  }
-  return 0;
-}
-
-int       gfx_render_eps (gfx_canvas_t *canvas,
-                 art_u32 width, art_u32 height,
-                 gfx_color_t background, FILE *fp){
-  struct eps_state state;
-  state.fp = fp;
-  state.canvas = canvas;
-  state.page_width = width;
-  state.page_height = height;
-  state.font = "no-default-font";
-  state.font_size = -1;
-  state.color = 0; /* black */
-  state.font_list = NULL;
-  state.linecap = -1;
-  state.linejoin = -1;
-  state.has_dash = 0;
-  state.line_width = 1;
-  if (eps_prologue(&state) == -1)
-    return -1;
-  eps_set_color(&state, background);
-  fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
-      height, width, height, width);
-  if (eps_write_content(&state) == -1)
+    if (node->angle) {
+        /* can't use svg_write_number as 2 decimals is far from enough to avoid
+           skewed text */
+        fprintf(fp, ") [%f %f %f %f %f %f] T2\n",
+                g.ma, g.mb, g.mc, g.md, g.tmx, g.tmy);
+    } else {
+        fputs(") ", fp);
+        svg_write_number(fp, g.tmx);
+        fputs(" ", fp);
+        svg_write_number(fp, g.tmy);
+        fputs(" T\n", fp);
+    }
+}
+
+static int eps_write_content(
+    eps_state * state)
+{
+    gfx_node_t *node;
+
+    fputs("%\n", state->fp);
+    for (node = state->canvas->firstnode; node; node = node->next) {
+        switch (node->type) {
+        case GFX_LINE:
+        case GFX_AREA:
+            eps_write_linearea(state, node);
+            break;
+        case GFX_TEXT:
+            eps_write_text(state, node);
+            break;
+        }
+    }
+    return 0;
+}
+
+int gfx_render_eps(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fp)
+{
+    struct eps_state state;
+
+    state.fp = fp;
+    state.canvas = canvas;
+    state.page_width = width;
+    state.page_height = height;
+    state.font = "no-default-font";
+    state.font_size = -1;
+    state.color = 0;    /* black */
+    state.font_list = NULL;
+    state.linecap = -1;
+    state.linejoin = -1;
+    state.has_dash = 0;
+    state.line_width = 1;
+    if (eps_prologue(&state) == -1)
+        return -1;
+    eps_set_color(&state, background);
+    fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
+            height, width, height, width);
+    if (eps_write_content(&state) == -1)
+        return 0;
+    fputs("showpage\n", fp);
+    fputs("%%EOF\n", fp);
+    while (state.font_list) {
+        eps_font *next = state.font_list->next;
+
+        free(state.font_list);
+        state.font_list = next;
+    }
     return 0;
-  fputs("showpage\n", fp);
-  fputs("%%EOF\n", fp);
-  while (state.font_list) {
-    eps_font *next = state.font_list->next;
-    free(state.font_list);
-    state.font_list = next;
-  }
-  return 0;
 }
 
 /* ------- PDF -------
@@ -1887,198 +2179,226 @@ int       gfx_render_eps (gfx_canvas_t *canvas,
    http://partners.adobe.com/public/developer/pdf/index_reference.html
 */
 
-typedef struct pdf_buffer
-{
-  int id, is_obj, is_dict, is_stream, pdf_file_pos;
-  char *data;
-  int alloc_size, current_size;
-  struct pdf_buffer *previous_buffer, *next_buffer;
-  struct pdf_state *state;
+typedef struct pdf_buffer {
+    int       id, is_obj, is_dict, is_stream, pdf_file_pos;
+    char     *data;
+    int       alloc_size, current_size;
+    struct pdf_buffer *previous_buffer, *next_buffer;
+    struct pdf_state *state;
 } pdf_buffer;
 
-typedef struct pdf_font
-{
-  const char *ps_font;
-  pdf_buffer obj;
-  struct pdf_font *next;
+typedef struct pdf_font {
+    const char *ps_font;
+    pdf_buffer obj;
+    struct pdf_font *next;
 } pdf_font;
 
-typedef struct pdf_state
-{
-  FILE *fp;
-  gfx_canvas_t *canvas;
-  art_u32 page_width, page_height;
-  pdf_font *font_list;
-  pdf_buffer *first_buffer, *last_buffer;
-  int pdf_file_pos;
-  int has_failed;
+typedef struct pdf_state {
+    FILE     *fp;
+    gfx_canvas_t *canvas;
+    art_u32   page_width, page_height;
+    pdf_font *font_list;
+    pdf_buffer *first_buffer, *last_buffer;
+    int       pdf_file_pos;
+    int       has_failed;
   /*--*/
-  gfx_color_t stroke_color, fill_color;
-  int font_id;
-  double font_size;
-  double line_width;
-  svg_dash dash;
-  int linecap, linejoin;
-  int last_obj_id;
+    gfx_color_t stroke_color, fill_color;
+    int       font_id;
+    double    font_size;
+    double    line_width;
+    svg_dash  dash;
+    int       linecap, linejoin;
+    int       last_obj_id;
   /*--*/
-  pdf_buffer pdf_header;
-  pdf_buffer info_obj, catalog_obj, pages_obj, page1_obj;
-  pdf_buffer fontsdict_obj;
-  pdf_buffer graph_stream;
+    pdf_buffer pdf_header;
+    pdf_buffer info_obj, catalog_obj, pages_obj, page1_obj;
+    pdf_buffer fontsdict_obj;
+    pdf_buffer graph_stream;
 } pdf_state;
 
-static void pdf_init_buffer(pdf_state *state, pdf_buffer *buf)
-{
-  int initial_size = 32;
-  buf->state = state;
-  buf->id = -42;
-  buf->alloc_size = 0;
-  buf->current_size = 0;
-  buf->data = (char*)malloc(initial_size);
-  buf->is_obj = 0;
-  buf->previous_buffer = NULL;
-  buf->next_buffer = NULL;
-  if (buf->data == NULL) {
-    rrd_set_error("malloc for pdf_buffer data");
-    state->has_failed = 1;
-    return;
-  }
-  buf->alloc_size = initial_size;
-  if (state->last_buffer)
-    state->last_buffer->next_buffer = buf;
-  if (state->first_buffer == NULL)
-    state->first_buffer = buf;
-  buf->previous_buffer = state->last_buffer;
-  state->last_buffer = buf;
-}
-
-static void pdf_put(pdf_buffer *buf, const char *text, int len)
-{
-  if (len <= 0)
-    return;
-  if (buf->alloc_size < buf->current_size + len) {
-    int new_size = buf->alloc_size;
-    char *new_buf;
-    while (new_size < buf->current_size + len)
-      new_size *= 4;
-    new_buf = (char*)malloc(new_size);
-    if (new_buf == NULL) {
-      rrd_set_error("re-malloc for pdf_buffer data");
-      buf->state->has_failed = 1;
-      return;
-    }
-    memcpy(new_buf, buf->data, buf->current_size);
-    free(buf->data);
-    buf->data = new_buf;
-    buf->alloc_size = new_size;
-  }
-  memcpy(buf->data + buf->current_size, text, len);
-  buf->current_size += len;
-}
-
-static void pdf_put_char(pdf_buffer *buf, char c)
+static void pdf_init_buffer(
+    pdf_state * state,
+    pdf_buffer * buf)
+{
+    int       initial_size = 32;
+
+    buf->state = state;
+    buf->id = -42;
+    buf->alloc_size = 0;
+    buf->current_size = 0;
+    buf->data = (char *) malloc(initial_size);
+    buf->is_obj = 0;
+    buf->previous_buffer = NULL;
+    buf->next_buffer = NULL;
+    if (buf->data == NULL) {
+        rrd_set_error("malloc for pdf_buffer data");
+        state->has_failed = 1;
+        return;
+    }
+    buf->alloc_size = initial_size;
+    if (state->last_buffer)
+        state->last_buffer->next_buffer = buf;
+    if (state->first_buffer == NULL)
+        state->first_buffer = buf;
+    buf->previous_buffer = state->last_buffer;
+    state->last_buffer = buf;
+}
+
+static void pdf_put(
+    pdf_buffer * buf,
+    const char *text,
+    int len)
+{
+    if (len <= 0)
+        return;
+    if (buf->alloc_size < buf->current_size + len) {
+        int       new_size = buf->alloc_size;
+        char     *new_buf;
+
+        while (new_size < buf->current_size + len)
+            new_size *= 4;
+        new_buf = (char *) malloc(new_size);
+        if (new_buf == NULL) {
+            rrd_set_error("re-malloc for pdf_buffer data");
+            buf->state->has_failed = 1;
+            return;
+        }
+        memcpy(new_buf, buf->data, buf->current_size);
+        free(buf->data);
+        buf->data = new_buf;
+        buf->alloc_size = new_size;
+    }
+    memcpy(buf->data + buf->current_size, text, len);
+    buf->current_size += len;
+}
+
+static void pdf_put_char(
+    pdf_buffer * buf,
+    char c)
 {
     if (buf->alloc_size >= buf->current_size + 1) {
-       buf->data[buf->current_size++] = c;
+        buf->data[buf->current_size++] = c;
     } else {
-       char tmp[1];
-       tmp[0] = (char)c;
-       pdf_put(buf, tmp, 1);
+        char      tmp[1];
+
+        tmp[0] = (char) c;
+        pdf_put(buf, tmp, 1);
     }
 }
 
-static void pdf_puts(pdf_buffer *buf, const char *text)
+static void pdf_puts(
+    pdf_buffer * buf,
+    const char *text)
 {
-  pdf_put(buf, text, strlen(text));
+    pdf_put(buf, text, strlen(text));
 }
 
-static void pdf_indent(pdf_buffer *buf)
+static void pdf_indent(
+    pdf_buffer * buf)
 {
-  pdf_puts(buf, "\t");
+    pdf_puts(buf, "\t");
 }
 
-static void pdf_putsi(pdf_buffer *buf, const char *text)
+static void pdf_putsi(
+    pdf_buffer * buf,
+    const char *text)
 {
-  pdf_indent(buf);
-  pdf_puts(buf, text);
+    pdf_indent(buf);
+    pdf_puts(buf, text);
 }
 
-static void pdf_putint(pdf_buffer *buf, int i)
+static void pdf_putint(
+    pdf_buffer * buf,
+    int i)
 {
-  char tmp[20];
-  sprintf(tmp, "%d", i);
-  pdf_puts(buf, tmp);
+    char      tmp[20];
+
+    sprintf(tmp, "%d", i);
+    pdf_puts(buf, tmp);
 }
 
-static void pdf_putnumber(pdf_buffer *buf, double d)
+static void pdf_putnumber(
+    pdf_buffer * buf,
+    double d)
 {
-  char tmp[50];
-  svg_format_number(tmp, sizeof(tmp), d);
-  pdf_puts(buf, tmp);
+    char      tmp[50];
+
+    svg_format_number(tmp, sizeof(tmp), d);
+    pdf_puts(buf, tmp);
 }
 
-static void pdf_put_string_contents_wide(pdf_buffer *buf, const afm_char *text)
+static void pdf_put_string_contents_wide(
+    pdf_buffer * buf,
+    const afm_char * text)
 {
     const afm_char *p = text;
+
     while (1) {
-       afm_char ch = *p;
-       ch = afm_fix_osx_charset(ch); /* unsafe macro */
-       switch (ch) {
-           case 0:
-               return;
-           case '(':
-               pdf_puts(buf, "\\(");
-               break;
-           case ')':
-               pdf_puts(buf, "\\)");
-               break;
-           case '\\':
-               pdf_puts(buf, "\\\\");
-               break;
-           case '\n':
-               pdf_puts(buf, "\\n");
-               break;
-           case '\r':
-               pdf_puts(buf, "\\r");
-               break;
-           case '\t':
-               pdf_puts(buf, "\\t");
-               break;
-           default:
-               if (ch > 255) {
-                   pdf_put_char(buf, '?');
-               } else if (ch > 125 || ch < 32) {
-                   pdf_put_char(buf, ch);
-               } else {
-                   char tmp[10];
-                   snprintf(tmp, sizeof(tmp), "\\%03o", (int)ch);
-                   pdf_puts(buf, tmp);
-               }
-       }
-       p++;
-    }
-}
-
-static void pdf_put_string_contents(pdf_buffer *buf, const char *text)
+        afm_char  ch = *p;
+
+        ch = afm_fix_osx_charset(ch);   /* unsafe macro */
+        switch (ch) {
+        case 0:
+            return;
+        case '(':
+            pdf_puts(buf, "\\(");
+            break;
+        case ')':
+            pdf_puts(buf, "\\)");
+            break;
+        case '\\':
+            pdf_puts(buf, "\\\\");
+            break;
+        case '\n':
+            pdf_puts(buf, "\\n");
+            break;
+        case '\r':
+            pdf_puts(buf, "\\r");
+            break;
+        case '\t':
+            pdf_puts(buf, "\\t");
+            break;
+        default:
+            if (ch > 255) {
+                pdf_put_char(buf, '?');
+            } else if (ch > 125 || ch < 32) {
+                pdf_put_char(buf, ch);
+            } else {
+                char      tmp[10];
+
+                snprintf(tmp, sizeof(tmp), "\\%03o", (int) ch);
+                pdf_puts(buf, tmp);
+            }
+        }
+        p++;
+    }
+}
+
+static void pdf_put_string_contents(
+    pdf_buffer * buf,
+    const char *text)
 {
 #ifdef HAVE_MBSTOWCS
-    size_t clen = strlen(text) + 1;
-    wchar_t *cstr = malloc(sizeof(wchar_t) * clen);
-    int text_count = mbstowcs(cstr, text, clen);
+    size_t    clen = strlen(text) + 1;
+    wchar_t  *cstr = malloc(sizeof(wchar_t) * clen);
+    int       text_count = mbstowcs(cstr, text, clen);
+
     if (text_count == -1)
-       text_count = mbstowcs(cstr, "Enc-Err", 6);
+        text_count = mbstowcs(cstr, "Enc-Err", 6);
     pdf_put_string_contents_wide(buf, cstr);
 #if 0
     if (*text == 'W') {
-       fprintf(stderr, "Decoding utf8 for '%s'\n", text);
-       wchar_t *p = cstr;
-       char *pp = text;
-       fprintf(stderr, "sz wc = %d\n", sizeof(wchar_t));
-       while (*p) {
-           fprintf(stderr, "  %d = %c  versus %d = %c\n", *p, (char)*p, 255 & (int)*pp, *pp);
-           p++;
-           pp++;
-       }
+        fprintf(stderr, "Decoding utf8 for '%s'\n", text);
+        wchar_t  *p = cstr;
+        char     *pp = text;
+
+        fprintf(stderr, "sz wc = %d\n", sizeof(wchar_t));
+        while (*p) {
+            fprintf(stderr, "  %d = %c  versus %d = %c\n", *p, (char) *p,
+                    255 & (int) *pp, *pp);
+            p++;
+            pp++;
+        }
     }
 #endif
     free(cstr);
@@ -2087,434 +2407,487 @@ static void pdf_put_string_contents(pdf_buffer *buf, const char *text)
 #endif
 }
 
-static void pdf_init_object(pdf_state *state, pdf_buffer *buf)
+static void pdf_init_object(
+    pdf_state * state,
+    pdf_buffer * buf)
 {
-  pdf_init_buffer(state, buf);
-  buf->id = ++state->last_obj_id;
-  buf->is_obj = 1;
-  buf->is_stream = 0;
+    pdf_init_buffer(state, buf);
+    buf->id = ++state->last_obj_id;
+    buf->is_obj = 1;
+    buf->is_stream = 0;
 }
 
-static void pdf_init_dict(pdf_state *state, pdf_buffer *buf)
+static void pdf_init_dict(
+    pdf_state * state,
+    pdf_buffer * buf)
 {
-  pdf_init_object(state, buf);
-  buf->is_dict = 1;
+    pdf_init_object(state, buf);
+    buf->is_dict = 1;
 }
 
-static void pdf_set_color(pdf_buffer *buf, gfx_color_t color,
-       gfx_color_t *current_color, const char *op)
+static void pdf_set_color(
+    pdf_buffer * buf,
+    gfx_color_t color,
+    gfx_color_t * current_color,
+    const char *op)
 {
 #if USE_PDF_FAKE_ALPHA
-   double a1, a2;
+    double    a1, a2;
 #endif
-   /* gfx_color_t is RRGGBBAA */
-  if (*current_color == color)
-    return;
+    /* gfx_color_t is RRGGBBAA */
+    if (*current_color == color)
+        return;
 #if USE_PDF_FAKE_ALPHA
-  a1 = (color & 255) / 255.0;
-  a2 = 1 - a1;
+    a1 = (color & 255) / 255.0;
+    a2 = 1 - a1;
 #define pdf_color_calc(x) ( ((x)  & 255) / 255.0 * a1 + a2)
 #else
 #define pdf_color_calc(x) ( ((x)  & 255) / 255.0)
 #endif
-  pdf_putnumber(buf, pdf_color_calc(color >> 24));
-  pdf_puts(buf, " ");
-  pdf_putnumber(buf, pdf_color_calc(color >> 16));
-  pdf_puts(buf, " ");
-  pdf_putnumber(buf, pdf_color_calc(color >>  8));
-  pdf_puts(buf, " ");
-  pdf_puts(buf, op);
-  pdf_puts(buf, "\n");
-  *current_color = color;
+    pdf_putnumber(buf, pdf_color_calc(color >> 24));
+    pdf_puts(buf, " ");
+    pdf_putnumber(buf, pdf_color_calc(color >> 16));
+    pdf_puts(buf, " ");
+    pdf_putnumber(buf, pdf_color_calc(color >> 8));
+    pdf_puts(buf, " ");
+    pdf_puts(buf, op);
+    pdf_puts(buf, "\n");
+    *current_color = color;
 }
 
-static void pdf_set_stroke_color(pdf_buffer *buf, gfx_color_t color)
+static void pdf_set_stroke_color(
+    pdf_buffer * buf,
+    gfx_color_t color)
 {
     pdf_set_color(buf, color, &buf->state->stroke_color, "RG");
 }
 
-static void pdf_set_fill_color(pdf_buffer *buf, gfx_color_t color)
+static void pdf_set_fill_color(
+    pdf_buffer * buf,
+    gfx_color_t color)
 {
     pdf_set_color(buf, color, &buf->state->fill_color, "rg");
 }
 
-static pdf_font *pdf_find_font(pdf_state *state, gfx_node_t *node)
-{
-  const char *ps_font = afm_get_font_postscript_name(node->filename);
-  pdf_font *ef;
-  for (ef = state->font_list; ef; ef = ef->next) {
-    if (!strcmp(ps_font, ef->ps_font))
-      return ef;
-  }
-  return NULL;
-}
-
-static void pdf_add_font(pdf_state *state, gfx_node_t *node)
-{
-  pdf_font *ef = pdf_find_font(state, node);
-  if (ef)
-    return;
-  ef = malloc(sizeof(pdf_font));
-  if (ef == NULL) {
-    rrd_set_error("malloc for pdf_font");
-    state->has_failed = 1;
-    return;
-  }
-  pdf_init_dict(state, &ef->obj);
-  ef->next = state->font_list;
-  ef->ps_font = afm_get_font_postscript_name(node->filename);
-  state->font_list = ef;
-  /* fonts dict */
-  pdf_putsi(&state->fontsdict_obj, "/F");
-  pdf_putint(&state->fontsdict_obj, ef->obj.id);
-  pdf_puts(&state->fontsdict_obj, " ");
-  pdf_putint(&state->fontsdict_obj, ef->obj.id);
-  pdf_puts(&state->fontsdict_obj, " 0 R\n");
-  /* fonts def */
-  pdf_putsi(&ef->obj, "/Type /Font\n");
-  pdf_putsi(&ef->obj, "/Subtype /Type1\n");
-  pdf_putsi(&ef->obj, "/Name /F");
-  pdf_putint(&ef->obj, ef->obj.id);
-  pdf_puts(&ef->obj, "\n");
-  pdf_putsi(&ef->obj, "/BaseFont /");
-  pdf_puts(&ef->obj, ef->ps_font);
-  pdf_puts(&ef->obj, "\n");
-  pdf_putsi(&ef->obj, "/Encoding /WinAnsiEncoding\n");
-  /*  'Cp1252' (this is latin 1 extended with 27 characters;
-      the encoding is also known as 'winansi')
-      http://www.lowagie.com/iText/tutorial/ch09.html */
-}
-
-static void pdf_create_fonts(pdf_state *state)
-{
-  gfx_node_t *node;
-  for (node = state->canvas->firstnode; node; node = node->next) {
-    if (node->type == GFX_TEXT)
-      pdf_add_font(state, node);
-  }
-}
-
-static void pdf_write_linearea(pdf_state *state, gfx_node_t *node)
-{
-  int i;
-  pdf_buffer *s = &state->graph_stream;
-  if (node->type == GFX_LINE) {
-    svg_dash dash_info;
-    svg_get_dash(node, &dash_info);
-    if (!svg_dash_equal(&dash_info, &state->dash)) {
-      state->dash = dash_info;
-      if (dash_info.dash_enable) {
-       pdf_puts(s, "[");
-       pdf_putnumber(s, dash_info.adjusted_on);
-       pdf_puts(s, " ");
-       pdf_putnumber(s, dash_info.adjusted_off);
-       pdf_puts(s, "] ");
-       pdf_putnumber(s, dash_info.dash_offset);
-       pdf_puts(s, " d\n");
-      } else {
-       pdf_puts(s, "[] 0 d\n");
-      }
-    }
-    pdf_set_stroke_color(s, node->color);
-    if (state->linecap != 1) {
-      pdf_puts(s, "1 j\n");
-      state->linecap = 1;
-    }
-    if (state->linejoin != 1) {
-      pdf_puts(s, "1 J\n");
-      state->linejoin = 1;
-    }
-    if (node->size != state->line_width) {
-      state->line_width = node->size;
-      pdf_putnumber(s, state->line_width);
-      pdf_puts(s, " w\n");
-    }
-  } else {
-    pdf_set_fill_color(s, node->color);
-  }
-  for (i = 0; i < node->points; i++) {
-    ArtVpath *vec = node->path + i;
-    double x = vec->x;
-    double y = state->page_height - vec->y;
-    if (node->type == GFX_AREA) {
-      x += LINEOFFSET; /* adjust for libart handling of areas */
-      y -= LINEOFFSET;
-    }
-    switch (vec->code) {
-    case ART_MOVETO_OPEN: /* fall-through */
-    case ART_MOVETO:
-      pdf_putnumber(s, x);
-      pdf_puts(s, " ");
-      pdf_putnumber(s, y);
-      pdf_puts(s, " m\n");
-      break;
-    case ART_LINETO:
-      pdf_putnumber(s, x);
-      pdf_puts(s, " ");
-      pdf_putnumber(s, y);
-      pdf_puts(s, " l\n");
-      break;
-    case ART_CURVETO: break; /* unsupported */
-    case ART_END: break; /* nop */
-    }
-  }
-  if (node->type == GFX_LINE) {
-    pdf_puts(s, node->closed_path ? "s\n" : "S\n");
-   } else {
-    pdf_puts(s, "f\n");
-   }
-}
-
-
-static void pdf_write_matrix(pdf_state *state, gfx_node_t *node, pdf_coords *g, int useTM)
-{
-       char tmp[150];
-       pdf_buffer *s = &state->graph_stream;
-       if (node->angle == 0) {
-               pdf_puts(s, "1 0 0 1 ");
-               pdf_putnumber(s, useTM ? g->tmx : g->mx);
-               pdf_puts(s, " ");
-               pdf_putnumber(s, useTM ? g->tmy : g->my);
-       } else {
-                /* can't use svg_write_number as 2 decimals is far from enough to avoid
-                       skewed text */
-               sprintf(tmp, "%f %f %f %f %f %f",
-                               g->ma, g->mb, g->mc, g->md, 
-                               useTM ? g->tmx : g->mx,
-                               useTM ? g->tmy : g->my);
-               pdf_puts(s, tmp);
-       }
-}
-
-static void pdf_write_text(pdf_state *state, gfx_node_t *node, 
-    int last_was_text, int next_is_text)
-{
-  pdf_coords g;
-  pdf_buffer *s = &state->graph_stream;
-  pdf_font *font = pdf_find_font(state, node);
-  if (font == NULL) {
-    rrd_set_error("font disappeared");
-    state->has_failed = 1;
-    return;
-  }
-  pdf_calc(state->page_height, node, &g);
+static pdf_font *pdf_find_font(
+    pdf_state * state,
+    gfx_node_t * node)
+{
+    const char *ps_font = afm_get_font_postscript_name(node->filename);
+    pdf_font *ef;
+
+    for (ef = state->font_list; ef; ef = ef->next) {
+        if (!strcmp(ps_font, ef->ps_font))
+            return ef;
+    }
+    return NULL;
+}
+
+static void pdf_add_font(
+    pdf_state * state,
+    gfx_node_t * node)
+{
+    pdf_font *ef = pdf_find_font(state, node);
+
+    if (ef)
+        return;
+    ef = malloc(sizeof(pdf_font));
+    if (ef == NULL) {
+        rrd_set_error("malloc for pdf_font");
+        state->has_failed = 1;
+        return;
+    }
+    pdf_init_dict(state, &ef->obj);
+    ef->next = state->font_list;
+    ef->ps_font = afm_get_font_postscript_name(node->filename);
+    state->font_list = ef;
+    /* fonts dict */
+    pdf_putsi(&state->fontsdict_obj, "/F");
+    pdf_putint(&state->fontsdict_obj, ef->obj.id);
+    pdf_puts(&state->fontsdict_obj, " ");
+    pdf_putint(&state->fontsdict_obj, ef->obj.id);
+    pdf_puts(&state->fontsdict_obj, " 0 R\n");
+    /* fonts def */
+    pdf_putsi(&ef->obj, "/Type /Font\n");
+    pdf_putsi(&ef->obj, "/Subtype /Type1\n");
+    pdf_putsi(&ef->obj, "/Name /F");
+    pdf_putint(&ef->obj, ef->obj.id);
+    pdf_puts(&ef->obj, "\n");
+    pdf_putsi(&ef->obj, "/BaseFont /");
+    pdf_puts(&ef->obj, ef->ps_font);
+    pdf_puts(&ef->obj, "\n");
+    pdf_putsi(&ef->obj, "/Encoding /WinAnsiEncoding\n");
+    /*  'Cp1252' (this is latin 1 extended with 27 characters;
+       the encoding is also known as 'winansi')
+       http://www.lowagie.com/iText/tutorial/ch09.html */
+}
+
+static void pdf_create_fonts(
+    pdf_state * state)
+{
+    gfx_node_t *node;
+
+    for (node = state->canvas->firstnode; node; node = node->next) {
+        if (node->type == GFX_TEXT)
+            pdf_add_font(state, node);
+    }
+}
+
+static void pdf_write_linearea(
+    pdf_state * state,
+    gfx_node_t * node)
+{
+    int       i;
+    pdf_buffer *s = &state->graph_stream;
+
+    if (node->type == GFX_LINE) {
+        svg_dash  dash_info;
+
+        svg_get_dash(node, &dash_info);
+        if (!svg_dash_equal(&dash_info, &state->dash)) {
+            state->dash = dash_info;
+            if (dash_info.dash_enable) {
+                pdf_puts(s, "[");
+                pdf_putnumber(s, dash_info.adjusted_on);
+                pdf_puts(s, " ");
+                pdf_putnumber(s, dash_info.adjusted_off);
+                pdf_puts(s, "] ");
+                pdf_putnumber(s, dash_info.dash_offset);
+                pdf_puts(s, " d\n");
+            } else {
+                pdf_puts(s, "[] 0 d\n");
+            }
+        }
+        pdf_set_stroke_color(s, node->color);
+        if (state->linecap != 1) {
+            pdf_puts(s, "1 j\n");
+            state->linecap = 1;
+        }
+        if (state->linejoin != 1) {
+            pdf_puts(s, "1 J\n");
+            state->linejoin = 1;
+        }
+        if (node->size != state->line_width) {
+            state->line_width = node->size;
+            pdf_putnumber(s, state->line_width);
+            pdf_puts(s, " w\n");
+        }
+    } else {
+        pdf_set_fill_color(s, node->color);
+    }
+    for (i = 0; i < node->points; i++) {
+        ArtVpath *vec = node->path + i;
+        double    x = vec->x;
+        double    y = state->page_height - vec->y;
+
+        if (node->type == GFX_AREA) {
+            x += LINEOFFSET;    /* adjust for libart handling of areas */
+            y -= LINEOFFSET;
+        }
+        switch (vec->code) {
+        case ART_MOVETO_OPEN:  /* fall-through */
+        case ART_MOVETO:
+            pdf_putnumber(s, x);
+            pdf_puts(s, " ");
+            pdf_putnumber(s, y);
+            pdf_puts(s, " m\n");
+            break;
+        case ART_LINETO:
+            pdf_putnumber(s, x);
+            pdf_puts(s, " ");
+            pdf_putnumber(s, y);
+            pdf_puts(s, " l\n");
+            break;
+        case ART_CURVETO:
+            break;      /* unsupported */
+        case ART_END:
+            break;      /* nop */
+        }
+    }
+    if (node->type == GFX_LINE) {
+        pdf_puts(s, node->closed_path ? "s\n" : "S\n");
+    } else {
+        pdf_puts(s, "f\n");
+    }
+}
+
+
+static void pdf_write_matrix(
+    pdf_state * state,
+    gfx_node_t * node,
+    pdf_coords * g,
+    int useTM)
+{
+    char      tmp[150];
+    pdf_buffer *s = &state->graph_stream;
+
+    if (node->angle == 0) {
+        pdf_puts(s, "1 0 0 1 ");
+        pdf_putnumber(s, useTM ? g->tmx : g->mx);
+        pdf_puts(s, " ");
+        pdf_putnumber(s, useTM ? g->tmy : g->my);
+    } else {
+        /* can't use svg_write_number as 2 decimals is far from enough to avoid
+           skewed text */
+        sprintf(tmp, "%f %f %f %f %f %f",
+                g->ma, g->mb, g->mc, g->md,
+                useTM ? g->tmx : g->mx, useTM ? g->tmy : g->my);
+        pdf_puts(s, tmp);
+    }
+}
+
+static void pdf_write_text(
+    pdf_state * state,
+    gfx_node_t * node,
+    int last_was_text,
+    int next_is_text)
+{
+    pdf_coords g;
+    pdf_buffer *s = &state->graph_stream;
+    pdf_font *font = pdf_find_font(state, node);
+
+    if (font == NULL) {
+        rrd_set_error("font disappeared");
+        state->has_failed = 1;
+        return;
+    }
+    pdf_calc(state->page_height, node, &g);
 #if PDF_CALC_DEBUG
-  pdf_puts(s, "q % debug green box\n");
-  pdf_write_matrix(state, node, &g, 0);
-  pdf_puts(s, " cm\n");
-  pdf_set_fill_color(s, 0x90FF9000);
-  pdf_puts(s, "0 0.4 0 rg\n");
-  pdf_puts(s, "0 0 ");
-  pdf_putnumber(s, g.sizep.x);
-  pdf_puts(s, " ");
-  pdf_putnumber(s, g.sizep.y);
-  pdf_puts(s, " re\n");
-  pdf_puts(s, "f\n");
-  pdf_puts(s, "Q\n");
-#endif
-  pdf_set_fill_color(s, node->color);
-  if (PDF_CALC_DEBUG || !last_was_text)
-    pdf_puts(s, "BT\n");
-  if (state->font_id != font->obj.id || node->size != state->font_size) {
-    state->font_id = font->obj.id;
-    state->font_size = node->size;
-    pdf_puts(s, "/F");
-    pdf_putint(s, font->obj.id);
+    pdf_puts(s, "q % debug green box\n");
+    pdf_write_matrix(state, node, &g, 0);
+    pdf_puts(s, " cm\n");
+    pdf_set_fill_color(s, 0x90FF9000);
+    pdf_puts(s, "0 0.4 0 rg\n");
+    pdf_puts(s, "0 0 ");
+    pdf_putnumber(s, g.sizep.x);
     pdf_puts(s, " ");
-    pdf_putnumber(s, node->size);
-    pdf_puts(s, " Tf\n");
-  }
-  pdf_write_matrix(state, node, &g, 1);
-  pdf_puts(s, " Tm\n");
-  pdf_puts(s, "(");
-  pdf_put_string_contents(s, node->text);
-  pdf_puts(s, ") Tj\n");
-  if (PDF_CALC_DEBUG || !next_is_text)
-    pdf_puts(s, "ET\n");
-}
-static void pdf_write_content(pdf_state *state)
-{
-  gfx_node_t *node;
-  int last_was_text = 0, next_is_text;
-  for (node = state->canvas->firstnode; node; node = node->next) {
-    switch (node->type) {
-    case GFX_LINE:
-    case GFX_AREA:
-      pdf_write_linearea(state, node);
-      break;
-    case GFX_TEXT:
-      next_is_text = node->next && node->next->type == GFX_TEXT;
-      pdf_write_text(state, node, last_was_text, next_is_text);
-      break;
-    }
-    last_was_text = node->type == GFX_TEXT;
-  }
-}
-
-static void pdf_init_document(pdf_state *state)
-{
-  pdf_init_buffer(state, &state->pdf_header);
-  pdf_init_dict(state, &state->catalog_obj);
-  pdf_init_dict(state, &state->info_obj);
-  pdf_init_dict(state, &state->pages_obj);
-  pdf_init_dict(state, &state->page1_obj);
-  pdf_init_dict(state, &state->fontsdict_obj);
-  pdf_create_fonts(state);
-  if (state->has_failed)
-    return;
-  /* make stream last object in file */
-  pdf_init_object(state, &state->graph_stream);
-  state->graph_stream.is_stream = 1;
-}
-
-static void pdf_setup_document(pdf_state *state)
-{
-  const char *creator = "RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch";
-  /* all objects created by now, so init code can reference them */
-  /* HEADER */
-  pdf_puts(&state->pdf_header, "%PDF-1.3\n");
-  /* following 8 bit comment is recommended by Adobe for
-     indicating binary file to file transfer applications */
-  pdf_puts(&state->pdf_header, "%\xE2\xE3\xCF\xD3\n");
-  /* INFO */
-  pdf_putsi(&state->info_obj, "/Creator (");
-  pdf_put_string_contents(&state->info_obj, creator);
-  pdf_puts(&state->info_obj, ")\n");
-  /* CATALOG */
-  pdf_putsi(&state->catalog_obj, "/Type /Catalog\n");
-  pdf_putsi(&state->catalog_obj, "/Pages ");
-  pdf_putint(&state->catalog_obj, state->pages_obj.id);
-  pdf_puts(&state->catalog_obj, " 0 R\n");
-  /* PAGES */
-  pdf_putsi(&state->pages_obj, "/Type /Pages\n");
-  pdf_putsi(&state->pages_obj, "/Kids [");
-  pdf_putint(&state->pages_obj, state->page1_obj.id);
-  pdf_puts(&state->pages_obj, " 0 R]\n");
-  pdf_putsi(&state->pages_obj, "/Count 1\n");
-  /* PAGE 1 */
-  pdf_putsi(&state->page1_obj, "/Type /Page\n");
-  pdf_putsi(&state->page1_obj, "/Parent ");
-  pdf_putint(&state->page1_obj, state->pages_obj.id);
-  pdf_puts(&state->page1_obj, " 0 R\n");
-  pdf_putsi(&state->page1_obj, "/MediaBox [0 0 ");
-  pdf_putint(&state->page1_obj, state->page_width);
-  pdf_puts(&state->page1_obj, " ");
-  pdf_putint(&state->page1_obj, state->page_height);
-  pdf_puts(&state->page1_obj, "]\n");
-  pdf_putsi(&state->page1_obj, "/Contents ");
-  pdf_putint(&state->page1_obj, state->graph_stream.id);
-  pdf_puts(&state->page1_obj, " 0 R\n");
-  pdf_putsi(&state->page1_obj, "/Resources << /Font ");
-  pdf_putint(&state->page1_obj, state->fontsdict_obj.id);
-  pdf_puts(&state->page1_obj, " 0 R >>\n");
-}
-
-static void pdf_write_string_to_file(pdf_state *state, const char *text)
+    pdf_putnumber(s, g.sizep.y);
+    pdf_puts(s, " re\n");
+    pdf_puts(s, "f\n");
+    pdf_puts(s, "Q\n");
+#endif
+    pdf_set_fill_color(s, node->color);
+    if (PDF_CALC_DEBUG || !last_was_text)
+        pdf_puts(s, "BT\n");
+    if (state->font_id != font->obj.id || node->size != state->font_size) {
+        state->font_id = font->obj.id;
+        state->font_size = node->size;
+        pdf_puts(s, "/F");
+        pdf_putint(s, font->obj.id);
+        pdf_puts(s, " ");
+        pdf_putnumber(s, node->size);
+        pdf_puts(s, " Tf\n");
+    }
+    pdf_write_matrix(state, node, &g, 1);
+    pdf_puts(s, " Tm\n");
+    pdf_puts(s, "(");
+    pdf_put_string_contents(s, node->text);
+    pdf_puts(s, ") Tj\n");
+    if (PDF_CALC_DEBUG || !next_is_text)
+        pdf_puts(s, "ET\n");
+}
+
+static void pdf_write_content(
+    pdf_state * state)
+{
+    gfx_node_t *node;
+    int       last_was_text = 0, next_is_text;
+
+    for (node = state->canvas->firstnode; node; node = node->next) {
+        switch (node->type) {
+        case GFX_LINE:
+        case GFX_AREA:
+            pdf_write_linearea(state, node);
+            break;
+        case GFX_TEXT:
+            next_is_text = node->next && node->next->type == GFX_TEXT;
+            pdf_write_text(state, node, last_was_text, next_is_text);
+            break;
+        }
+        last_was_text = node->type == GFX_TEXT;
+    }
+}
+
+static void pdf_init_document(
+    pdf_state * state)
+{
+    pdf_init_buffer(state, &state->pdf_header);
+    pdf_init_dict(state, &state->catalog_obj);
+    pdf_init_dict(state, &state->info_obj);
+    pdf_init_dict(state, &state->pages_obj);
+    pdf_init_dict(state, &state->page1_obj);
+    pdf_init_dict(state, &state->fontsdict_obj);
+    pdf_create_fonts(state);
+    if (state->has_failed)
+        return;
+    /* make stream last object in file */
+    pdf_init_object(state, &state->graph_stream);
+    state->graph_stream.is_stream = 1;
+}
+
+static void pdf_setup_document(
+    pdf_state * state)
+{
+    const char *creator =
+        "RRDtool " PACKAGE_VERSION " Tobias Oetiker, http://tobi.oetiker.ch";
+    /* all objects created by now, so init code can reference them */
+    /* HEADER */
+    pdf_puts(&state->pdf_header, "%PDF-1.3\n");
+    /* following 8 bit comment is recommended by Adobe for
+       indicating binary file to file transfer applications */
+    pdf_puts(&state->pdf_header, "%\xE2\xE3\xCF\xD3\n");
+    /* INFO */
+    pdf_putsi(&state->info_obj, "/Creator (");
+    pdf_put_string_contents(&state->info_obj, creator);
+    pdf_puts(&state->info_obj, ")\n");
+    /* CATALOG */
+    pdf_putsi(&state->catalog_obj, "/Type /Catalog\n");
+    pdf_putsi(&state->catalog_obj, "/Pages ");
+    pdf_putint(&state->catalog_obj, state->pages_obj.id);
+    pdf_puts(&state->catalog_obj, " 0 R\n");
+    /* PAGES */
+    pdf_putsi(&state->pages_obj, "/Type /Pages\n");
+    pdf_putsi(&state->pages_obj, "/Kids [");
+    pdf_putint(&state->pages_obj, state->page1_obj.id);
+    pdf_puts(&state->pages_obj, " 0 R]\n");
+    pdf_putsi(&state->pages_obj, "/Count 1\n");
+    /* PAGE 1 */
+    pdf_putsi(&state->page1_obj, "/Type /Page\n");
+    pdf_putsi(&state->page1_obj, "/Parent ");
+    pdf_putint(&state->page1_obj, state->pages_obj.id);
+    pdf_puts(&state->page1_obj, " 0 R\n");
+    pdf_putsi(&state->page1_obj, "/MediaBox [0 0 ");
+    pdf_putint(&state->page1_obj, state->page_width);
+    pdf_puts(&state->page1_obj, " ");
+    pdf_putint(&state->page1_obj, state->page_height);
+    pdf_puts(&state->page1_obj, "]\n");
+    pdf_putsi(&state->page1_obj, "/Contents ");
+    pdf_putint(&state->page1_obj, state->graph_stream.id);
+    pdf_puts(&state->page1_obj, " 0 R\n");
+    pdf_putsi(&state->page1_obj, "/Resources << /Font ");
+    pdf_putint(&state->page1_obj, state->fontsdict_obj.id);
+    pdf_puts(&state->page1_obj, " 0 R >>\n");
+}
+
+static void pdf_write_string_to_file(
+    pdf_state * state,
+    const char *text)
 {
     fputs(text, state->fp);
     state->pdf_file_pos += strlen(text);
 }
 
-static void pdf_write_buf_to_file(pdf_state *state, pdf_buffer *buf)
-{
-  char tmp[40];
-  buf->pdf_file_pos = state->pdf_file_pos;
-  if (buf->is_obj) {
-    snprintf(tmp, sizeof(tmp), "%d 0 obj\n", buf->id);
-    pdf_write_string_to_file(state, tmp);
-  }
-  if (buf->is_dict)
-    pdf_write_string_to_file(state, "<<\n");
-  if (buf->is_stream) {
-    snprintf(tmp, sizeof(tmp), "<< /Length %d >>\n", buf->current_size);
-    pdf_write_string_to_file(state, tmp);
-    pdf_write_string_to_file(state, "stream\n");
-  }
-  fwrite(buf->data, 1, buf->current_size, state->fp);
-  state->pdf_file_pos += buf->current_size;
-  if (buf->is_stream)
-    pdf_write_string_to_file(state, "endstream\n");
-  if (buf->is_dict)
-    pdf_write_string_to_file(state, ">>\n");
-  if (buf->is_obj)
-    pdf_write_string_to_file(state, "endobj\n");
-}
-
-static void pdf_write_to_file(pdf_state *state)
-{
-  pdf_buffer *buf = state->first_buffer;
-  int xref_pos;
-  state->pdf_file_pos = 0;
-  pdf_write_buf_to_file(state, &state->pdf_header);
-  while (buf) {
-    if (buf->is_obj)
-      pdf_write_buf_to_file(state, buf);
-    buf = buf->next_buffer;
-  }
-  xref_pos = state->pdf_file_pos;
-  fprintf(state->fp, "xref\n");
-  fprintf(state->fp, "%d %d\n", 0, state->last_obj_id + 1);
-  /* TOC lines must be exactly 20 bytes including \n */
-  fprintf(state->fp, "%010d %05d f\x20\n", 0, 65535);
-  for (buf = state->first_buffer; buf; buf = buf->next_buffer) {
+static void pdf_write_buf_to_file(
+    pdf_state * state,
+    pdf_buffer * buf)
+{
+    char      tmp[40];
+
+    buf->pdf_file_pos = state->pdf_file_pos;
+    if (buf->is_obj) {
+        snprintf(tmp, sizeof(tmp), "%d 0 obj\n", buf->id);
+        pdf_write_string_to_file(state, tmp);
+    }
+    if (buf->is_dict)
+        pdf_write_string_to_file(state, "<<\n");
+    if (buf->is_stream) {
+        snprintf(tmp, sizeof(tmp), "<< /Length %d >>\n", buf->current_size);
+        pdf_write_string_to_file(state, tmp);
+        pdf_write_string_to_file(state, "stream\n");
+    }
+    fwrite(buf->data, 1, buf->current_size, state->fp);
+    state->pdf_file_pos += buf->current_size;
+    if (buf->is_stream)
+        pdf_write_string_to_file(state, "endstream\n");
+    if (buf->is_dict)
+        pdf_write_string_to_file(state, ">>\n");
     if (buf->is_obj)
-      fprintf(state->fp, "%010d %05d n\x20\n", buf->pdf_file_pos, 0);
-  }
-  fprintf(state->fp, "trailer\n");
-  fprintf(state->fp, "<<\n");
-  fprintf(state->fp, "\t/Size %d\n", state->last_obj_id + 1);
-  fprintf(state->fp, "\t/Root %d 0 R\n", state->catalog_obj.id);
-  fprintf(state->fp, "\t/Info %d 0 R\n", state->info_obj.id);
-  fprintf(state->fp, ">>\n");
-  fprintf(state->fp, "startxref\n");
-  fprintf(state->fp, "%d\n", xref_pos);
-  fputs("%%EOF\n", state->fp);
-}
-
-static void pdf_free_resources(pdf_state *state)
-{
-  pdf_buffer *buf = state->first_buffer;
-  while (buf) {
-    free(buf->data);
-    buf->data = NULL;
-    buf->alloc_size = buf->current_size = 0;
-    buf = buf->next_buffer;
-  }
-  while (state->font_list) {
-    pdf_font *next = state->font_list->next;
-    free(state->font_list);
-    state->font_list = next;
-  }
-}
-
-int       gfx_render_pdf (gfx_canvas_t *canvas,
-                 art_u32 width, art_u32 height,
-                 gfx_color_t UNUSED(background), FILE *fp){
-  struct pdf_state state;
-  memset(&state, 0, sizeof(pdf_state));
-  state.fp = fp;
-  state.canvas = canvas;
-  state.page_width = width;
-  state.page_height = height;
-  state.font_id = -1;
-  state.font_size = -1;
-  state.font_list = NULL;
-  state.linecap = -1;
-  state.linejoin = -1;
-  pdf_init_document(&state);
-  /*
-  pdf_set_color(&state, background);
-  fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
-      height, width, height, width);
-  */
-  if (!state.has_failed)
-    pdf_write_content(&state);
-  if (!state.has_failed)
-    pdf_setup_document(&state);
-  if (!state.has_failed)
-    pdf_write_to_file(&state);
-  pdf_free_resources(&state);
-  return state.has_failed ? -1 : 0;
+        pdf_write_string_to_file(state, "endobj\n");
 }
 
+static void pdf_write_to_file(
+    pdf_state * state)
+{
+    pdf_buffer *buf = state->first_buffer;
+    int       xref_pos;
+
+    state->pdf_file_pos = 0;
+    pdf_write_buf_to_file(state, &state->pdf_header);
+    while (buf) {
+        if (buf->is_obj)
+            pdf_write_buf_to_file(state, buf);
+        buf = buf->next_buffer;
+    }
+    xref_pos = state->pdf_file_pos;
+    fprintf(state->fp, "xref\n");
+    fprintf(state->fp, "%d %d\n", 0, state->last_obj_id + 1);
+    /* TOC lines must be exactly 20 bytes including \n */
+    fprintf(state->fp, "%010d %05d f\x20\n", 0, 65535);
+    for (buf = state->first_buffer; buf; buf = buf->next_buffer) {
+        if (buf->is_obj)
+            fprintf(state->fp, "%010d %05d n\x20\n", buf->pdf_file_pos, 0);
+    }
+    fprintf(state->fp, "trailer\n");
+    fprintf(state->fp, "<<\n");
+    fprintf(state->fp, "\t/Size %d\n", state->last_obj_id + 1);
+    fprintf(state->fp, "\t/Root %d 0 R\n", state->catalog_obj.id);
+    fprintf(state->fp, "\t/Info %d 0 R\n", state->info_obj.id);
+    fprintf(state->fp, ">>\n");
+    fprintf(state->fp, "startxref\n");
+    fprintf(state->fp, "%d\n", xref_pos);
+    fputs("%%EOF\n", state->fp);
+}
+
+static void pdf_free_resources(
+    pdf_state * state)
+{
+    pdf_buffer *buf = state->first_buffer;
+
+    while (buf) {
+        free(buf->data);
+        buf->data = NULL;
+        buf->alloc_size = buf->current_size = 0;
+        buf = buf->next_buffer;
+    }
+    while (state->font_list) {
+        pdf_font *next = state->font_list->next;
+
+        free(state->font_list);
+        state->font_list = next;
+    }
+}
+
+int gfx_render_pdf(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t UNUSED(background),
+    FILE * fp)
+{
+    struct pdf_state state;
+
+    memset(&state, 0, sizeof(pdf_state));
+    state.fp = fp;
+    state.canvas = canvas;
+    state.page_width = width;
+    state.page_height = height;
+    state.font_id = -1;
+    state.font_size = -1;
+    state.font_list = NULL;
+    state.linecap = -1;
+    state.linejoin = -1;
+    pdf_init_document(&state);
+    /*
+       pdf_set_color(&state, background);
+       fprintf(fp, "0 0 M 0 %d L %d %d L %d 0 L fill\n",
+       height, width, height, width);
+     */
+    if (!state.has_failed)
+        pdf_write_content(&state);
+    if (!state.has_failed)
+        pdf_setup_document(&state);
+    if (!state.has_failed)
+        pdf_write_to_file(&state);
+    pdf_free_resources(&state);
+    return state.has_failed ? -1 : 0;
+}
index 40b0ee0..dcfe48f 100644 (file)
 #undef y1
 
 
-enum gfx_if_en {IF_PNG=0,IF_SVG,IF_EPS,IF_PDF};
-enum gfx_en { GFX_LINE=0,GFX_AREA,GFX_TEXT };
-enum gfx_h_align_en { GFX_H_NULL=0, GFX_H_LEFT, GFX_H_RIGHT, GFX_H_CENTER };
-enum gfx_v_align_en { GFX_V_NULL=0, GFX_V_TOP,  GFX_V_BOTTOM, GFX_V_CENTER };
-enum gfx_aa_type_en {AA_NORMAL=0,AA_LIGHT,AA_NONE};
+enum gfx_if_en { IF_PNG = 0, IF_SVG, IF_EPS, IF_PDF };
+enum gfx_en { GFX_LINE = 0, GFX_AREA, GFX_TEXT };
+enum gfx_h_align_en { GFX_H_NULL = 0, GFX_H_LEFT, GFX_H_RIGHT, GFX_H_CENTER };
+enum gfx_v_align_en { GFX_V_NULL = 0, GFX_V_TOP, GFX_V_BOTTOM, GFX_V_CENTER };
+enum gfx_aa_type_en { AA_NORMAL = 0, AA_LIGHT, AA_NONE };
 typedef unsigned long gfx_color_t;
 
-typedef struct  gfx_node_t {
-  enum gfx_en   type;         /* type of graph element */
-  gfx_color_t   color;        /* color of element  0xRRGGBBAA  alpha 0xff is solid*/
-  double        size;         /* font size, line width */
-  double        dash_on, dash_off; /* dash line fragments lengths */
-  int           closed_path;
-  int           points;
-  int           points_max;
-  char *filename;             /* font or image filename */
-  char *text;
-  ArtVpath      *path;        /* path */
-  double        x,y;          /* position */
-  double        angle;        /* text angle */
-  enum gfx_h_align_en halign; /* text alignement */
-  enum gfx_v_align_en valign; /* text alignement */
-  double        tabwidth; 
-  struct gfx_node_t  *next; 
+typedef struct gfx_node_t {
+    enum gfx_en type;   /* type of graph element */
+    gfx_color_t color;  /* color of element  0xRRGGBBAA  alpha 0xff is solid */
+    double    size;     /* font size, line width */
+    double    dash_on, dash_off;    /* dash line fragments lengths */
+    int       closed_path;
+    int       points;
+    int       points_max;
+    char     *filename; /* font or image filename */
+    char     *text;
+    ArtVpath *path;     /* path */
+    double    x, y;     /* position */
+    double    angle;    /* text angle */
+    enum gfx_h_align_en halign; /* text alignement */
+    enum gfx_v_align_en valign; /* text alignement */
+    double    tabwidth;
+    struct gfx_node_t *next;
 } gfx_node_t;
 
 
-typedef struct gfx_canvas_t 
-{
+typedef struct gfx_canvas_t {
     struct gfx_node_t *firstnode;
     struct gfx_node_t *lastnode;
-    enum gfx_if_en imgformat;      /* image format */
-    int            interlaced;     /* will the graph be interlaced? */
-    double         zoom;           /* zoom for graph */
-    double         font_aa_threshold; /* no anti-aliasing for sizes <= */
-    enum gfx_aa_type_en aa_type;   /* anti-aliasing type (normal/light/none) */
+    enum gfx_if_en imgformat;   /* image format */
+    int       interlaced;   /* will the graph be interlaced? */
+    double    zoom;     /* zoom for graph */
+    double    font_aa_threshold;    /* no anti-aliasing for sizes <= */
+    enum gfx_aa_type_en aa_type;    /* anti-aliasing type (normal/light/none) */
 } gfx_canvas_t;
 
-gfx_canvas_t *gfx_new_canvas (void);
+gfx_canvas_t *gfx_new_canvas(
+    void);
 
 /* create a new line */
-gfx_node_t   *gfx_new_line   (gfx_canvas_t *canvas, 
-                             double X0, double Y0, 
-                             double X1, double Y1,
-                             double width, gfx_color_t color);
-
-gfx_node_t   *gfx_new_dashed_line   (gfx_canvas_t *canvas, 
-                             double X0, double Y0, 
-                             double X1, double Y1,
-                             double width, gfx_color_t color,
-                             double dash_on, double dash_off);
+gfx_node_t *gfx_new_line(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double width,
+    gfx_color_t color);
+
+gfx_node_t *gfx_new_dashed_line(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double width,
+    gfx_color_t color,
+    double dash_on,
+    double dash_off);
 
 /* create a new area */
-gfx_node_t   *gfx_new_area   (gfx_canvas_t *canvas, 
-                             double X0, double Y0,
-                             double X1, double Y1,
-                             double X2, double Y2,
-                             gfx_color_t  color);
+gfx_node_t *gfx_new_area(
+    gfx_canvas_t * canvas,
+    double X0,
+    double Y0,
+    double X1,
+    double Y1,
+    double X2,
+    double Y2,
+    gfx_color_t color);
 
 /* add a point to a line or to an area */
-int           gfx_add_point  (gfx_node_t *node, double x, double y);
+int       gfx_add_point(
+    gfx_node_t * node,
+    double x,
+    double y);
 
 /* close current path so it ends at the same point as it started */
-void          gfx_close_path  (gfx_node_t *node);
+void      gfx_close_path(
+    gfx_node_t * node);
 
 
 /* create a text node */
-gfx_node_t   *gfx_new_text   (gfx_canvas_t *canvas,  
-                             double x, double y, gfx_color_t color,
-                             char* font, double size,                        
-                             double tabwidth, double angle,
-                             enum gfx_h_align_en h_align,
-                             enum gfx_v_align_en v_align,
-                              char* text);
+gfx_node_t *gfx_new_text(
+    gfx_canvas_t * canvas,
+    double x,
+    double y,
+    gfx_color_t color,
+    char *font,
+    double size,
+    double tabwidth,
+    double angle,
+    enum gfx_h_align_en h_align,
+    enum gfx_v_align_en v_align,
+    char *text);
 
 /* measure width of a text string */
-double gfx_get_text_width ( gfx_canvas_t *canvas,
-                           double start, char* font, double size,
-                           double tabwidth, char* text, int rotation);
+double    gfx_get_text_width(
+    gfx_canvas_t * canvas,
+    double start,
+    char *font,
+    double size,
+    double tabwidth,
+    char *text,
+    int rotation);
 
 /* save image to file */
-int       gfx_render (gfx_canvas_t *canvas,
-                              art_u32 width, art_u32 height,
-                              gfx_color_t background, FILE *fo);
+int       gfx_render(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fo);
 
 /* free memory used by nodes this will also remove memory required for
    node chain and associated material */
-int           gfx_destroy    (gfx_canvas_t *canvas); 
+int       gfx_destroy(
+    gfx_canvas_t * canvas);
 
 
 /* PNG support*/
-int       gfx_render_png (gfx_canvas_t *canvas,
-                              art_u32 width, art_u32 height,
-                              gfx_color_t background, FILE *fo);
-double gfx_get_text_width_libart ( gfx_canvas_t *canvas, double start, 
-                char* font, double size, double tabwidth, 
-                char* text, int rotation );
+int       gfx_render_png(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fo);
+double    gfx_get_text_width_libart(
+    gfx_canvas_t * canvas,
+    double start,
+    char *font,
+    double size,
+    double tabwidth,
+    char *text,
+    int rotation);
 
 /* SVG support */
-int       gfx_render_svg (gfx_canvas_t *canvas,
-                              art_u32 width, art_u32 height,
-                              gfx_color_t background, FILE *fo);
+int       gfx_render_svg(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fo);
 
 /* EPS support */
-int       gfx_render_eps (gfx_canvas_t *canvas,
-                              art_u32 width, art_u32 height,
-                              gfx_color_t background, FILE *fo);
+int       gfx_render_eps(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fo);
 
 /* PDF support */
-int       gfx_render_pdf (gfx_canvas_t *canvas,
-                              art_u32 width, art_u32 height,
-                              gfx_color_t background, FILE *fo);
+int       gfx_render_pdf(
+    gfx_canvas_t * canvas,
+    art_u32 width,
+    art_u32 height,
+    gfx_color_t background,
+    FILE * fo);
 
 #endif
index 22439b5..5154210 100644 (file)
 #define RRD_DEFAULT_FONT "DejaVuSansMono-Roman.ttf"
 #endif
 
-text_prop_t text_prop[] = {   
-     { 8.0, RRD_DEFAULT_FONT }, /* default */
-     { 9.0, RRD_DEFAULT_FONT }, /* title */
-     { 7.0,  RRD_DEFAULT_FONT }, /* axis */
-     { 8.0, RRD_DEFAULT_FONT }, /* unit */
-     { 8.0, RRD_DEFAULT_FONT }  /* legend */
+text_prop_t text_prop[] = {
+    {8.0, RRD_DEFAULT_FONT}
+    ,                   /* default */
+    {9.0, RRD_DEFAULT_FONT}
+    ,                   /* title */
+    {7.0, RRD_DEFAULT_FONT}
+    ,                   /* axis */
+    {8.0, RRD_DEFAULT_FONT}
+    ,                   /* unit */
+    {8.0, RRD_DEFAULT_FONT} /* legend */
 };
 
-xlab_t xlab[] = {
-    {0,                 0,   TMT_SECOND,30, TMT_MINUTE,5,  TMT_MINUTE,5,         0,"%H:%M"},
-    {2,                 0,   TMT_MINUTE,1,  TMT_MINUTE,5,  TMT_MINUTE,5,         0,"%H:%M"},
-    {5,                 0,   TMT_MINUTE,2,  TMT_MINUTE,10, TMT_MINUTE,10,        0,"%H:%M"},
-    {10,                0,   TMT_MINUTE,5,  TMT_MINUTE,20, TMT_MINUTE,20,        0,"%H:%M"},
-    {30,                0,   TMT_MINUTE,10, TMT_HOUR,1,    TMT_HOUR,1,           0,"%H:%M"},
-    {60,                0,   TMT_MINUTE,30, TMT_HOUR,2,    TMT_HOUR,2,           0,"%H:%M"},
-    {60,          24*3600,   TMT_MINUTE,30, TMT_HOUR,2,    TMT_HOUR,4,           0,"%a %H:%M"},
-    {180,               0,   TMT_HOUR,1,    TMT_HOUR,6,    TMT_HOUR,6,           0,"%H:%M"},
-    {180,         24*3600,   TMT_HOUR,1,    TMT_HOUR,6,    TMT_HOUR,12,          0,"%a %H:%M"},
-    /*{300,             0,   TMT_HOUR,3,    TMT_HOUR,12,   TMT_HOUR,12,    12*3600,"%a %p"},  this looks silly*/
-    {600,               0,   TMT_HOUR,6,    TMT_DAY,1,     TMT_DAY,1,      24*3600,"%a"},
-    {1200,               0,   TMT_HOUR,6,    TMT_DAY,1,     TMT_DAY,1,      24*3600,"%d"},
-    {1800,              0,   TMT_HOUR,12,   TMT_DAY,1,     TMT_DAY,2,      24*3600,"%a %d"},
-    {2400,              0,   TMT_HOUR,12,   TMT_DAY,1,     TMT_DAY,2,      24*3600,"%a"},
-    {3600,              0,   TMT_DAY,1,     TMT_WEEK,1,    TMT_WEEK,1,   7*24*3600,"Week %V"},
-    {3*3600,            0,   TMT_WEEK,1,    TMT_MONTH,1,   TMT_WEEK,2,   7*24*3600,"Week %V"},
-    {6*3600,            0,   TMT_MONTH,1,   TMT_MONTH,1,   TMT_MONTH,1, 30*24*3600,"%b"},
-    {48*3600,           0,   TMT_MONTH,1,   TMT_MONTH,3,   TMT_MONTH,3, 30*24*3600,"%b"},
-    {315360,            0,   TMT_MONTH,3,   TMT_YEAR,1,    TMT_YEAR,1,  365*24*3600,"%Y"},
-    {10*24*3600,        0,   TMT_YEAR,1,  TMT_YEAR,1,    TMT_YEAR,1, 365*24*3600,"%y"},
-    {-1,0,TMT_MONTH,0,TMT_MONTH,0,TMT_MONTH,0,0,""}
+xlab_t    xlab[] = {
+    {0, 0, TMT_SECOND, 30, TMT_MINUTE, 5, TMT_MINUTE, 5, 0, "%H:%M"}
+    ,
+    {2, 0, TMT_MINUTE, 1, TMT_MINUTE, 5, TMT_MINUTE, 5, 0, "%H:%M"}
+    ,
+    {5, 0, TMT_MINUTE, 2, TMT_MINUTE, 10, TMT_MINUTE, 10, 0, "%H:%M"}
+    ,
+    {10, 0, TMT_MINUTE, 5, TMT_MINUTE, 20, TMT_MINUTE, 20, 0, "%H:%M"}
+    ,
+    {30, 0, TMT_MINUTE, 10, TMT_HOUR, 1, TMT_HOUR, 1, 0, "%H:%M"}
+    ,
+    {60, 0, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 2, 0, "%H:%M"}
+    ,
+    {60, 24 * 3600, TMT_MINUTE, 30, TMT_HOUR, 2, TMT_HOUR, 4, 0, "%a %H:%M"}
+    ,
+    {180, 0, TMT_HOUR, 1, TMT_HOUR, 6, TMT_HOUR, 6, 0, "%H:%M"}
+    ,
+    {180, 24 * 3600, TMT_HOUR, 1, TMT_HOUR, 6, TMT_HOUR, 12, 0, "%a %H:%M"}
+    ,
+    /*{300,             0,   TMT_HOUR,3,    TMT_HOUR,12,   TMT_HOUR,12,    12*3600,"%a %p"},  this looks silly */
+    {600, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%a"}
+    ,
+    {1200, 0, TMT_HOUR, 6, TMT_DAY, 1, TMT_DAY, 1, 24 * 3600, "%d"}
+    ,
+    {1800, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a %d"}
+    ,
+    {2400, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a"}
+    ,
+    {3600, 0, TMT_DAY, 1, TMT_WEEK, 1, TMT_WEEK, 1, 7 * 24 * 3600, "Week %V"}
+    ,
+    {3 * 3600, 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_WEEK, 2, 7 * 24 * 3600,
+     "Week %V"}
+    ,
+    {6 * 3600, 0, TMT_MONTH, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600,
+     "%b"}
+    ,
+    {48 * 3600, 0, TMT_MONTH, 1, TMT_MONTH, 3, TMT_MONTH, 3, 30 * 24 * 3600,
+     "%b"}
+    ,
+    {315360, 0, TMT_MONTH, 3, TMT_YEAR, 1, TMT_YEAR, 1, 365 * 24 * 3600, "%Y"}
+    ,
+    {10 * 24 * 3600, 0, TMT_YEAR, 1, TMT_YEAR, 1, TMT_YEAR, 1,
+     365 * 24 * 3600, "%y"}
+    ,
+    {-1, 0, TMT_MONTH, 0, TMT_MONTH, 0, TMT_MONTH, 0, 0, ""}
 };
 
 /* sensible y label intervals ...*/
 
-ylab_t ylab[]= {
-    {0.1, {1,2, 5,10}},
-    {0.2, {1,5,10,20}},
-    {0.5, {1,2, 4,10}},
-    {1.0,   {1,2, 5,10}},
-    {2.0,   {1,5,10,20}},
-    {5.0,   {1,2, 4,10}},
-    {10.0,  {1,2, 5,10}},
-    {20.0,  {1,5,10,20}},
-    {50.0,  {1,2, 4,10}},
-    {100.0, {1,2, 5,10}},
-    {200.0, {1,5,10,20}},
-    {500.0, {1,2, 4,10}},
-    {0.0,   {0,0,0,0}}};
+ylab_t    ylab[] = {
+    {0.1, {1, 2, 5, 10}
+     }
+    ,
+    {0.2, {1, 5, 10, 20}
+     }
+    ,
+    {0.5, {1, 2, 4, 10}
+     }
+    ,
+    {1.0, {1, 2, 5, 10}
+     }
+    ,
+    {2.0, {1, 5, 10, 20}
+     }
+    ,
+    {5.0, {1, 2, 4, 10}
+     }
+    ,
+    {10.0, {1, 2, 5, 10}
+     }
+    ,
+    {20.0, {1, 5, 10, 20}
+     }
+    ,
+    {50.0, {1, 2, 4, 10}
+     }
+    ,
+    {100.0, {1, 2, 5, 10}
+     }
+    ,
+    {200.0, {1, 5, 10, 20}
+     }
+    ,
+    {500.0, {1, 2, 4, 10}
+     }
+    ,
+    {0.0, {0, 0, 0, 0}
+     }
+};
 
 
 gfx_color_t graph_col[] =   /* default colors */
-{    0xFFFFFFFF,   /* canvas     */
-     0xF0F0F0FF,   /* background */
-     0xD0D0D0FF,   /* shade A    */
-     0xA0A0A0FF,   /* shade B    */
-     0x90909080,   /* grid       */
-     0xE0505080,   /* major grid */
-     0x000000FF,   /* font       */ 
-     0x802020FF,   /* arrow      */
-     0x202020FF,   /* axis       */
-     0x000000FF    /* frame      */ 
-};     
+{ 0xFFFFFFFF,           /* canvas     */
+    0xF0F0F0FF,         /* background */
+    0xD0D0D0FF,         /* shade A    */
+    0xA0A0A0FF,         /* shade B    */
+    0x90909080,         /* grid       */
+    0xE0505080,         /* major grid */
+    0x000000FF,         /* font       */
+    0x802020FF,         /* arrow      */
+    0x202020FF,         /* axis       */
+    0x000000FF          /* frame      */
+};
 
 
 /* #define DEBUG */
@@ -110,47 +163,53 @@ gfx_color_t graph_col[] =   /* default colors */
 
 
 /* initialize with xtr(im,0); */
-int
-xtr(image_desc_t *im,time_t mytime){
+int xtr(
+    image_desc_t * im,
+    time_t mytime)
+{
     static double pixie;
-    if (mytime==0){
-        pixie = (double) im->xsize / (double)(im->end - im->start);
+
+    if (mytime == 0) {
+        pixie = (double) im->xsize / (double) (im->end - im->start);
         return im->xorigin;
     }
-    return (int)((double)im->xorigin 
-                 + pixie * ( mytime - im->start ) );
+    return (int) ((double) im->xorigin + pixie * (mytime - im->start));
 }
 
 /* translate data values into y coordinates */
-double
-ytr(image_desc_t *im, double value){
+double ytr(
+    image_desc_t * im,
+    double value)
+{
     static double pixie;
-    double yval;
-    if (isnan(value)){
-      if(!im->logarithmic)
-        pixie = (double) im->ysize / (im->maxval - im->minval);
-      else 
-        pixie = (double) im->ysize / (log10(im->maxval) - log10(im->minval));
-      yval = im->yorigin;
-    } else if(!im->logarithmic) {
-      yval = im->yorigin - pixie * (value - im->minval);
-    } else {
-      if (value < im->minval) {
+    double    yval;
+
+    if (isnan(value)) {
+        if (!im->logarithmic)
+            pixie = (double) im->ysize / (im->maxval - im->minval);
+        else
+            pixie =
+                (double) im->ysize / (log10(im->maxval) - log10(im->minval));
         yval = im->yorigin;
-      } else {
-        yval = im->yorigin - pixie * (log10(value) - log10(im->minval));
-      }
+    } else if (!im->logarithmic) {
+        yval = im->yorigin - pixie * (value - im->minval);
+    } else {
+        if (value < im->minval) {
+            yval = im->yorigin;
+        } else {
+            yval = im->yorigin - pixie * (log10(value) - log10(im->minval));
+        }
     }
     /* make sure we don't return anything too unreasonable. GD lib can
        get terribly slow when drawing lines outside its scope. This is 
        especially problematic in connection with the rigid option */
-    if (! im->rigid) {
-      /* keep yval as-is */
+    if (!im->rigid) {
+        /* keep yval as-is */
     } else if (yval > im->yorigin) {
-      yval = im->yorigin +0.00001;
-    } else if (yval < im->yorigin - im->ysize){
-      yval = im->yorigin - im->ysize - 0.00001;
-    } 
+        yval = im->yorigin + 0.00001;
+    } else if (yval < im->yorigin - im->ysize) {
+        yval = im->yorigin - im->ysize - 0.00001;
+    }
     return yval;
 }
 
@@ -162,98 +221,109 @@ ytr(image_desc_t *im, double value){
 #define conv_if(VV,VVV) \
    if (strcmp(#VV, string) == 0) return VVV ;
 
-enum gf_en gf_conv(char *string){
-    
-    conv_if(PRINT,GF_PRINT)
-    conv_if(GPRINT,GF_GPRINT)
-    conv_if(COMMENT,GF_COMMENT)
-    conv_if(HRULE,GF_HRULE)
-    conv_if(VRULE,GF_VRULE)
-    conv_if(LINE,GF_LINE)
-    conv_if(AREA,GF_AREA)
-    conv_if(STACK,GF_STACK) 
-    conv_if(TICK,GF_TICK)
-    conv_if(DEF,GF_DEF)
-    conv_if(CDEF,GF_CDEF)
-    conv_if(VDEF,GF_VDEF)
+enum gf_en gf_conv(
+    char *string)
+{
+
+    conv_if(PRINT, GF_PRINT)
+        conv_if(GPRINT, GF_GPRINT)
+        conv_if(COMMENT, GF_COMMENT)
+        conv_if(HRULE, GF_HRULE)
+        conv_if(VRULE, GF_VRULE)
+        conv_if(LINE, GF_LINE)
+        conv_if(AREA, GF_AREA)
+        conv_if(STACK, GF_STACK)
+        conv_if(TICK, GF_TICK)
+        conv_if(DEF, GF_DEF)
+        conv_if(CDEF, GF_CDEF)
+        conv_if(VDEF, GF_VDEF)
 #ifdef WITH_PIECHART
-    conv_if(PART,GF_PART)
+        conv_if(PART, GF_PART)
 #endif
-    conv_if(XPORT,GF_XPORT)
-    conv_if(SHIFT,GF_SHIFT)
-    
-    return (-1);
+        conv_if(XPORT, GF_XPORT)
+        conv_if(SHIFT, GF_SHIFT)
+
+        return (-1);
 }
 
-enum gfx_if_en if_conv(char *string){
-    
-    conv_if(PNG,IF_PNG)
-    conv_if(SVG,IF_SVG)
-    conv_if(EPS,IF_EPS)
-    conv_if(PDF,IF_PDF)
+enum gfx_if_en if_conv(
+    char *string)
+{
+
+    conv_if(PNG, IF_PNG)
+        conv_if(SVG, IF_SVG)
+        conv_if(EPS, IF_EPS)
+        conv_if(PDF, IF_PDF)
 
-    return (-1);
+        return (-1);
 }
 
-enum tmt_en tmt_conv(char *string){
+enum tmt_en tmt_conv(
+    char *string)
+{
 
-    conv_if(SECOND,TMT_SECOND)
-    conv_if(MINUTE,TMT_MINUTE)
-    conv_if(HOUR,TMT_HOUR)
-    conv_if(DAY,TMT_DAY)
-    conv_if(WEEK,TMT_WEEK)
-    conv_if(MONTH,TMT_MONTH)
-    conv_if(YEAR,TMT_YEAR)
-    return (-1);
+    conv_if(SECOND, TMT_SECOND)
+        conv_if(MINUTE, TMT_MINUTE)
+        conv_if(HOUR, TMT_HOUR)
+        conv_if(DAY, TMT_DAY)
+        conv_if(WEEK, TMT_WEEK)
+        conv_if(MONTH, TMT_MONTH)
+        conv_if(YEAR, TMT_YEAR)
+        return (-1);
 }
 
-enum grc_en grc_conv(char *string){
+enum grc_en grc_conv(
+    char *string)
+{
 
-    conv_if(BACK,GRC_BACK)
-    conv_if(CANVAS,GRC_CANVAS)
-    conv_if(SHADEA,GRC_SHADEA)
-    conv_if(SHADEB,GRC_SHADEB)
-    conv_if(GRID,GRC_GRID)
-    conv_if(MGRID,GRC_MGRID)
-    conv_if(FONT,GRC_FONT)
-    conv_if(ARROW,GRC_ARROW)
-    conv_if(AXIS,GRC_AXIS)
-    conv_if(FRAME,GRC_FRAME)
+    conv_if(BACK, GRC_BACK)
+        conv_if(CANVAS, GRC_CANVAS)
+        conv_if(SHADEA, GRC_SHADEA)
+        conv_if(SHADEB, GRC_SHADEB)
+        conv_if(GRID, GRC_GRID)
+        conv_if(MGRID, GRC_MGRID)
+        conv_if(FONT, GRC_FONT)
+        conv_if(ARROW, GRC_ARROW)
+        conv_if(AXIS, GRC_AXIS)
+        conv_if(FRAME, GRC_FRAME)
 
-    return -1;        
+        return -1;
 }
 
-enum text_prop_en text_prop_conv(char *string){
-      
-    conv_if(DEFAULT,TEXT_PROP_DEFAULT)
-    conv_if(TITLE,TEXT_PROP_TITLE)
-    conv_if(AXIS,TEXT_PROP_AXIS)
-    conv_if(UNIT,TEXT_PROP_UNIT)
-    conv_if(LEGEND,TEXT_PROP_LEGEND)
-    return -1;
+enum text_prop_en text_prop_conv(
+    char *string)
+{
+
+    conv_if(DEFAULT, TEXT_PROP_DEFAULT)
+        conv_if(TITLE, TEXT_PROP_TITLE)
+        conv_if(AXIS, TEXT_PROP_AXIS)
+        conv_if(UNIT, TEXT_PROP_UNIT)
+        conv_if(LEGEND, TEXT_PROP_LEGEND)
+        return -1;
 }
 
 
 #undef conv_if
 
-int
-im_free(image_desc_t *im)
+int im_free(
+    image_desc_t * im)
 {
-    unsigned long        i,ii;
-
-    if (im == NULL) return 0;
-    for(i=0;i<(unsigned)im->gdes_c;i++){
-      if (im->gdes[i].data_first){
-        /* careful here, because a single pointer can occur several times */
-          free (im->gdes[i].data);
-          if (im->gdes[i].ds_namv){
-              for (ii=0;ii<im->gdes[i].ds_cnt;ii++)
-                  free(im->gdes[i].ds_namv[ii]);
-              free(im->gdes[i].ds_namv);
-          }
-      }
-      free (im->gdes[i].p_data);
-      free (im->gdes[i].rpnp);
+    unsigned long i, ii;
+
+    if (im == NULL)
+        return 0;
+    for (i = 0; i < (unsigned) im->gdes_c; i++) {
+        if (im->gdes[i].data_first) {
+            /* careful here, because a single pointer can occur several times */
+            free(im->gdes[i].data);
+            if (im->gdes[i].ds_namv) {
+                for (ii = 0; ii < im->gdes[i].ds_cnt; ii++)
+                    free(im->gdes[i].ds_namv[ii]);
+                free(im->gdes[i].ds_namv);
+            }
+        }
+        free(im->gdes[i].p_data);
+        free(im->gdes[i].rpnp);
     }
     free(im->gdes);
     gfx_destroy(im->canvas);
@@ -261,76 +331,75 @@ im_free(image_desc_t *im)
 }
 
 /* find SI magnitude symbol for the given number*/
-void
-auto_scale(
-           image_desc_t *im,   /* image description */
-           double *value,
-           char **symb_ptr,
-           double *magfact
-           )
+void auto_scale(
+    image_desc_t * im,  /* image description */
+    double *value,
+    char **symb_ptr,
+    double *magfact)
 {
-        
-    char *symbol[] = {"a", /* 10e-18 Atto */
-                      "f", /* 10e-15 Femto */
-                      "p", /* 10e-12 Pico */
-                      "n", /* 10e-9  Nano */
-                      "u", /* 10e-6  Micro */
-                      "m", /* 10e-3  Milli */
-                      " ", /* Base */
-                      "k", /* 10e3   Kilo */
-                      "M", /* 10e6   Mega */
-                      "G", /* 10e9   Giga */
-                      "T", /* 10e12  Tera */
-                      "P", /* 10e15  Peta */
-                      "E"};/* 10e18  Exa */
-
-    int symbcenter = 6;
-    int sindex;  
-
-    if (*value == 0.0 || isnan(*value) ) {
+
+    char     *symbol[] = { "a", /* 10e-18 Atto */
+        "f",            /* 10e-15 Femto */
+        "p",            /* 10e-12 Pico */
+        "n",            /* 10e-9  Nano */
+        "u",            /* 10e-6  Micro */
+        "m",            /* 10e-3  Milli */
+        " ",            /* Base */
+        "k",            /* 10e3   Kilo */
+        "M",            /* 10e6   Mega */
+        "G",            /* 10e9   Giga */
+        "T",            /* 10e12  Tera */
+        "P",            /* 10e15  Peta */
+        "E"
+    };                  /* 10e18  Exa */
+
+    int       symbcenter = 6;
+    int       sindex;
+
+    if (*value == 0.0 || isnan(*value)) {
         sindex = 0;
         *magfact = 1.0;
     } else {
-        sindex = floor(log(fabs(*value))/log((double)im->base)); 
-        *magfact = pow((double)im->base, (double)sindex);
+        sindex = floor(log(fabs(*value)) / log((double) im->base));
+        *magfact = pow((double) im->base, (double) sindex);
         (*value) /= (*magfact);
     }
-    if ( sindex <= symbcenter && sindex >= -symbcenter) {
-        (*symb_ptr) = symbol[sindex+symbcenter];
-    }
-    else {
+    if (sindex <= symbcenter && sindex >= -symbcenter) {
+        (*symb_ptr) = symbol[sindex + symbcenter];
+    } else {
         (*symb_ptr) = "?";
     }
 }
 
 
 static char si_symbol[] = {
-                     'a', /* 10e-18 Atto */ 
-                     'f', /* 10e-15 Femto */
-                     'p', /* 10e-12 Pico */
-                     'n', /* 10e-9  Nano */
-                     'u', /* 10e-6  Micro */
-                     'm', /* 10e-3  Milli */
-                     ' ', /* Base */
-                     'k', /* 10e3   Kilo */
-                     'M', /* 10e6   Mega */
-                     'G', /* 10e9   Giga */
-                     'T', /* 10e12  Tera */
-                     'P', /* 10e15  Peta */
-                     'E', /* 10e18  Exa */
+    'a',                /* 10e-18 Atto */
+    'f',                /* 10e-15 Femto */
+    'p',                /* 10e-12 Pico */
+    'n',                /* 10e-9  Nano */
+    'u',                /* 10e-6  Micro */
+    'm',                /* 10e-3  Milli */
+    ' ',                /* Base */
+    'k',                /* 10e3   Kilo */
+    'M',                /* 10e6   Mega */
+    'G',                /* 10e9   Giga */
+    'T',                /* 10e12  Tera */
+    'P',                /* 10e15  Peta */
+    'E',                /* 10e18  Exa */
 };
 static const int si_symbcenter = 6;
 
 /* find SI magnitude symbol for the numbers on the y-axis*/
-void 
-si_unit(
-    image_desc_t *im   /* image description */
-)
+void si_unit(
+    image_desc_t * im   /* image description */
+    )
 {
 
-    double digits,viewdigits=0;  
-    
-    digits = floor( log( max( fabs(im->minval),fabs(im->maxval)))/log((double)im->base)); 
+    double    digits, viewdigits = 0;
+
+    digits =
+        floor(log(max(fabs(im->minval), fabs(im->maxval))) /
+              log((double) im->base));
 
     if (im->unitsexponent != 9999) {
         /* unitsexponent = 9, 6, 3, 0, -3, -6, -9, etc */
@@ -339,349 +408,362 @@ si_unit(
         viewdigits = digits;
     }
 
-    im->magfact = pow((double)im->base , digits);
-    
+    im->magfact = pow((double) im->base, digits);
+
 #ifdef DEBUG
-    printf("digits %6.3f  im->magfact %6.3f\n",digits,im->magfact);
+    printf("digits %6.3f  im->magfact %6.3f\n", digits, im->magfact);
 #endif
 
-    im->viewfactor = im->magfact / pow((double)im->base , viewdigits);
+    im->viewfactor = im->magfact / pow((double) im->base, viewdigits);
 
-    if ( ((viewdigits+si_symbcenter) < sizeof(si_symbol)) &&
-                    ((viewdigits+si_symbcenter) >= 0) )
-        im->symbol = si_symbol[(int)viewdigits+si_symbcenter];
+    if (((viewdigits + si_symbcenter) < sizeof(si_symbol)) &&
+        ((viewdigits + si_symbcenter) >= 0))
+        im->symbol = si_symbol[(int) viewdigits + si_symbcenter];
     else
         im->symbol = '?';
- }
+}
 
 /*  move min and max values around to become sensible */
 
-void 
-expand_range(image_desc_t *im)
+void expand_range(
+    image_desc_t * im)
 {
-    double sensiblevalues[] ={1000.0,900.0,800.0,750.0,700.0,
-                              600.0,500.0,400.0,300.0,250.0,
-                              200.0,125.0,100.0,90.0,80.0,
-                              75.0,70.0,60.0,50.0,40.0,30.0,
-                              25.0,20.0,10.0,9.0,8.0,
-                              7.0,6.0,5.0,4.0,3.5,3.0,
-                              2.5,2.0,1.8,1.5,1.2,1.0,
-                              0.8,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0.0,-1};
-    
-    double scaled_min,scaled_max;  
-    double adj;
-    int i;
-    
-
-    
+    double    sensiblevalues[] = { 1000.0, 900.0, 800.0, 750.0, 700.0,
+        600.0, 500.0, 400.0, 300.0, 250.0,
+        200.0, 125.0, 100.0, 90.0, 80.0,
+        75.0, 70.0, 60.0, 50.0, 40.0, 30.0,
+        25.0, 20.0, 10.0, 9.0, 8.0,
+        7.0, 6.0, 5.0, 4.0, 3.5, 3.0,
+        2.5, 2.0, 1.8, 1.5, 1.2, 1.0,
+        0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1, 0.0, -1
+    };
+
+    double    scaled_min, scaled_max;
+    double    adj;
+    int       i;
+
+
+
 #ifdef DEBUG
     printf("Min: %6.2f Max: %6.2f MagFactor: %6.2f\n",
-           im->minval,im->maxval,im->magfact);
+           im->minval, im->maxval, im->magfact);
 #endif
 
-    if (isnan(im->ygridstep)){
-        if(im->extra_flags & ALTAUTOSCALE) {
+    if (isnan(im->ygridstep)) {
+        if (im->extra_flags & ALTAUTOSCALE) {
             /* measure the amplitude of the function. Make sure that
                graph boundaries are slightly higher then max/min vals
                so we can see amplitude on the graph */
-              double delt, fact;
-
-              delt = im->maxval - im->minval;
-              adj = delt * 0.1;
-              fact = 2.0 * pow(10.0,
-                    floor(log10(max(fabs(im->minval), fabs(im->maxval))/im->magfact)) - 2);
-              if (delt < fact) {
+            double    delt, fact;
+
+            delt = im->maxval - im->minval;
+            adj = delt * 0.1;
+            fact = 2.0 * pow(10.0,
+                             floor(log10
+                                   (max(fabs(im->minval), fabs(im->maxval)) /
+                                    im->magfact)) - 2);
+            if (delt < fact) {
                 adj = (fact - delt) * 0.55;
 #ifdef DEBUG
-              printf("Min: %6.2f Max: %6.2f delt: %6.2f fact: %6.2f adj: %6.2f\n", im->minval, im->maxval, delt, fact, adj);
+                printf
+                    ("Min: %6.2f Max: %6.2f delt: %6.2f fact: %6.2f adj: %6.2f\n",
+                     im->minval, im->maxval, delt, fact, adj);
 #endif
-              }
-              im->minval -= adj;
-              im->maxval += adj;
-        }
-       else if(im->extra_flags & ALTAUTOSCALE_MIN) {
-           /* measure the amplitude of the function. Make sure that
-              graph boundaries are slightly lower than min vals
-              so we can see amplitude on the graph */
-             adj = (im->maxval - im->minval) * 0.1;
-             im->minval -= adj;
-       }
-        else if(im->extra_flags & ALTAUTOSCALE_MAX) {
+            }
+            im->minval -= adj;
+            im->maxval += adj;
+        } else if (im->extra_flags & ALTAUTOSCALE_MIN) {
+            /* measure the amplitude of the function. Make sure that
+               graph boundaries are slightly lower than min vals
+               so we can see amplitude on the graph */
+            adj = (im->maxval - im->minval) * 0.1;
+            im->minval -= adj;
+        } else if (im->extra_flags & ALTAUTOSCALE_MAX) {
             /* measure the amplitude of the function. Make sure that
                graph boundaries are slightly higher than max vals
                so we can see amplitude on the graph */
-              adj = (im->maxval - im->minval) * 0.1;
-              im->maxval += adj;
-        }
-        else {
+            adj = (im->maxval - im->minval) * 0.1;
+            im->maxval += adj;
+        } else {
             scaled_min = im->minval / im->magfact;
             scaled_max = im->maxval / im->magfact;
-            
-            for (i=1; sensiblevalues[i] > 0; i++){
-                if (sensiblevalues[i-1]>=scaled_min &&
-                    sensiblevalues[i]<=scaled_min)        
-                    im->minval = sensiblevalues[i]*(im->magfact);
-                
-                if (-sensiblevalues[i-1]<=scaled_min &&
-                -sensiblevalues[i]>=scaled_min)
-                    im->minval = -sensiblevalues[i-1]*(im->magfact);
-                
-                if (sensiblevalues[i-1] >= scaled_max &&
+
+            for (i = 1; sensiblevalues[i] > 0; i++) {
+                if (sensiblevalues[i - 1] >= scaled_min &&
+                    sensiblevalues[i] <= scaled_min)
+                    im->minval = sensiblevalues[i] * (im->magfact);
+
+                if (-sensiblevalues[i - 1] <= scaled_min &&
+                    -sensiblevalues[i] >= scaled_min)
+                    im->minval = -sensiblevalues[i - 1] * (im->magfact);
+
+                if (sensiblevalues[i - 1] >= scaled_max &&
                     sensiblevalues[i] <= scaled_max)
-                    im->maxval = sensiblevalues[i-1]*(im->magfact);
-                
-                if (-sensiblevalues[i-1]<=scaled_max &&
-                    -sensiblevalues[i] >=scaled_max)
-                    im->maxval = -sensiblevalues[i]*(im->magfact);
+                    im->maxval = sensiblevalues[i - 1] * (im->magfact);
+
+                if (-sensiblevalues[i - 1] <= scaled_max &&
+                    -sensiblevalues[i] >= scaled_max)
+                    im->maxval = -sensiblevalues[i] * (im->magfact);
             }
         }
     } else {
         /* adjust min and max to the grid definition if there is one */
-        im->minval = (double)im->ylabfact * im->ygridstep * 
-            floor(im->minval / ((double)im->ylabfact * im->ygridstep));
-        im->maxval = (double)im->ylabfact * im->ygridstep * 
-            ceil(im->maxval /( (double)im->ylabfact * im->ygridstep));
+        im->minval = (double) im->ylabfact * im->ygridstep *
+            floor(im->minval / ((double) im->ylabfact * im->ygridstep));
+        im->maxval = (double) im->ylabfact * im->ygridstep *
+            ceil(im->maxval / ((double) im->ylabfact * im->ygridstep));
     }
-    
+
 #ifdef DEBUG
-    fprintf(stderr,"SCALED Min: %6.2f Max: %6.2f Factor: %6.2f\n",
-           im->minval,im->maxval,im->magfact);
+    fprintf(stderr, "SCALED Min: %6.2f Max: %6.2f Factor: %6.2f\n",
+            im->minval, im->maxval, im->magfact);
 #endif
 }
 
-void
-apply_gridfit(image_desc_t *im)
+void apply_gridfit(
+    image_desc_t * im)
 {
-  if (isnan(im->minval) || isnan(im->maxval))
-    return;
-  ytr(im,DNAN);
-  if (im->logarithmic) {
-    double ya, yb, ypix, ypixfrac;
-    double log10_range = log10(im->maxval) - log10(im->minval);
-    ya = pow((double)10, floor(log10(im->minval)));
-    while (ya < im->minval)
-      ya *= 10;
-    if (ya > im->maxval)
-      return; /* don't have y=10^x gridline */
-    yb = ya * 10;
-    if (yb <= im->maxval) {
-      /* we have at least 2 y=10^x gridlines.
-         Make sure distance between them in pixels
-         are an integer by expanding im->maxval */
-      double y_pixel_delta = ytr(im, ya) - ytr(im, yb);
-      double factor = y_pixel_delta / floor(y_pixel_delta);
-      double new_log10_range = factor * log10_range;
-      double new_ymax_log10 = log10(im->minval) + new_log10_range;
-      im->maxval = pow(10, new_ymax_log10);
-      ytr(im,DNAN); /* reset precalc */
-      log10_range = log10(im->maxval) - log10(im->minval);
-    }
-    /* make sure first y=10^x gridline is located on 
-       integer pixel position by moving scale slightly 
-       downwards (sub-pixel movement) */
-    ypix = ytr(im, ya) + im->ysize; /* add im->ysize so it always is positive */
-    ypixfrac = ypix - floor(ypix);
-    if (ypixfrac > 0 && ypixfrac < 1) {
-      double yfrac = ypixfrac / im->ysize;
-      im->minval = pow(10, log10(im->minval) - yfrac * log10_range);
-      im->maxval = pow(10, log10(im->maxval) - yfrac * log10_range);
-      ytr(im,DNAN); /* reset precalc */
-    }
-  } else {
-    /* Make sure we have an integer pixel distance between
-       each minor gridline */
-    double ypos1 = ytr(im, im->minval);
-    double ypos2 = ytr(im, im->minval + im->ygrid_scale.gridstep);
-    double y_pixel_delta = ypos1 - ypos2;
-    double factor = y_pixel_delta / floor(y_pixel_delta);
-    double new_range = factor * (im->maxval - im->minval);
-    double gridstep = im->ygrid_scale.gridstep;
-    double minor_y, minor_y_px, minor_y_px_frac;
-    if (im->maxval > 0.0)
-      im->maxval = im->minval + new_range;
-    else
-      im->minval = im->maxval - new_range;
-    ytr(im,DNAN); /* reset precalc */
-    /* make sure first minor gridline is on integer pixel y coord */
-    minor_y = gridstep * floor(im->minval / gridstep);
-    while (minor_y < im->minval)
-      minor_y += gridstep;
-    minor_y_px = ytr(im, minor_y) + im->ysize; /* ensure > 0 by adding ysize */
-    minor_y_px_frac = minor_y_px - floor(minor_y_px);
-    if (minor_y_px_frac > 0 && minor_y_px_frac < 1) {
-      double yfrac = minor_y_px_frac / im->ysize;
-      double range = im->maxval - im->minval;
-      im->minval = im->minval - yfrac * range;
-      im->maxval = im->maxval - yfrac * range;
-      ytr(im,DNAN); /* reset precalc */
-    }
-    calc_horizontal_grid(im); /* recalc with changed im->maxval */
-  }
+    if (isnan(im->minval) || isnan(im->maxval))
+        return;
+    ytr(im, DNAN);
+    if (im->logarithmic) {
+        double    ya, yb, ypix, ypixfrac;
+        double    log10_range = log10(im->maxval) - log10(im->minval);
+
+        ya = pow((double) 10, floor(log10(im->minval)));
+        while (ya < im->minval)
+            ya *= 10;
+        if (ya > im->maxval)
+            return;     /* don't have y=10^x gridline */
+        yb = ya * 10;
+        if (yb <= im->maxval) {
+            /* we have at least 2 y=10^x gridlines.
+               Make sure distance between them in pixels
+               are an integer by expanding im->maxval */
+            double    y_pixel_delta = ytr(im, ya) - ytr(im, yb);
+            double    factor = y_pixel_delta / floor(y_pixel_delta);
+            double    new_log10_range = factor * log10_range;
+            double    new_ymax_log10 = log10(im->minval) + new_log10_range;
+
+            im->maxval = pow(10, new_ymax_log10);
+            ytr(im, DNAN);  /* reset precalc */
+            log10_range = log10(im->maxval) - log10(im->minval);
+        }
+        /* make sure first y=10^x gridline is located on 
+           integer pixel position by moving scale slightly 
+           downwards (sub-pixel movement) */
+        ypix = ytr(im, ya) + im->ysize; /* add im->ysize so it always is positive */
+        ypixfrac = ypix - floor(ypix);
+        if (ypixfrac > 0 && ypixfrac < 1) {
+            double    yfrac = ypixfrac / im->ysize;
+
+            im->minval = pow(10, log10(im->minval) - yfrac * log10_range);
+            im->maxval = pow(10, log10(im->maxval) - yfrac * log10_range);
+            ytr(im, DNAN);  /* reset precalc */
+        }
+    } else {
+        /* Make sure we have an integer pixel distance between
+           each minor gridline */
+        double    ypos1 = ytr(im, im->minval);
+        double    ypos2 = ytr(im, im->minval + im->ygrid_scale.gridstep);
+        double    y_pixel_delta = ypos1 - ypos2;
+        double    factor = y_pixel_delta / floor(y_pixel_delta);
+        double    new_range = factor * (im->maxval - im->minval);
+        double    gridstep = im->ygrid_scale.gridstep;
+        double    minor_y, minor_y_px, minor_y_px_frac;
+
+        if (im->maxval > 0.0)
+            im->maxval = im->minval + new_range;
+        else
+            im->minval = im->maxval - new_range;
+        ytr(im, DNAN);  /* reset precalc */
+        /* make sure first minor gridline is on integer pixel y coord */
+        minor_y = gridstep * floor(im->minval / gridstep);
+        while (minor_y < im->minval)
+            minor_y += gridstep;
+        minor_y_px = ytr(im, minor_y) + im->ysize;  /* ensure > 0 by adding ysize */
+        minor_y_px_frac = minor_y_px - floor(minor_y_px);
+        if (minor_y_px_frac > 0 && minor_y_px_frac < 1) {
+            double    yfrac = minor_y_px_frac / im->ysize;
+            double    range = im->maxval - im->minval;
+
+            im->minval = im->minval - yfrac * range;
+            im->maxval = im->maxval - yfrac * range;
+            ytr(im, DNAN);  /* reset precalc */
+        }
+        calc_horizontal_grid(im);   /* recalc with changed im->maxval */
+    }
 }
 
 /* reduce data reimplementation by Alex */
 
-void
-reduce_data(
-    enum cf_en     cf,         /* which consolidation function ?*/
-    unsigned long  cur_step,   /* step the data currently is in */
-    time_t         *start,     /* start, end and step as requested ... */
-    time_t         *end,       /* ... by the application will be   ... */
-    unsigned long  *step,      /* ... adjusted to represent reality    */
-    unsigned long  *ds_cnt,    /* number of data sources in file */
-    rrd_value_t    **data)     /* two dimensional array containing the data */
-{
-    int i,reduce_factor = ceil((double)(*step) / (double)cur_step);
-    unsigned long col,dst_row,row_cnt,start_offset,end_offset,skiprows=0;
-    rrd_value_t    *srcptr,*dstptr;
-
-    (*step) = cur_step*reduce_factor; /* set new step size for reduced data */
+void reduce_data(
+    enum cf_en cf,      /* which consolidation function ? */
+    unsigned long cur_step, /* step the data currently is in */
+    time_t *start,      /* start, end and step as requested ... */
+    time_t *end,        /* ... by the application will be   ... */
+    unsigned long *step,    /* ... adjusted to represent reality    */
+    unsigned long *ds_cnt,  /* number of data sources in file */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
+    int       i, reduce_factor = ceil((double) (*step) / (double) cur_step);
+    unsigned long col, dst_row, row_cnt, start_offset, end_offset, skiprows =
+        0;
+    rrd_value_t *srcptr, *dstptr;
+
+    (*step) = cur_step * reduce_factor; /* set new step size for reduced data */
     dstptr = *data;
     srcptr = *data;
-    row_cnt = ((*end)-(*start))/cur_step;
+    row_cnt = ((*end) - (*start)) / cur_step;
 
 #ifdef DEBUG
 #define DEBUG_REDUCE
 #endif
 #ifdef DEBUG_REDUCE
-printf("Reducing %lu rows with factor %i time %lu to %lu, step %lu\n",
-                        row_cnt,reduce_factor,*start,*end,cur_step);
-for (col=0;col<row_cnt;col++) {
-    printf("time %10lu: ",*start+(col+1)*cur_step);
-    for (i=0;i<*ds_cnt;i++)
-        printf(" %8.2e",srcptr[*ds_cnt*col+i]);
-    printf("\n");
-}
+    printf("Reducing %lu rows with factor %i time %lu to %lu, step %lu\n",
+           row_cnt, reduce_factor, *start, *end, cur_step);
+    for (col = 0; col < row_cnt; col++) {
+        printf("time %10lu: ", *start + (col + 1) * cur_step);
+        for (i = 0; i < *ds_cnt; i++)
+            printf(" %8.2e", srcptr[*ds_cnt * col + i]);
+        printf("\n");
+    }
 #endif
 
     /* We have to combine [reduce_factor] rows of the source
-    ** into one row for the destination.  Doing this we also
-    ** need to take care to combine the correct rows.  First
-    ** alter the start and end time so that they are multiples
-    ** of the new step time.  We cannot reduce the amount of
-    ** time so we have to move the end towards the future and
-    ** the start towards the past.
-    */
+     ** into one row for the destination.  Doing this we also
+     ** need to take care to combine the correct rows.  First
+     ** alter the start and end time so that they are multiples
+     ** of the new step time.  We cannot reduce the amount of
+     ** time so we have to move the end towards the future and
+     ** the start towards the past.
+     */
     end_offset = (*end) % (*step);
     start_offset = (*start) % (*step);
 
     /* If there is a start offset (which cannot be more than
-    ** one destination row), skip the appropriate number of
-    ** source rows and one destination row.  The appropriate
-    ** number is what we do know (start_offset/cur_step) of
-    ** the new interval (*step/cur_step aka reduce_factor).
-    */
+     ** one destination row), skip the appropriate number of
+     ** source rows and one destination row.  The appropriate
+     ** number is what we do know (start_offset/cur_step) of
+     ** the new interval (*step/cur_step aka reduce_factor).
+     */
 #ifdef DEBUG_REDUCE
-printf("start_offset: %lu  end_offset: %lu\n",start_offset,end_offset);
-printf("row_cnt before:  %lu\n",row_cnt);
+    printf("start_offset: %lu  end_offset: %lu\n", start_offset, end_offset);
+    printf("row_cnt before:  %lu\n", row_cnt);
 #endif
     if (start_offset) {
-        (*start) = (*start)-start_offset;
-        skiprows=reduce_factor-start_offset/cur_step;
-        srcptr+=skiprows* *ds_cnt;
-        for (col=0;col<(*ds_cnt);col++) *dstptr++ = DNAN;
-        row_cnt-=skiprows;
+        (*start) = (*start) - start_offset;
+        skiprows = reduce_factor - start_offset / cur_step;
+        srcptr += skiprows * *ds_cnt;
+        for (col = 0; col < (*ds_cnt); col++)
+            *dstptr++ = DNAN;
+        row_cnt -= skiprows;
     }
 #ifdef DEBUG_REDUCE
-printf("row_cnt between: %lu\n",row_cnt);
+    printf("row_cnt between: %lu\n", row_cnt);
 #endif
 
     /* At the end we have some rows that are not going to be
-    ** used, the amount is end_offset/cur_step
-    */
+     ** used, the amount is end_offset/cur_step
+     */
     if (end_offset) {
-        (*end) = (*end)-end_offset+(*step);
-        skiprows = end_offset/cur_step;
-        row_cnt-=skiprows;
+        (*end) = (*end) - end_offset + (*step);
+        skiprows = end_offset / cur_step;
+        row_cnt -= skiprows;
     }
 #ifdef DEBUG_REDUCE
-printf("row_cnt after:   %lu\n",row_cnt);
+    printf("row_cnt after:   %lu\n", row_cnt);
 #endif
 
 /* Sanity check: row_cnt should be multiple of reduce_factor */
 /* if this gets triggered, something is REALLY WRONG ... we die immediately */
 
-    if (row_cnt%reduce_factor) {
+    if (row_cnt % reduce_factor) {
         printf("SANITY CHECK: %lu rows cannot be reduced by %i \n",
-                                row_cnt,reduce_factor);
+               row_cnt, reduce_factor);
         printf("BUG in reduce_data()\n");
         exit(1);
     }
 
     /* Now combine reduce_factor intervals at a time
-    ** into one interval for the destination.
-    */
+     ** into one interval for the destination.
+     */
 
-    for (dst_row=0;(long int)row_cnt>=reduce_factor;dst_row++) {
-        for (col=0;col<(*ds_cnt);col++) {
-            rrd_value_t newval=DNAN;
-            unsigned long validval=0;
+    for (dst_row = 0; (long int) row_cnt >= reduce_factor; dst_row++) {
+        for (col = 0; col < (*ds_cnt); col++) {
+            rrd_value_t newval = DNAN;
+            unsigned long validval = 0;
 
-            for (i=0;i<reduce_factor;i++) {
-                if (isnan(srcptr[i*(*ds_cnt)+col])) {
+            for (i = 0; i < reduce_factor; i++) {
+                if (isnan(srcptr[i * (*ds_cnt) + col])) {
                     continue;
                 }
                 validval++;
-                if (isnan(newval)) newval = srcptr[i*(*ds_cnt)+col];
+                if (isnan(newval))
+                    newval = srcptr[i * (*ds_cnt) + col];
                 else {
                     switch (cf) {
-                        case CF_HWPREDICT:
-                        case CF_DEVSEASONAL:
-                        case CF_DEVPREDICT:
-                        case CF_SEASONAL:
-                        case CF_AVERAGE:
-                            newval += srcptr[i*(*ds_cnt)+col];
-                            break;
-                        case CF_MINIMUM:
-                            newval = min (newval,srcptr[i*(*ds_cnt)+col]);
-                            break;
-                        case CF_FAILURES: 
-                        /* an interval contains a failure if any subintervals contained a failure */
-                        case CF_MAXIMUM:
-                            newval = max (newval,srcptr[i*(*ds_cnt)+col]);
-                            break;
-                        case CF_LAST:
-                            newval = srcptr[i*(*ds_cnt)+col];
-                            break;
-                    }
-                }
-            }
-            if (validval == 0){newval = DNAN;} else{
-                switch (cf) {
                     case CF_HWPREDICT:
-                case CF_DEVSEASONAL:
+                    case CF_DEVSEASONAL:
                     case CF_DEVPREDICT:
                     case CF_SEASONAL:
-                    case CF_AVERAGE:                
-                       newval /= validval;
+                    case CF_AVERAGE:
+                        newval += srcptr[i * (*ds_cnt) + col];
                         break;
                     case CF_MINIMUM:
+                        newval = min(newval, srcptr[i * (*ds_cnt) + col]);
+                        break;
                     case CF_FAILURES:
-                     case CF_MAXIMUM:
+                        /* an interval contains a failure if any subintervals contained a failure */
+                    case CF_MAXIMUM:
+                        newval = max(newval, srcptr[i * (*ds_cnt) + col]);
+                        break;
                     case CF_LAST:
+                        newval = srcptr[i * (*ds_cnt) + col];
                         break;
+                    }
+                }
+            }
+            if (validval == 0) {
+                newval = DNAN;
+            } else {
+                switch (cf) {
+                case CF_HWPREDICT:
+                case CF_DEVSEASONAL:
+                case CF_DEVPREDICT:
+                case CF_SEASONAL:
+                case CF_AVERAGE:
+                    newval /= validval;
+                    break;
+                case CF_MINIMUM:
+                case CF_FAILURES:
+                case CF_MAXIMUM:
+                case CF_LAST:
+                    break;
                 }
             }
-            *dstptr++=newval;
+            *dstptr++ = newval;
         }
-        srcptr+=(*ds_cnt)*reduce_factor;
-        row_cnt-=reduce_factor;
+        srcptr += (*ds_cnt) * reduce_factor;
+        row_cnt -= reduce_factor;
     }
     /* If we had to alter the endtime, we didn't have enough
-    ** source rows to fill the last row. Fill it with NaN.
-    */
-    if (end_offset) for (col=0;col<(*ds_cnt);col++) *dstptr++ = DNAN;
+     ** source rows to fill the last row. Fill it with NaN.
+     */
+    if (end_offset)
+        for (col = 0; col < (*ds_cnt); col++)
+            *dstptr++ = DNAN;
 #ifdef DEBUG_REDUCE
-    row_cnt = ((*end)-(*start))/ *step;
+    row_cnt = ((*end) - (*start)) / *step;
     srcptr = *data;
     printf("Done reducing. Currently %lu rows, time %lu to %lu, step %lu\n",
-                                row_cnt,*start,*end,*step);
-for (col=0;col<row_cnt;col++) {
-    printf("time %10lu: ",*start+(col+1)*(*step));
-    for (i=0;i<*ds_cnt;i++)
-        printf(" %8.2e",srcptr[*ds_cnt*col+i]);
-    printf("\n");
-}
+           row_cnt, *start, *end, *step);
+    for (col = 0; col < row_cnt; col++) {
+        printf("time %10lu: ", *start + (col + 1) * (*step));
+        for (i = 0; i < *ds_cnt; i++)
+            printf(" %8.2e", srcptr[*ds_cnt * col + i]);
+        printf("\n");
+    }
 #endif
 }
 
@@ -689,83 +771,83 @@ for (col=0;col<row_cnt;col++) {
 /* get the data required for the graphs from the 
    relevant rrds ... */
 
-int
-data_fetch(image_desc_t *im )
+int data_fetch(
+    image_desc_t * im)
 {
-    int i,ii;
-    int                skip;
+    int       i, ii;
+    int       skip;
 
     /* pull the data from the rrd files ... */
-    for (i=0;i< (int)im->gdes_c;i++){
+    for (i = 0; i < (int) im->gdes_c; i++) {
         /* only GF_DEF elements fetch data */
-        if (im->gdes[i].gf != GF_DEF) 
+        if (im->gdes[i].gf != GF_DEF)
             continue;
 
-        skip=0;
-        /* do we have it already ?*/
-        for (ii=0;ii<i;ii++) {
-            if (im->gdes[ii].gf != GF_DEF) 
+        skip = 0;
+        /* do we have it already ? */
+        for (ii = 0; ii < i; ii++) {
+            if (im->gdes[ii].gf != GF_DEF)
                 continue;
             if ((strcmp(im->gdes[i].rrd, im->gdes[ii].rrd) == 0)
-                        && (im->gdes[i].cf    == im->gdes[ii].cf)
-                        && (im->gdes[i].cf_reduce == im->gdes[ii].cf_reduce)
-                        && (im->gdes[i].start_orig == im->gdes[ii].start_orig)
-                        && (im->gdes[i].end_orig   == im->gdes[ii].end_orig)
-                        && (im->gdes[i].step_orig  == im->gdes[ii].step_orig)) {
+                && (im->gdes[i].cf == im->gdes[ii].cf)
+                && (im->gdes[i].cf_reduce == im->gdes[ii].cf_reduce)
+                && (im->gdes[i].start_orig == im->gdes[ii].start_orig)
+                && (im->gdes[i].end_orig == im->gdes[ii].end_orig)
+                && (im->gdes[i].step_orig == im->gdes[ii].step_orig)) {
                 /* OK, the data is already there.
-                ** Just copy the header portion
-                */
+                 ** Just copy the header portion
+                 */
                 im->gdes[i].start = im->gdes[ii].start;
                 im->gdes[i].end = im->gdes[ii].end;
                 im->gdes[i].step = im->gdes[ii].step;
                 im->gdes[i].ds_cnt = im->gdes[ii].ds_cnt;
-                im->gdes[i].ds_namv = im->gdes[ii].ds_namv;                
+                im->gdes[i].ds_namv = im->gdes[ii].ds_namv;
                 im->gdes[i].data = im->gdes[ii].data;
                 im->gdes[i].data_first = 0;
-                skip=1;
+                skip = 1;
             }
-            if (skip) 
+            if (skip)
                 break;
         }
-        if (! skip) {
-            unsigned long  ft_step = im->gdes[i].step ; /* ft_step will record what we got from fetch */
-            
-            if((rrd_fetch_fn(im->gdes[i].rrd,
-                             im->gdes[i].cf,
-                             &im->gdes[i].start,
-                             &im->gdes[i].end,
-                             &ft_step,
-                             &im->gdes[i].ds_cnt,
-                             &im->gdes[i].ds_namv,
-                             &im->gdes[i].data)) == -1){                
+        if (!skip) {
+            unsigned long ft_step = im->gdes[i].step;   /* ft_step will record what we got from fetch */
+
+            if ((rrd_fetch_fn(im->gdes[i].rrd,
+                              im->gdes[i].cf,
+                              &im->gdes[i].start,
+                              &im->gdes[i].end,
+                              &ft_step,
+                              &im->gdes[i].ds_cnt,
+                              &im->gdes[i].ds_namv,
+                              &im->gdes[i].data)) == -1) {
                 return -1;
             }
-            im->gdes[i].data_first = 1;            
-        
+            im->gdes[i].data_first = 1;
+
             if (ft_step < im->gdes[i].step) {
                 reduce_data(im->gdes[i].cf_reduce,
                             ft_step,
                             &im->gdes[i].start,
                             &im->gdes[i].end,
                             &im->gdes[i].step,
-                            &im->gdes[i].ds_cnt,
-                            &im->gdes[i].data);
+                            &im->gdes[i].ds_cnt, &im->gdes[i].data);
             } else {
                 im->gdes[i].step = ft_step;
             }
         }
-        
+
         /* lets see if the required data source is really there */
-        for(ii=0;ii<(int)im->gdes[i].ds_cnt;ii++){
-            if(strcmp(im->gdes[i].ds_namv[ii],im->gdes[i].ds_nam) == 0){
-                im->gdes[i].ds=ii; }
+        for (ii = 0; ii < (int) im->gdes[i].ds_cnt; ii++) {
+            if (strcmp(im->gdes[i].ds_namv[ii], im->gdes[i].ds_nam) == 0) {
+                im->gdes[i].ds = ii;
+            }
         }
-        if (im->gdes[i].ds== -1){
+        if (im->gdes[i].ds == -1) {
             rrd_set_error("No DS called '%s' in '%s'",
-                          im->gdes[i].ds_nam,im->gdes[i].rrd);
-            return -1; 
+                          im->gdes[i].ds_nam, im->gdes[i].rrd);
+            return -1;
         }
-        
+
     }
     return 0;
 }
@@ -776,320 +858,339 @@ data_fetch(image_desc_t *im )
  * CDEF stuff 
  *************************************************************/
 
-long
-find_var_wrapper(void *arg1, char *key)
+long find_var_wrapper(
+    void *arg1,
+    char *key)
 {
-   return find_var((image_desc_t *) arg1, key);
+    return find_var((image_desc_t *) arg1, key);
 }
 
 /* find gdes containing var*/
-long
-find_var(image_desc_t *im, char *key){
-    long ii;
-    for(ii=0;ii<im->gdes_c-1;ii++){
-        if((im->gdes[ii].gf == GF_DEF 
-            || im->gdes[ii].gf == GF_VDEF
-            || im->gdes[ii].gf == GF_CDEF) 
-           && (strcmp(im->gdes[ii].vname,key) == 0)){
-            return ii; 
-        }           
-    }                        
+long find_var(
+    image_desc_t * im,
+    char *key)
+{
+    long      ii;
+
+    for (ii = 0; ii < im->gdes_c - 1; ii++) {
+        if ((im->gdes[ii].gf == GF_DEF
+             || im->gdes[ii].gf == GF_VDEF || im->gdes[ii].gf == GF_CDEF)
+            && (strcmp(im->gdes[ii].vname, key) == 0)) {
+            return ii;
+        }
+    }
     return -1;
 }
 
 /* find the largest common denominator for all the numbers
    in the 0 terminated num array */
-long
-lcd(long *num){
-    long rest;
-    int i;
-    for (i=0;num[i+1]!=0;i++){
-        do { 
-            rest=num[i] % num[i+1];
-            num[i]=num[i+1]; num[i+1]=rest;
-        } while (rest!=0);
-        num[i+1] = num[i];
+long lcd(
+    long *num)
+{
+    long      rest;
+    int       i;
+
+    for (i = 0; num[i + 1] != 0; i++) {
+        do {
+            rest = num[i] % num[i + 1];
+            num[i] = num[i + 1];
+            num[i + 1] = rest;
+        } while (rest != 0);
+        num[i + 1] = num[i];
     }
 /*    return i==0?num[i]:num[i-1]; */
-      return num[i];
+    return num[i];
 }
 
 /* run the rpn calculator on all the VDEF and CDEF arguments */
-int
-data_calc( image_desc_t *im){
+int data_calc(
+    image_desc_t * im)
+{
 
     int       gdi;
     int       dataidx;
-    long      *steparray, rpi;
+    long     *steparray, rpi;
     int       stepcnt;
     time_t    now;
     rpnstack_t rpnstack;
 
     rpnstack_init(&rpnstack);
 
-    for (gdi=0;gdi<im->gdes_c;gdi++){
+    for (gdi = 0; gdi < im->gdes_c; gdi++) {
         /* Look for GF_VDEF and GF_CDEF in the same loop,
          * so CDEFs can use VDEFs and vice versa
          */
         switch (im->gdes[gdi].gf) {
-            case GF_XPORT:
-              break;
-            case GF_SHIFT: {
-                graph_desc_t        *vdp = &im->gdes[im->gdes[gdi].vidx];
-                
-                /* remove current shift */
-                vdp->start -= vdp->shift;
-                vdp->end -= vdp->shift;
-                
-                /* vdef */
-                if (im->gdes[gdi].shidx >= 0) 
-                        vdp->shift = im->gdes[im->gdes[gdi].shidx].vf.val;
-                /* constant */
-                else
-                        vdp->shift = im->gdes[gdi].shval;
+        case GF_XPORT:
+            break;
+        case GF_SHIFT:{
+            graph_desc_t *vdp = &im->gdes[im->gdes[gdi].vidx];
 
-                /* normalize shift to multiple of consolidated step */
-                vdp->shift = (vdp->shift / (long)vdp->step) * (long)vdp->step;
+            /* remove current shift */
+            vdp->start -= vdp->shift;
+            vdp->end -= vdp->shift;
 
-                /* apply shift */
-                vdp->start += vdp->shift;
-                vdp->end += vdp->shift;
-                break;
+            /* vdef */
+            if (im->gdes[gdi].shidx >= 0)
+                vdp->shift = im->gdes[im->gdes[gdi].shidx].vf.val;
+            /* constant */
+            else
+                vdp->shift = im->gdes[gdi].shval;
+
+            /* normalize shift to multiple of consolidated step */
+            vdp->shift = (vdp->shift / (long) vdp->step) * (long) vdp->step;
+
+            /* apply shift */
+            vdp->start += vdp->shift;
+            vdp->end += vdp->shift;
+            break;
+        }
+        case GF_VDEF:
+            /* A VDEF has no DS.  This also signals other parts
+             * of rrdtool that this is a VDEF value, not a CDEF.
+             */
+            im->gdes[gdi].ds_cnt = 0;
+            if (vdef_calc(im, gdi)) {
+                rrd_set_error("Error processing VDEF '%s'",
+                              im->gdes[gdi].vname);
+                rpnstack_free(&rpnstack);
+                return -1;
             }
-            case GF_VDEF:
-                /* A VDEF has no DS.  This also signals other parts
-                 * of rrdtool that this is a VDEF value, not a CDEF.
-                 */
-                im->gdes[gdi].ds_cnt = 0;
-                if (vdef_calc(im,gdi)) {
-                    rrd_set_error("Error processing VDEF '%s'"
-                        ,im->gdes[gdi].vname
-                        );
-                    rpnstack_free(&rpnstack);
-                    return -1;
-                }
-                break;
-            case GF_CDEF:
-                im->gdes[gdi].ds_cnt = 1;
-                im->gdes[gdi].ds = 0;
-                im->gdes[gdi].data_first = 1;
-                im->gdes[gdi].start = 0;
-                im->gdes[gdi].end = 0;
-                steparray=NULL;
-                stepcnt = 0;
-                dataidx=-1;
-
-                /* Find the variables in the expression.
-                 * - VDEF variables are substituted by their values
-                 *   and the opcode is changed into OP_NUMBER.
-                 * - CDEF variables are analized for their step size,
-                 *   the lowest common denominator of all the step
-                 *   sizes of the data sources involved is calculated
-                 *   and the resulting number is the step size for the
-                 *   resulting data source.
-                 */
-                for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
-                    if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE  ||
-                        im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
-                        long ptr = im->gdes[gdi].rpnp[rpi].ptr;
-                        if (im->gdes[ptr].ds_cnt == 0) { /* this is a VDEF data source */
+            break;
+        case GF_CDEF:
+            im->gdes[gdi].ds_cnt = 1;
+            im->gdes[gdi].ds = 0;
+            im->gdes[gdi].data_first = 1;
+            im->gdes[gdi].start = 0;
+            im->gdes[gdi].end = 0;
+            steparray = NULL;
+            stepcnt = 0;
+            dataidx = -1;
+
+            /* Find the variables in the expression.
+             * - VDEF variables are substituted by their values
+             *   and the opcode is changed into OP_NUMBER.
+             * - CDEF variables are analized for their step size,
+             *   the lowest common denominator of all the step
+             *   sizes of the data sources involved is calculated
+             *   and the resulting number is the step size for the
+             *   resulting data source.
+             */
+            for (rpi = 0; im->gdes[gdi].rpnp[rpi].op != OP_END; rpi++) {
+                if (im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
+                    im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER) {
+                    long      ptr = im->gdes[gdi].rpnp[rpi].ptr;
+
+                    if (im->gdes[ptr].ds_cnt == 0) {    /* this is a VDEF data source */
 #if 0
-                            printf("DEBUG: inside CDEF '%s' processing VDEF '%s'\n",
-                               im->gdes[gdi].vname,
-                               im->gdes[ptr].vname);
-                            printf("DEBUG: value from vdef is %f\n",im->gdes[ptr].vf.val);
+                        printf
+                            ("DEBUG: inside CDEF '%s' processing VDEF '%s'\n",
+                             im->gdes[gdi].vname, im->gdes[ptr].vname);
+                        printf("DEBUG: value from vdef is %f\n",
+                               im->gdes[ptr].vf.val);
 #endif
-                            im->gdes[gdi].rpnp[rpi].val = im->gdes[ptr].vf.val;
-                            im->gdes[gdi].rpnp[rpi].op  = OP_NUMBER;
-                        } else { /* normal variables and PREF(variables) */
-
-                            /* add one entry to the array that keeps track of the step sizes of the
-                             * data sources going into the CDEF. */
-                            if ((steparray =
-                                 rrd_realloc(steparray,
-                                                         (++stepcnt+1)*sizeof(*steparray)))==NULL){
-                                  rrd_set_error("realloc steparray");
-                                  rpnstack_free(&rpnstack);
-                                 return -1;
-                            };
+                        im->gdes[gdi].rpnp[rpi].val = im->gdes[ptr].vf.val;
+                        im->gdes[gdi].rpnp[rpi].op = OP_NUMBER;
+                    } else {    /* normal variables and PREF(variables) */
+
+                        /* add one entry to the array that keeps track of the step sizes of the
+                         * data sources going into the CDEF. */
+                        if ((steparray =
+                             rrd_realloc(steparray,
+                                         (++stepcnt +
+                                          1) * sizeof(*steparray))) == NULL) {
+                            rrd_set_error("realloc steparray");
+                            rpnstack_free(&rpnstack);
+                            return -1;
+                        };
+
+                        steparray[stepcnt - 1] = im->gdes[ptr].step;
+
+                        /* adjust start and end of cdef (gdi) so
+                         * that it runs from the latest start point
+                         * to the earliest endpoint of any of the
+                         * rras involved (ptr)
+                         */
 
-                            steparray[stepcnt-1] = im->gdes[ptr].step;
-
-                            /* adjust start and end of cdef (gdi) so
-                             * that it runs from the latest start point
-                             * to the earliest endpoint of any of the
-                             * rras involved (ptr)
-                             */
-
-                            if(im->gdes[gdi].start < im->gdes[ptr].start)
-                                im->gdes[gdi].start = im->gdes[ptr].start;
-
-                            if(im->gdes[gdi].end == 0 ||
-                                        im->gdes[gdi].end > im->gdes[ptr].end)
-                                im->gdes[gdi].end = im->gdes[ptr].end;
-                
-                            /* store pointer to the first element of
-                             * the rra providing data for variable,
-                             * further save step size and data source
-                             * count of this rra
-                             */ 
-                            im->gdes[gdi].rpnp[rpi].data   = im->gdes[ptr].data + im->gdes[ptr].ds;
-                            im->gdes[gdi].rpnp[rpi].step   = im->gdes[ptr].step;
-                            im->gdes[gdi].rpnp[rpi].ds_cnt = im->gdes[ptr].ds_cnt;
-
-                            /* backoff the *.data ptr; this is done so
-                             * rpncalc() function doesn't have to treat
-                             * the first case differently
-                             */
-                        } /* if ds_cnt != 0 */
-                    } /* if OP_VARIABLE */
-                } /* loop through all rpi */
-
-                /* move the data pointers to the correct period */
-                for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){
-                    if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
-                        im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER){
-                        long ptr  = im->gdes[gdi].rpnp[rpi].ptr;
-                        long diff = im->gdes[gdi].start - im->gdes[ptr].start;
-
-                        if(diff > 0)
-                            im->gdes[gdi].rpnp[rpi].data += (diff / im->gdes[ptr].step) * im->gdes[ptr].ds_cnt;
-                     }
-                }
+                        if (im->gdes[gdi].start < im->gdes[ptr].start)
+                            im->gdes[gdi].start = im->gdes[ptr].start;
 
-                if(steparray == NULL){
-                    rrd_set_error("rpn expressions without DEF"
-                                " or CDEF variables are not supported");
-                    rpnstack_free(&rpnstack);
-                    return -1;    
+                        if (im->gdes[gdi].end == 0 ||
+                            im->gdes[gdi].end > im->gdes[ptr].end)
+                            im->gdes[gdi].end = im->gdes[ptr].end;
+
+                        /* store pointer to the first element of
+                         * the rra providing data for variable,
+                         * further save step size and data source
+                         * count of this rra
+                         */
+                        im->gdes[gdi].rpnp[rpi].data =
+                            im->gdes[ptr].data + im->gdes[ptr].ds;
+                        im->gdes[gdi].rpnp[rpi].step = im->gdes[ptr].step;
+                        im->gdes[gdi].rpnp[rpi].ds_cnt = im->gdes[ptr].ds_cnt;
+
+                        /* backoff the *.data ptr; this is done so
+                         * rpncalc() function doesn't have to treat
+                         * the first case differently
+                         */
+                    }   /* if ds_cnt != 0 */
+                }       /* if OP_VARIABLE */
+            }           /* loop through all rpi */
+
+            /* move the data pointers to the correct period */
+            for (rpi = 0; im->gdes[gdi].rpnp[rpi].op != OP_END; rpi++) {
+                if (im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE ||
+                    im->gdes[gdi].rpnp[rpi].op == OP_PREV_OTHER) {
+                    long      ptr = im->gdes[gdi].rpnp[rpi].ptr;
+                    long      diff =
+                        im->gdes[gdi].start - im->gdes[ptr].start;
+
+                    if (diff > 0)
+                        im->gdes[gdi].rpnp[rpi].data +=
+                            (diff / im->gdes[ptr].step) *
+                            im->gdes[ptr].ds_cnt;
                 }
-                steparray[stepcnt]=0;
-                /* Now find the resulting step.  All steps in all
-                 * used RRAs have to be visited
+            }
+
+            if (steparray == NULL) {
+                rrd_set_error("rpn expressions without DEF"
+                              " or CDEF variables are not supported");
+                rpnstack_free(&rpnstack);
+                return -1;
+            }
+            steparray[stepcnt] = 0;
+            /* Now find the resulting step.  All steps in all
+             * used RRAs have to be visited
+             */
+            im->gdes[gdi].step = lcd(steparray);
+            free(steparray);
+            if ((im->gdes[gdi].data = malloc(((im->gdes[gdi].end -
+                                               im->gdes[gdi].start)
+                                              / im->gdes[gdi].step)
+                                             * sizeof(double))) == NULL) {
+                rrd_set_error("malloc im->gdes[gdi].data");
+                rpnstack_free(&rpnstack);
+                return -1;
+            }
+
+            /* Step through the new cdef results array and
+             * calculate the values
+             */
+            for (now = im->gdes[gdi].start + im->gdes[gdi].step;
+                 now <= im->gdes[gdi].end; now += im->gdes[gdi].step) {
+                rpnp_t   *rpnp = im->gdes[gdi].rpnp;
+
+                /* 3rd arg of rpn_calc is for OP_VARIABLE lookups;
+                 * in this case we are advancing by timesteps;
+                 * we use the fact that time_t is a synonym for long
                  */
-                im->gdes[gdi].step = lcd(steparray);
-                free(steparray);
-                if((im->gdes[gdi].data = malloc((
-                                (im->gdes[gdi].end-im->gdes[gdi].start) 
-                                    / im->gdes[gdi].step)
-                                    * sizeof(double)))==NULL){
-                    rrd_set_error("malloc im->gdes[gdi].data");
+                if (rpn_calc(rpnp, &rpnstack, (long) now,
+                             im->gdes[gdi].data, ++dataidx) == -1) {
+                    /* rpn_calc sets the error string */
                     rpnstack_free(&rpnstack);
                     return -1;
                 }
-        
-                /* Step through the new cdef results array and
-                 * calculate the values
-                 */
-                for (now = im->gdes[gdi].start + im->gdes[gdi].step;
-                                now<=im->gdes[gdi].end;
-                                now += im->gdes[gdi].step)
-                {
-                    rpnp_t  *rpnp = im -> gdes[gdi].rpnp;
-
-                    /* 3rd arg of rpn_calc is for OP_VARIABLE lookups;
-                     * in this case we are advancing by timesteps;
-                     * we use the fact that time_t is a synonym for long
-                     */
-                    if (rpn_calc(rpnp,&rpnstack,(long) now, 
-                                im->gdes[gdi].data,++dataidx) == -1) {
-                        /* rpn_calc sets the error string */
-                        rpnstack_free(&rpnstack); 
-                        return -1;
-                    } 
-                } /* enumerate over time steps within a CDEF */
-                break;
-            default:
-                continue;
+            }           /* enumerate over time steps within a CDEF */
+            break;
+        default:
+            continue;
         }
-    } /* enumerate over CDEFs */
+    }                   /* enumerate over CDEFs */
     rpnstack_free(&rpnstack);
     return 0;
 }
 
 /* massage data so, that we get one value for each x coordinate in the graph */
-int
-data_proc( image_desc_t *im ){
-    long i,ii;
-    double pixstep = (double)(im->end-im->start)
-        /(double)im->xsize; /* how much time 
-                               passes in one pixel */
-    double paintval;
-    double minval=DNAN,maxval=DNAN;
-    
-    unsigned long gr_time;    
+int data_proc(
+    image_desc_t * im)
+{
+    long      i, ii;
+    double    pixstep = (double) (im->end - im->start)
+        / (double) im->xsize;   /* how much time 
+                                   passes in one pixel */
+    double    paintval;
+    double    minval = DNAN, maxval = DNAN;
+
+    unsigned long gr_time;
 
     /* memory for the processed data */
-    for(i=0;i<im->gdes_c;i++) {
-        if((im->gdes[i].gf==GF_LINE) ||
-                (im->gdes[i].gf==GF_AREA) ||
-                (im->gdes[i].gf==GF_TICK)) {
-            if((im->gdes[i].p_data = malloc((im->xsize +1)
-                                        * sizeof(rrd_value_t)))==NULL){
+    for (i = 0; i < im->gdes_c; i++) {
+        if ((im->gdes[i].gf == GF_LINE) ||
+            (im->gdes[i].gf == GF_AREA) || (im->gdes[i].gf == GF_TICK)) {
+            if ((im->gdes[i].p_data = malloc((im->xsize + 1)
+                                             * sizeof(rrd_value_t))) == NULL) {
                 rrd_set_error("malloc data_proc");
                 return -1;
             }
         }
     }
 
-    for (i=0;i<im->xsize;i++) {        /* for each pixel */
-        long vidx;
-        gr_time = im->start+pixstep*i; /* time of the current step */
-        paintval=0.0;
-        
-        for (ii=0;ii<im->gdes_c;ii++) {
-            double value;
+    for (i = 0; i < im->xsize; i++) {   /* for each pixel */
+        long      vidx;
+
+        gr_time = im->start + pixstep * i;  /* time of the current step */
+        paintval = 0.0;
+
+        for (ii = 0; ii < im->gdes_c; ii++) {
+            double    value;
+
             switch (im->gdes[ii].gf) {
-                case GF_LINE:
-                case GF_AREA:
-                case GF_TICK:
-                    if (!im->gdes[ii].stack)
-                        paintval = 0.0;
-                    value = im->gdes[ii].yrule;
-                    if (isnan(value) || (im->gdes[ii].gf == GF_TICK)) {
-                        /* The time of the data doesn't necessarily match
-                        ** the time of the graph. Beware.
-                        */
-                        vidx = im->gdes[ii].vidx;
-                        if (im->gdes[vidx].gf == GF_VDEF) {
-                            value = im->gdes[vidx].vf.val;
-                        } else if (((long int)gr_time >= (long int)im->gdes[vidx].start) &&
-                                   ((long int)gr_time <= (long int)im->gdes[vidx].end) ) {
-                            value = im->gdes[vidx].data[
-                                (unsigned long) floor(
-                                    (double)(gr_time - im->gdes[vidx].start)
-                                                / im->gdes[vidx].step)
-                                * im->gdes[vidx].ds_cnt
-                                + im->gdes[vidx].ds
-                            ];
-                        } else {
-                            value = DNAN;
-                        }
-                    };
-
-                    if (! isnan(value)) {
-                        paintval += value;
-                        im->gdes[ii].p_data[i] = paintval;
-                        /* GF_TICK: the data values are not
-                        ** relevant for min and max
-                        */
-                        if (finite(paintval) && im->gdes[ii].gf != GF_TICK ) {
-                            if ((isnan(minval) || paintval <  minval ) &&
-                              ! (im->logarithmic && paintval <= 0.0)) 
-                                        minval = paintval;
-                            if (isnan(maxval) || paintval >  maxval)
-                                maxval = paintval;
-                        }
+            case GF_LINE:
+            case GF_AREA:
+            case GF_TICK:
+                if (!im->gdes[ii].stack)
+                    paintval = 0.0;
+                value = im->gdes[ii].yrule;
+                if (isnan(value) || (im->gdes[ii].gf == GF_TICK)) {
+                    /* The time of the data doesn't necessarily match
+                     ** the time of the graph. Beware.
+                     */
+                    vidx = im->gdes[ii].vidx;
+                    if (im->gdes[vidx].gf == GF_VDEF) {
+                        value = im->gdes[vidx].vf.val;
+                    } else
+                        if (((long int) gr_time >=
+                             (long int) im->gdes[vidx].start)
+                            && ((long int) gr_time <=
+                                (long int) im->gdes[vidx].end)) {
+                        value = im->gdes[vidx].data[(unsigned long)
+                                                    floor((double)
+                                                          (gr_time -
+                                                           im->gdes[vidx].
+                                                           start)
+                                                          /
+                                                          im->gdes[vidx].step)
+                                                    * im->gdes[vidx].ds_cnt +
+                                                    im->gdes[vidx].ds];
                     } else {
-                        im->gdes[ii].p_data[i] = DNAN;
+                        value = DNAN;
                     }
-                    break;
-                case GF_STACK:
-                    rrd_set_error("STACK should already be turned into LINE or AREA here");
-                    return -1;
-                    break;
-                default:
-                    break;
+                };
+
+                if (!isnan(value)) {
+                    paintval += value;
+                    im->gdes[ii].p_data[i] = paintval;
+                    /* GF_TICK: the data values are not
+                     ** relevant for min and max
+                     */
+                    if (finite(paintval) && im->gdes[ii].gf != GF_TICK) {
+                        if ((isnan(minval) || paintval < minval) &&
+                            !(im->logarithmic && paintval <= 0.0))
+                            minval = paintval;
+                        if (isnan(maxval) || paintval > maxval)
+                            maxval = paintval;
+                    }
+                } else {
+                    im->gdes[ii].p_data[i] = DNAN;
+                }
+                break;
+            case GF_STACK:
+                rrd_set_error
+                    ("STACK should already be turned into LINE or AREA here");
+                return -1;
+                break;
+            default:
+                break;
             }
         }
     }
@@ -1099,17 +1200,20 @@ data_proc( image_desc_t *im ){
        lets set these to dummy values then ... */
 
     if (im->logarithmic) {
-        if (isnan(minval)) minval = 0.2;
-        if (isnan(maxval)) maxval = 5.1;
-    }
-    else {
-        if (isnan(minval)) minval = 0.0;
-        if (isnan(maxval)) maxval = 1.0;
+        if (isnan(minval))
+            minval = 0.2;
+        if (isnan(maxval))
+            maxval = 5.1;
+    } else {
+        if (isnan(minval))
+            minval = 0.0;
+        if (isnan(maxval))
+            maxval = 1.0;
     }
-    
+
     /* adjust min and max values */
-    if (isnan(im->minval) 
-        /* don't adjust low-end with log scale */ /* why not? */
+    if (isnan(im->minval)
+        /* don't adjust low-end with log scale *//* why not? */
         || ((!im->rigid) && im->minval > minval)
         ) {
         if (im->logarithmic)
@@ -1117,7 +1221,7 @@ data_proc( image_desc_t *im ){
         else
             im->minval = minval;
     }
-    if (isnan(im->maxval) 
+    if (isnan(im->maxval)
         || (!im->rigid && im->maxval < maxval)
         ) {
         if (im->logarithmic)
@@ -1127,13 +1231,13 @@ data_proc( image_desc_t *im ){
     }
     /* make sure min is smaller than max */
     if (im->minval > im->maxval) {
-            im->minval = 0.99 * im->maxval;
+        im->minval = 0.99 * im->maxval;
     }
-                      
+
     /* make sure min and max are not equal */
     if (im->minval == im->maxval) {
-        im->maxval *= 1.01; 
-        if (! im->logarithmic) {
+        im->maxval *= 1.01;
+        if (!im->logarithmic) {
             im->minval *= 0.99;
         }
         /* make sure min and max are not both zero */
@@ -1148,118 +1252,135 @@ data_proc( image_desc_t *im ){
 
 /* identify the point where the first gridline, label ... gets placed */
 
-time_t
-find_first_time(
-    time_t   start, /* what is the initial time */
-    enum tmt_en baseint,  /* what is the basic interval */
-    long     basestep /* how many if these do we jump a time */
+time_t find_first_time(
+    time_t start,       /* what is the initial time */
+    enum tmt_en baseint,    /* what is the basic interval */
+    long basestep       /* how many if these do we jump a time */
     )
 {
     struct tm tm;
+
     localtime_r(&start, &tm);
-    switch(baseint){
+    switch (baseint) {
     case TMT_SECOND:
-        tm.tm_sec -= tm.tm_sec % basestep; break;
-    case TMT_MINUTE: 
-        tm.tm_sec=0;
-        tm.tm_min -= tm.tm_min % basestep; 
+        tm.tm_sec -= tm.tm_sec % basestep;
+        break;
+    case TMT_MINUTE:
+        tm.tm_sec = 0;
+        tm.tm_min -= tm.tm_min % basestep;
         break;
     case TMT_HOUR:
-        tm.tm_sec=0;
+        tm.tm_sec = 0;
         tm.tm_min = 0;
-        tm.tm_hour -= tm.tm_hour % basestep; break;
+        tm.tm_hour -= tm.tm_hour % basestep;
+        break;
     case TMT_DAY:
         /* we do NOT look at the basestep for this ... */
-        tm.tm_sec=0;
+        tm.tm_sec = 0;
         tm.tm_min = 0;
-        tm.tm_hour = 0; break;
+        tm.tm_hour = 0;
+        break;
     case TMT_WEEK:
         /* we do NOT look at the basestep for this ... */
-        tm.tm_sec=0;
+        tm.tm_sec = 0;
         tm.tm_min = 0;
         tm.tm_hour = 0;
-        tm.tm_mday -= tm.tm_wday -1;        /* -1 because we want the monday */
-        if (tm.tm_wday==0) tm.tm_mday -= 7; /* we want the *previous* monday */
+        tm.tm_mday -= tm.tm_wday - 1;   /* -1 because we want the monday */
+        if (tm.tm_wday == 0)
+            tm.tm_mday -= 7;    /* we want the *previous* monday */
         break;
     case TMT_MONTH:
-        tm.tm_sec=0;
+        tm.tm_sec = 0;
         tm.tm_min = 0;
         tm.tm_hour = 0;
         tm.tm_mday = 1;
-        tm.tm_mon -= tm.tm_mon % basestep; break;
+        tm.tm_mon -= tm.tm_mon % basestep;
+        break;
 
     case TMT_YEAR:
-        tm.tm_sec=0;
+        tm.tm_sec = 0;
         tm.tm_min = 0;
         tm.tm_hour = 0;
         tm.tm_mday = 1;
         tm.tm_mon = 0;
-        tm.tm_year -= (tm.tm_year+1900) % basestep;
-        
+        tm.tm_year -= (tm.tm_year + 1900) % basestep;
+
     }
     return mktime(&tm);
 }
+
 /* identify the point where the next gridline, label ... gets placed */
-time_t 
-find_next_time(
-    time_t   current, /* what is the initial time */
-    enum tmt_en baseint,  /* what is the basic interval */
-    long     basestep /* how many if these do we jump a time */
+time_t find_next_time(
+    time_t current,     /* what is the initial time */
+    enum tmt_en baseint,    /* what is the basic interval */
+    long basestep       /* how many if these do we jump a time */
     )
 {
     struct tm tm;
-    time_t madetime;
+    time_t    madetime;
+
     localtime_r(&current, &tm);
     do {
-        switch(baseint){
+        switch (baseint) {
         case TMT_SECOND:
-            tm.tm_sec += basestep; break;
-        case TMT_MINUTE: 
-            tm.tm_min += basestep; break;
+            tm.tm_sec += basestep;
+            break;
+        case TMT_MINUTE:
+            tm.tm_min += basestep;
+            break;
         case TMT_HOUR:
-            tm.tm_hour += basestep; break;
+            tm.tm_hour += basestep;
+            break;
         case TMT_DAY:
-            tm.tm_mday += basestep; break;
+            tm.tm_mday += basestep;
+            break;
         case TMT_WEEK:
-            tm.tm_mday += 7*basestep; break;
+            tm.tm_mday += 7 * basestep;
+            break;
         case TMT_MONTH:
-            tm.tm_mon += basestep; break;
+            tm.tm_mon += basestep;
+            break;
         case TMT_YEAR:
-            tm.tm_year += basestep;        
+            tm.tm_year += basestep;
         }
         madetime = mktime(&tm);
-    } while (madetime == -1); /* this is necessary to skip impssible times
-                                 like the daylight saving time skips */
+    } while (madetime == -1);   /* this is necessary to skip impssible times
+                                   like the daylight saving time skips */
     return madetime;
-          
+
 }
 
 
 /* calculate values required for PRINT and GPRINT functions */
 
-int
-print_calc(image_desc_t *im, char ***prdata) 
+int print_calc(
+    image_desc_t * im,
+    char ***prdata)
 {
-    long i,ii,validsteps;
-    double printval;
+    long      i, ii, validsteps;
+    double    printval;
     struct tm tmvdef;
-    int graphelement = 0;
-    long vidx;
-    int max_ii;        
-    double magfact = -1;
-    char *si_symb = "";
-    char *percent_s;
-    int prlines = 1;
+    int       graphelement = 0;
+    long      vidx;
+    int       max_ii;
+    double    magfact = -1;
+    char     *si_symb = "";
+    char     *percent_s;
+    int       prlines = 1;
+
     /* wow initializing tmvdef is quite a task :-) */
-    time_t now = time(NULL);
-    localtime_r(&now,&tmvdef);
-    if (im->imginfo) prlines++;
-    for(i=0;i<im->gdes_c;i++){
-            vidx = im->gdes[i].vidx;
-        switch(im->gdes[i].gf){
+    time_t    now = time(NULL);
+
+    localtime_r(&now, &tmvdef);
+    if (im->imginfo)
+        prlines++;
+    for (i = 0; i < im->gdes_c; i++) {
+        vidx = im->gdes[i].vidx;
+        switch (im->gdes[i].gf) {
         case GF_PRINT:
             prlines++;
-            if(((*prdata) = rrd_realloc((*prdata),prlines*sizeof(char *)))==NULL){
+            if (((*prdata) =
+                 rrd_realloc((*prdata), prlines * sizeof(char *))) == NULL) {
                 rrd_set_error("realloc prdata");
                 return 0;
             }
@@ -1268,107 +1389,112 @@ print_calc(image_desc_t *im, char ***prdata)
              * There's no need to do any calculations on them as these
              * calculations were already made.
              */
-            if (im->gdes[vidx].gf==GF_VDEF) { /* simply use vals */
+            if (im->gdes[vidx].gf == GF_VDEF) { /* simply use vals */
                 printval = im->gdes[vidx].vf.val;
-                localtime_r(&im->gdes[vidx].vf.when,&tmvdef);
-            } else { /* need to calculate max,min,avg etcetera */
-                max_ii =((im->gdes[vidx].end 
-                        - im->gdes[vidx].start)
-                        / im->gdes[vidx].step
-                        * im->gdes[vidx].ds_cnt);
+                localtime_r(&im->gdes[vidx].vf.when, &tmvdef);
+            } else {    /* need to calculate max,min,avg etcetera */
+                max_ii = ((im->gdes[vidx].end - im->gdes[vidx].start)
+                          / im->gdes[vidx].step * im->gdes[vidx].ds_cnt);
                 printval = DNAN;
                 validsteps = 0;
-                for(        ii=im->gdes[vidx].ds;
-                        ii < max_ii;
-                        ii+=im->gdes[vidx].ds_cnt){
-                    if (! finite(im->gdes[vidx].data[ii]))
+                for (ii = im->gdes[vidx].ds;
+                     ii < max_ii; ii += im->gdes[vidx].ds_cnt) {
+                    if (!finite(im->gdes[vidx].data[ii]))
                         continue;
-                    if (isnan(printval)){
+                    if (isnan(printval)) {
                         printval = im->gdes[vidx].data[ii];
                         validsteps++;
                         continue;
                     }
 
-                    switch (im->gdes[i].cf){
-                        case CF_HWPREDICT:
-                        case CF_DEVPREDICT:
-                        case CF_DEVSEASONAL:
-                        case CF_SEASONAL:
-                        case CF_AVERAGE:
-                            validsteps++;
-                            printval += im->gdes[vidx].data[ii];
-                            break;
-                        case CF_MINIMUM:
-                            printval = min( printval, im->gdes[vidx].data[ii]);
-                            break;
-                        case CF_FAILURES:
-                        case CF_MAXIMUM:
-                            printval = max( printval, im->gdes[vidx].data[ii]);
-                            break;
-                        case CF_LAST:
-                            printval = im->gdes[vidx].data[ii];
+                    switch (im->gdes[i].cf) {
+                    case CF_HWPREDICT:
+                    case CF_DEVPREDICT:
+                    case CF_DEVSEASONAL:
+                    case CF_SEASONAL:
+                    case CF_AVERAGE:
+                        validsteps++;
+                        printval += im->gdes[vidx].data[ii];
+                        break;
+                    case CF_MINIMUM:
+                        printval = min(printval, im->gdes[vidx].data[ii]);
+                        break;
+                    case CF_FAILURES:
+                    case CF_MAXIMUM:
+                        printval = max(printval, im->gdes[vidx].data[ii]);
+                        break;
+                    case CF_LAST:
+                        printval = im->gdes[vidx].data[ii];
                     }
                 }
-                if (im->gdes[i].cf==CF_AVERAGE || im->gdes[i].cf > CF_LAST) {
+                if (im->gdes[i].cf == CF_AVERAGE || im->gdes[i].cf > CF_LAST) {
                     if (validsteps > 1) {
                         printval = (printval / validsteps);
                     }
                 }
-            } /* prepare printval */
+            }           /* prepare printval */
 
-            if ((percent_s = strstr(im->gdes[i].format,"%S")) != NULL) {
+            if ((percent_s = strstr(im->gdes[i].format, "%S")) != NULL) {
                 /* Magfact is set to -1 upon entry to print_calc.  If it
                  * is still less than 0, then we need to run auto_scale.
                  * Otherwise, put the value into the correct units.  If
                  * the value is 0, then do not set the symbol or magnification
                  * so next the calculation will be performed again. */
                 if (magfact < 0.0) {
-                    auto_scale(im,&printval,&si_symb,&magfact);
+                    auto_scale(im, &printval, &si_symb, &magfact);
                     if (printval == 0.0)
                         magfact = -1.0;
                 } else {
                     printval /= magfact;
                 }
                 *(++percent_s) = 's';
-            } else if (strstr(im->gdes[i].format,"%s") != NULL) {
-                auto_scale(im,&printval,&si_symb,&magfact);
+            } else if (strstr(im->gdes[i].format, "%s") != NULL) {
+                auto_scale(im, &printval, &si_symb, &magfact);
             }
 
-            if (im->gdes[i].gf == GF_PRINT){
-                (*prdata)[prlines-2] = malloc((FMT_LEG_LEN+2)*sizeof(char));
-                (*prdata)[prlines-1] = NULL;
-                if (im->gdes[i].strftm){
-                        strftime((*prdata)[prlines-2],FMT_LEG_LEN,im->gdes[i].format,&tmvdef);
+            if (im->gdes[i].gf == GF_PRINT) {
+                (*prdata)[prlines - 2] =
+                    malloc((FMT_LEG_LEN + 2) * sizeof(char));
+                (*prdata)[prlines - 1] = NULL;
+                if (im->gdes[i].strftm) {
+                    strftime((*prdata)[prlines - 2], FMT_LEG_LEN,
+                             im->gdes[i].format, &tmvdef);
                 } else {
-                     if (bad_format(im->gdes[i].format)) {
-                          rrd_set_error("bad format for PRINT in '%s'", im->gdes[i].format);
+                    if (bad_format(im->gdes[i].format)) {
+                        rrd_set_error("bad format for PRINT in '%s'",
+                                      im->gdes[i].format);
                         return -1;
-                  }
-
+                    }
 #ifdef HAVE_SNPRINTF
-                  snprintf((*prdata)[prlines-2],FMT_LEG_LEN,im->gdes[i].format,printval,si_symb);
+                    snprintf((*prdata)[prlines - 2], FMT_LEG_LEN,
+                             im->gdes[i].format, printval, si_symb);
 #else
-                  sprintf((*prdata)[prlines-2],im->gdes[i].format,printval,si_symb);
+                    sprintf((*prdata)[prlines - 2], im->gdes[i].format,
+                            printval, si_symb);
 #endif
-               }
-             } else {
+                }
+            } else {
                 /* GF_GPRINT */
 
-                if (im->gdes[i].strftm){
-                        strftime(im->gdes[i].legend,FMT_LEG_LEN,im->gdes[i].format,&tmvdef);
+                if (im->gdes[i].strftm) {
+                    strftime(im->gdes[i].legend, FMT_LEG_LEN,
+                             im->gdes[i].format, &tmvdef);
                 } else {
                     if (bad_format(im->gdes[i].format)) {
-                        rrd_set_error("bad format for GPRINT in '%s'", im->gdes[i].format);
+                        rrd_set_error("bad format for GPRINT in '%s'",
+                                      im->gdes[i].format);
                         return -1;
-                  }
+                    }
 #ifdef HAVE_SNPRINTF
-                  snprintf(im->gdes[i].legend,FMT_LEG_LEN-2,im->gdes[i].format,printval,si_symb);
+                    snprintf(im->gdes[i].legend, FMT_LEG_LEN - 2,
+                             im->gdes[i].format, printval, si_symb);
 #else
-                  sprintf(im->gdes[i].legend,im->gdes[i].format,printval,si_symb);
+                    sprintf(im->gdes[i].legend, im->gdes[i].format, printval,
+                            si_symb);
 #endif
                 }
-                graphelement = 1;               
-            }            
+                graphelement = 1;
+            }
             break;
         case GF_LINE:
         case GF_AREA:
@@ -1376,21 +1502,21 @@ print_calc(image_desc_t *im, char ***prdata)
             graphelement = 1;
             break;
         case GF_HRULE:
-            if(isnan(im->gdes[i].yrule)) { /* we must set this here or the legend printer can not decide to print the legend */
-               im->gdes[i].yrule=im->gdes[vidx].vf.val;
+            if (isnan(im->gdes[i].yrule)) { /* we must set this here or the legend printer can not decide to print the legend */
+                im->gdes[i].yrule = im->gdes[vidx].vf.val;
             };
             graphelement = 1;
             break;
         case GF_VRULE:
-            if(im->gdes[i].xrule == 0) { /* again ... the legend printer needs it*/
-              im->gdes[i].xrule = im->gdes[vidx].vf.when;
+            if (im->gdes[i].xrule == 0) {   /* again ... the legend printer needs it */
+                im->gdes[i].xrule = im->gdes[vidx].vf.when;
             };
             graphelement = 1;
             break;
         case GF_COMMENT:
         case GF_DEF:
-        case GF_CDEF:            
-        case GF_VDEF:            
+        case GF_CDEF:
+        case GF_VDEF:
 #ifdef WITH_PIECHART
         case GF_PART:
 #endif
@@ -1398,7 +1524,8 @@ print_calc(image_desc_t *im, char ***prdata)
         case GF_XPORT:
             break;
         case GF_STACK:
-            rrd_set_error("STACK should already be turned into LINE or AREA here");
+            rrd_set_error
+                ("STACK should already be turned into LINE or AREA here");
             return -1;
             break;
         }
@@ -1408,245 +1535,265 @@ print_calc(image_desc_t *im, char ***prdata)
 
 
 /* place legends with color spots */
-int
-leg_place(image_desc_t *im)
+int leg_place(
+    image_desc_t * im)
 {
     /* graph labels */
-    int   interleg = im->text_prop[TEXT_PROP_LEGEND].size*2.0;
-    int   border = im->text_prop[TEXT_PROP_LEGEND].size*2.0;
-    int   fill=0, fill_last;
-    int   leg_c = 0;
-    int   leg_x = border, leg_y = im->yimg;
-    int   leg_y_prev = im->yimg;
-    int   leg_cc;
-    int   glue = 0;
-    int   i,ii, mark = 0;
-    char  prt_fctn; /*special printfunctions */
-    int  *legspace;
-
-  if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
-    if ((legspace = malloc(im->gdes_c*sizeof(int)))==NULL){
-       rrd_set_error("malloc for legspace");
-       return -1;
-    }
-
-    for(i=0;i<im->gdes_c;i++){
-        fill_last = fill;
-        
-        /* hid legends for rules which are not displayed */
-        
-        if(!(im->extra_flags & FORCE_RULES_LEGEND)) {
+    int       interleg = im->text_prop[TEXT_PROP_LEGEND].size * 2.0;
+    int       border = im->text_prop[TEXT_PROP_LEGEND].size * 2.0;
+    int       fill = 0, fill_last;
+    int       leg_c = 0;
+    int       leg_x = border, leg_y = im->yimg;
+    int       leg_y_prev = im->yimg;
+    int       leg_cc;
+    int       glue = 0;
+    int       i, ii, mark = 0;
+    char      prt_fctn; /*special printfunctions */
+    int      *legspace;
+
+    if (!(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH)) {
+        if ((legspace = malloc(im->gdes_c * sizeof(int))) == NULL) {
+            rrd_set_error("malloc for legspace");
+            return -1;
+        }
+
+        for (i = 0; i < im->gdes_c; i++) {
+            fill_last = fill;
+
+            /* hid legends for rules which are not displayed */
+
+            if (!(im->extra_flags & FORCE_RULES_LEGEND)) {
                 if (im->gdes[i].gf == GF_HRULE &&
-                    (im->gdes[i].yrule < im->minval || im->gdes[i].yrule > im->maxval))
+                    (im->gdes[i].yrule < im->minval
+                     || im->gdes[i].yrule > im->maxval))
                     im->gdes[i].legend[0] = '\0';
 
                 if (im->gdes[i].gf == GF_VRULE &&
-                    (im->gdes[i].xrule < im->start || im->gdes[i].xrule > im->end))
+                    (im->gdes[i].xrule < im->start
+                     || im->gdes[i].xrule > im->end))
                     im->gdes[i].legend[0] = '\0';
-        }
+            }
 
-        leg_cc = strlen(im->gdes[i].legend);
-        
-        /* is there a controle code ant the end of the legend string ? */ 
-        /* and it is not a tab \\t */
-        if (leg_cc >= 2 && im->gdes[i].legend[leg_cc-2] == '\\' && im->gdes[i].legend[leg_cc-1] != 't') {
-            prt_fctn = im->gdes[i].legend[leg_cc-1];
-            leg_cc -= 2;
-            im->gdes[i].legend[leg_cc] = '\0';
-        } else {
-            prt_fctn = '\0';
-        }
-        /* only valid control codes */
-        if (prt_fctn != 'l' && 
-            prt_fctn != 'n' && /* a synonym for l */
-            prt_fctn != 'r' &&
-            prt_fctn != 'j' &&
-            prt_fctn != 'c' &&
-            prt_fctn != 's' &&
-            prt_fctn != 't' &&
-            prt_fctn != '\0' &&
-            prt_fctn != 'g' ) {
-               free(legspace);
-               rrd_set_error("Unknown control code at the end of '%s\\%c'",im->gdes[i].legend,prt_fctn);
-                      return -1;
+            leg_cc = strlen(im->gdes[i].legend);
 
-        }
+            /* is there a controle code ant the end of the legend string ? */
+            /* and it is not a tab \\t */
+            if (leg_cc >= 2 && im->gdes[i].legend[leg_cc - 2] == '\\'
+                && im->gdes[i].legend[leg_cc - 1] != 't') {
+                prt_fctn = im->gdes[i].legend[leg_cc - 1];
+                leg_cc -= 2;
+                im->gdes[i].legend[leg_cc] = '\0';
+            } else {
+                prt_fctn = '\0';
+            }
+            /* only valid control codes */
+            if (prt_fctn != 'l' && prt_fctn != 'n' &&   /* a synonym for l */
+                prt_fctn != 'r' &&
+                prt_fctn != 'j' &&
+                prt_fctn != 'c' &&
+                prt_fctn != 's' &&
+                prt_fctn != 't' && prt_fctn != '\0' && prt_fctn != 'g') {
+                free(legspace);
+                rrd_set_error("Unknown control code at the end of '%s\\%c'",
+                              im->gdes[i].legend, prt_fctn);
+                return -1;
 
-        /* remove exess space */
-        if ( prt_fctn == 'n' ){
-            prt_fctn='l';
-        }
+            }
 
-        while (prt_fctn=='g' && 
-               leg_cc > 0 && 
-               im->gdes[i].legend[leg_cc-1]==' '){
-           leg_cc--;
-           im->gdes[i].legend[leg_cc]='\0';
-        }
-        if (leg_cc != 0 ){
-           legspace[i]=(prt_fctn=='g' ? 0 : interleg);
-           
-           if (fill > 0){ 
-                /* no interleg space if string ends in \g */
-               fill += legspace[i];
+            /* remove exess space */
+            if (prt_fctn == 'n') {
+                prt_fctn = 'l';
             }
-           fill += gfx_get_text_width(im->canvas, fill+border,
-                                      im->text_prop[TEXT_PROP_LEGEND].font,
-                                      im->text_prop[TEXT_PROP_LEGEND].size,
-                                      im->tabwidth,
-                                      im->gdes[i].legend, 0);
-            leg_c++;
-        } else {
-           legspace[i]=0;
-        }
-        /* who said there was a special tag ... ?*/
-        if (prt_fctn=='g') {    
-           prt_fctn = '\0';
-        }
-        if (prt_fctn == '\0') {
-            if (i == im->gdes_c -1 ) prt_fctn ='l';
-            
-            /* is it time to place the legends ? */
-            if (fill > im->ximg - 2*border){
-                if (leg_c > 1) {
-                    /* go back one */
-                    i--; 
-                    fill = fill_last;
-                    leg_c--;
-                    prt_fctn = 'j';
-                } else {
-                    prt_fctn = 'l';
+
+            while (prt_fctn == 'g' &&
+                   leg_cc > 0 && im->gdes[i].legend[leg_cc - 1] == ' ') {
+                leg_cc--;
+                im->gdes[i].legend[leg_cc] = '\0';
+            }
+            if (leg_cc != 0) {
+                legspace[i] = (prt_fctn == 'g' ? 0 : interleg);
+
+                if (fill > 0) {
+                    /* no interleg space if string ends in \g */
+                    fill += legspace[i];
                 }
-                
+                fill += gfx_get_text_width(im->canvas, fill + border,
+                                           im->text_prop[TEXT_PROP_LEGEND].
+                                           font,
+                                           im->text_prop[TEXT_PROP_LEGEND].
+                                           size, im->tabwidth,
+                                           im->gdes[i].legend, 0);
+                leg_c++;
+            } else {
+                legspace[i] = 0;
             }
-        }
+            /* who said there was a special tag ... ? */
+            if (prt_fctn == 'g') {
+                prt_fctn = '\0';
+            }
+            if (prt_fctn == '\0') {
+                if (i == im->gdes_c - 1)
+                    prt_fctn = 'l';
 
+                /* is it time to place the legends ? */
+                if (fill > im->ximg - 2 * border) {
+                    if (leg_c > 1) {
+                        /* go back one */
+                        i--;
+                        fill = fill_last;
+                        leg_c--;
+                        prt_fctn = 'j';
+                    } else {
+                        prt_fctn = 'l';
+                    }
 
-        if (prt_fctn != '\0'){        
-            leg_x = border;
-            if (leg_c >= 2 && prt_fctn == 'j') {
-                glue = (im->ximg - fill - 2* border) / (leg_c-1);
-            } else {
-                glue = 0;
+                }
             }
-            if (prt_fctn =='c') leg_x =  (im->ximg - fill) / 2.0;
-            if (prt_fctn =='r') leg_x =  im->ximg - fill - border;
-
-            for(ii=mark;ii<=i;ii++){
-                if(im->gdes[ii].legend[0]=='\0')
-                    continue; /* skip empty legends */
-                im->gdes[ii].leg_x = leg_x;
-                im->gdes[ii].leg_y = leg_y;
-                leg_x += 
-                 gfx_get_text_width(im->canvas, leg_x,
-                                      im->text_prop[TEXT_PROP_LEGEND].font,
-                                      im->text_prop[TEXT_PROP_LEGEND].size,
-                                      im->tabwidth,
-                                      im->gdes[ii].legend, 0) 
-                   + legspace[ii]
-                   + glue;
-            }                        
-            leg_y_prev = leg_y;
-            /* only add y space if there was text on the line */
-            if (leg_x > border || prt_fctn == 's')            
-               leg_y += im->text_prop[TEXT_PROP_LEGEND].size*1.8;
-            if (prt_fctn == 's')
-               leg_y -=  im->text_prop[TEXT_PROP_LEGEND].size;           
-            fill = 0;
-            leg_c = 0;
-            mark = ii;
-        }           
-    }
-    im->yimg = leg_y_prev;
-    /* if we did place some legends we have to add vertical space */
-    if (leg_y != im->yimg){
-        im->yimg += im->text_prop[TEXT_PROP_LEGEND].size*1.8;
-    }
-    free(legspace);
-  }
-  return 0;
-}
 
-/* create a grid on the graph. it determines what to do
-   from the values of xsize, start and end */
 
-/* the xaxis labels are determined from the number of seconds per pixel
+            if (prt_fctn != '\0') {
+                leg_x = border;
+                if (leg_c >= 2 && prt_fctn == 'j') {
+                    glue = (im->ximg - fill - 2 * border) / (leg_c - 1);
+                } else {
+                    glue = 0;
+                }
+                if (prt_fctn == 'c')
+                    leg_x = (im->ximg - fill) / 2.0;
+                if (prt_fctn == 'r')
+                    leg_x = im->ximg - fill - border;
+
+                for (ii = mark; ii <= i; ii++) {
+                    if (im->gdes[ii].legend[0] == '\0')
+                        continue;   /* skip empty legends */
+                    im->gdes[ii].leg_x = leg_x;
+                    im->gdes[ii].leg_y = leg_y;
+                    leg_x +=
+                        gfx_get_text_width(im->canvas, leg_x,
+                                           im->text_prop[TEXT_PROP_LEGEND].
+                                           font,
+                                           im->text_prop[TEXT_PROP_LEGEND].
+                                           size, im->tabwidth,
+                                           im->gdes[ii].legend, 0)
+                        + legspace[ii]
+                        + glue;
+                }
+                leg_y_prev = leg_y;
+                /* only add y space if there was text on the line */
+                if (leg_x > border || prt_fctn == 's')
+                    leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+                if (prt_fctn == 's')
+                    leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
+                fill = 0;
+                leg_c = 0;
+                mark = ii;
+            }
+        }
+        im->yimg = leg_y_prev;
+        /* if we did place some legends we have to add vertical space */
+        if (leg_y != im->yimg) {
+            im->yimg += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
+        }
+        free(legspace);
+    }
+    return 0;
+}
+
+/* create a grid on the graph. it determines what to do
+   from the values of xsize, start and end */
+
+/* the xaxis labels are determined from the number of seconds per pixel
    in the requested graph */
 
 
 
-int
-calc_horizontal_grid(image_desc_t   *im)
+int calc_horizontal_grid(
+    image_desc_t * im)
 {
-    double   range;
-    double   scaledrange;
-    int      pixel,i;
-    int      gridind=0;
-    int      decimals, fractionals;
-
-    im->ygrid_scale.labfact=2;
-    range =  im->maxval - im->minval;
+    double    range;
+    double    scaledrange;
+    int       pixel, i;
+    int       gridind = 0;
+    int       decimals, fractionals;
+
+    im->ygrid_scale.labfact = 2;
+    range = im->maxval - im->minval;
     scaledrange = range / im->magfact;
 
-        /* does the scale of this graph make it impossible to put lines
-           on it? If so, give up. */
-        if (isnan(scaledrange)) {
-                return 0;
-        }
+    /* does the scale of this graph make it impossible to put lines
+       on it? If so, give up. */
+    if (isnan(scaledrange)) {
+        return 0;
+    }
 
     /* find grid spaceing */
-    pixel=1;
-    if(isnan(im->ygridstep)){
-        if(im->extra_flags & ALTYGRID) {
+    pixel = 1;
+    if (isnan(im->ygridstep)) {
+        if (im->extra_flags & ALTYGRID) {
             /* find the value with max number of digits. Get number of digits */
-            decimals = ceil(log10(max(fabs(im->maxval), fabs(im->minval))*im->viewfactor/im->magfact));
-            if(decimals <= 0) /* everything is small. make place for zero */
+            decimals =
+                ceil(log10
+                     (max(fabs(im->maxval), fabs(im->minval)) *
+                      im->viewfactor / im->magfact));
+            if (decimals <= 0)  /* everything is small. make place for zero */
                 decimals = 1;
-            
-            im->ygrid_scale.gridstep = pow((double)10, floor(log10(range*im->viewfactor/im->magfact)))/im->viewfactor*im->magfact;
-            
-            if(im->ygrid_scale.gridstep == 0) /* range is one -> 0.1 is reasonable scale */
+
+            im->ygrid_scale.gridstep =
+                pow((double) 10,
+                    floor(log10(range * im->viewfactor / im->magfact))) /
+                im->viewfactor * im->magfact;
+
+            if (im->ygrid_scale.gridstep == 0)  /* range is one -> 0.1 is reasonable scale */
                 im->ygrid_scale.gridstep = 0.1;
             /* should have at least 5 lines but no more then 15 */
-            if(range/im->ygrid_scale.gridstep < 5)
+            if (range / im->ygrid_scale.gridstep < 5)
                 im->ygrid_scale.gridstep /= 10;
-            if(range/im->ygrid_scale.gridstep > 15)
+            if (range / im->ygrid_scale.gridstep > 15)
                 im->ygrid_scale.gridstep *= 10;
-            if(range/im->ygrid_scale.gridstep > 5) {
+            if (range / im->ygrid_scale.gridstep > 5) {
                 im->ygrid_scale.labfact = 1;
-                if(range/im->ygrid_scale.gridstep > 8)
+                if (range / im->ygrid_scale.gridstep > 8)
                     im->ygrid_scale.labfact = 2;
-            }
-            else {
+            } else {
                 im->ygrid_scale.gridstep /= 5;
                 im->ygrid_scale.labfact = 5;
             }
-            fractionals = floor(log10(im->ygrid_scale.gridstep*(double)im->ygrid_scale.labfact*im->viewfactor/im->magfact));
-            if(fractionals < 0) { /* small amplitude. */
-                int len = decimals - fractionals + 1;
-                if (im->unitslength < len+2) im->unitslength = len+2;
-                sprintf(im->ygrid_scale.labfmt, "%%%d.%df%s", len, -fractionals,(im->symbol != ' ' ? " %c" : ""));
+            fractionals =
+                floor(log10
+                      (im->ygrid_scale.gridstep *
+                       (double) im->ygrid_scale.labfact * im->viewfactor /
+                       im->magfact));
+            if (fractionals < 0) {  /* small amplitude. */
+                int       len = decimals - fractionals + 1;
+
+                if (im->unitslength < len + 2)
+                    im->unitslength = len + 2;
+                sprintf(im->ygrid_scale.labfmt, "%%%d.%df%s", len,
+                        -fractionals, (im->symbol != ' ' ? " %c" : ""));
             } else {
-                int len = decimals + 1;
-                if (im->unitslength < len+2) im->unitslength = len+2;
-                sprintf(im->ygrid_scale.labfmt, "%%%d.0f%s", len, ( im->symbol != ' ' ? " %c" : "" ));
+                int       len = decimals + 1;
+
+                if (im->unitslength < len + 2)
+                    im->unitslength = len + 2;
+                sprintf(im->ygrid_scale.labfmt, "%%%d.0f%s", len,
+                        (im->symbol != ' ' ? " %c" : ""));
             }
-        }
-        else {
-            for(i=0;ylab[i].grid > 0;i++){
+        } else {
+            for (i = 0; ylab[i].grid > 0; i++) {
                 pixel = im->ysize / (scaledrange / ylab[i].grid);
-                   gridind = i;
+                gridind = i;
                 if (pixel > 7)
                     break;
             }
-            
-            for(i=0; i<4;i++) {
-               if (pixel * ylab[gridind].lfac[i] >=  2.5 * im->text_prop[TEXT_PROP_AXIS].size) {
-                  im->ygrid_scale.labfact =  ylab[gridind].lfac[i];
-                  break;
-               }
-            } 
-            
+
+            for (i = 0; i < 4; i++) {
+                if (pixel * ylab[gridind].lfac[i] >=
+                    2.5 * im->text_prop[TEXT_PROP_AXIS].size) {
+                    im->ygrid_scale.labfact = ylab[gridind].lfac[i];
+                    break;
+                }
+            }
+
             im->ygrid_scale.gridstep = ylab[gridind].grid * im->magfact;
         }
     } else {
@@ -1656,88 +1803,107 @@ calc_horizontal_grid(image_desc_t   *im)
     return 1;
 }
 
-int draw_horizontal_grid(image_desc_t *im)
+int draw_horizontal_grid(
+    image_desc_t * im)
 {
-    int      i;
-    double   scaledstep;
-    char     graph_label[100];
-    int      nlabels=0;
-    double X0=im->xorigin;
-    double X1=im->xorigin+im->xsize;
-   
-    int sgrid = (int)( im->minval / im->ygrid_scale.gridstep - 1);
-    int egrid = (int)( im->maxval / im->ygrid_scale.gridstep + 1);
-    double MaxY;
-    scaledstep = im->ygrid_scale.gridstep/(double)im->magfact*(double)im->viewfactor;
-    MaxY = scaledstep*(double)egrid;
-    for (i = sgrid; i <= egrid; i++){
-       double Y0=ytr(im,im->ygrid_scale.gridstep*i);
-       double YN=ytr(im,im->ygrid_scale.gridstep*(i+1));
-       if ( floor(Y0+0.5) >= im->yorigin-im->ysize 
-            && floor(Y0+0.5) <= im->yorigin){       
+    int       i;
+    double    scaledstep;
+    char      graph_label[100];
+    int       nlabels = 0;
+    double    X0 = im->xorigin;
+    double    X1 = im->xorigin + im->xsize;
+
+    int       sgrid = (int) (im->minval / im->ygrid_scale.gridstep - 1);
+    int       egrid = (int) (im->maxval / im->ygrid_scale.gridstep + 1);
+    double    MaxY;
+
+    scaledstep =
+        im->ygrid_scale.gridstep / (double) im->magfact *
+        (double) im->viewfactor;
+    MaxY = scaledstep * (double) egrid;
+    for (i = sgrid; i <= egrid; i++) {
+        double    Y0 = ytr(im, im->ygrid_scale.gridstep * i);
+        double    YN = ytr(im, im->ygrid_scale.gridstep * (i + 1));
+
+        if (floor(Y0 + 0.5) >= im->yorigin - im->ysize
+            && floor(Y0 + 0.5) <= im->yorigin) {
             /* Make sure at least 2 grid labels are shown, even if it doesn't agree
                with the chosen settings. Add a label if required by settings, or if
                there is only one label so far and the next grid line is out of bounds. */
-            if(i % im->ygrid_scale.labfact == 0 || ( nlabels==1 && (YN < im->yorigin-im->ysize || YN > im->yorigin) )){                
+            if (i % im->ygrid_scale.labfact == 0
+                || (nlabels == 1
+                    && (YN < im->yorigin - im->ysize || YN > im->yorigin))) {
                 if (im->symbol == ' ') {
-                     if(im->extra_flags & ALTYGRID) {
-                        sprintf(graph_label,im->ygrid_scale.labfmt,scaledstep*(double)i);
+                    if (im->extra_flags & ALTYGRID) {
+                        sprintf(graph_label, im->ygrid_scale.labfmt,
+                                scaledstep * (double) i);
                     } else {
-                        if(MaxY < 10) {
-                           sprintf(graph_label,"%4.1f",scaledstep*(double)i);
-                          } else {
-                           sprintf(graph_label,"%4.0f",scaledstep*(double)i);
+                        if (MaxY < 10) {
+                            sprintf(graph_label, "%4.1f",
+                                    scaledstep * (double) i);
+                        } else {
+                            sprintf(graph_label, "%4.0f",
+                                    scaledstep * (double) i);
                         }
                     }
-                }else {
-                    char sisym = ( i == 0  ? ' ' : im->symbol);
-                     if(im->extra_flags & ALTYGRID) {
-                        sprintf(graph_label,im->ygrid_scale.labfmt,scaledstep*(double)i,sisym);
+                } else {
+                    char      sisym = (i == 0 ? ' ' : im->symbol);
+
+                    if (im->extra_flags & ALTYGRID) {
+                        sprintf(graph_label, im->ygrid_scale.labfmt,
+                                scaledstep * (double) i, sisym);
                     } else {
-                          if(MaxY < 10){
-                             sprintf(graph_label,"%4.1f %c",scaledstep*(double)i, sisym);
+                        if (MaxY < 10) {
+                            sprintf(graph_label, "%4.1f %c",
+                                    scaledstep * (double) i, sisym);
                         } else {
-                             sprintf(graph_label,"%4.0f %c",scaledstep*(double)i, sisym);
+                            sprintf(graph_label, "%4.0f %c",
+                                    scaledstep * (double) i, sisym);
                         }
                     }
                 }
                 nlabels++;
 
-               gfx_new_text ( im->canvas,
-                              X0-im->text_prop[TEXT_PROP_AXIS].size, Y0,
-                              im->graph_col[GRC_FONT],
-                              im->text_prop[TEXT_PROP_AXIS].font,
-                              im->text_prop[TEXT_PROP_AXIS].size,
-                              im->tabwidth, 0.0, GFX_H_RIGHT, GFX_V_CENTER,
-                              graph_label );
-               gfx_new_dashed_line ( im->canvas,
-                              X0-2,Y0,
-                              X1+2,Y0,
-                              MGRIDWIDTH, im->graph_col[GRC_MGRID],
-                              im->grid_dash_on, im->grid_dash_off);               
-               
-            } else if (!(im->extra_flags & NOMINOR)) {                
-               gfx_new_dashed_line ( im->canvas,
-                              X0-1,Y0,
-                              X1+1,Y0,
-                              GRIDWIDTH, im->graph_col[GRC_GRID],
-                              im->grid_dash_on, im->grid_dash_off);               
-               
-            }            
-        }        
-    } 
+                gfx_new_text(im->canvas,
+                             X0 - im->text_prop[TEXT_PROP_AXIS].size, Y0,
+                             im->graph_col[GRC_FONT],
+                             im->text_prop[TEXT_PROP_AXIS].font,
+                             im->text_prop[TEXT_PROP_AXIS].size,
+                             im->tabwidth, 0.0, GFX_H_RIGHT, GFX_V_CENTER,
+                             graph_label);
+                gfx_new_dashed_line(im->canvas,
+                                    X0 - 2, Y0,
+                                    X1 + 2, Y0,
+                                    MGRIDWIDTH, im->graph_col[GRC_MGRID],
+                                    im->grid_dash_on, im->grid_dash_off);
+
+            } else if (!(im->extra_flags & NOMINOR)) {
+                gfx_new_dashed_line(im->canvas,
+                                    X0 - 1, Y0,
+                                    X1 + 1, Y0,
+                                    GRIDWIDTH, im->graph_col[GRC_GRID],
+                                    im->grid_dash_on, im->grid_dash_off);
+
+            }
+        }
+    }
     return 1;
 }
 
 /* this is frexp for base 10 */
-double frexp10(double, double *);
-double frexp10(double x, double *e) {
-    double mnt;
-    int iexp;
+double    frexp10(
+    double,
+    double *);
+double frexp10(
+    double x,
+    double *e)
+{
+    double    mnt;
+    int       iexp;
 
     iexp = floor(log(fabs(x)) / log(10));
     mnt = x / pow(10.0, iexp);
-    if(mnt >= 10.0) {
+    if (mnt >= 10.0) {
         iexp++;
         mnt = x / pow(10.0, iexp);
     }
@@ -1745,12 +1911,16 @@ double frexp10(double x, double *e) {
     return mnt;
 }
 
-static int AlmostEqual2sComplement (float A, float B, int maxUlps)
+static int AlmostEqual2sComplement(
+    float A,
+    float B,
+    int maxUlps)
 {
 
-    int aInt = *(int*)&A;
-    int bInt = *(int*)&B;
-    int intDiff;
+    int       aInt = *(int *) &A;
+    int       bInt = *(int *) &B;
+    int       intDiff;
+
     /* Make sure maxUlps is non-negative and small enough that the
        default NAN won't compare as equal to anything.  */
 
@@ -1775,210 +1945,227 @@ static int AlmostEqual2sComplement (float A, float B, int maxUlps)
 }
 
 /* logaritmic horizontal grid */
-int
-horizontal_log_grid(image_desc_t   *im)   
+int horizontal_log_grid(
+    image_desc_t * im)
 {
-    double yloglab[][10] = {
+    double    yloglab[][10] = {
         {1.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
         {1.0, 5.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
         {1.0, 2.0, 5.0, 7.0, 10., 0.0, 0.0, 0.0, 0.0, 0.0},
         {1.0, 2.0, 4.0, 6.0, 8.0, 10., 0.0, 0.0, 0.0, 0.0},
         {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.},
-        {0,0,0,0,0, 0,0,0,0,0} /* last line */ };
-
-    int i, j, val_exp, min_exp;
-    double nex;                /* number of decades in data */
-    double logscale;        /* scale in logarithmic space */
-    int exfrac = 1;        /* decade spacing */
-    int mid = -1;        /* row in yloglab for major grid */
-    double mspac;        /* smallest major grid spacing (pixels) */
-    int flab;                /* first value in yloglab to use */
-    double value, tmp, pre_value;
-    double X0,X1,Y0;   
-    char graph_label[100];
+        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}  /* last line */
+    };
+
+    int       i, j, val_exp, min_exp;
+    double    nex;      /* number of decades in data */
+    double    logscale; /* scale in logarithmic space */
+    int       exfrac = 1;   /* decade spacing */
+    int       mid = -1; /* row in yloglab for major grid */
+    double    mspac;    /* smallest major grid spacing (pixels) */
+    int       flab;     /* first value in yloglab to use */
+    double    value, tmp, pre_value;
+    double    X0, X1, Y0;
+    char      graph_label[100];
 
     nex = log10(im->maxval / im->minval);
     logscale = im->ysize / nex;
 
     /* major spacing for data with high dynamic range */
-    while(logscale * exfrac < 3 * im->text_prop[TEXT_PROP_LEGEND].size) {
-        if(exfrac == 1) exfrac = 3;
-        else exfrac += 3;
+    while (logscale * exfrac < 3 * im->text_prop[TEXT_PROP_LEGEND].size) {
+        if (exfrac == 1)
+            exfrac = 3;
+        else
+            exfrac += 3;
     }
 
     /* major spacing for less dynamic data */
     do {
         /* search best row in yloglab */
         mid++;
-        for(i = 0; yloglab[mid][i + 1] < 10.0; i++);
+        for (i = 0; yloglab[mid][i + 1] < 10.0; i++);
         mspac = logscale * log10(10.0 / yloglab[mid][i]);
-    } while(mspac > 2 * im->text_prop[TEXT_PROP_LEGEND].size && yloglab[mid][0] > 0);
-    if(mid) mid--;
+    } while (mspac > 2 * im->text_prop[TEXT_PROP_LEGEND].size
+             && yloglab[mid][0] > 0);
+    if (mid)
+        mid--;
 
     /* find first value in yloglab */
-    for(flab = 0; yloglab[mid][flab] < 10 && frexp10(im->minval, &tmp) > yloglab[mid][flab] ; flab++);
-    if(yloglab[mid][flab] == 10.0) {
+    for (flab = 0;
+         yloglab[mid][flab] < 10
+         && frexp10(im->minval, &tmp) > yloglab[mid][flab]; flab++);
+    if (yloglab[mid][flab] == 10.0) {
         tmp += 1.0;
         flab = 0;
     }
     val_exp = tmp;
-    if(val_exp % exfrac) val_exp += abs(-val_exp % exfrac);
+    if (val_exp % exfrac)
+        val_exp += abs(-val_exp % exfrac);
 
-    X0=im->xorigin;
-    X1=im->xorigin+im->xsize;
+    X0 = im->xorigin;
+    X1 = im->xorigin + im->xsize;
 
     /* draw grid */
     pre_value = DNAN;
-    while(1) {       
+    while (1) {
 
         value = yloglab[mid][flab] * pow(10.0, val_exp);
-        if (  AlmostEqual2sComplement(value,pre_value,4) ) break; /* it seems we are not converging */
+        if (AlmostEqual2sComplement(value, pre_value, 4))
+            break;      /* it seems we are not converging */
 
         pre_value = value;
 
         Y0 = ytr(im, value);
-        if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+        if (floor(Y0 + 0.5) <= im->yorigin - im->ysize)
+            break;
 
         /* major grid line */
-        gfx_new_dashed_line ( im->canvas,
-            X0-2,Y0,
-            X1+2,Y0,
-            MGRIDWIDTH, im->graph_col[GRC_MGRID],
-            im->grid_dash_on, im->grid_dash_off);
+        gfx_new_dashed_line(im->canvas,
+                            X0 - 2, Y0,
+                            X1 + 2, Y0,
+                            MGRIDWIDTH, im->graph_col[GRC_MGRID],
+                            im->grid_dash_on, im->grid_dash_off);
 
         /* label */
         if (im->extra_flags & FORCE_UNITS_SI) {
-            int scale;
-            double pvalue;
-            char symbol;
+            int       scale;
+            double    pvalue;
+            char      symbol;
 
             scale = floor(val_exp / 3.0);
-            if( value >= 1.0 ) pvalue = pow(10.0, val_exp % 3);
-            else pvalue = pow(10.0, ((val_exp + 1) % 3) + 2);
+            if (value >= 1.0)
+                pvalue = pow(10.0, val_exp % 3);
+            else
+                pvalue = pow(10.0, ((val_exp + 1) % 3) + 2);
             pvalue *= yloglab[mid][flab];
 
-            if ( ((scale+si_symbcenter) < (int)sizeof(si_symbol)) &&
-                ((scale+si_symbcenter) >= 0) )
-                symbol = si_symbol[scale+si_symbcenter];
+            if (((scale + si_symbcenter) < (int) sizeof(si_symbol)) &&
+                ((scale + si_symbcenter) >= 0))
+                symbol = si_symbol[scale + si_symbcenter];
             else
                 symbol = '?';
 
-                sprintf(graph_label,"%3.0f %c", pvalue, symbol);
+            sprintf(graph_label, "%3.0f %c", pvalue, symbol);
         } else
-            sprintf(graph_label,"%3.0e", value);
-        gfx_new_text ( im->canvas,
-            X0-im->text_prop[TEXT_PROP_AXIS].size, Y0,
-            im->graph_col[GRC_FONT],
-            im->text_prop[TEXT_PROP_AXIS].font,
-            im->text_prop[TEXT_PROP_AXIS].size,
-            im->tabwidth,0.0, GFX_H_RIGHT, GFX_V_CENTER,
-            graph_label );
+            sprintf(graph_label, "%3.0e", value);
+        gfx_new_text(im->canvas,
+                     X0 - im->text_prop[TEXT_PROP_AXIS].size, Y0,
+                     im->graph_col[GRC_FONT],
+                     im->text_prop[TEXT_PROP_AXIS].font,
+                     im->text_prop[TEXT_PROP_AXIS].size,
+                     im->tabwidth, 0.0, GFX_H_RIGHT, GFX_V_CENTER,
+                     graph_label);
 
         /* minor grid */
-        if(mid < 4 && exfrac == 1) {
+        if (mid < 4 && exfrac == 1) {
             /* find first and last minor line behind current major line
              * i is the first line and j tha last */
-            if(flab == 0) {
+            if (flab == 0) {
                 min_exp = val_exp - 1;
-                for(i = 1; yloglab[mid][i] < 10.0; i++);
+                for (i = 1; yloglab[mid][i] < 10.0; i++);
                 i = yloglab[mid][i - 1] + 1;
                 j = 10;
-            }
-            else {
+            } else {
                 min_exp = val_exp;
                 i = yloglab[mid][flab - 1] + 1;
                 j = yloglab[mid][flab];
             }
 
             /* draw minor lines below current major line */
-            for(; i < j; i++) {
+            for (; i < j; i++) {
 
                 value = i * pow(10.0, min_exp);
-                if(value < im->minval) continue;
+                if (value < im->minval)
+                    continue;
 
                 Y0 = ytr(im, value);
-                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+                if (floor(Y0 + 0.5) <= im->yorigin - im->ysize)
+                    break;
 
                 /* draw lines */
-                gfx_new_dashed_line ( im->canvas,
-                    X0-1,Y0,
-                    X1+1,Y0,
-                    GRIDWIDTH, im->graph_col[GRC_GRID],
-                    im->grid_dash_on, im->grid_dash_off);
+                gfx_new_dashed_line(im->canvas,
+                                    X0 - 1, Y0,
+                                    X1 + 1, Y0,
+                                    GRIDWIDTH, im->graph_col[GRC_GRID],
+                                    im->grid_dash_on, im->grid_dash_off);
             }
-        }
-        else if(exfrac > 1) {
-            for(i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
+        } else if (exfrac > 1) {
+            for (i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
                 value = pow(10.0, i);
-                if(value < im->minval) continue;
+                if (value < im->minval)
+                    continue;
 
                 Y0 = ytr(im, value);
-                if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+                if (floor(Y0 + 0.5) <= im->yorigin - im->ysize)
+                    break;
 
                 /* draw lines */
-                gfx_new_dashed_line ( im->canvas,
-                    X0-1,Y0,
-                    X1+1,Y0,
-                    GRIDWIDTH, im->graph_col[GRC_GRID],
-                    im->grid_dash_on, im->grid_dash_off);
+                gfx_new_dashed_line(im->canvas,
+                                    X0 - 1, Y0,
+                                    X1 + 1, Y0,
+                                    GRIDWIDTH, im->graph_col[GRC_GRID],
+                                    im->grid_dash_on, im->grid_dash_off);
             }
         }
 
         /* next decade */
-        if(yloglab[mid][++flab] == 10.0) {
+        if (yloglab[mid][++flab] == 10.0) {
             flab = 0;
             val_exp += exfrac;
         }
     }
 
     /* draw minor lines after highest major line */
-    if(mid < 4 && exfrac == 1) {
+    if (mid < 4 && exfrac == 1) {
         /* find first and last minor line below current major line
          * i is the first line and j tha last */
-        if(flab == 0) {
+        if (flab == 0) {
             min_exp = val_exp - 1;
-            for(i = 1; yloglab[mid][i] < 10.0; i++);
+            for (i = 1; yloglab[mid][i] < 10.0; i++);
             i = yloglab[mid][i - 1] + 1;
             j = 10;
-        }
-        else {
+        } else {
             min_exp = val_exp;
             i = yloglab[mid][flab - 1] + 1;
             j = yloglab[mid][flab];
         }
 
         /* draw minor lines below current major line */
-        for(; i < j; i++) {
+        for (; i < j; i++) {
 
             value = i * pow(10.0, min_exp);
-            if(value < im->minval) continue;
+            if (value < im->minval)
+                continue;
 
             Y0 = ytr(im, value);
-            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+            if (floor(Y0 + 0.5) <= im->yorigin - im->ysize)
+                break;
 
             /* draw lines */
-            gfx_new_dashed_line ( im->canvas,
-                X0-1,Y0,
-                X1+1,Y0,
-                GRIDWIDTH, im->graph_col[GRC_GRID],
-                im->grid_dash_on, im->grid_dash_off);
+            gfx_new_dashed_line(im->canvas,
+                                X0 - 1, Y0,
+                                X1 + 1, Y0,
+                                GRIDWIDTH, im->graph_col[GRC_GRID],
+                                im->grid_dash_on, im->grid_dash_off);
         }
     }
     /* fancy minor gridlines */
-    else if(exfrac > 1) {
-        for(i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
+    else if (exfrac > 1) {
+        for (i = val_exp - exfrac / 3 * 2; i < val_exp; i += exfrac / 3) {
             value = pow(10.0, i);
-            if(value < im->minval) continue;
+            if (value < im->minval)
+                continue;
 
             Y0 = ytr(im, value);
-            if(floor(Y0+0.5) <= im->yorigin - im->ysize) break;
+            if (floor(Y0 + 0.5) <= im->yorigin - im->ysize)
+                break;
 
             /* draw lines */
-            gfx_new_dashed_line ( im->canvas,
-                X0-1,Y0,
-                X1+1,Y0,
-                GRIDWIDTH, im->graph_col[GRC_GRID],
-                im->grid_dash_on, im->grid_dash_off);
+            gfx_new_dashed_line(im->canvas,
+                                X0 - 1, Y0,
+                                X1 + 1, Y0,
+                                GRIDWIDTH, im->graph_col[GRC_GRID],
+                                im->grid_dash_on, im->grid_dash_off);
         }
     }
 
@@ -1986,28 +2173,31 @@ horizontal_log_grid(image_desc_t   *im)
 }
 
 
-void
-vertical_grid(
-    image_desc_t   *im )
-{   
-    int xlab_sel;                /* which sort of label and grid ? */
-    time_t ti, tilab, timajor;
-    long factor;
-    char graph_label[100];
-    double X0,Y0,Y1; /* points for filled graph and more*/
+void vertical_grid(
+    image_desc_t * im)
+{
+    int       xlab_sel; /* which sort of label and grid ? */
+    time_t    ti, tilab, timajor;
+    long      factor;
+    char      graph_label[100];
+    double    X0, Y0, Y1;   /* points for filled graph and more */
     struct tm tm;
 
     /* the type of time grid is determined by finding
        the number of seconds per pixel in the graph */
-    
-    
-    if(im->xlab_user.minsec == -1){
-        factor=(im->end - im->start)/im->xsize;
-        xlab_sel=0;
-        while ( xlab[xlab_sel+1].minsec != -1 
-                && xlab[xlab_sel+1].minsec <= factor) { xlab_sel++; }        /* pick the last one */
-        while ( xlab[xlab_sel-1].minsec == xlab[xlab_sel].minsec
-                && xlab[xlab_sel].length > (im->end - im->start)) { xlab_sel--; }        /* go back to the smallest size */
+
+
+    if (im->xlab_user.minsec == -1) {
+        factor = (im->end - im->start) / im->xsize;
+        xlab_sel = 0;
+        while (xlab[xlab_sel + 1].minsec != -1
+               && xlab[xlab_sel + 1].minsec <= factor) {
+            xlab_sel++;
+        }               /* pick the last one */
+        while (xlab[xlab_sel - 1].minsec == xlab[xlab_sel].minsec
+               && xlab[xlab_sel].length > (im->end - im->start)) {
+            xlab_sel--;
+        }               /* go back to the smallest size */
         im->xlab_user.gridtm = xlab[xlab_sel].gridtm;
         im->xlab_user.gridst = xlab[xlab_sel].gridst;
         im->xlab_user.mgridtm = xlab[xlab_sel].mgridtm;
@@ -2017,260 +2207,248 @@ vertical_grid(
         im->xlab_user.precis = xlab[xlab_sel].precis;
         im->xlab_user.stst = xlab[xlab_sel].stst;
     }
-    
+
     /* y coords are the same for every line ... */
     Y0 = im->yorigin;
-    Y1 = im->yorigin-im->ysize;
-   
+    Y1 = im->yorigin - im->ysize;
+
 
     /* paint the minor grid */
-    if (!(im->extra_flags & NOMINOR))
-    {
-        for(ti = find_first_time(im->start,
-                                im->xlab_user.gridtm,
-                                im->xlab_user.gridst),
-            timajor = find_first_time(im->start,
-                                im->xlab_user.mgridtm,
-                                im->xlab_user.mgridst);
-            ti < im->end; 
-            ti = find_next_time(ti,im->xlab_user.gridtm,im->xlab_user.gridst)
-            ){
+    if (!(im->extra_flags & NOMINOR)) {
+        for (ti = find_first_time(im->start,
+                                  im->xlab_user.gridtm,
+                                  im->xlab_user.gridst),
+             timajor = find_first_time(im->start,
+                                       im->xlab_user.mgridtm,
+                                       im->xlab_user.mgridst);
+             ti < im->end;
+             ti =
+             find_next_time(ti, im->xlab_user.gridtm, im->xlab_user.gridst)
+            ) {
             /* are we inside the graph ? */
-            if (ti < im->start || ti > im->end) continue;
+            if (ti < im->start || ti > im->end)
+                continue;
             while (timajor < ti) {
                 timajor = find_next_time(timajor,
-                        im->xlab_user.mgridtm, im->xlab_user.mgridst);
+                                         im->xlab_user.mgridtm,
+                                         im->xlab_user.mgridst);
             }
-            if (ti == timajor) continue; /* skip as falls on major grid line */
-           X0 = xtr(im,ti);       
-           gfx_new_dashed_line(im->canvas,X0,Y0+1, X0,Y1-1,GRIDWIDTH,
-               im->graph_col[GRC_GRID],
-               im->grid_dash_on, im->grid_dash_off);
-           
+            if (ti == timajor)
+                continue;   /* skip as falls on major grid line */
+            X0 = xtr(im, ti);
+            gfx_new_dashed_line(im->canvas, X0, Y0 + 1, X0, Y1 - 1, GRIDWIDTH,
+                                im->graph_col[GRC_GRID],
+                                im->grid_dash_on, im->grid_dash_off);
+
         }
     }
 
     /* paint the major grid */
-    for(ti = find_first_time(im->start,
-                            im->xlab_user.mgridtm,
-                            im->xlab_user.mgridst);
-        ti < im->end; 
-        ti = find_next_time(ti,im->xlab_user.mgridtm,im->xlab_user.mgridst)
-        ){
+    for (ti = find_first_time(im->start,
+                              im->xlab_user.mgridtm,
+                              im->xlab_user.mgridst);
+         ti < im->end;
+         ti = find_next_time(ti, im->xlab_user.mgridtm, im->xlab_user.mgridst)
+        ) {
         /* are we inside the graph ? */
-        if (ti < im->start || ti > im->end) continue;
-       X0 = xtr(im,ti);
-       gfx_new_dashed_line(im->canvas,X0,Y0+3, X0,Y1-2,MGRIDWIDTH,
-           im->graph_col[GRC_MGRID],
-           im->grid_dash_on, im->grid_dash_off);
-       
+        if (ti < im->start || ti > im->end)
+            continue;
+        X0 = xtr(im, ti);
+        gfx_new_dashed_line(im->canvas, X0, Y0 + 3, X0, Y1 - 2, MGRIDWIDTH,
+                            im->graph_col[GRC_MGRID],
+                            im->grid_dash_on, im->grid_dash_off);
+
     }
     /* paint the labels below the graph */
-    for(ti = find_first_time(im->start - im->xlab_user.precis/2,
-                            im->xlab_user.labtm,
-                            im->xlab_user.labst);
-        ti <= im->end - im->xlab_user.precis/2; 
-        ti = find_next_time(ti,im->xlab_user.labtm,im->xlab_user.labst)
-        ){
-        tilab= ti + im->xlab_user.precis/2; /* correct time for the label */
+    for (ti = find_first_time(im->start - im->xlab_user.precis / 2,
+                              im->xlab_user.labtm,
+                              im->xlab_user.labst);
+         ti <= im->end - im->xlab_user.precis / 2;
+         ti = find_next_time(ti, im->xlab_user.labtm, im->xlab_user.labst)
+        ) {
+        tilab = ti + im->xlab_user.precis / 2;  /* correct time for the label */
         /* are we inside the graph ? */
-        if (tilab < im->start || tilab > im->end) continue;
+        if (tilab < im->start || tilab > im->end)
+            continue;
 
 #if HAVE_STRFTIME
         localtime_r(&tilab, &tm);
-        strftime(graph_label,99,im->xlab_user.stst, &tm);
+        strftime(graph_label, 99, im->xlab_user.stst, &tm);
 #else
 # error "your libc has no strftime I guess we'll abort the exercise here."
 #endif
-       gfx_new_text ( im->canvas,
-                      xtr(im,tilab), Y0+im->text_prop[TEXT_PROP_AXIS].size*1.4+5,
-                      im->graph_col[GRC_FONT],
-                      im->text_prop[TEXT_PROP_AXIS].font,
-                      im->text_prop[TEXT_PROP_AXIS].size,
-                      im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_BOTTOM,
-                      graph_label );
-       
+        gfx_new_text(im->canvas,
+                     xtr(im, tilab),
+                     Y0 + im->text_prop[TEXT_PROP_AXIS].size * 1.4 + 5,
+                     im->graph_col[GRC_FONT],
+                     im->text_prop[TEXT_PROP_AXIS].font,
+                     im->text_prop[TEXT_PROP_AXIS].size, im->tabwidth, 0.0,
+                     GFX_H_CENTER, GFX_V_BOTTOM, graph_label);
+
     }
 
 }
 
 
-void 
-axis_paint(
-   image_desc_t   *im
-           )
-{   
+void axis_paint(
+    image_desc_t * im)
+{
     /* draw x and y axis */
     /* gfx_new_line ( im->canvas, im->xorigin+im->xsize,im->yorigin,
-                      im->xorigin+im->xsize,im->yorigin-im->ysize,
-                      GRIDWIDTH, im->graph_col[GRC_AXIS]);
-       
+       im->xorigin+im->xsize,im->yorigin-im->ysize,
+       GRIDWIDTH, im->graph_col[GRC_AXIS]);
+
        gfx_new_line ( im->canvas, im->xorigin,im->yorigin-im->ysize,
-                         im->xorigin+im->xsize,im->yorigin-im->ysize,
-                         GRIDWIDTH, im->graph_col[GRC_AXIS]); */
-   
-       gfx_new_line ( im->canvas, im->xorigin-4,im->yorigin,
-                         im->xorigin+im->xsize+4,im->yorigin,
-                         MGRIDWIDTH, im->graph_col[GRC_AXIS]);
-   
-       gfx_new_line ( im->canvas, im->xorigin,im->yorigin+4,
-                         im->xorigin,im->yorigin-im->ysize-4,
-                         MGRIDWIDTH, im->graph_col[GRC_AXIS]);
-   
-    
+       im->xorigin+im->xsize,im->yorigin-im->ysize,
+       GRIDWIDTH, im->graph_col[GRC_AXIS]); */
+
+    gfx_new_line(im->canvas, im->xorigin - 4, im->yorigin,
+                 im->xorigin + im->xsize + 4, im->yorigin,
+                 MGRIDWIDTH, im->graph_col[GRC_AXIS]);
+
+    gfx_new_line(im->canvas, im->xorigin, im->yorigin + 4,
+                 im->xorigin, im->yorigin - im->ysize - 4,
+                 MGRIDWIDTH, im->graph_col[GRC_AXIS]);
+
+
     /* arrow for X and Y axis direction */
-    gfx_new_area ( im->canvas, 
-                   im->xorigin+im->xsize+2,  im->yorigin-2,
-                   im->xorigin+im->xsize+2,  im->yorigin+3,
-                   im->xorigin+im->xsize+7,  im->yorigin+0.5, /* LINEOFFSET */
-                   im->graph_col[GRC_ARROW]);
-
-    gfx_new_area ( im->canvas, 
-                   im->xorigin-2,  im->yorigin-im->ysize-2,
-                   im->xorigin+3,  im->yorigin-im->ysize-2,
-                   im->xorigin+0.5,    im->yorigin-im->ysize-7, /* LINEOFFSET */
-                   im->graph_col[GRC_ARROW]);
+    gfx_new_area(im->canvas, im->xorigin + im->xsize + 2, im->yorigin - 2, im->xorigin + im->xsize + 2, im->yorigin + 3, im->xorigin + im->xsize + 7, im->yorigin + 0.5,    /* LINEOFFSET */
+                 im->graph_col[GRC_ARROW]);
+
+    gfx_new_area(im->canvas, im->xorigin - 2, im->yorigin - im->ysize - 2, im->xorigin + 3, im->yorigin - im->ysize - 2, im->xorigin + 0.5, im->yorigin - im->ysize - 7,    /* LINEOFFSET */
+                 im->graph_col[GRC_ARROW]);
 
 }
 
-void
-grid_paint(image_desc_t   *im)
-{   
-    long i;
-    int res=0;
-    double X0,Y0; /* points for filled graph and more*/
+void grid_paint(
+    image_desc_t * im)
+{
+    long      i;
+    int       res = 0;
+    double    X0, Y0;   /* points for filled graph and more */
     gfx_node_t *node;
 
     /* draw 3d border */
-    node = gfx_new_area (im->canvas, 0,im->yimg,
-                                 2,im->yimg-2,
-                                 2,2,im->graph_col[GRC_SHADEA]);
-    gfx_add_point( node , im->ximg - 2, 2 );
-    gfx_add_point( node , im->ximg, 0 );
-    gfx_add_point( node , 0,0 );
+    node = gfx_new_area(im->canvas, 0, im->yimg,
+                        2, im->yimg - 2, 2, 2, im->graph_col[GRC_SHADEA]);
+    gfx_add_point(node, im->ximg - 2, 2);
+    gfx_add_point(node, im->ximg, 0);
+    gfx_add_point(node, 0, 0);
 /*    gfx_add_point( node , 0,im->yimg ); */
-   
-    node =  gfx_new_area (im->canvas, 2,im->yimg-2,
-                                  im->ximg-2,im->yimg-2,
-                                  im->ximg - 2, 2,
-                                 im->graph_col[GRC_SHADEB]);
-    gfx_add_point( node ,   im->ximg,0);
-    gfx_add_point( node ,   im->ximg,im->yimg);
-    gfx_add_point( node ,   0,im->yimg);
+
+    node = gfx_new_area(im->canvas, 2, im->yimg - 2,
+                        im->ximg - 2, im->yimg - 2,
+                        im->ximg - 2, 2, im->graph_col[GRC_SHADEB]);
+    gfx_add_point(node, im->ximg, 0);
+    gfx_add_point(node, im->ximg, im->yimg);
+    gfx_add_point(node, 0, im->yimg);
 /*    gfx_add_point( node , 0,im->yimg ); */
-   
-   
-    if (im->draw_x_grid == 1 )
-      vertical_grid(im);
-    
-    if (im->draw_y_grid == 1){
-        if(im->logarithmic){
-                res = horizontal_log_grid(im);
+
+
+    if (im->draw_x_grid == 1)
+        vertical_grid(im);
+
+    if (im->draw_y_grid == 1) {
+        if (im->logarithmic) {
+            res = horizontal_log_grid(im);
         } else {
-                res = draw_horizontal_grid(im);
+            res = draw_horizontal_grid(im);
         }
-        
+
         /* dont draw horizontal grid if there is no min and max val */
-        if (! res ) {
-          char *nodata = "No Data found";
-           gfx_new_text(im->canvas,im->ximg/2, (2*im->yorigin-im->ysize) / 2,
-                        im->graph_col[GRC_FONT],
-                        im->text_prop[TEXT_PROP_AXIS].font,
-                        im->text_prop[TEXT_PROP_AXIS].size,
-                        im->tabwidth, 0.0, GFX_H_CENTER, GFX_V_CENTER,
-                        nodata );           
+        if (!res) {
+            char     *nodata = "No Data found";
+
+            gfx_new_text(im->canvas, im->ximg / 2,
+                         (2 * im->yorigin - im->ysize) / 2,
+                         im->graph_col[GRC_FONT],
+                         im->text_prop[TEXT_PROP_AXIS].font,
+                         im->text_prop[TEXT_PROP_AXIS].size, im->tabwidth,
+                         0.0, GFX_H_CENTER, GFX_V_CENTER, nodata);
         }
     }
 
     /* yaxis unit description */
-    gfx_new_text( im->canvas,
-                  10, (im->yorigin - im->ysize/2),
-                  im->graph_col[GRC_FONT],
-                  im->text_prop[TEXT_PROP_UNIT].font,
-                  im->text_prop[TEXT_PROP_UNIT].size, im->tabwidth, 
-                  RRDGRAPH_YLEGEND_ANGLE,
-                  GFX_H_LEFT, GFX_V_CENTER,
-                  im->ylegend);
+    gfx_new_text(im->canvas,
+                 10, (im->yorigin - im->ysize / 2),
+                 im->graph_col[GRC_FONT],
+                 im->text_prop[TEXT_PROP_UNIT].font,
+                 im->text_prop[TEXT_PROP_UNIT].size, im->tabwidth,
+                 RRDGRAPH_YLEGEND_ANGLE,
+                 GFX_H_LEFT, GFX_V_CENTER, im->ylegend);
 
     /* graph title */
-    gfx_new_text( im->canvas,
-                  im->ximg/2, im->text_prop[TEXT_PROP_TITLE].size*1.3+4,
-                  im->graph_col[GRC_FONT],
-                  im->text_prop[TEXT_PROP_TITLE].font,
-                  im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
-                  GFX_H_CENTER, GFX_V_CENTER,
-                  im->title);
+    gfx_new_text(im->canvas,
+                 im->ximg / 2, im->text_prop[TEXT_PROP_TITLE].size * 1.3 + 4,
+                 im->graph_col[GRC_FONT],
+                 im->text_prop[TEXT_PROP_TITLE].font,
+                 im->text_prop[TEXT_PROP_TITLE].size, im->tabwidth, 0.0,
+                 GFX_H_CENTER, GFX_V_CENTER, im->title);
     /* rrdtool 'logo' */
-    gfx_new_text( im->canvas,
-                  im->ximg-7, 7,
-                  ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044,
-                  im->text_prop[TEXT_PROP_AXIS].font,
-                  5.5, im->tabwidth, 270,
-                  GFX_H_RIGHT, GFX_V_TOP,
-                  "RRDTOOL / TOBI OETIKER");
+    gfx_new_text(im->canvas,
+                 im->ximg - 7, 7,
+                 (im->graph_col[GRC_FONT] & 0xffffff00) | 0x00000044,
+                 im->text_prop[TEXT_PROP_AXIS].font,
+                 5.5, im->tabwidth, 270,
+                 GFX_H_RIGHT, GFX_V_TOP, "RRDTOOL / TOBI OETIKER");
 
     /* graph watermark */
-    if(im->watermark[0] != '\0') {
-        gfx_new_text( im->canvas,
-                  im->ximg/2, im->yimg-6,
-                  ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044,
-                  im->text_prop[TEXT_PROP_AXIS].font,
-                  5.5, im->tabwidth, 0,
-                  GFX_H_CENTER, GFX_V_BOTTOM,
-                  im->watermark);
-    }
-    
+    if (im->watermark[0] != '\0') {
+        gfx_new_text(im->canvas,
+                     im->ximg / 2, im->yimg - 6,
+                     (im->graph_col[GRC_FONT] & 0xffffff00) | 0x00000044,
+                     im->text_prop[TEXT_PROP_AXIS].font,
+                     5.5, im->tabwidth, 0,
+                     GFX_H_CENTER, GFX_V_BOTTOM, im->watermark);
+    }
+
     /* graph labels */
-    if( !(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH) ) {
-            for(i=0;i<im->gdes_c;i++){
-                    if(im->gdes[i].legend[0] =='\0')
-                            continue;
-                    
-                    /* im->gdes[i].leg_y is the bottom of the legend */
-                    X0 = im->gdes[i].leg_x;
-                    Y0 = im->gdes[i].leg_y;
-                    gfx_new_text ( im->canvas, X0, Y0,
-                                   im->graph_col[GRC_FONT],
-                                   im->text_prop[TEXT_PROP_LEGEND].font,
-                                   im->text_prop[TEXT_PROP_LEGEND].size,
-                                   im->tabwidth,0.0, GFX_H_LEFT, GFX_V_BOTTOM,
-                                   im->gdes[i].legend );
-                    /* The legend for GRAPH items starts with "M " to have
-                       enough space for the box */
-                    if (           im->gdes[i].gf != GF_PRINT &&
-                                   im->gdes[i].gf != GF_GPRINT &&
-                                   im->gdes[i].gf != GF_COMMENT) {
-                            int boxH, boxV;
-                            
-                            boxH = gfx_get_text_width(im->canvas, 0,
-                                                      im->text_prop[TEXT_PROP_LEGEND].font,
-                                                      im->text_prop[TEXT_PROP_LEGEND].size,
-                                                      im->tabwidth,"o", 0) * 1.2;
-                            boxV = boxH*1.1;
-                            
-                            /* make sure transparent colors show up the same way as in the graph */
-                             node = gfx_new_area(im->canvas,
-                                                X0,Y0-boxV,
-                                                X0,Y0,
-                                                X0+boxH,Y0,
-                                                im->graph_col[GRC_BACK]);
-                            gfx_add_point ( node, X0+boxH, Y0-boxV );
+    if (!(im->extra_flags & NOLEGEND) & !(im->extra_flags & ONLY_GRAPH)) {
+        for (i = 0; i < im->gdes_c; i++) {
+            if (im->gdes[i].legend[0] == '\0')
+                continue;
 
-                            node = gfx_new_area(im->canvas,
-                                                X0,Y0-boxV,
-                                                X0,Y0,
-                                                X0+boxH,Y0,
-                                                im->gdes[i].col);
-                            gfx_add_point ( node, X0+boxH, Y0-boxV );
-                            node = gfx_new_line(im->canvas,
-                                                X0,Y0-boxV,
-                                                X0,Y0,
-                                                1.0,im->graph_col[GRC_FRAME]);
-                            gfx_add_point(node,X0+boxH,Y0);
-                            gfx_add_point(node,X0+boxH,Y0-boxV);
-                            gfx_close_path(node);
-                    }
+            /* im->gdes[i].leg_y is the bottom of the legend */
+            X0 = im->gdes[i].leg_x;
+            Y0 = im->gdes[i].leg_y;
+            gfx_new_text(im->canvas, X0, Y0,
+                         im->graph_col[GRC_FONT],
+                         im->text_prop[TEXT_PROP_LEGEND].font,
+                         im->text_prop[TEXT_PROP_LEGEND].size,
+                         im->tabwidth, 0.0, GFX_H_LEFT, GFX_V_BOTTOM,
+                         im->gdes[i].legend);
+            /* The legend for GRAPH items starts with "M " to have
+               enough space for the box */
+            if (im->gdes[i].gf != GF_PRINT &&
+                im->gdes[i].gf != GF_GPRINT && im->gdes[i].gf != GF_COMMENT) {
+                int       boxH, boxV;
+
+                boxH = gfx_get_text_width(im->canvas, 0,
+                                          im->text_prop[TEXT_PROP_LEGEND].
+                                          font,
+                                          im->text_prop[TEXT_PROP_LEGEND].
+                                          size, im->tabwidth, "o", 0) * 1.2;
+                boxV = boxH * 1.1;
+
+                /* make sure transparent colors show up the same way as in the graph */
+                node = gfx_new_area(im->canvas,
+                                    X0, Y0 - boxV,
+                                    X0, Y0,
+                                    X0 + boxH, Y0, im->graph_col[GRC_BACK]);
+                gfx_add_point(node, X0 + boxH, Y0 - boxV);
+
+                node = gfx_new_area(im->canvas,
+                                    X0, Y0 - boxV,
+                                    X0, Y0, X0 + boxH, Y0, im->gdes[i].col);
+                gfx_add_point(node, X0 + boxH, Y0 - boxV);
+                node = gfx_new_line(im->canvas,
+                                    X0, Y0 - boxV,
+                                    X0, Y0, 1.0, im->graph_col[GRC_FRAME]);
+                gfx_add_point(node, X0 + boxH, Y0);
+                gfx_add_point(node, X0 + boxH, Y0 - boxV);
+                gfx_close_path(node);
             }
+        }
     }
 }
 
@@ -2279,175 +2457,175 @@ grid_paint(image_desc_t   *im)
  * lazy check make sure we rely need to create this graph
  *****************************************************/
 
-int lazy_check(image_desc_t *im){
-    FILE *fd = NULL;
-        int size = 1;
-    struct stat  imgstat;
-    
-    if (im->lazy == 0) return 0; /* no lazy option */
-    if (stat(im->graphfile,&imgstat) != 0) 
-      return 0; /* can't stat */
+int lazy_check(
+    image_desc_t * im)
+{
+    FILE     *fd = NULL;
+    int       size = 1;
+    struct stat imgstat;
+
+    if (im->lazy == 0)
+        return 0;       /* no lazy option */
+    if (stat(im->graphfile, &imgstat) != 0)
+        return 0;       /* can't stat */
     /* one pixel in the existing graph is more then what we would
        change here ... */
-    if (time(NULL) - imgstat.st_mtime > 
-        (im->end - im->start) / im->xsize) 
-      return 0;
-    if ((fd = fopen(im->graphfile,"rb")) == NULL) 
-      return 0; /* the file does not exist */
+    if (time(NULL) - imgstat.st_mtime > (im->end - im->start) / im->xsize)
+        return 0;
+    if ((fd = fopen(im->graphfile, "rb")) == NULL)
+        return 0;       /* the file does not exist */
     switch (im->canvas->imgformat) {
     case IF_PNG:
-           size = PngSize(fd,&(im->ximg),&(im->yimg));
-           break;
+        size = PngSize(fd, &(im->ximg), &(im->yimg));
+        break;
     default:
-           size = 1;
+        size = 1;
     }
     fclose(fd);
     return size;
 }
 
 #ifdef WITH_PIECHART
-void
-pie_part(image_desc_t *im, gfx_color_t color,
-            double PieCenterX, double PieCenterY, double Radius,
-            double startangle, double endangle)
+void pie_part(
+    image_desc_t * im,
+    gfx_color_t color,
+    double PieCenterX,
+    double PieCenterY,
+    double Radius,
+    double startangle,
+    double endangle)
 {
     gfx_node_t *node;
-    double angle;
-    double step=M_PI/50; /* Number of iterations for the circle;
-                         ** 10 is definitely too low, more than
-                         ** 50 seems to be overkill
-                         */
+    double    angle;
+    double    step = M_PI / 50; /* Number of iterations for the circle;
+                                 ** 10 is definitely too low, more than
+                                 ** 50 seems to be overkill
+                                 */
 
     /* Strange but true: we have to work clockwise or else
-    ** anti aliasing nor transparency don't work.
-    **
-    ** This test is here to make sure we do it right, also
-    ** this makes the for...next loop more easy to implement.
-    ** The return will occur if the user enters a negative number
-    ** (which shouldn't be done according to the specs) or if the
-    ** programmers do something wrong (which, as we all know, never
-    ** happens anyway :)
-    */
-    if (endangle<startangle) return;
+     ** anti aliasing nor transparency don't work.
+     **
+     ** This test is here to make sure we do it right, also
+     ** this makes the for...next loop more easy to implement.
+     ** The return will occur if the user enters a negative number
+     ** (which shouldn't be done according to the specs) or if the
+     ** programmers do something wrong (which, as we all know, never
+     ** happens anyway :)
+     */
+    if (endangle < startangle)
+        return;
 
     /* Hidden feature: Radius decreases each full circle */
-    angle=startangle;
-    while (angle>=2*M_PI) {
-        angle  -= 2*M_PI;
+    angle = startangle;
+    while (angle >= 2 * M_PI) {
+        angle -= 2 * M_PI;
         Radius *= 0.8;
     }
 
-    node=gfx_new_area(im->canvas,
-                PieCenterX+sin(startangle)*Radius,
-                PieCenterY-cos(startangle)*Radius,
-                PieCenterX,
-                PieCenterY,
-                PieCenterX+sin(endangle)*Radius,
-                PieCenterY-cos(endangle)*Radius,
-                color);
-    for (angle=endangle;angle-startangle>=step;angle-=step) {
+    node = gfx_new_area(im->canvas,
+                        PieCenterX + sin(startangle) * Radius,
+                        PieCenterY - cos(startangle) * Radius,
+                        PieCenterX,
+                        PieCenterY,
+                        PieCenterX + sin(endangle) * Radius,
+                        PieCenterY - cos(endangle) * Radius, color);
+    for (angle = endangle; angle - startangle >= step; angle -= step) {
         gfx_add_point(node,
-                PieCenterX+sin(angle)*Radius,
-                PieCenterY-cos(angle)*Radius );
+                      PieCenterX + sin(angle) * Radius,
+                      PieCenterY - cos(angle) * Radius);
     }
 }
 
 #endif
 
-int
-graph_size_location(image_desc_t *im, int elements
-
+int graph_size_location(
+    image_desc_t * im,
+    int elements
 #ifdef WITH_PIECHART
-, int piechart
+    ,
+    int piechart
 #endif
-
- )
+    )
 {
     /* The actual size of the image to draw is determined from
-    ** several sources.  The size given on the command line is
-    ** the graph area but we need more as we have to draw labels
-    ** and other things outside the graph area
-    */
+     ** several sources.  The size given on the command line is
+     ** the graph area but we need more as we have to draw labels
+     ** and other things outside the graph area
+     */
 
     /* +-+-------------------------------------------+
-    ** |l|.................title.....................|
-    ** |e+--+-------------------------------+--------+
-    ** |b| b|                               |        |
-    ** |a| a|                               |  pie   |
-    ** |l| l|          main graph area      | chart  |
-    ** |.| .|                               |  area  |
-    ** |t| y|                               |        |
-    ** |r+--+-------------------------------+--------+
-    ** |e|  | x-axis labels                 |        |
-    ** |v+--+-------------------------------+--------+
-    ** | |..............legends......................|
-    ** +-+-------------------------------------------+
-    ** |                 watermark                   |
-    ** +---------------------------------------------+
-    */
-    int Xvertical=0,        
-                        Ytitle   =0,
-        Xylabel  =0,        
-        Xmain    =0,        Ymain    =0,
+     ** |l|.................title.....................|
+     ** |e+--+-------------------------------+--------+
+     ** |b| b|                               |        |
+     ** |a| a|                               |  pie   |
+     ** |l| l|          main graph area      | chart  |
+     ** |.| .|                               |  area  |
+     ** |t| y|                               |        |
+     ** |r+--+-------------------------------+--------+
+     ** |e|  | x-axis labels                 |        |
+     ** |v+--+-------------------------------+--------+
+     ** | |..............legends......................|
+     ** +-+-------------------------------------------+
+     ** |                 watermark                   |
+     ** +---------------------------------------------+
+     */
+    int       Xvertical = 0, Ytitle = 0, Xylabel = 0, Xmain = 0, Ymain = 0,
 #ifdef WITH_PIECHART
-        Xpie     =0,        Ypie     =0,
+        Xpie = 0, Ypie = 0,
 #endif
-                        Yxlabel  =0,
+        Yxlabel = 0,
 #if 0
-        Xlegend  =0,        Ylegend  =0,
+        Xlegend = 0, Ylegend = 0,
 #endif
-        Xspacing =15,  Yspacing =15,
-       
-                      Ywatermark =4;
+        Xspacing = 15, Yspacing = 15, Ywatermark = 4;
 
     if (im->extra_flags & ONLY_GRAPH) {
-        im->xorigin =0;
+        im->xorigin = 0;
         im->ximg = im->xsize;
         im->yimg = im->ysize;
         im->yorigin = im->ysize;
-        ytr(im,DNAN); 
+        ytr(im, DNAN);
         return 0;
     }
 
-    if (im->ylegend[0] != '\0' ) {
-           Xvertical = im->text_prop[TEXT_PROP_UNIT].size *2;
+    if (im->ylegend[0] != '\0') {
+        Xvertical = im->text_prop[TEXT_PROP_UNIT].size * 2;
     }
 
 
     if (im->title[0] != '\0') {
         /* The title is placed "inbetween" two text lines so it
-        ** automatically has some vertical spacing.  The horizontal
-        ** spacing is added here, on each side.
-        */
+         ** automatically has some vertical spacing.  The horizontal
+         ** spacing is added here, on each side.
+         */
         /* don't care for the with of the title
-                Xtitle = gfx_get_text_width(im->canvas, 0,
-                im->text_prop[TEXT_PROP_TITLE].font,
-                im->text_prop[TEXT_PROP_TITLE].size,
-                im->tabwidth,
-                im->title, 0) + 2*Xspacing; */
-        Ytitle = im->text_prop[TEXT_PROP_TITLE].size*2.6+10;
+           Xtitle = gfx_get_text_width(im->canvas, 0,
+           im->text_prop[TEXT_PROP_TITLE].font,
+           im->text_prop[TEXT_PROP_TITLE].size,
+           im->tabwidth,
+           im->title, 0) + 2*Xspacing; */
+        Ytitle = im->text_prop[TEXT_PROP_TITLE].size * 2.6 + 10;
     }
 
     if (elements) {
-        Xmain=im->xsize;
-        Ymain=im->ysize;
+        Xmain = im->xsize;
+        Ymain = im->ysize;
         if (im->draw_x_grid) {
-            Yxlabel=im->text_prop[TEXT_PROP_AXIS].size *2.5;
+            Yxlabel = im->text_prop[TEXT_PROP_AXIS].size * 2.5;
         }
-        if (im->draw_y_grid || im->forceleftspace ) {
-            Xylabel=gfx_get_text_width(im->canvas, 0,
-                        im->text_prop[TEXT_PROP_AXIS].font,
-                        im->text_prop[TEXT_PROP_AXIS].size,
-                        im->tabwidth,
-                        "0", 0) * im->unitslength;
+        if (im->draw_y_grid || im->forceleftspace) {
+            Xylabel = gfx_get_text_width(im->canvas, 0,
+                                         im->text_prop[TEXT_PROP_AXIS].font,
+                                         im->text_prop[TEXT_PROP_AXIS].size,
+                                         im->tabwidth,
+                                         "0", 0) * im->unitslength;
         }
     }
-
 #ifdef WITH_PIECHART
     if (piechart) {
-        im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
-        Xpie=im->piesize;
-        Ypie=im->piesize;
+        im->piesize = im->xsize < im->ysize ? im->xsize : im->ysize;
+        Xpie = im->piesize;
+        Ypie = im->piesize;
     }
 #endif
 
@@ -2458,19 +2636,21 @@ graph_size_location(image_desc_t *im, int elements
        pie chart area. */
 
     /* The legend width cannot yet be determined, as a result we
-    ** have problems adjusting the image to it.  For now, we just
-    ** forget about it at all; the legend will have to fit in the
-    ** size already allocated.
-    */
+     ** have problems adjusting the image to it.  For now, we just
+     ** forget about it at all; the legend will have to fit in the
+     ** size already allocated.
+     */
     im->ximg = Xylabel + Xmain + 2 * Xspacing;
 
 #ifdef WITH_PIECHART
-    im->ximg  += Xpie;
+    im->ximg += Xpie;
 #endif
 
-    if (Xmain) im->ximg += Xspacing;
+    if (Xmain)
+        im->ximg += Xspacing;
 #ifdef WITH_PIECHART
-    if (Xpie) im->ximg += Xspacing;
+    if (Xpie)
+        im->ximg += Xspacing;
 #endif
 
     im->xorigin = Xspacing + Xylabel;
@@ -2478,28 +2658,29 @@ graph_size_location(image_desc_t *im, int elements
     /* the length of the title should not influence with width of the graph
        if (Xtitle > im->ximg) im->ximg = Xtitle; */
 
-    if (Xvertical) { /* unit description */
+    if (Xvertical) {    /* unit description */
         im->ximg += Xvertical;
         im->xorigin += Xvertical;
     }
-    xtr(im,0);
+    xtr(im, 0);
 
     /* The vertical size is interesting... we need to compare
-    ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with 
-    ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
-    ** in order to start even thinking about Ylegend or Ywatermark.
-    **
-    ** Do it in three portions: First calculate the inner part,
-    ** then do the legend, then adjust the total height of the img,
-    ** adding space for a watermark if one exists;
-    */
+     ** the sum of {Ytitle, Ymain, Yxlabel, Ylegend, Ywatermark} with 
+     ** Yvertical however we need to know {Ytitle+Ymain+Yxlabel}
+     ** in order to start even thinking about Ylegend or Ywatermark.
+     **
+     ** Do it in three portions: First calculate the inner part,
+     ** then do the legend, then adjust the total height of the img,
+     ** adding space for a watermark if one exists;
+     */
 
     /* reserve space for main and/or pie */
 
     im->yimg = Ymain + Yxlabel;
-    
+
 #ifdef WITH_PIECHART
-    if (im->yimg < Ypie) im->yimg = Ypie;
+    if (im->yimg < Ypie)
+        im->yimg = Ypie;
 #endif
 
     im->yorigin = im->yimg - Yxlabel;
@@ -2509,22 +2690,21 @@ graph_size_location(image_desc_t *im, int elements
         im->yimg += Ytitle;
         im->yorigin += Ytitle;
     } else {
-        im->yimg += 1.5*Yspacing;
-        im->yorigin += 1.5*Yspacing;
+        im->yimg += 1.5 * Yspacing;
+        im->yorigin += 1.5 * Yspacing;
     }
     /* reserve space for padding below the graph */
     im->yimg += Yspacing;
-     
+
     /* Determine where to place the legends onto the image.
-    ** Adjust im->yimg to match the space requirements.
-    */
-    if(leg_place(im)==-1)
+     ** Adjust im->yimg to match the space requirements.
+     */
+    if (leg_place(im) == -1)
         return -1;
-        
+
     if (im->watermark[0] != '\0') {
         im->yimg += Ywatermark;
     }
-
 #if 0
     if (Xlegend > im->ximg) {
         im->ximg = Xlegend;
@@ -2534,420 +2714,474 @@ graph_size_location(image_desc_t *im, int elements
 
 #ifdef WITH_PIECHART
     /* The pie is placed in the upper right hand corner,
-    ** just below the title (if any) and with sufficient
-    ** padding.
-    */
+     ** just below the title (if any) and with sufficient
+     ** padding.
+     */
     if (elements) {
-        im->pie_x = im->ximg - Xspacing - Xpie/2;
-        im->pie_y = im->yorigin-Ymain+Ypie/2;
+        im->pie_x = im->ximg - Xspacing - Xpie / 2;
+        im->pie_y = im->yorigin - Ymain + Ypie / 2;
     } else {
-        im->pie_x = im->ximg/2;
-        im->pie_y = im->yorigin-Ypie/2;
+        im->pie_x = im->ximg / 2;
+        im->pie_y = im->yorigin - Ypie / 2;
     }
 #endif
 
-    ytr(im,DNAN);
+    ytr(im, DNAN);
     return 0;
 }
 
 /* from http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm */
 /* yes we are loosing precision by doing tos with floats instead of doubles
    but it seems more stable this way. */
-   
+
 
 /* draw that picture thing ... */
-int
-graph_paint(image_desc_t *im, char ***calcpr)
+int graph_paint(
+    image_desc_t * im,
+    char ***calcpr)
 {
-  int i,ii;
-  int lazy =     lazy_check(im);
+    int       i, ii;
+    int       lazy = lazy_check(im);
+
 #ifdef WITH_PIECHART
-  int piechart = 0;
-  double PieStart=0.0;
+    int       piechart = 0;
+    double    PieStart = 0.0;
 #endif
-  FILE  *fo;
-  gfx_node_t *node;
-  
-  double areazero = 0.0;
-  graph_desc_t *lastgdes = NULL;    
-
-  /* if we are lazy and there is nothing to PRINT ... quit now */
-  if (lazy && im->prt_c==0) return 0;
-
-  /* pull the data from the rrd files ... */
-  
-  if(data_fetch(im)==-1)
-    return -1;
+    FILE     *fo;
+    gfx_node_t *node;
 
-  /* evaluate VDEF and CDEF operations ... */
-  if(data_calc(im)==-1)
-    return -1;
+    double    areazero = 0.0;
+    graph_desc_t *lastgdes = NULL;
+
+    /* if we are lazy and there is nothing to PRINT ... quit now */
+    if (lazy && im->prt_c == 0)
+        return 0;
+
+    /* pull the data from the rrd files ... */
+
+    if (data_fetch(im) == -1)
+        return -1;
 
-#ifdef WITH_PIECHART  
-  /* check if we need to draw a piechart */
-  for(i=0;i<im->gdes_c;i++){
-    if (im->gdes[i].gf == GF_PART) {
-      piechart=1;
-      break;
+    /* evaluate VDEF and CDEF operations ... */
+    if (data_calc(im) == -1)
+        return -1;
+
+#ifdef WITH_PIECHART
+    /* check if we need to draw a piechart */
+    for (i = 0; i < im->gdes_c; i++) {
+        if (im->gdes[i].gf == GF_PART) {
+            piechart = 1;
+            break;
+        }
     }
-  }
 #endif
 
-  /* calculate and PRINT and GPRINT definitions. We have to do it at
-   * this point because it will affect the length of the legends
-   * if there are no graph elements we stop here ... 
-   * if we are lazy, try to quit ... 
-   */
-  i=print_calc(im,calcpr);
-  if(i<0) return -1;
-  if(((i==0)
+    /* calculate and PRINT and GPRINT definitions. We have to do it at
+     * this point because it will affect the length of the legends
+     * if there are no graph elements we stop here ... 
+     * if we are lazy, try to quit ... 
+     */
+    i = print_calc(im, calcpr);
+    if (i < 0)
+        return -1;
+    if (((i == 0)
 #ifdef WITH_PIECHART
-&&(piechart==0)
+         && (piechart == 0)
 #endif
-) || lazy) return 0;
+        ) || lazy)
+        return 0;
 
 #ifdef WITH_PIECHART
-  /* If there's only the pie chart to draw, signal this */
-  if (i==0) piechart=2;
+    /* If there's only the pie chart to draw, signal this */
+    if (i == 0)
+        piechart = 2;
 #endif
-  
-  /* get actual drawing data and find min and max values*/
-  if(data_proc(im)==-1)
-    return -1;
-  
-  if(!im->logarithmic){si_unit(im);}        /* identify si magnitude Kilo, Mega Giga ? */
-  
-  if(!im->rigid && ! im->logarithmic)
-    expand_range(im);   /* make sure the upper and lower limit are
-                           sensible values */
-
-  if (!calc_horizontal_grid(im))
-    return -1;
 
-  if (im->gridfit)
-    apply_gridfit(im);
+    /* get actual drawing data and find min and max values */
+    if (data_proc(im) == -1)
+        return -1;
+
+    if (!im->logarithmic) {
+        si_unit(im);
+    }
+    /* identify si magnitude Kilo, Mega Giga ? */
+    if (!im->rigid && !im->logarithmic)
+        expand_range(im);   /* make sure the upper and lower limit are
+                               sensible values */
+
+    if (!calc_horizontal_grid(im))
+        return -1;
+
+    if (im->gridfit)
+        apply_gridfit(im);
 
 
 /**************************************************************
  *** Calculating sizes and locations became a bit confusing ***
  *** so I moved this into a separate function.              ***
  **************************************************************/
-  if(graph_size_location(im,i
+    if (graph_size_location(im, i
 #ifdef WITH_PIECHART
-,piechart
+                            , piechart
 #endif
-)==-1)
-    return -1;
+        ) == -1)
+        return -1;
+
+    /* the actual graph is created by going through the individual
+       graph elements and then drawing them */
 
-  /* the actual graph is created by going through the individual
-     graph elements and then drawing them */
-  
-  node=gfx_new_area ( im->canvas,
-                      0, 0,
-                      0, im->yimg,
-                      im->ximg, im->yimg,                      
-                      im->graph_col[GRC_BACK]);
+    node = gfx_new_area(im->canvas,
+                        0, 0,
+                        0, im->yimg,
+                        im->ximg, im->yimg, im->graph_col[GRC_BACK]);
 
-  gfx_add_point(node,im->ximg, 0);
+    gfx_add_point(node, im->ximg, 0);
 
 #ifdef WITH_PIECHART
-  if (piechart != 2) {
+    if (piechart != 2) {
 #endif
-    node=gfx_new_area ( im->canvas,
-                      im->xorigin,             im->yorigin, 
-                      im->xorigin + im->xsize, im->yorigin,
-                      im->xorigin + im->xsize, im->yorigin-im->ysize,
-                      im->graph_col[GRC_CANVAS]);
-  
-    gfx_add_point(node,im->xorigin, im->yorigin - im->ysize);
-
-    if (im->minval > 0.0)
-      areazero = im->minval;
-    if (im->maxval < 0.0)
-      areazero = im->maxval;
+        node = gfx_new_area(im->canvas,
+                            im->xorigin, im->yorigin,
+                            im->xorigin + im->xsize, im->yorigin,
+                            im->xorigin + im->xsize, im->yorigin - im->ysize,
+                            im->graph_col[GRC_CANVAS]);
+
+        gfx_add_point(node, im->xorigin, im->yorigin - im->ysize);
+
+        if (im->minval > 0.0)
+            areazero = im->minval;
+        if (im->maxval < 0.0)
+            areazero = im->maxval;
 #ifdef WITH_PIECHART
-   }
+    }
 #endif
 
 #ifdef WITH_PIECHART
-  if (piechart) {
-    pie_part(im,im->graph_col[GRC_CANVAS],im->pie_x,im->pie_y,im->piesize*0.5,0,2*M_PI);
-  }
+    if (piechart) {
+        pie_part(im, im->graph_col[GRC_CANVAS], im->pie_x, im->pie_y,
+                 im->piesize * 0.5, 0, 2 * M_PI);
+    }
 #endif
 
-  for(i=0;i<im->gdes_c;i++){
-    switch(im->gdes[i].gf){
-    case GF_CDEF:
-    case GF_VDEF:
-    case GF_DEF:
-    case GF_PRINT:
-    case GF_GPRINT:
-    case GF_COMMENT:
-    case GF_HRULE:
-    case GF_VRULE:
-    case GF_XPORT:
-    case GF_SHIFT:
-      break;
-    case GF_TICK:
-      for (ii = 0; ii < im->xsize; ii++)
-        {
-          if (!isnan(im->gdes[i].p_data[ii]) && 
-              im->gdes[i].p_data[ii] != 0.0)
-           { 
-              if (im -> gdes[i].yrule > 0 ) {
-                      gfx_new_line(im->canvas,
-                                   im -> xorigin + ii, im->yorigin,
-                                   im -> xorigin + ii, im->yorigin - im -> gdes[i].yrule * im -> ysize,
-                                   1.0,
-                                   im -> gdes[i].col );
-              } else if ( im -> gdes[i].yrule < 0 ) {
-                      gfx_new_line(im->canvas,
-                                   im -> xorigin + ii, im->yorigin - im -> ysize,
-                                   im -> xorigin + ii, im->yorigin - ( 1 - im -> gdes[i].yrule ) * im -> ysize,
-                                   1.0,
-                                   im -> gdes[i].col );
-              
-              }
-           }
-        }
-      break;
-    case GF_LINE:
-    case GF_AREA:
-      /* fix data points at oo and -oo */
-      for(ii=0;ii<im->xsize;ii++){
-        if (isinf(im->gdes[i].p_data[ii])){
-          if (im->gdes[i].p_data[ii] > 0) {
-            im->gdes[i].p_data[ii] = im->maxval ;
-          } else {
-            im->gdes[i].p_data[ii] = im->minval ;
-          }                 
-          
-        }
-      } /* for */
-
-      /* *******************************************************
-       a           ___. (a,t) 
-                    |   |    ___
-              ____|   |   |   |
-              |       |___|
-       -------|--t-1--t--------------------------------      
-                      
-      if we know the value at time t was a then 
-      we draw a square from t-1 to t with the value a.
-
-      ********************************************************* */
-      if (im->gdes[i].col != 0x0){   
-        /* GF_LINE and friend */
-        if(im->gdes[i].gf == GF_LINE ){
-          double last_y=0.0;
-          node = NULL;
-          for(ii=1;ii<im->xsize;ii++){
-            if (isnan(im->gdes[i].p_data[ii]) || (im->slopemode==1 && isnan(im->gdes[i].p_data[ii-1]))){
-                node = NULL;
-                continue;
-            }
-            if ( node == NULL ) {
-                     last_y = ytr(im,im->gdes[i].p_data[ii]);
-                if ( im->slopemode == 0 ){
-                  node = gfx_new_line(im->canvas,
-                                    ii-1+im->xorigin,last_y,
-                                    ii+im->xorigin,last_y,
-                                    im->gdes[i].linewidth,
-                                    im->gdes[i].col);
-                } else {
-                  node = gfx_new_line(im->canvas,
-                                    ii-1+im->xorigin,ytr(im,im->gdes[i].p_data[ii-1]),
-                                    ii+im->xorigin,last_y,
-                                    im->gdes[i].linewidth,
-                                    im->gdes[i].col);
+    for (i = 0; i < im->gdes_c; i++) {
+        switch (im->gdes[i].gf) {
+        case GF_CDEF:
+        case GF_VDEF:
+        case GF_DEF:
+        case GF_PRINT:
+        case GF_GPRINT:
+        case GF_COMMENT:
+        case GF_HRULE:
+        case GF_VRULE:
+        case GF_XPORT:
+        case GF_SHIFT:
+            break;
+        case GF_TICK:
+            for (ii = 0; ii < im->xsize; ii++) {
+                if (!isnan(im->gdes[i].p_data[ii]) &&
+                    im->gdes[i].p_data[ii] != 0.0) {
+                    if (im->gdes[i].yrule > 0) {
+                        gfx_new_line(im->canvas,
+                                     im->xorigin + ii, im->yorigin,
+                                     im->xorigin + ii,
+                                     im->yorigin -
+                                     im->gdes[i].yrule * im->ysize, 1.0,
+                                     im->gdes[i].col);
+                    } else if (im->gdes[i].yrule < 0) {
+                        gfx_new_line(im->canvas,
+                                     im->xorigin + ii,
+                                     im->yorigin - im->ysize,
+                                     im->xorigin + ii,
+                                     im->yorigin - (1 -
+                                                    im->gdes[i].yrule) *
+                                     im->ysize, 1.0, im->gdes[i].col);
+
+                    }
                 }
-             } else {
-               double new_y = ytr(im,im->gdes[i].p_data[ii]);
-               if ( im->slopemode==0 && ! AlmostEqual2sComplement(new_y,last_y,4)){
-                   gfx_add_point(node,ii-1+im->xorigin,new_y);
-               };
-               last_y = new_y;
-               gfx_add_point(node,ii+im->xorigin,new_y);
-             };
-
-          }
-        } else {
-          int idxI=-1;
-          double *foreY=malloc(sizeof(double)*im->xsize*2);
-          double *foreX=malloc(sizeof(double)*im->xsize*2);
-          double *backY=malloc(sizeof(double)*im->xsize*2);
-          double *backX=malloc(sizeof(double)*im->xsize*2);
-          int drawem = 0;
-          for(ii=0;ii<=im->xsize;ii++){
-            double ybase,ytop;
-            if ( idxI > 0 && ( drawem != 0 || ii==im->xsize)){
-               int cntI=1;
-               int lastI=0;
-               while (cntI < idxI && AlmostEqual2sComplement(foreY[lastI],foreY[cntI],4) && AlmostEqual2sComplement(foreY[lastI],foreY[cntI+1],4)){cntI++;}
-               node = gfx_new_area(im->canvas,
-                                backX[0],backY[0],
-                                foreX[0],foreY[0],
-                                foreX[cntI],foreY[cntI], im->gdes[i].col);
-               while (cntI < idxI) {
-                 lastI = cntI;
-                 cntI++;
-                 while ( cntI < idxI && AlmostEqual2sComplement(foreY[lastI],foreY[cntI],4) && AlmostEqual2sComplement(foreY[lastI],foreY[cntI+1],4)){cntI++;} 
-                 gfx_add_point(node,foreX[cntI],foreY[cntI]);
-               }
-               gfx_add_point(node,backX[idxI],backY[idxI]);
-               while (idxI > 1){
-                 lastI = idxI;
-                 idxI--;
-                 while ( idxI > 1 && AlmostEqual2sComplement(backY[lastI], backY[idxI],4) && AlmostEqual2sComplement(backY[lastI],backY[idxI-1],4)){idxI--;} 
-                 gfx_add_point(node,backX[idxI],backY[idxI]);
-               }
-               idxI=-1;
-               drawem = 0;
-            }
-            if (drawem != 0){
-              drawem = 0;
-              idxI=-1;
             }
-            if (ii == im->xsize) break;
-            
-            /* keep things simple for now, just draw these bars
-               do not try to build a big and complex area */
+            break;
+        case GF_LINE:
+        case GF_AREA:
+            /* fix data points at oo and -oo */
+            for (ii = 0; ii < im->xsize; ii++) {
+                if (isinf(im->gdes[i].p_data[ii])) {
+                    if (im->gdes[i].p_data[ii] > 0) {
+                        im->gdes[i].p_data[ii] = im->maxval;
+                    } else {
+                        im->gdes[i].p_data[ii] = im->minval;
+                    }
 
-                                                               
-            if ( im->slopemode == 0 && ii==0){
-                continue;
-            }
-            if ( isnan(im->gdes[i].p_data[ii]) ) {
-                drawem = 1;
-                continue;
-            }
-            ytop = ytr(im,im->gdes[i].p_data[ii]);
-             if ( lastgdes && im->gdes[i].stack ) {
-                  ybase = ytr(im,lastgdes->p_data[ii]);
-            } else {
-                  ybase = ytr(im,areazero);
-            }
-            if ( ybase == ytop ){
-                drawem = 1;
-                continue;        
-            }
-            /* every area has to be wound clock-wise,
-               so we have to make sur base remains base  */                
-            if (ybase > ytop){
-                double extra = ytop;
-                ytop = ybase;
-                ybase = extra;
+                }
+            }           /* for */
+
+            /* *******************************************************
+               a           ___. (a,t) 
+               |   |    ___
+               ____|   |   |   |
+               |       |___|
+               -------|--t-1--t--------------------------------      
+
+               if we know the value at time t was a then 
+               we draw a square from t-1 to t with the value a.
+
+               ********************************************************* */
+            if (im->gdes[i].col != 0x0) {
+                /* GF_LINE and friend */
+                if (im->gdes[i].gf == GF_LINE) {
+                    double    last_y = 0.0;
+
+                    node = NULL;
+                    for (ii = 1; ii < im->xsize; ii++) {
+                        if (isnan(im->gdes[i].p_data[ii])
+                            || (im->slopemode == 1
+                                && isnan(im->gdes[i].p_data[ii - 1]))) {
+                            node = NULL;
+                            continue;
+                        }
+                        if (node == NULL) {
+                            last_y = ytr(im, im->gdes[i].p_data[ii]);
+                            if (im->slopemode == 0) {
+                                node = gfx_new_line(im->canvas,
+                                                    ii - 1 + im->xorigin,
+                                                    last_y, ii + im->xorigin,
+                                                    last_y,
+                                                    im->gdes[i].linewidth,
+                                                    im->gdes[i].col);
+                            } else {
+                                node = gfx_new_line(im->canvas,
+                                                    ii - 1 + im->xorigin,
+                                                    ytr(im,
+                                                        im->gdes[i].
+                                                        p_data[ii - 1]),
+                                                    ii + im->xorigin, last_y,
+                                                    im->gdes[i].linewidth,
+                                                    im->gdes[i].col);
+                            }
+                        } else {
+                            double    new_y = ytr(im, im->gdes[i].p_data[ii]);
+
+                            if (im->slopemode == 0
+                                && !AlmostEqual2sComplement(new_y, last_y,
+                                                            4)) {
+                                gfx_add_point(node, ii - 1 + im->xorigin,
+                                              new_y);
+                            };
+                            last_y = new_y;
+                            gfx_add_point(node, ii + im->xorigin, new_y);
+                        };
+
+                    }
+                } else {
+                    int       idxI = -1;
+                    double   *foreY = malloc(sizeof(double) * im->xsize * 2);
+                    double   *foreX = malloc(sizeof(double) * im->xsize * 2);
+                    double   *backY = malloc(sizeof(double) * im->xsize * 2);
+                    double   *backX = malloc(sizeof(double) * im->xsize * 2);
+                    int       drawem = 0;
+
+                    for (ii = 0; ii <= im->xsize; ii++) {
+                        double    ybase, ytop;
+
+                        if (idxI > 0 && (drawem != 0 || ii == im->xsize)) {
+                            int       cntI = 1;
+                            int       lastI = 0;
+
+                            while (cntI < idxI
+                                   && AlmostEqual2sComplement(foreY[lastI],
+                                                              foreY[cntI], 4)
+                                   && AlmostEqual2sComplement(foreY[lastI],
+                                                              foreY[cntI + 1],
+                                                              4)) {
+                                cntI++;
+                            }
+                            node = gfx_new_area(im->canvas,
+                                                backX[0], backY[0],
+                                                foreX[0], foreY[0],
+                                                foreX[cntI], foreY[cntI],
+                                                im->gdes[i].col);
+                            while (cntI < idxI) {
+                                lastI = cntI;
+                                cntI++;
+                                while (cntI < idxI
+                                       &&
+                                       AlmostEqual2sComplement(foreY[lastI],
+                                                               foreY[cntI], 4)
+                                       &&
+                                       AlmostEqual2sComplement(foreY[lastI],
+                                                               foreY[cntI +
+                                                                     1], 4)) {
+                                    cntI++;
+                                }
+                                gfx_add_point(node, foreX[cntI], foreY[cntI]);
+                            }
+                            gfx_add_point(node, backX[idxI], backY[idxI]);
+                            while (idxI > 1) {
+                                lastI = idxI;
+                                idxI--;
+                                while (idxI > 1
+                                       &&
+                                       AlmostEqual2sComplement(backY[lastI],
+                                                               backY[idxI], 4)
+                                       &&
+                                       AlmostEqual2sComplement(backY[lastI],
+                                                               backY[idxI -
+                                                                     1], 4)) {
+                                    idxI--;
+                                }
+                                gfx_add_point(node, backX[idxI], backY[idxI]);
+                            }
+                            idxI = -1;
+                            drawem = 0;
+                        }
+                        if (drawem != 0) {
+                            drawem = 0;
+                            idxI = -1;
+                        }
+                        if (ii == im->xsize)
+                            break;
+
+                        /* keep things simple for now, just draw these bars
+                           do not try to build a big and complex area */
+
+
+                        if (im->slopemode == 0 && ii == 0) {
+                            continue;
+                        }
+                        if (isnan(im->gdes[i].p_data[ii])) {
+                            drawem = 1;
+                            continue;
+                        }
+                        ytop = ytr(im, im->gdes[i].p_data[ii]);
+                        if (lastgdes && im->gdes[i].stack) {
+                            ybase = ytr(im, lastgdes->p_data[ii]);
+                        } else {
+                            ybase = ytr(im, areazero);
+                        }
+                        if (ybase == ytop) {
+                            drawem = 1;
+                            continue;
+                        }
+                        /* every area has to be wound clock-wise,
+                           so we have to make sur base remains base  */
+                        if (ybase > ytop) {
+                            double    extra = ytop;
+
+                            ytop = ybase;
+                            ybase = extra;
+                        }
+                        if (im->slopemode == 0) {
+                            backY[++idxI] = ybase - 0.2;
+                            backX[idxI] = ii + im->xorigin - 1;
+                            foreY[idxI] = ytop + 0.2;
+                            foreX[idxI] = ii + im->xorigin - 1;
+                        }
+                        backY[++idxI] = ybase - 0.2;
+                        backX[idxI] = ii + im->xorigin;
+                        foreY[idxI] = ytop + 0.2;
+                        foreX[idxI] = ii + im->xorigin;
+                    }
+                    /* close up any remaining area */
+                    free(foreY);
+                    free(foreX);
+                    free(backY);
+                    free(backX);
+                }       /* else GF_LINE */
             }
-            if ( im->slopemode == 0 ){
-                    backY[++idxI] = ybase-0.2;
-                    backX[idxI] = ii+im->xorigin-1;
-                    foreY[idxI] = ytop+0.2;
-                    foreX[idxI] = ii+im->xorigin-1;
+            /* if color != 0x0 */
+            /* make sure we do not run into trouble when stacking on NaN */
+            for (ii = 0; ii < im->xsize; ii++) {
+                if (isnan(im->gdes[i].p_data[ii])) {
+                    if (lastgdes && (im->gdes[i].stack)) {
+                        im->gdes[i].p_data[ii] = lastgdes->p_data[ii];
+                    } else {
+                        im->gdes[i].p_data[ii] = areazero;
+                    }
+                }
             }
-            backY[++idxI] = ybase-0.2;
-            backX[idxI] = ii+im->xorigin;
-            foreY[idxI] = ytop+0.2;
-            foreX[idxI] = ii+im->xorigin;
-          }
-          /* close up any remaining area */             
-          free(foreY);
-          free(foreX);
-          free(backY);
-          free(backX);
-        } /* else GF_LINE */
-      } /* if color != 0x0 */
-      /* make sure we do not run into trouble when stacking on NaN */
-      for(ii=0;ii<im->xsize;ii++){
-        if (isnan(im->gdes[i].p_data[ii])) {
-          if (lastgdes && (im->gdes[i].stack)) {
-            im->gdes[i].p_data[ii] = lastgdes->p_data[ii];
-          } else {
-            im->gdes[i].p_data[ii] = areazero;
-          }
-        }
-      } 
-      lastgdes = &(im->gdes[i]);                         
-      break;
+            lastgdes = &(im->gdes[i]);
+            break;
 #ifdef WITH_PIECHART
-    case GF_PART:
-      if(isnan(im->gdes[i].yrule)) /* fetch variable */
-        im->gdes[i].yrule = im->gdes[im->gdes[i].vidx].vf.val;
-     
-      if (finite(im->gdes[i].yrule)) {        /* even the fetched var can be NaN */
-        pie_part(im,im->gdes[i].col,
-                im->pie_x,im->pie_y,im->piesize*0.4,
-                M_PI*2.0*PieStart/100.0,
-                M_PI*2.0*(PieStart+im->gdes[i].yrule)/100.0);
-        PieStart += im->gdes[i].yrule;
-      }
-      break;
+        case GF_PART:
+            if (isnan(im->gdes[i].yrule))   /* fetch variable */
+                im->gdes[i].yrule = im->gdes[im->gdes[i].vidx].vf.val;
+
+            if (finite(im->gdes[i].yrule)) {    /* even the fetched var can be NaN */
+                pie_part(im, im->gdes[i].col,
+                         im->pie_x, im->pie_y, im->piesize * 0.4,
+                         M_PI * 2.0 * PieStart / 100.0,
+                         M_PI * 2.0 * (PieStart + im->gdes[i].yrule) / 100.0);
+                PieStart += im->gdes[i].yrule;
+            }
+            break;
 #endif
-    case GF_STACK:
-      rrd_set_error("STACK should already be turned into LINE or AREA here");
-      return -1;
-      break;
-        
-    } /* switch */
-  }
+        case GF_STACK:
+            rrd_set_error
+                ("STACK should already be turned into LINE or AREA here");
+            return -1;
+            break;
+
+        }               /* switch */
+    }
 #ifdef WITH_PIECHART
-  if (piechart==2) {
-    im->draw_x_grid=0;
-    im->draw_y_grid=0;
-  }
+    if (piechart == 2) {
+        im->draw_x_grid = 0;
+        im->draw_y_grid = 0;
+    }
 #endif
 
 
-  /* grid_paint also does the text */
-  if( !(im->extra_flags & ONLY_GRAPH) )  
-    grid_paint(im);
-
-  
-  if( !(im->extra_flags & ONLY_GRAPH) )  
-      axis_paint(im);
-  
-  /* the RULES are the last thing to paint ... */
-  for(i=0;i<im->gdes_c;i++){    
-    
-    switch(im->gdes[i].gf){
-    case GF_HRULE:
-      if(im->gdes[i].yrule >= im->minval
-         && im->gdes[i].yrule <= im->maxval)
-        gfx_new_line(im->canvas,
-                     im->xorigin,ytr(im,im->gdes[i].yrule),
-                     im->xorigin+im->xsize,ytr(im,im->gdes[i].yrule),
-                     1.0,im->gdes[i].col); 
-      break;
-    case GF_VRULE:
-      if(im->gdes[i].xrule >= im->start
-         && im->gdes[i].xrule <= im->end)
-        gfx_new_line(im->canvas,
-                     xtr(im,im->gdes[i].xrule),im->yorigin,
-                     xtr(im,im->gdes[i].xrule),im->yorigin-im->ysize,
-                     1.0,im->gdes[i].col); 
-      break;
-    default:
-      break;
+    /* grid_paint also does the text */
+    if (!(im->extra_flags & ONLY_GRAPH))
+        grid_paint(im);
+
+
+    if (!(im->extra_flags & ONLY_GRAPH))
+        axis_paint(im);
+
+    /* the RULES are the last thing to paint ... */
+    for (i = 0; i < im->gdes_c; i++) {
+
+        switch (im->gdes[i].gf) {
+        case GF_HRULE:
+            if (im->gdes[i].yrule >= im->minval
+                && im->gdes[i].yrule <= im->maxval)
+                gfx_new_line(im->canvas,
+                             im->xorigin, ytr(im, im->gdes[i].yrule),
+                             im->xorigin + im->xsize, ytr(im,
+                                                          im->gdes[i].yrule),
+                             1.0, im->gdes[i].col);
+            break;
+        case GF_VRULE:
+            if (im->gdes[i].xrule >= im->start
+                && im->gdes[i].xrule <= im->end)
+                gfx_new_line(im->canvas,
+                             xtr(im, im->gdes[i].xrule), im->yorigin,
+                             xtr(im, im->gdes[i].xrule),
+                             im->yorigin - im->ysize, 1.0, im->gdes[i].col);
+            break;
+        default:
+            break;
+        }
     }
-  }
 
-  
-  if (strcmp(im->graphfile,"-")==0) {
-    fo = im->graphhandle ? im->graphhandle : stdout;
+
+    if (strcmp(im->graphfile, "-") == 0) {
+        fo = im->graphhandle ? im->graphhandle : stdout;
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-    /* Change translation mode for stdout to BINARY */
-    _setmode( _fileno( fo ), O_BINARY );
+        /* Change translation mode for stdout to BINARY */
+        _setmode(_fileno(fo), O_BINARY);
 #endif
-  } else {
-    if ((fo = fopen(im->graphfile,"wb")) == NULL) {
-      rrd_set_error("Opening '%s' for write: %s",im->graphfile,
-                    rrd_strerror(errno));
-      return (-1);
-    }
-  }
-  gfx_render (im->canvas,im->ximg,im->yimg,0x00000000,fo);
-  if (strcmp(im->graphfile,"-") != 0)
-    fclose(fo);
-  return 0;
+    } else {
+        if ((fo = fopen(im->graphfile, "wb")) == NULL) {
+            rrd_set_error("Opening '%s' for write: %s", im->graphfile,
+                          rrd_strerror(errno));
+            return (-1);
+        }
+    }
+    gfx_render(im->canvas, im->ximg, im->yimg, 0x00000000, fo);
+    if (strcmp(im->graphfile, "-") != 0)
+        fclose(fo);
+    return 0;
 }
 
 
@@ -2955,99 +3189,107 @@ graph_paint(image_desc_t *im, char ***calcpr)
  * graph stuff 
  *****************************************************/
 
-int
-gdes_alloc(image_desc_t *im){
+int gdes_alloc(
+    image_desc_t * im)
+{
 
     im->gdes_c++;
     if ((im->gdes = (graph_desc_t *) rrd_realloc(im->gdes, (im->gdes_c)
-                                           * sizeof(graph_desc_t)))==NULL){
+                                                 * sizeof(graph_desc_t))) ==
+        NULL) {
         rrd_set_error("realloc graph_descs");
         return -1;
     }
 
 
-    im->gdes[im->gdes_c-1].step=im->step;
-    im->gdes[im->gdes_c-1].step_orig=im->step;
-    im->gdes[im->gdes_c-1].stack=0;
-    im->gdes[im->gdes_c-1].linewidth=0;
-    im->gdes[im->gdes_c-1].debug=0;
-    im->gdes[im->gdes_c-1].start=im->start; 
-    im->gdes[im->gdes_c-1].start_orig=im->start; 
-    im->gdes[im->gdes_c-1].end=im->end; 
-    im->gdes[im->gdes_c-1].end_orig=im->end; 
-    im->gdes[im->gdes_c-1].vname[0]='\0'; 
-    im->gdes[im->gdes_c-1].data=NULL;
-    im->gdes[im->gdes_c-1].ds_namv=NULL;
-    im->gdes[im->gdes_c-1].data_first=0;
-    im->gdes[im->gdes_c-1].p_data=NULL;
-    im->gdes[im->gdes_c-1].rpnp=NULL;
-    im->gdes[im->gdes_c-1].shift=0;
-    im->gdes[im->gdes_c-1].col = 0x0;
-    im->gdes[im->gdes_c-1].legend[0]='\0';
-    im->gdes[im->gdes_c-1].format[0]='\0';
-    im->gdes[im->gdes_c-1].strftm=0;   
-    im->gdes[im->gdes_c-1].rrd[0]='\0';
-    im->gdes[im->gdes_c-1].ds=-1;    
-    im->gdes[im->gdes_c-1].cf_reduce=CF_AVERAGE;    
-    im->gdes[im->gdes_c-1].cf=CF_AVERAGE;    
-    im->gdes[im->gdes_c-1].p_data=NULL;    
-    im->gdes[im->gdes_c-1].yrule=DNAN;
-    im->gdes[im->gdes_c-1].xrule=0;
+    im->gdes[im->gdes_c - 1].step = im->step;
+    im->gdes[im->gdes_c - 1].step_orig = im->step;
+    im->gdes[im->gdes_c - 1].stack = 0;
+    im->gdes[im->gdes_c - 1].linewidth = 0;
+    im->gdes[im->gdes_c - 1].debug = 0;
+    im->gdes[im->gdes_c - 1].start = im->start;
+    im->gdes[im->gdes_c - 1].start_orig = im->start;
+    im->gdes[im->gdes_c - 1].end = im->end;
+    im->gdes[im->gdes_c - 1].end_orig = im->end;
+    im->gdes[im->gdes_c - 1].vname[0] = '\0';
+    im->gdes[im->gdes_c - 1].data = NULL;
+    im->gdes[im->gdes_c - 1].ds_namv = NULL;
+    im->gdes[im->gdes_c - 1].data_first = 0;
+    im->gdes[im->gdes_c - 1].p_data = NULL;
+    im->gdes[im->gdes_c - 1].rpnp = NULL;
+    im->gdes[im->gdes_c - 1].shift = 0;
+    im->gdes[im->gdes_c - 1].col = 0x0;
+    im->gdes[im->gdes_c - 1].legend[0] = '\0';
+    im->gdes[im->gdes_c - 1].format[0] = '\0';
+    im->gdes[im->gdes_c - 1].strftm = 0;
+    im->gdes[im->gdes_c - 1].rrd[0] = '\0';
+    im->gdes[im->gdes_c - 1].ds = -1;
+    im->gdes[im->gdes_c - 1].cf_reduce = CF_AVERAGE;
+    im->gdes[im->gdes_c - 1].cf = CF_AVERAGE;
+    im->gdes[im->gdes_c - 1].p_data = NULL;
+    im->gdes[im->gdes_c - 1].yrule = DNAN;
+    im->gdes[im->gdes_c - 1].xrule = 0;
     return 0;
 }
 
 /* copies input untill the first unescaped colon is found
    or until input ends. backslashes have to be escaped as well */
-int
-scan_for_col(const char *const input, int len, char *const output)
+int scan_for_col(
+    const char *const input,
+    int len,
+    char *const output)
 {
-    int inp,outp=0;
-    for (inp=0; 
-         inp < len &&
-           input[inp] != ':' &&
-           input[inp] != '\0';
-         inp++){
-      if (input[inp] == '\\' &&
-          input[inp+1] != '\0' && 
-          (input[inp+1] == '\\' ||
-           input[inp+1] == ':')){
-        output[outp++] = input[++inp];
-      }
-      else {
-        output[outp++] = input[inp];
-      }
+    int       inp, outp = 0;
+
+    for (inp = 0; inp < len && input[inp] != ':' && input[inp] != '\0'; inp++) {
+        if (input[inp] == '\\' &&
+            input[inp + 1] != '\0' &&
+            (input[inp + 1] == '\\' || input[inp + 1] == ':')) {
+            output[outp++] = input[++inp];
+        } else {
+            output[outp++] = input[inp];
+        }
     }
     output[outp] = '\0';
     return inp;
 }
+
 /* Some surgery done on this function, it became ridiculously big.
 ** Things moved:
 ** - initializing     now in rrd_graph_init()
 ** - options parsing  now in rrd_graph_options()
 ** - script parsing   now in rrd_graph_script()
 */
-int 
-rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *stream, double *ymin, double *ymax)
+int rrd_graph(
+    int argc,
+    char **argv,
+    char ***prdata,
+    int *xsize,
+    int *ysize,
+    FILE * stream,
+    double *ymin,
+    double *ymax)
 {
-    image_desc_t   im;
+    image_desc_t im;
+
     rrd_graph_init(&im);
     im.graphhandle = stream;
-    
-    rrd_graph_options(argc,argv,&im);
+
+    rrd_graph_options(argc, argv, &im);
     if (rrd_test_error()) {
         im_free(&im);
         return -1;
     }
-    
-    if (strlen(argv[optind])>=MAXPATH) {
+
+    if (strlen(argv[optind]) >= MAXPATH) {
         rrd_set_error("filename (including path) too long");
         im_free(&im);
         return -1;
     }
-    strncpy(im.graphfile,argv[optind],MAXPATH-1);
-    im.graphfile[MAXPATH-1]='\0';
+    strncpy(im.graphfile, argv[optind], MAXPATH - 1);
+    im.graphfile[MAXPATH - 1] = '\0';
 
-    rrd_graph_script(argc,argv,&im,1);
+    rrd_graph_script(argc, argv, &im, 1);
     if (rrd_test_error()) {
         im_free(&im);
         return -1;
@@ -3055,48 +3297,54 @@ rrd_graph(int argc, char **argv, char ***prdata, int *xsize, int *ysize, FILE *s
 
     /* Everything is now read and the actual work can start */
 
-    (*prdata)=NULL;
-    if (graph_paint(&im,prdata)==-1){
+    (*prdata) = NULL;
+    if (graph_paint(&im, prdata) == -1) {
         im_free(&im);
         return -1;
     }
 
     /* The image is generated and needs to be output.
-    ** Also, if needed, print a line with information about the image.
-    */
+     ** Also, if needed, print a line with information about the image.
+     */
 
-    *xsize=im.ximg;
-    *ysize=im.yimg;
-    *ymin=im.minval;
-    *ymax=im.maxval;
+    *xsize = im.ximg;
+    *ysize = im.yimg;
+    *ymin = im.minval;
+    *ymax = im.maxval;
     if (im.imginfo) {
-        char *filename;
+        char     *filename;
+
         if (!(*prdata)) {
             /* maybe prdata is not allocated yet ... lets do it now */
-            if ((*prdata = calloc(2,sizeof(char *)))==NULL) {
+            if ((*prdata = calloc(2, sizeof(char *))) == NULL) {
                 rrd_set_error("malloc imginfo");
-                return -1; 
+                return -1;
             };
         }
-        if(((*prdata)[0] = malloc((strlen(im.imginfo)+200+strlen(im.graphfile))*sizeof(char)))
-         ==NULL){
+        if (((*prdata)[0] =
+             malloc((strlen(im.imginfo) + 200 +
+                     strlen(im.graphfile)) * sizeof(char)))
+            == NULL) {
             rrd_set_error("malloc imginfo");
             return -1;
         }
-        filename=im.graphfile+strlen(im.graphfile);
-        while(filename > im.graphfile) {
-            if (*(filename-1)=='/' || *(filename-1)=='\\' ) break;
+        filename = im.graphfile + strlen(im.graphfile);
+        while (filename > im.graphfile) {
+            if (*(filename - 1) == '/' || *(filename - 1) == '\\')
+                break;
             filename--;
         }
 
-        sprintf((*prdata)[0],im.imginfo,filename,(long)(im.canvas->zoom*im.ximg),(long)(im.canvas->zoom*im.yimg));
+        sprintf((*prdata)[0], im.imginfo, filename,
+                (long) (im.canvas->zoom * im.ximg),
+                (long) (im.canvas->zoom * im.yimg));
     }
     im_free(&im);
     return 0;
 }
 
-void
-rrd_graph_init(image_desc_t *im)
+void rrd_graph_init(
+    image_desc_t * im)
 {
     unsigned int i;
 
@@ -3104,17 +3352,17 @@ rrd_graph_init(image_desc_t *im)
     tzset();
 #endif
 #ifdef HAVE_SETLOCALE
-    setlocale(LC_TIME,"");
+    setlocale(LC_TIME, "");
 #ifdef HAVE_MBSTOWCS
-    setlocale(LC_CTYPE,"");
+    setlocale(LC_CTYPE, "");
 #endif
 #endif
-    im->yorigin=0;
-    im->xorigin=0;
-    im->minval=0;
+    im->yorigin = 0;
+    im->xorigin = 0;
+    im->minval = 0;
     im->xlab_user.minsec = -1;
-    im->ximg=0;
-    im->yimg=0;
+    im->ximg = 0;
+    im->yimg = 0;
     im->xsize = 400;
     im->ysize = 100;
     im->step = 0;
@@ -3122,13 +3370,13 @@ rrd_graph_init(image_desc_t *im)
     im->title[0] = '\0';
     im->watermark[0] = '\0';
     im->minval = DNAN;
-    im->maxval = DNAN;    
-    im->unitsexponent= 9999;
-    im->unitslength= 6; 
+    im->maxval = DNAN;
+    im->unitsexponent = 9999;
+    im->unitslength = 6;
     im->forceleftspace = 0;
     im->symbol = ' ';
     im->viewfactor = 1.0;
-    im->extra_flags= 0;
+    im->extra_flags = 0;
     im->rigid = 0;
     im->gridfit = 1;
     im->imginfo = NULL;
@@ -3146,118 +3394,126 @@ rrd_graph_init(image_desc_t *im)
     im->grid_dash_on = 1;
     im->grid_dash_off = 1;
     im->tabwidth = 40.0;
-    
-    for(i=0;i<DIM(graph_col);i++)
-        im->graph_col[i]=graph_col[i];
+
+    for (i = 0; i < DIM(graph_col); i++)
+        im->graph_col[i] = graph_col[i];
 
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
     {
-            char *windir; 
-            char rrd_win_default_font[1000];
-            windir = getenv("windir");
-            /* %windir% is something like D:\windows or C:\winnt */
-            if (windir != NULL) {
-                    strncpy(rrd_win_default_font,windir,500);
-                    rrd_win_default_font[500] = '\0';
-                    strcat(rrd_win_default_font,"\\fonts\\");
-                    strcat(rrd_win_default_font,RRD_DEFAULT_FONT);         
-                    for(i=0;i<DIM(text_prop);i++){
-                            strncpy(text_prop[i].font,rrd_win_default_font,sizeof(text_prop[i].font)-1);
-                            text_prop[i].font[sizeof(text_prop[i].font)-1] = '\0';
-                     }
-             }
+        char     *windir;
+        char      rrd_win_default_font[1000];
+
+        windir = getenv("windir");
+        /* %windir% is something like D:\windows or C:\winnt */
+        if (windir != NULL) {
+            strncpy(rrd_win_default_font, windir, 500);
+            rrd_win_default_font[500] = '\0';
+            strcat(rrd_win_default_font, "\\fonts\\");
+            strcat(rrd_win_default_font, RRD_DEFAULT_FONT);
+            for (i = 0; i < DIM(text_prop); i++) {
+                strncpy(text_prop[i].font, rrd_win_default_font,
+                        sizeof(text_prop[i].font) - 1);
+                text_prop[i].font[sizeof(text_prop[i].font) - 1] = '\0';
+            }
+        }
     }
 #endif
     {
-            char *deffont; 
-            deffont = getenv("RRD_DEFAULT_FONT");
-            if (deffont != NULL) {
-                 for(i=0;i<DIM(text_prop);i++){
-                        strncpy(text_prop[i].font,deffont,sizeof(text_prop[i].font)-1);
-                        text_prop[i].font[sizeof(text_prop[i].font)-1] = '\0';
-                 }
+        char     *deffont;
+
+        deffont = getenv("RRD_DEFAULT_FONT");
+        if (deffont != NULL) {
+            for (i = 0; i < DIM(text_prop); i++) {
+                strncpy(text_prop[i].font, deffont,
+                        sizeof(text_prop[i].font) - 1);
+                text_prop[i].font[sizeof(text_prop[i].font) - 1] = '\0';
             }
+        }
     }
-    for(i=0;i<DIM(text_prop);i++){        
-      im->text_prop[i].size = text_prop[i].size;
-      strcpy(im->text_prop[i].font,text_prop[i].font);
+    for (i = 0; i < DIM(text_prop); i++) {
+        im->text_prop[i].size = text_prop[i].size;
+        strcpy(im->text_prop[i].font, text_prop[i].font);
     }
 }
 
-void
-rrd_graph_options(int argc, char *argv[],image_desc_t *im)
+void rrd_graph_options(
+    int argc,
+    char *argv[],
+    image_desc_t * im)
 {
-    int                        stroff;    
-    char                *parsetime_error = NULL;
-    char                scan_gtm[12],scan_mtm[12],scan_ltm[12],col_nam[12];
-    time_t                start_tmp=0,end_tmp=0;
-    long                long_tmp;
-    struct rrd_time_value        start_tv, end_tv;
-    gfx_color_t         color;
-    optind = 0; opterr = 0;  /* initialize getopt */
+    int       stroff;
+    char     *parsetime_error = NULL;
+    char      scan_gtm[12], scan_mtm[12], scan_ltm[12], col_nam[12];
+    time_t    start_tmp = 0, end_tmp = 0;
+    long      long_tmp;
+    struct rrd_time_value start_tv, end_tv;
+    gfx_color_t color;
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
     parsetime("end-24h", &start_tv);
     parsetime("now", &end_tv);
 
     /* defines for long options without a short equivalent. should be bytes,
        and may not collide with (the ASCII value of) short options */
-    #define LONGOPT_UNITS_SI 255
-
-    while (1){
-        static struct option long_options[] =
-        {
-            {"start",      required_argument, 0,  's'},
-            {"end",        required_argument, 0,  'e'},
-            {"x-grid",     required_argument, 0,  'x'},
-            {"y-grid",     required_argument, 0,  'y'},
-            {"vertical-label",required_argument,0,'v'},
-            {"width",      required_argument, 0,  'w'},
-            {"height",     required_argument, 0,  'h'},
-            {"interlaced", no_argument,       0,  'i'},
-            {"upper-limit",required_argument, 0,  'u'},
-            {"lower-limit",required_argument, 0,  'l'},
-            {"rigid",      no_argument,       0,  'r'},
-            {"base",       required_argument, 0,  'b'},
-            {"logarithmic",no_argument,       0,  'o'},
-            {"color",      required_argument, 0,  'c'},
-            {"font",       required_argument, 0,  'n'},
-            {"title",      required_argument, 0,  't'},
-            {"imginfo",    required_argument, 0,  'f'},
-            {"imgformat",  required_argument, 0,  'a'},
-            {"lazy",       no_argument,       0,  'z'},
-            {"zoom",       required_argument, 0,  'm'},
-            {"no-legend",  no_argument,       0,  'g'},
-            {"force-rules-legend",no_argument,0,  'F'},
-            {"only-graph", no_argument,       0,  'j'},
-            {"alt-y-grid", no_argument,       0,  'Y'},
-            {"no-minor",   no_argument,       0,  'I'},
-            {"slope-mode", no_argument,              0,  'E'},
-            {"alt-autoscale", no_argument,    0,  'A'},
-           {"alt-autoscale-min", no_argument, 0, 'J'},
+#define LONGOPT_UNITS_SI 255
+
+    while (1) {
+        static struct option long_options[] = {
+            {"start", required_argument, 0, 's'},
+            {"end", required_argument, 0, 'e'},
+            {"x-grid", required_argument, 0, 'x'},
+            {"y-grid", required_argument, 0, 'y'},
+            {"vertical-label", required_argument, 0, 'v'},
+            {"width", required_argument, 0, 'w'},
+            {"height", required_argument, 0, 'h'},
+            {"interlaced", no_argument, 0, 'i'},
+            {"upper-limit", required_argument, 0, 'u'},
+            {"lower-limit", required_argument, 0, 'l'},
+            {"rigid", no_argument, 0, 'r'},
+            {"base", required_argument, 0, 'b'},
+            {"logarithmic", no_argument, 0, 'o'},
+            {"color", required_argument, 0, 'c'},
+            {"font", required_argument, 0, 'n'},
+            {"title", required_argument, 0, 't'},
+            {"imginfo", required_argument, 0, 'f'},
+            {"imgformat", required_argument, 0, 'a'},
+            {"lazy", no_argument, 0, 'z'},
+            {"zoom", required_argument, 0, 'm'},
+            {"no-legend", no_argument, 0, 'g'},
+            {"force-rules-legend", no_argument, 0, 'F'},
+            {"only-graph", no_argument, 0, 'j'},
+            {"alt-y-grid", no_argument, 0, 'Y'},
+            {"no-minor", no_argument, 0, 'I'},
+            {"slope-mode", no_argument, 0, 'E'},
+            {"alt-autoscale", no_argument, 0, 'A'},
+            {"alt-autoscale-min", no_argument, 0, 'J'},
             {"alt-autoscale-max", no_argument, 0, 'M'},
-            {"no-gridfit", no_argument,       0,   'N'},
-            {"units-exponent",required_argument, 0, 'X'},
-            {"units-length",required_argument, 0, 'L'},
-            {"units",      required_argument, 0,  LONGOPT_UNITS_SI },
-            {"step",       required_argument, 0,    'S'},
-            {"tabwidth",   required_argument, 0,    'T'},            
+            {"no-gridfit", no_argument, 0, 'N'},
+            {"units-exponent", required_argument, 0, 'X'},
+            {"units-length", required_argument, 0, 'L'},
+            {"units", required_argument, 0, LONGOPT_UNITS_SI},
+            {"step", required_argument, 0, 'S'},
+            {"tabwidth", required_argument, 0, 'T'},
             {"font-render-mode", required_argument, 0, 'R'},
             {"font-smoothing-threshold", required_argument, 0, 'B'},
-            {"watermark",  required_argument, 0,  'W'},
-            {"alt-y-mrtg", no_argument,       0,  1000}, /* this has no effect it is just here to save old apps from crashing when they use it */
-            {0,0,0,0}};
-        int option_index = 0;
-        int opt;
-        int col_start,col_end;
-
-        opt = getopt_long(argc, argv, 
-                         "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:",
+            {"watermark", required_argument, 0, 'W'},
+            {"alt-y-mrtg", no_argument, 0, 1000},   /* this has no effect it is just here to save old apps from crashing when they use it */
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+        int       col_start, col_end;
+
+        opt = getopt_long(argc, argv,
+                          "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMEX:L:S:T:NR:B:W:",
                           long_options, &option_index);
 
         if (opt == EOF)
             break;
-        
-        switch(opt) {
+
+        switch (opt) {
         case 'I':
             im->extra_flags |= NOMINOR;
             break;
@@ -3266,16 +3522,16 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             break;
         case 'A':
             im->extra_flags |= ALTAUTOSCALE;
-           break;
-       case 'J':
-           im->extra_flags |= ALTAUTOSCALE_MIN;
+            break;
+        case 'J':
+            im->extra_flags |= ALTAUTOSCALE_MIN;
             break;
         case 'M':
             im->extra_flags |= ALTAUTOSCALE_MAX;
             break;
         case 'j':
-           im->extra_flags |= ONLY_GRAPH;
-           break;
+            im->extra_flags |= ONLY_GRAPH;
+            break;
         case 'g':
             im->extra_flags |= NOLEGEND;
             break;
@@ -3283,14 +3539,14 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             im->extra_flags |= FORCE_RULES_LEGEND;
             break;
         case LONGOPT_UNITS_SI:
-            if(im->extra_flags & FORCE_UNITS) {
+            if (im->extra_flags & FORCE_UNITS) {
                 rrd_set_error("--units can only be used once!");
                 return;
             }
-            if(strcmp(optarg,"si")==0)
+            if (strcmp(optarg, "si") == 0)
                 im->extra_flags |= FORCE_UNITS_SI;
             else {
-                rrd_set_error("invalid argument for --units: %s", optarg );
+                rrd_set_error("invalid argument for --units: %s", optarg);
                 return;
             }
             break;
@@ -3305,51 +3561,53 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             im->tabwidth = atof(optarg);
             break;
         case 'S':
-            im->step =  atoi(optarg);
+            im->step = atoi(optarg);
             break;
         case 'N':
             im->gridfit = 0;
             break;
         case 's':
             if ((parsetime_error = parsetime(optarg, &start_tv))) {
-                rrd_set_error( "start time: %s", parsetime_error );
+                rrd_set_error("start time: %s", parsetime_error);
                 return;
             }
             break;
         case 'e':
             if ((parsetime_error = parsetime(optarg, &end_tv))) {
-                rrd_set_error( "end time: %s", parsetime_error );
+                rrd_set_error("end time: %s", parsetime_error);
                 return;
             }
             break;
         case 'x':
-            if(strcmp(optarg,"none") == 0){
-              im->draw_x_grid=0;
-              break;
+            if (strcmp(optarg, "none") == 0) {
+                im->draw_x_grid = 0;
+                break;
             };
-                
-            if(sscanf(optarg,
-                      "%10[A-Z]:%ld:%10[A-Z]:%ld:%10[A-Z]:%ld:%ld:%n",
-                      scan_gtm,
-                      &im->xlab_user.gridst,
-                      scan_mtm,
-                      &im->xlab_user.mgridst,
-                      scan_ltm,
-                      &im->xlab_user.labst,
-                      &im->xlab_user.precis,
-                      &stroff) == 7 && stroff != 0){
-                strncpy(im->xlab_form, optarg+stroff, sizeof(im->xlab_form) - 1);
-                im->xlab_form[sizeof(im->xlab_form)-1] = '\0'; 
-                if((int)(im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1){
-                    rrd_set_error("unknown keyword %s",scan_gtm);
+
+            if (sscanf(optarg,
+                       "%10[A-Z]:%ld:%10[A-Z]:%ld:%10[A-Z]:%ld:%ld:%n",
+                       scan_gtm,
+                       &im->xlab_user.gridst,
+                       scan_mtm,
+                       &im->xlab_user.mgridst,
+                       scan_ltm,
+                       &im->xlab_user.labst,
+                       &im->xlab_user.precis, &stroff) == 7 && stroff != 0) {
+                strncpy(im->xlab_form, optarg + stroff,
+                        sizeof(im->xlab_form) - 1);
+                im->xlab_form[sizeof(im->xlab_form) - 1] = '\0';
+                if ((int) (im->xlab_user.gridtm = tmt_conv(scan_gtm)) == -1) {
+                    rrd_set_error("unknown keyword %s", scan_gtm);
                     return;
-                } else if ((int)(im->xlab_user.mgridtm = tmt_conv(scan_mtm)) == -1){
-                    rrd_set_error("unknown keyword %s",scan_mtm);
+                } else if ((int) (im->xlab_user.mgridtm = tmt_conv(scan_mtm))
+                           == -1) {
+                    rrd_set_error("unknown keyword %s", scan_mtm);
                     return;
-                } else if ((int)(im->xlab_user.labtm = tmt_conv(scan_ltm)) == -1){
-                    rrd_set_error("unknown keyword %s",scan_ltm);
+                } else if ((int) (im->xlab_user.labtm = tmt_conv(scan_ltm)) ==
+                           -1) {
+                    rrd_set_error("unknown keyword %s", scan_ltm);
                     return;
-                } 
+                }
                 im->xlab_user.minsec = 1;
                 im->xlab_user.stst = im->xlab_form;
             } else {
@@ -3359,30 +3617,27 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             break;
         case 'y':
 
-            if(strcmp(optarg,"none") == 0){
-              im->draw_y_grid=0;
-              break;
+            if (strcmp(optarg, "none") == 0) {
+                im->draw_y_grid = 0;
+                break;
             };
 
-            if(sscanf(optarg,
-                      "%lf:%d",
-                      &im->ygridstep,
-                      &im->ylabfact) == 2) {
-                if(im->ygridstep<=0){
+            if (sscanf(optarg, "%lf:%d", &im->ygridstep, &im->ylabfact) == 2) {
+                if (im->ygridstep <= 0) {
                     rrd_set_error("grid step must be > 0");
                     return;
-                } else if (im->ylabfact < 1){
+                } else if (im->ylabfact < 1) {
                     rrd_set_error("label factor must be > 0");
                     return;
-                } 
+                }
             } else {
                 rrd_set_error("invalid y-grid format");
                 return;
             }
             break;
         case 'v':
-            strncpy(im->ylegend,optarg,150);
-            im->ylegend[150]='\0';
+            strncpy(im->ylegend, optarg, 150);
+            im->ylegend[150] = '\0';
             break;
         case 'u':
             im->maxval = atof(optarg);
@@ -3392,8 +3647,9 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             break;
         case 'b':
             im->base = atol(optarg);
-            if(im->base != 1024 && im->base != 1000 ){
-                rrd_set_error("the only sensible value for base apart from 1000 is 1024");
+            if (im->base != 1024 && im->base != 1000) {
+                rrd_set_error
+                    ("the only sensible value for base apart from 1000 is 1024");
                 return;
             }
             break;
@@ -3422,9 +3678,9 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
         case 'f':
             im->imginfo = optarg;
             break;
-            case 'a':
-            if((int)(im->canvas->imgformat = if_conv(optarg)) == -1) {
-                rrd_set_error("unsupported graphics format '%s'",optarg);
+        case 'a':
+            if ((int) (im->canvas->imgformat = if_conv(optarg)) == -1) {
+                rrd_set_error("unsupported graphics format '%s'", optarg);
                 return;
             }
             break;
@@ -3439,76 +3695,74 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
             im->logarithmic = 1;
             break;
         case 'c':
-            if(sscanf(optarg,
-                      "%10[A-Z]#%n%8lx%n",
-                      col_nam,&col_start,&color,&col_end) == 2){
-                int ci;
-                int col_len = col_end - col_start;
-                switch (col_len){
-                        case 3:
-                                color = (
-                                        ((color & 0xF00) * 0x110000) |
-                                        ((color & 0x0F0) * 0x011000) |
-                                        ((color & 0x00F) * 0x001100) |
-                                        0x000000FF
-                                        );
-                                break;
-                        case 4:
-                                color = (
-                                        ((color & 0xF000) * 0x11000) |
-                                        ((color & 0x0F00) * 0x01100) |
-                                        ((color & 0x00F0) * 0x00110) |
-                                        ((color & 0x000F) * 0x00011)
-                                        );
-                                break;
-                        case 6:
-                                color = (color << 8) + 0xff /* shift left by 8 */;
-                                break;
-                        case 8:
-                                break;
-                        default:
-                                rrd_set_error("the color format is #RRGGBB[AA]");
-                                return;
+            if (sscanf(optarg,
+                       "%10[A-Z]#%n%8lx%n",
+                       col_nam, &col_start, &color, &col_end) == 2) {
+                int       ci;
+                int       col_len = col_end - col_start;
+
+                switch (col_len) {
+                case 3:
+                    color = (((color & 0xF00) * 0x110000) |
+                             ((color & 0x0F0) * 0x011000) |
+                             ((color & 0x00F) * 0x001100) | 0x000000FF);
+                    break;
+                case 4:
+                    color = (((color & 0xF000) * 0x11000) |
+                             ((color & 0x0F00) * 0x01100) |
+                             ((color & 0x00F0) * 0x00110) |
+                             ((color & 0x000F) * 0x00011)
+                        );
+                    break;
+                case 6:
+                    color = (color << 8) + 0xff /* shift left by 8 */ ;
+                    break;
+                case 8:
+                    break;
+                default:
+                    rrd_set_error("the color format is #RRGGBB[AA]");
+                    return;
                 }
-                if((ci=grc_conv(col_nam)) != -1){
-                    im->graph_col[ci]=color;
-                }  else {
-                  rrd_set_error("invalid color name '%s'",col_nam);
-                  return;
+                if ((ci = grc_conv(col_nam)) != -1) {
+                    im->graph_col[ci] = color;
+                } else {
+                    rrd_set_error("invalid color name '%s'", col_nam);
+                    return;
                 }
             } else {
                 rrd_set_error("invalid color def format");
                 return;
             }
-            break;        
+            break;
         case 'n':{
-            char prop[15];
-            double size = 1;
-            char font[1024] = "";
-
-            if(sscanf(optarg,
-                                "%10[A-Z]:%lf:%1000s",
-                                prop,&size,font) >= 2){
-                int sindex,propidx;
-                if((sindex=text_prop_conv(prop)) != -1){
-                  for (propidx=sindex;propidx<TEXT_PROP_LAST;propidx++){                        
-                        if (size > 0){
-                              im->text_prop[propidx].size=size;              
-                      }
-                       if (strlen(font) > 0){
-                          strcpy(im->text_prop[propidx].font,font);
-                      }
-                      if (propidx==sindex && sindex != 0) break;
-                  }
+            char      prop[15];
+            double    size = 1;
+            char      font[1024] = "";
+
+            if (sscanf(optarg, "%10[A-Z]:%lf:%1000s", prop, &size, font) >= 2) {
+                int       sindex, propidx;
+
+                if ((sindex = text_prop_conv(prop)) != -1) {
+                    for (propidx = sindex; propidx < TEXT_PROP_LAST;
+                         propidx++) {
+                        if (size > 0) {
+                            im->text_prop[propidx].size = size;
+                        }
+                        if (strlen(font) > 0) {
+                            strcpy(im->text_prop[propidx].font, font);
+                        }
+                        if (propidx == sindex && sindex != 0)
+                            break;
+                    }
                 } else {
-                    rrd_set_error("invalid fonttag '%s'",prop);
+                    rrd_set_error("invalid fonttag '%s'", prop);
                     return;
                 }
             } else {
                 rrd_set_error("invalid text property format");
                 return;
             }
-            break;          
+            break;
         }
         case 'm':
             im->canvas->zoom = atof(optarg);
@@ -3516,261 +3770,282 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
                 rrd_set_error("zoom factor must be > 0");
                 return;
             }
-          break;
+            break;
         case 't':
-            strncpy(im->title,optarg,150);
-            im->title[150]='\0';
+            strncpy(im->title, optarg, 150);
+            im->title[150] = '\0';
             break;
 
         case 'R':
-                if ( strcmp( optarg, "normal" ) == 0 )
-                        im->canvas->aa_type = AA_NORMAL;
-                else if ( strcmp( optarg, "light" ) == 0 )
-                        im->canvas->aa_type = AA_LIGHT;
-                else if ( strcmp( optarg, "mono" ) == 0 )
-                        im->canvas->aa_type = AA_NONE;
-                else
-                {
-                        rrd_set_error("unknown font-render-mode '%s'", optarg );
-                        return;
-                }
-                break;
+            if (strcmp(optarg, "normal") == 0)
+                im->canvas->aa_type = AA_NORMAL;
+            else if (strcmp(optarg, "light") == 0)
+                im->canvas->aa_type = AA_LIGHT;
+            else if (strcmp(optarg, "mono") == 0)
+                im->canvas->aa_type = AA_NONE;
+            else {
+                rrd_set_error("unknown font-render-mode '%s'", optarg);
+                return;
+            }
+            break;
 
         case 'B':
             im->canvas->font_aa_threshold = atof(optarg);
-                break;
+            break;
 
         case 'W':
-            strncpy(im->watermark,optarg,100);
-            im->watermark[99]='\0';
+            strncpy(im->watermark, optarg, 100);
+            im->watermark[99] = '\0';
             break;
 
         case '?':
             if (optopt != 0)
                 rrd_set_error("unknown option '%c'", optopt);
             else
-                rrd_set_error("unknown option '%s'",argv[optind-1]);
+                rrd_set_error("unknown option '%s'", argv[optind - 1]);
             return;
         }
     }
-    
+
     if (optind >= argc) {
-       rrd_set_error("missing filename");
-       return;
+        rrd_set_error("missing filename");
+        return;
     }
 
-    if (im->logarithmic == 1 && im->minval <= 0){
-        rrd_set_error("for a logarithmic yaxis you must specify a lower-limit > 0");        
+    if (im->logarithmic == 1 && im->minval <= 0) {
+        rrd_set_error
+            ("for a logarithmic yaxis you must specify a lower-limit > 0");
         return;
     }
 
-    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
+    if (proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
         /* error string is set in parsetime.c */
         return;
-    }  
-    
-    if (start_tmp < 3600*24*365*10){
-        rrd_set_error("the first entry to fetch should be after 1980 (%ld)",start_tmp);
+    }
+
+    if (start_tmp < 3600 * 24 * 365 * 10) {
+        rrd_set_error("the first entry to fetch should be after 1980 (%ld)",
+                      start_tmp);
         return;
     }
-    
+
     if (end_tmp < start_tmp) {
-        rrd_set_error("start (%ld) should be less than end (%ld)", 
-               start_tmp, end_tmp);
+        rrd_set_error("start (%ld) should be less than end (%ld)",
+                      start_tmp, end_tmp);
         return;
     }
-    
+
     im->start = start_tmp;
     im->end = end_tmp;
-    im->step = max((long)im->step, (im->end-im->start)/im->xsize);
+    im->step = max((long) im->step, (im->end - im->start) / im->xsize);
 }
 
-int
-rrd_graph_color(image_desc_t *im, char *var, char *err, int optional)
+int rrd_graph_color(
+    image_desc_t * im,
+    char *var,
+    char *err,
+    int optional)
 {
-    char *color;
-    graph_desc_t *gdp=&im->gdes[im->gdes_c-1];
+    char     *color;
+    graph_desc_t *gdp = &im->gdes[im->gdes_c - 1];
 
-    color=strstr(var,"#");
-    if (color==NULL) {
-        if (optional==0) {
-            rrd_set_error("Found no color in %s",err);
+    color = strstr(var, "#");
+    if (color == NULL) {
+        if (optional == 0) {
+            rrd_set_error("Found no color in %s", err);
             return 0;
         }
         return 0;
     } else {
-        int n=0;
-        char *rest;
-        gfx_color_t    col;
+        int       n = 0;
+        char     *rest;
+        gfx_color_t col;
 
-        rest=strstr(color,":");
-        if (rest!=NULL)
-            n=rest-color;
+        rest = strstr(color, ":");
+        if (rest != NULL)
+            n = rest - color;
         else
-            n=strlen(color);
+            n = strlen(color);
 
         switch (n) {
-            case 7:
-                sscanf(color,"#%6lx%n",&col,&n);
-                col = (col << 8) + 0xff /* shift left by 8 */;
-                if (n!=7) rrd_set_error("Color problem in %s",err);
+        case 7:
+            sscanf(color, "#%6lx%n", &col, &n);
+            col = (col << 8) + 0xff /* shift left by 8 */ ;
+            if (n != 7)
+                rrd_set_error("Color problem in %s", err);
+            break;
+        case 9:
+            sscanf(color, "#%8lx%n", &col, &n);
+            if (n == 9)
                 break;
-            case 9:
-                sscanf(color,"#%8lx%n",&col,&n);
-                if (n==9) break;
-            default:
-                rrd_set_error("Color problem in %s",err);
+        default:
+            rrd_set_error("Color problem in %s", err);
         }
-        if (rrd_test_error()) return 0;
+        if (rrd_test_error())
+            return 0;
         gdp->col = col;
         return n;
     }
 }
 
 
-int bad_format(char *fmt) {
-    char *ptr;
-    int n=0;
+int bad_format(
+    char *fmt)
+{
+    char     *ptr;
+    int       n = 0;
+
     ptr = fmt;
     while (*ptr != '\0')
         if (*ptr++ == '%') {
-             /* line cannot end with percent char */
-             if (*ptr == '\0') return 1;
-             /* '%s', '%S' and '%%' are allowed */
-             if (*ptr == 's' || *ptr == 'S' || *ptr == '%') ptr++;
-
-             /* %c is allowed (but use only with vdef!) */
-             else if (*ptr == 'c') {
+
+            /* line cannot end with percent char */
+            if (*ptr == '\0')
+                return 1;
+
+            /* '%s', '%S' and '%%' are allowed */
+            if (*ptr == 's' || *ptr == 'S' || *ptr == '%')
+                ptr++;
+
+            /* %c is allowed (but use only with vdef!) */
+            else if (*ptr == 'c') {
                 ptr++;
-                n=1;
-             }
-
-             /* or else '% 6.2lf' and such are allowed */
-             else {
-                 /* optional padding character */
-                 if (*ptr == ' ' || *ptr == '+' || *ptr == '-') ptr++;
-
-                 /* This should take care of 'm.n' with all three optional */
-                 while (*ptr >= '0' && *ptr <= '9') ptr++;
-                 if (*ptr == '.') ptr++;
-                 while (*ptr >= '0' && *ptr <= '9') ptr++;
-  
-                 /* Either 'le', 'lf' or 'lg' must follow here */
-                 if (*ptr++ != 'l') return 1;
-                 if (*ptr == 'e' || *ptr == 'f' || *ptr == 'g') ptr++;
-                 else return 1;
-                 n++;
+                n = 1;
             }
-         }
-      
-      return (n!=1); 
+
+            /* or else '% 6.2lf' and such are allowed */
+            else {
+                /* optional padding character */
+                if (*ptr == ' ' || *ptr == '+' || *ptr == '-')
+                    ptr++;
+
+                /* This should take care of 'm.n' with all three optional */
+                while (*ptr >= '0' && *ptr <= '9')
+                    ptr++;
+                if (*ptr == '.')
+                    ptr++;
+                while (*ptr >= '0' && *ptr <= '9')
+                    ptr++;
+
+                /* Either 'le', 'lf' or 'lg' must follow here */
+                if (*ptr++ != 'l')
+                    return 1;
+                if (*ptr == 'e' || *ptr == 'f' || *ptr == 'g')
+                    ptr++;
+                else
+                    return 1;
+                n++;
+            }
+        }
+
+    return (n != 1);
 }
 
 
-int
-vdef_parse(gdes,str)
-struct graph_desc_t *gdes;
-const char *const str;
+int vdef_parse(
+    gdes,
+    str)
+    struct graph_desc_t *gdes;
+    const char *const str;
 {
     /* A VDEF currently is either "func" or "param,func"
      * so the parsing is rather simple.  Change if needed.
      */
-    double        param;
-    char        func[30];
-    int                n;
-    
-    n=0;
-    sscanf(str,"%le,%29[A-Z]%n",&param,func,&n);
-    if (n== (int)strlen(str)) { /* matched */
+    double    param;
+    char      func[30];
+    int       n;
+
+    n = 0;
+    sscanf(str, "%le,%29[A-Z]%n", &param, func, &n);
+    if (n == (int) strlen(str)) {   /* matched */
         ;
     } else {
-        n=0;
-        sscanf(str,"%29[A-Z]%n",func,&n);
-        if (n== (int)strlen(str)) { /* matched */
-            param=DNAN;
+        n = 0;
+        sscanf(str, "%29[A-Z]%n", func, &n);
+        if (n == (int) strlen(str)) {   /* matched */
+            param = DNAN;
         } else {
-            rrd_set_error("Unknown function string '%s' in VDEF '%s'"
-                ,str
-                ,gdes->vname
-                );
+            rrd_set_error("Unknown function string '%s' in VDEF '%s'", str,
+                          gdes->vname);
             return -1;
         }
     }
-    if                (!strcmp("PERCENT",func)) gdes->vf.op = VDEF_PERCENT;
-    else if        (!strcmp("MAXIMUM",func)) gdes->vf.op = VDEF_MAXIMUM;
-    else if        (!strcmp("AVERAGE",func)) gdes->vf.op = VDEF_AVERAGE;
-    else if        (!strcmp("MINIMUM",func)) gdes->vf.op = VDEF_MINIMUM;
-    else if        (!strcmp("TOTAL",  func)) gdes->vf.op = VDEF_TOTAL;
-    else if        (!strcmp("FIRST",  func)) gdes->vf.op = VDEF_FIRST;
-    else if        (!strcmp("LAST",   func)) gdes->vf.op = VDEF_LAST;
-    else if     (!strcmp("LSLSLOPE", func)) gdes->vf.op = VDEF_LSLSLOPE;
-    else if     (!strcmp("LSLINT",   func)) gdes->vf.op = VDEF_LSLINT;
-    else if     (!strcmp("LSLCORREL",func)) gdes->vf.op = VDEF_LSLCORREL;
+    if (!strcmp("PERCENT", func))
+        gdes->vf.op = VDEF_PERCENT;
+    else if (!strcmp("MAXIMUM", func))
+        gdes->vf.op = VDEF_MAXIMUM;
+    else if (!strcmp("AVERAGE", func))
+        gdes->vf.op = VDEF_AVERAGE;
+    else if (!strcmp("MINIMUM", func))
+        gdes->vf.op = VDEF_MINIMUM;
+    else if (!strcmp("TOTAL", func))
+        gdes->vf.op = VDEF_TOTAL;
+    else if (!strcmp("FIRST", func))
+        gdes->vf.op = VDEF_FIRST;
+    else if (!strcmp("LAST", func))
+        gdes->vf.op = VDEF_LAST;
+    else if (!strcmp("LSLSLOPE", func))
+        gdes->vf.op = VDEF_LSLSLOPE;
+    else if (!strcmp("LSLINT", func))
+        gdes->vf.op = VDEF_LSLINT;
+    else if (!strcmp("LSLCORREL", func))
+        gdes->vf.op = VDEF_LSLCORREL;
     else {
-        rrd_set_error("Unknown function '%s' in VDEF '%s'\n"
-            ,func
-            ,gdes->vname
-            );
+        rrd_set_error("Unknown function '%s' in VDEF '%s'\n", func,
+                      gdes->vname);
         return -1;
     };
 
     switch (gdes->vf.op) {
-        case VDEF_PERCENT:
-            if (isnan(param)) { /* no parameter given */
-                rrd_set_error("Function '%s' needs parameter in VDEF '%s'\n"
-                    ,func
-                    ,gdes->vname
-                    );
-                return -1;
-            };
-            if (param>=0.0 && param<=100.0) {
-                gdes->vf.param = param;
-                gdes->vf.val   = DNAN;        /* undefined */
-                gdes->vf.when  = 0;        /* undefined */
-            } else {
-                rrd_set_error("Parameter '%f' out of range in VDEF '%s'\n"
-                    ,param
-                    ,gdes->vname
-                    );
-                return -1;
-            };
-            break;
-        case VDEF_MAXIMUM:
-        case VDEF_AVERAGE:
-        case VDEF_MINIMUM:
-        case VDEF_TOTAL:
-        case VDEF_FIRST:
-        case VDEF_LAST:
-        case VDEF_LSLSLOPE:
-        case VDEF_LSLINT:
-        case VDEF_LSLCORREL:
-            if (isnan(param)) {
-                gdes->vf.param = DNAN;
-                gdes->vf.val   = DNAN;
-                gdes->vf.when  = 0;
-            } else {
-                rrd_set_error("Function '%s' needs no parameter in VDEF '%s'\n"
-                    ,func
-                    ,gdes->vname
-                    );
-                return -1;
-            };
-            break;
+    case VDEF_PERCENT:
+        if (isnan(param)) { /* no parameter given */
+            rrd_set_error("Function '%s' needs parameter in VDEF '%s'\n",
+                          func, gdes->vname);
+            return -1;
+        };
+        if (param >= 0.0 && param <= 100.0) {
+            gdes->vf.param = param;
+            gdes->vf.val = DNAN;    /* undefined */
+            gdes->vf.when = 0;  /* undefined */
+        } else {
+            rrd_set_error("Parameter '%f' out of range in VDEF '%s'\n", param,
+                          gdes->vname);
+            return -1;
+        };
+        break;
+    case VDEF_MAXIMUM:
+    case VDEF_AVERAGE:
+    case VDEF_MINIMUM:
+    case VDEF_TOTAL:
+    case VDEF_FIRST:
+    case VDEF_LAST:
+    case VDEF_LSLSLOPE:
+    case VDEF_LSLINT:
+    case VDEF_LSLCORREL:
+        if (isnan(param)) {
+            gdes->vf.param = DNAN;
+            gdes->vf.val = DNAN;
+            gdes->vf.when = 0;
+        } else {
+            rrd_set_error("Function '%s' needs no parameter in VDEF '%s'\n",
+                          func, gdes->vname);
+            return -1;
+        };
+        break;
     };
     return 0;
 }
 
 
-int
-vdef_calc(im,gdi)
-image_desc_t *im;
-int gdi;
+int vdef_calc(
+    im,
+    gdi)
+    image_desc_t *im;
+    int gdi;
 {
-    graph_desc_t        *src,*dst;
-    rrd_value_t                *data;
-    long                step,steps;
+    graph_desc_t *src, *dst;
+    rrd_value_t *data;
+    long      step, steps;
 
     dst = &im->gdes[gdi];
     src = &im->gdes[dst->vidx];
@@ -3778,197 +4053,219 @@ int gdi;
     steps = (src->end - src->start) / src->step;
 
 #if 0
-printf("DEBUG: start == %lu, end == %lu, %lu steps\n"
-    ,src->start
-    ,src->end
-    ,steps
-    );
+    printf("DEBUG: start == %lu, end == %lu, %lu steps\n", src->start,
+           src->end, steps);
 #endif
 
     switch (dst->vf.op) {
-        case VDEF_PERCENT: {
-                rrd_value_t *        array;
-                int                field;
+    case VDEF_PERCENT:{
+        rrd_value_t *array;
+        int       field;
 
 
-                if ((array = malloc(steps*sizeof(double)))==NULL) {
-                    rrd_set_error("malloc VDEV_PERCENT");
-                    return -1;
-                }
-                for (step=0;step < steps; step++) {
-                    array[step]=data[step*src->ds_cnt];
-                }
-                qsort(array,step,sizeof(double),vdef_percent_compar);
+        if ((array = malloc(steps * sizeof(double))) == NULL) {
+            rrd_set_error("malloc VDEV_PERCENT");
+            return -1;
+        }
+        for (step = 0; step < steps; step++) {
+            array[step] = data[step * src->ds_cnt];
+        }
+        qsort(array, step, sizeof(double), vdef_percent_compar);
 
-                field = (steps-1)*dst->vf.param/100;
-                dst->vf.val  = array[field];
-                dst->vf.when = 0;        /* no time component */
-                free(array);
+        field = (steps - 1) * dst->vf.param / 100;
+        dst->vf.val = array[field];
+        dst->vf.when = 0;   /* no time component */
+        free(array);
 #if 0
-for(step=0;step<steps;step++)
-printf("DEBUG: %3li:%10.2f %c\n",step,array[step],step==field?'*':' ');
+        for (step = 0; step < steps; step++)
+            printf("DEBUG: %3li:%10.2f %c\n", step, array[step],
+                   step == field ? '*' : ' ');
 #endif
-            }
-            break;
-        case VDEF_MAXIMUM:
-            step=0;
-            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
-            if (step == steps) {
-                dst->vf.val  = DNAN;
-                dst->vf.when = 0;
-            } else {
-                dst->vf.val  = data[step*src->ds_cnt];
-                dst->vf.when = src->start + (step+1)*src->step;
-            }
-            while (step != steps) {
-                if (finite(data[step*src->ds_cnt])) {
-                    if (data[step*src->ds_cnt] > dst->vf.val) {
-                        dst->vf.val  = data[step*src->ds_cnt];
-                        dst->vf.when = src->start + (step+1)*src->step;
-                    }
+    }
+        break;
+    case VDEF_MAXIMUM:
+        step = 0;
+        while (step != steps && isnan(data[step * src->ds_cnt]))
+            step++;
+        if (step == steps) {
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
+        } else {
+            dst->vf.val = data[step * src->ds_cnt];
+            dst->vf.when = src->start + (step + 1) * src->step;
+        }
+        while (step != steps) {
+            if (finite(data[step * src->ds_cnt])) {
+                if (data[step * src->ds_cnt] > dst->vf.val) {
+                    dst->vf.val = data[step * src->ds_cnt];
+                    dst->vf.when = src->start + (step + 1) * src->step;
                 }
-                step++;
-            }
-            break;
-        case VDEF_TOTAL:
-        case VDEF_AVERAGE: {
-            int cnt=0;
-            double sum=0.0;
-            for (step=0;step<steps;step++) {
-                if (finite(data[step*src->ds_cnt])) {
-                    sum += data[step*src->ds_cnt];
-                    cnt ++;
-                };
-            }
-            if (cnt) {
-                if (dst->vf.op == VDEF_TOTAL) {
-                    dst->vf.val  = sum*src->step;
-                    dst->vf.when = 0;        /* no time component */
-                } else {
-                    dst->vf.val = sum/cnt;
-                    dst->vf.when = 0;        /* no time component */
-                };
-            } else {
-                dst->vf.val  = DNAN;
-                dst->vf.when = 0;
-            }
             }
-            break;
-        case VDEF_MINIMUM:
-            step=0;
-            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
-            if (step == steps) {
-                dst->vf.val  = DNAN;
-                dst->vf.when = 0;
+            step++;
+        }
+        break;
+    case VDEF_TOTAL:
+    case VDEF_AVERAGE:{
+        int       cnt = 0;
+        double    sum = 0.0;
+
+        for (step = 0; step < steps; step++) {
+            if (finite(data[step * src->ds_cnt])) {
+                sum += data[step * src->ds_cnt];
+                cnt++;
+            };
+        }
+        if (cnt) {
+            if (dst->vf.op == VDEF_TOTAL) {
+                dst->vf.val = sum * src->step;
+                dst->vf.when = 0;   /* no time component */
             } else {
-                dst->vf.val  = data[step*src->ds_cnt];
-                dst->vf.when = src->start + (step+1)*src->step;
-            }
-            while (step != steps) {
-                if (finite(data[step*src->ds_cnt])) {
-                    if (data[step*src->ds_cnt] < dst->vf.val) {
-                        dst->vf.val  = data[step*src->ds_cnt];
-                        dst->vf.when = src->start + (step+1)*src->step;
-                    }
+                dst->vf.val = sum / cnt;
+                dst->vf.when = 0;   /* no time component */
+            };
+        } else {
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
+        }
+    }
+        break;
+    case VDEF_MINIMUM:
+        step = 0;
+        while (step != steps && isnan(data[step * src->ds_cnt]))
+            step++;
+        if (step == steps) {
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
+        } else {
+            dst->vf.val = data[step * src->ds_cnt];
+            dst->vf.when = src->start + (step + 1) * src->step;
+        }
+        while (step != steps) {
+            if (finite(data[step * src->ds_cnt])) {
+                if (data[step * src->ds_cnt] < dst->vf.val) {
+                    dst->vf.val = data[step * src->ds_cnt];
+                    dst->vf.when = src->start + (step + 1) * src->step;
                 }
-                step++;
             }
-            break;
-        case VDEF_FIRST:
-            /* The time value returned here is one step before the
-             * actual time value.  This is the start of the first
-             * non-NaN interval.
-             */
-            step=0;
-            while (step != steps && isnan(data[step*src->ds_cnt])) step++;
-            if (step == steps) { /* all entries were NaN */
-                dst->vf.val  = DNAN;
+            step++;
+        }
+        break;
+    case VDEF_FIRST:
+        /* The time value returned here is one step before the
+         * actual time value.  This is the start of the first
+         * non-NaN interval.
+         */
+        step = 0;
+        while (step != steps && isnan(data[step * src->ds_cnt]))
+            step++;
+        if (step == steps) {    /* all entries were NaN */
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
+        } else {
+            dst->vf.val = data[step * src->ds_cnt];
+            dst->vf.when = src->start + step * src->step;
+        }
+        break;
+    case VDEF_LAST:
+        /* The time value returned here is the
+         * actual time value.  This is the end of the last
+         * non-NaN interval.
+         */
+        step = steps - 1;
+        while (step >= 0 && isnan(data[step * src->ds_cnt]))
+            step--;
+        if (step < 0) { /* all entries were NaN */
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
+        } else {
+            dst->vf.val = data[step * src->ds_cnt];
+            dst->vf.when = src->start + (step + 1) * src->step;
+        }
+        break;
+    case VDEF_LSLSLOPE:
+    case VDEF_LSLINT:
+    case VDEF_LSLCORREL:{
+        /* Bestfit line by linear least squares method */
+
+        int       cnt = 0;
+        double    SUMx, SUMy, SUMxy, SUMxx, SUMyy, slope, y_intercept, correl;
+
+        SUMx = 0;
+        SUMy = 0;
+        SUMxy = 0;
+        SUMxx = 0;
+        SUMyy = 0;
+
+        for (step = 0; step < steps; step++) {
+            if (finite(data[step * src->ds_cnt])) {
+                cnt++;
+                SUMx += step;
+                SUMxx += step * step;
+                SUMxy += step * data[step * src->ds_cnt];
+                SUMy += data[step * src->ds_cnt];
+                SUMyy += data[step * src->ds_cnt] * data[step * src->ds_cnt];
+            };
+        }
+
+        slope = (SUMx * SUMy - cnt * SUMxy) / (SUMx * SUMx - cnt * SUMxx);
+        y_intercept = (SUMy - slope * SUMx) / cnt;
+        correl =
+            (SUMxy -
+             (SUMx * SUMy) / cnt) / sqrt((SUMxx -
+                                          (SUMx * SUMx) / cnt) * (SUMyy -
+                                                                  (SUMy *
+                                                                   SUMy) /
+                                                                  cnt));
+
+        if (cnt) {
+            if (dst->vf.op == VDEF_LSLSLOPE) {
+                dst->vf.val = slope;
                 dst->vf.when = 0;
-            } else {
-                dst->vf.val  = data[step*src->ds_cnt];
-                dst->vf.when = src->start + step*src->step;
-            }
-            break;
-        case VDEF_LAST:
-            /* The time value returned here is the
-             * actual time value.  This is the end of the last
-             * non-NaN interval.
-             */
-            step=steps-1;
-            while (step >= 0 && isnan(data[step*src->ds_cnt])) step--;
-            if (step < 0) { /* all entries were NaN */
-                dst->vf.val  = DNAN;
+            } else if (dst->vf.op == VDEF_LSLINT) {
+                dst->vf.val = y_intercept;
                 dst->vf.when = 0;
-            } else {
-                dst->vf.val  = data[step*src->ds_cnt];
-                dst->vf.when = src->start + (step+1)*src->step;
-            }
-            break;
-        case VDEF_LSLSLOPE:
-        case VDEF_LSLINT:
-        case VDEF_LSLCORREL:{
-            /* Bestfit line by linear least squares method */ 
-
-            int cnt=0;
-            double SUMx, SUMy, SUMxy, SUMxx, SUMyy, slope, y_intercept, correl ;
-            SUMx = 0; SUMy = 0; SUMxy = 0; SUMxx = 0; SUMyy = 0;
-
-            for (step=0;step<steps;step++) {
-                if (finite(data[step*src->ds_cnt])) {
-                    cnt++;
-                    SUMx  += step;
-                    SUMxx += step * step;
-                    SUMxy += step * data[step*src->ds_cnt];
-                    SUMy  += data[step*src->ds_cnt];
-                    SUMyy  += data[step*src->ds_cnt]*data[step*src->ds_cnt];
-                };
-            }
-
-            slope = ( SUMx*SUMy - cnt*SUMxy ) / ( SUMx*SUMx - cnt*SUMxx );
-            y_intercept = ( SUMy - slope*SUMx ) / cnt;
-            correl = (SUMxy - (SUMx*SUMy)/cnt) / sqrt((SUMxx - (SUMx*SUMx)/cnt)*(SUMyy - (SUMy*SUMy)/cnt));
-
-            if (cnt) {
-                    if (dst->vf.op == VDEF_LSLSLOPE) {
-                        dst->vf.val  = slope;
-                        dst->vf.when = 0;
-                    } else if (dst->vf.op == VDEF_LSLINT)  {
-                        dst->vf.val = y_intercept;
-                        dst->vf.when = 0;
-                    } else if (dst->vf.op == VDEF_LSLCORREL)  {
-                        dst->vf.val = correl;
-                        dst->vf.when = 0;
-                    };
-                
-            } else {
-                dst->vf.val  = DNAN;
+            } else if (dst->vf.op == VDEF_LSLCORREL) {
+                dst->vf.val = correl;
                 dst->vf.when = 0;
-            }
+            };
+
+        } else {
+            dst->vf.val = DNAN;
+            dst->vf.when = 0;
         }
+    }
         break;
     }
     return 0;
 }
 
 /* NaN < -INF < finite_values < INF */
-int
-vdef_percent_compar(a,b)
-const void *a,*b;
+int vdef_percent_compar(
+    a,
+    b)
+    const void *a, *b;
 {
     /* Equality is not returned; this doesn't hurt except
      * (maybe) for a little performance.
      */
 
     /* First catch NaN values. They are smallest */
-    if (isnan( *(double *)a )) return -1;
-    if (isnan( *(double *)b )) return  1;
+    if (isnan(*(double *) a))
+        return -1;
+    if (isnan(*(double *) b))
+        return 1;
 
     /* NaN doesn't reach this part so INF and -INF are extremes.
      * The sign from isinf() is compatible with the sign we return
      */
-    if (isinf( *(double *)a )) return isinf( *(double *)a );
-    if (isinf( *(double *)b )) return isinf( *(double *)b );
+    if (isinf(*(double *) a))
+        return isinf(*(double *) a);
+    if (isinf(*(double *) b))
+        return isinf(*(double *) b);
 
     /* If we reach this, both values must be finite */
-    if ( *(double *)a < *(double *)b ) return -1; else return 1;
+    if (*(double *) a < *(double *) b)
+        return -1;
+    else
+        return 1;
 }
index e83b442..22523be 100644 (file)
@@ -8,91 +8,95 @@
 #define MAX_VNAME_LEN 255
 #define DEF_NAM_FMT "%255[-_A-Za-z0-9]"
 
-#define ALTYGRID        0x01   /* use alternative y grid algorithm */
-#define ALTAUTOSCALE    0x02   /* use alternative algorithm to find lower and upper bounds */
-#define ALTAUTOSCALE_MIN 0x04  /* use alternative algorithm to find lower bounds */
-#define ALTAUTOSCALE_MAX 0x08  /* use alternative algorithm to find upper bounds */
-#define NOLEGEND        0x10   /* use no legend */
-#define NOMINOR          0x20    /* Turn off minor gridlines */
+#define ALTYGRID        0x01   /* use alternative y grid algorithm */
+#define ALTAUTOSCALE    0x02   /* use alternative algorithm to find lower and upper bounds */
+#define ALTAUTOSCALE_MIN 0x04   /* use alternative algorithm to find lower bounds */
+#define ALTAUTOSCALE_MAX 0x08   /* use alternative algorithm to find upper bounds */
+#define NOLEGEND        0x10   /* use no legend */
+#define NOMINOR          0x20   /* Turn off minor gridlines */
 #define ONLY_GRAPH       0x40   /* use only graph */
-#define FORCE_RULES_LEGEND 0x80        /* force printing of HRULE and VRULE legend */
+#define FORCE_RULES_LEGEND 0x80 /* force printing of HRULE and VRULE legend */
 
-#define FORCE_UNITS 0x100        /* mask for all FORCE_UNITS_* flags */
-#define FORCE_UNITS_SI 0x100     /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */
+#define FORCE_UNITS 0x100   /* mask for all FORCE_UNITS_* flags */
+#define FORCE_UNITS_SI 0x100    /* force use of SI units in Y axis (no effect in linear graph, SI instead of E in log graph) */
 
-enum tmt_en {TMT_SECOND=0,TMT_MINUTE,TMT_HOUR,TMT_DAY,
-            TMT_WEEK,TMT_MONTH,TMT_YEAR};
+enum tmt_en { TMT_SECOND = 0, TMT_MINUTE, TMT_HOUR, TMT_DAY,
+    TMT_WEEK, TMT_MONTH, TMT_YEAR
+};
 
-enum grc_en {GRC_CANVAS=0,GRC_BACK,GRC_SHADEA,GRC_SHADEB,
-            GRC_GRID,GRC_MGRID,GRC_FONT,GRC_ARROW,GRC_AXIS,GRC_FRAME,__GRC_END__};
+enum grc_en { GRC_CANVAS = 0, GRC_BACK, GRC_SHADEA, GRC_SHADEB,
+    GRC_GRID, GRC_MGRID, GRC_FONT, GRC_ARROW, GRC_AXIS, GRC_FRAME, __GRC_END__
+};
 
 #define MGRIDWIDTH 0.6
 #define GRIDWIDTH  0.4
 
-enum gf_en {GF_PRINT=0,GF_GPRINT,GF_COMMENT,GF_HRULE,GF_VRULE,GF_LINE,
-           GF_AREA,GF_STACK,GF_TICK,
-           GF_DEF, GF_CDEF, GF_VDEF, GF_SHIFT,
+enum gf_en { GF_PRINT = 0, GF_GPRINT, GF_COMMENT, GF_HRULE, GF_VRULE, GF_LINE,
+    GF_AREA, GF_STACK, GF_TICK,
+    GF_DEF, GF_CDEF, GF_VDEF, GF_SHIFT,
 #ifdef WITH_PIECHART
-           GF_PART,
+    GF_PART,
 #endif
-            GF_XPORT};
+    GF_XPORT
+};
 
 enum vdef_op_en {
-                VDEF_MAXIMUM=0 /* like the MAX in (G)PRINT */
-               ,VDEF_MINIMUM   /* like the MIN in (G)PRINT */
-               ,VDEF_AVERAGE   /* like the AVERAGE in (G)PRINT */
-               ,VDEF_PERCENT   /* Nth percentile */
-               ,VDEF_TOTAL     /* average multiplied by time */
-               ,VDEF_FIRST     /* first non-unknown value and time */
-               ,VDEF_LAST      /* last  non-unknown value and time */
-               ,VDEF_LSLSLOPE  /* least squares line slope */
-               ,VDEF_LSLINT    /* least squares line y_intercept */
-               ,VDEF_LSLCORREL /* least squares line correlation coefficient */
-               };
-enum text_prop_en { TEXT_PROP_DEFAULT=0,   /* default settings */
-                   TEXT_PROP_TITLE,       /* properties for the title */
-                   TEXT_PROP_AXIS,        /* for the numbers next to the axis */
-                   TEXT_PROP_UNIT,        /* for the vertical unit description */
-                   TEXT_PROP_LEGEND,      /* fot the legend below the graph */
-                   TEXT_PROP_LAST };
+    VDEF_MAXIMUM = 0    /* like the MAX in (G)PRINT */
+        , VDEF_MINIMUM  /* like the MIN in (G)PRINT */
+        , VDEF_AVERAGE  /* like the AVERAGE in (G)PRINT */
+        , VDEF_PERCENT  /* Nth percentile */
+        , VDEF_TOTAL    /* average multiplied by time */
+        , VDEF_FIRST    /* first non-unknown value and time */
+        , VDEF_LAST     /* last  non-unknown value and time */
+        , VDEF_LSLSLOPE /* least squares line slope */
+        , VDEF_LSLINT   /* least squares line y_intercept */
+        , VDEF_LSLCORREL    /* least squares line correlation coefficient */
+};
+enum text_prop_en { TEXT_PROP_DEFAULT = 0,  /* default settings */
+    TEXT_PROP_TITLE,    /* properties for the title */
+    TEXT_PROP_AXIS,     /* for the numbers next to the axis */
+    TEXT_PROP_UNIT,     /* for the vertical unit description */
+    TEXT_PROP_LEGEND,   /* fot the legend below the graph */
+    TEXT_PROP_LAST
+};
 
 typedef struct text_prop_t {
-  double       size;
-  char         font[1024];
+    double    size;
+    char      font[1024];
 } text_prop_t;
 
 
 typedef struct vdef_t {
-    enum vdef_op_en    op;
-    double             param;  /* parameter for function, if applicable */
-    double             val;    /* resulting value */
-    time_t             when;   /* timestamp, if applicable */
+    enum vdef_op_en op;
+    double    param;    /* parameter for function, if applicable */
+    double    val;      /* resulting value */
+    time_t    when;     /* timestamp, if applicable */
 } vdef_t;
 
 typedef struct xlab_t {
-    long         minsec;       /* minimum sec per pix */
-    long         length;       /* number of secs on the image */
-    enum tmt_en  gridtm;       /* grid interval in what ?*/
-    long         gridst;       /* how many whats per grid*/
-    enum tmt_en  mgridtm;      /* label interval in what ?*/
-    long         mgridst;      /* how many whats per label*/
-    enum tmt_en  labtm;        /* label interval in what ?*/
-    long         labst;        /* how many whats per label*/
-    long         precis;       /* label precision -> label placement*/
-    char         *stst;        /* strftime string*/
+    long      minsec;   /* minimum sec per pix */
+    long      length;   /* number of secs on the image */
+    enum tmt_en gridtm; /* grid interval in what ? */
+    long      gridst;   /* how many whats per grid */
+    enum tmt_en mgridtm;    /* label interval in what ? */
+    long      mgridst;  /* how many whats per label */
+    enum tmt_en labtm;  /* label interval in what ? */
+    long      labst;    /* how many whats per label */
+    long      precis;   /* label precision -> label placement */
+    char     *stst;     /* strftime string */
 } xlab_t;
 
 typedef struct ygrid_scale_t {  /* y axis grid scaling info */
-    double       gridstep;
-    int          labfact;
-    char         labfmt[64];
+    double    gridstep;
+    int       labfact;
+    char      labfmt[64];
 } ygrid_scale_t;
 
 /* sensible y label intervals ...*/
 
 typedef struct ylab_t {
-    double   grid;    /* grid spacing */
-    int      lfac[4]; /* associated label spacing*/
+    double    grid;     /* grid spacing */
+    int       lfac[4];  /* associated label spacing */
 } ylab_t;
 
 
@@ -105,159 +109,251 @@ typedef struct ylab_t {
 #define FMT_LEG_LEN 2000
 #endif
 
-typedef  struct graph_desc_t {
-    enum gf_en     gf;         /* graphing function */
-    int            stack;      /* boolean */
-    int            debug;      /* boolean */
-    char           vname[MAX_VNAME_LEN+1];  /* name of the variable */
-    long           vidx;       /* gdes reference */
-    char           rrd[1024];   /* name of the rrd_file containing data */
-    char           ds_nam[DS_NAM_SIZE]; /* data source name */
-    long           ds;         /* data source number */
-    enum cf_en     cf;         /* consolidation function */
-    enum cf_en     cf_reduce;  /* consolidation function for reduce_data() */
-    gfx_color_t    col;        /* graph color */
-    char  format[FMT_LEG_LEN+5]; /* format for PRINT AND GPRINT */
-    char  legend[FMT_LEG_LEN+5]; /* legend*/
-    int            strftm;     /* should the VDEF legend be formated with strftime */
-    double         leg_x,leg_y;  /* location of legend */   
-    double         yrule;      /* value for y rule line and for VDEF */
-    time_t         xrule;      /* time for x rule line and for VDEF */
-    vdef_t         vf;         /* instruction for VDEF function */
-    rpnp_t         *rpnp;     /* instructions for CDEF function */
+typedef struct graph_desc_t {
+    enum gf_en gf;      /* graphing function */
+    int       stack;    /* boolean */
+    int       debug;    /* boolean */
+    char      vname[MAX_VNAME_LEN + 1]; /* name of the variable */
+    long      vidx;     /* gdes reference */
+    char      rrd[1024];    /* name of the rrd_file containing data */
+    char      ds_nam[DS_NAM_SIZE];  /* data source name */
+    long      ds;       /* data source number */
+    enum cf_en cf;      /* consolidation function */
+    enum cf_en cf_reduce;   /* consolidation function for reduce_data() */
+    gfx_color_t col;    /* graph color */
+    char      format[FMT_LEG_LEN + 5];  /* format for PRINT AND GPRINT */
+    char      legend[FMT_LEG_LEN + 5];  /* legend */
+    int       strftm;   /* should the VDEF legend be formated with strftime */
+    double    leg_x, leg_y; /* location of legend */
+    double    yrule;    /* value for y rule line and for VDEF */
+    time_t    xrule;    /* time for x rule line and for VDEF */
+    vdef_t    vf;       /* instruction for VDEF function */
+    rpnp_t   *rpnp;     /* instructions for CDEF function */
 
     /* SHIFT implementation */
-    int            shidx; /* gdes reference for offset (-1 --> constant) */
-    time_t         shval; /* offset if shidx is -1 */
-    time_t         shift; /* current shift applied */
+    int       shidx;    /* gdes reference for offset (-1 --> constant) */
+    time_t    shval;    /* offset if shidx is -1 */
+    time_t    shift;    /* current shift applied */
 
     /* description of data fetched for the graph element */
-    time_t         start,end; /* timestaps for first and last data element */
-    time_t         start_orig,end_orig; /* timestaps for first and last data element */
-    unsigned long  step;      /* time between samples */
-    unsigned long  step_orig;      /* time between samples */
-    unsigned long  ds_cnt; /* how many data sources are there in the fetch */
-    long           data_first; /* first pointer to this data */
-    char           **ds_namv; /* name of datasources  in the fetch. */
-    rrd_value_t    *data; /* the raw data drawn from the rrd */
-    rrd_value_t    *p_data; /* processed data, xsize elments */
-    double         linewidth;  /* linewideth */
+    time_t    start, end;   /* timestaps for first and last data element */
+    time_t    start_orig, end_orig; /* timestaps for first and last data element */
+    unsigned long step; /* time between samples */
+    unsigned long step_orig;    /* time between samples */
+    unsigned long ds_cnt;   /* how many data sources are there in the fetch */
+    long      data_first;   /* first pointer to this data */
+    char    **ds_namv;  /* name of datasources  in the fetch. */
+    rrd_value_t *data;  /* the raw data drawn from the rrd */
+    rrd_value_t *p_data;    /* processed data, xsize elments */
+    double    linewidth;    /* linewideth */
 } graph_desc_t;
 
 typedef struct image_desc_t {
 
     /* configuration of graph */
 
-    char           graphfile[MAXPATH]; /* filename for graphic */
-    FILE         *graphhandle;        /* FILE to use if filename is "-" */
-    long           xsize,ysize;        /* graph area size in pixels */
+    char      graphfile[MAXPATH];   /* filename for graphic */
+    FILE     *graphhandle;  /* FILE to use if filename is "-" */
+    long      xsize, ysize; /* graph area size in pixels */
 #ifdef WITH_PIECHART
-    long          piesize;            /* size of the piechart */
+    long      piesize;  /* size of the piechart */
 #endif
-    gfx_color_t    graph_col[__GRC_END__]; /* real colors for the graph */   
-    text_prop_t    text_prop[TEXT_PROP_LAST]; /* text properties */
-    char           ylegend[210];   /* legend along the yaxis */
-    char           title[210];     /* title for graph */
-    char           watermark[110];   /* watermark for graph */
-    int            draw_x_grid;      /* no x-grid at all */
-    int            draw_y_grid;      /* no x-grid at all */
-    double         grid_dash_on, grid_dash_off;
-    xlab_t         xlab_user;      /* user defined labeling for xaxis */
-    char           xlab_form[210]; /* format for the label on the xaxis */
-
-    double         ygridstep;      /* user defined step for y grid */
-    int            ylabfact;       /* every how many y grid shall a label be written ? */
-    double         tabwidth;       /* tabwdith */
-    time_t         start,end;      /* what time does the graph cover */
-    unsigned long  step;           /* any preference for the default step ? */
-    rrd_value_t    minval,maxval;  /* extreme values in the data */
-    int            rigid;          /* do not expand range even with 
-                                     values outside */
-    ygrid_scale_t  ygrid_scale;    /* calculated y axis grid info */
-    int            gridfit;        /* adjust y-axis range etc so all
-                                     grindlines falls in integer pixel values */
-    char*          imginfo;        /* construct an <IMG ... tag and return 
-                                     as first retval */
-    int            lazy;           /* only update the image if there is
-                                     reasonable probablility that the
-                                     existing one is out of date */
-    int                   slopemode;      /* connect the dots of the curve directly, not using a stair */
-    int            logarithmic;    /* scale the yaxis logarithmic */
-    
+    gfx_color_t graph_col[__GRC_END__]; /* real colors for the graph */
+    text_prop_t text_prop[TEXT_PROP_LAST];  /* text properties */
+    char      ylegend[210]; /* legend along the yaxis */
+    char      title[210];   /* title for graph */
+    char      watermark[110];   /* watermark for graph */
+    int       draw_x_grid;  /* no x-grid at all */
+    int       draw_y_grid;  /* no x-grid at all */
+    double    grid_dash_on, grid_dash_off;
+    xlab_t    xlab_user;    /* user defined labeling for xaxis */
+    char      xlab_form[210];   /* format for the label on the xaxis */
+
+    double    ygridstep;    /* user defined step for y grid */
+    int       ylabfact; /* every how many y grid shall a label be written ? */
+    double    tabwidth; /* tabwdith */
+    time_t    start, end;   /* what time does the graph cover */
+    unsigned long step; /* any preference for the default step ? */
+    rrd_value_t minval, maxval; /* extreme values in the data */
+    int       rigid;    /* do not expand range even with 
+                           values outside */
+    ygrid_scale_t ygrid_scale;  /* calculated y axis grid info */
+    int       gridfit;  /* adjust y-axis range etc so all
+                           grindlines falls in integer pixel values */
+    char     *imginfo;  /* construct an <IMG ... tag and return 
+                           as first retval */
+    int       lazy;     /* only update the image if there is
+                           reasonable probablility that the
+                           existing one is out of date */
+    int       slopemode;    /* connect the dots of the curve directly, not using a stair */
+    int       logarithmic;  /* scale the yaxis logarithmic */
+
     /* status information */
-           
-    long           xorigin,yorigin;/* where is (0,0) of the graph */
+
+    long      xorigin, yorigin; /* where is (0,0) of the graph */
 #ifdef WITH_PIECHART
-    long           pie_x,pie_y;    /* where is the centerpoint */
+    long      pie_x, pie_y; /* where is the centerpoint */
 #endif
-    long           ximg,yimg;      /* total size of the image */
-    double         magfact;        /* numerical magnitude*/
-    long         base;             /* 1000 or 1024 depending on what we graph */
-    char           symbol;         /* magnitude symbol for y-axis */
-    float          viewfactor;     /* how should the numbers on the y-axis be scaled for viewing ? */
-    int            unitsexponent;  /* 10*exponent for units on y-asis */
-    int            unitslength;    /* width of the yaxis labels */
-    int            forceleftspace; /* do not kill the space to the left of the y-axis if there is no grid */
-
-    int            extra_flags;    /* flags for boolean options */
+    long      ximg, yimg;   /* total size of the image */
+    double    magfact;  /* numerical magnitude */
+    long      base;     /* 1000 or 1024 depending on what we graph */
+    char      symbol;   /* magnitude symbol for y-axis */
+    float     viewfactor;   /* how should the numbers on the y-axis be scaled for viewing ? */
+    int       unitsexponent;    /* 10*exponent for units on y-asis */
+    int       unitslength;  /* width of the yaxis labels */
+    int       forceleftspace;   /* do not kill the space to the left of the y-axis if there is no grid */
+
+    int       extra_flags;  /* flags for boolean options */
     /* data elements */
 
-    long  prt_c;                  /* number of print elements */
-    long  gdes_c;                  /* number of graphics elements */
-    graph_desc_t   *gdes;          /* points to an array of graph elements */
-    gfx_canvas_t   *canvas;        /* graphics library */
+    long      prt_c;    /* number of print elements */
+    long      gdes_c;   /* number of graphics elements */
+    graph_desc_t *gdes; /* points to an array of graph elements */
+    gfx_canvas_t *canvas;   /* graphics library */
 } image_desc_t;
 
 /* Prototypes */
-int xtr(image_desc_t *,time_t);
-double ytr(image_desc_t *, double);
-enum gf_en gf_conv(char *);
-enum gfx_if_en if_conv(char *);
-enum tmt_en tmt_conv(char *);
-enum grc_en grc_conv(char *);
-enum text_prop_en text_prop_conv(char *);
-int im_free(image_desc_t *);
-void auto_scale( image_desc_t *,  double *, char **, double *);
-void si_unit( image_desc_t *);
-void expand_range(image_desc_t *);
-void apply_gridfit(image_desc_t *);
-void reduce_data( enum cf_en,  unsigned long,  time_t *, time_t *,  unsigned long *,  unsigned long *,  rrd_value_t **);
-int data_fetch( image_desc_t *);
-long find_var(image_desc_t *, char *);
-long find_var_wrapper(void *arg1, char *key);
-long lcd(long *);
-int data_calc( image_desc_t *);
-int data_proc( image_desc_t *);
-time_t find_first_time( time_t,  enum tmt_en,  long);
-time_t find_next_time( time_t,  enum tmt_en,  long);
-int print_calc(image_desc_t *, char ***);
-int leg_place(image_desc_t *);
-int calc_horizontal_grid(image_desc_t *);
-int draw_horizontal_grid(image_desc_t *);
-int horizontal_log_grid(image_desc_t *);
-void vertical_grid(image_desc_t *);
-void axis_paint(image_desc_t *);
-void grid_paint(image_desc_t *);
-int lazy_check(image_desc_t *);
-int graph_paint(image_desc_t *, char ***);
+int       xtr(
+    image_desc_t *,
+    time_t);
+double    ytr(
+    image_desc_t *,
+    double);
+enum gf_en gf_conv(
+    char *);
+enum gfx_if_en if_conv(
+    char *);
+enum tmt_en tmt_conv(
+    char *);
+enum grc_en grc_conv(
+    char *);
+enum text_prop_en text_prop_conv(
+    char *);
+int       im_free(
+    image_desc_t *);
+void      auto_scale(
+    image_desc_t *,
+    double *,
+    char **,
+    double *);
+void      si_unit(
+    image_desc_t *);
+void      expand_range(
+    image_desc_t *);
+void      apply_gridfit(
+    image_desc_t *);
+void      reduce_data(
+    enum cf_en,
+    unsigned long,
+    time_t *,
+    time_t *,
+    unsigned long *,
+    unsigned long *,
+    rrd_value_t **);
+int       data_fetch(
+    image_desc_t *);
+long      find_var(
+    image_desc_t *,
+    char *);
+long      find_var_wrapper(
+    void *arg1,
+    char *key);
+long      lcd(
+    long *);
+int       data_calc(
+    image_desc_t *);
+int       data_proc(
+    image_desc_t *);
+time_t    find_first_time(
+    time_t,
+    enum tmt_en,
+    long);
+time_t    find_next_time(
+    time_t,
+    enum tmt_en,
+    long);
+int       print_calc(
+    image_desc_t *,
+    char ***);
+int       leg_place(
+    image_desc_t *);
+int       calc_horizontal_grid(
+    image_desc_t *);
+int       draw_horizontal_grid(
+    image_desc_t *);
+int       horizontal_log_grid(
+    image_desc_t *);
+void      vertical_grid(
+    image_desc_t *);
+void      axis_paint(
+    image_desc_t *);
+void      grid_paint(
+    image_desc_t *);
+int       lazy_check(
+    image_desc_t *);
+int       graph_paint(
+    image_desc_t *,
+    char ***);
+
 #ifdef WITH_PIECHART
-void pie_part(image_desc_t *, gfx_color_t, double, double, double, double, double);
+void      pie_part(
+    image_desc_t *,
+    gfx_color_t,
+    double,
+    double,
+    double,
+    double,
+    double);
 #endif
-int gdes_alloc(image_desc_t *);
-int scan_for_col(const char *const , int, char *const);
-int rrd_graph(int, char **, char ***, int *, int *, FILE *, double *, double *);
-void rrd_graph_init(image_desc_t *);
-void rrd_graph_options(int, char **, image_desc_t *);
-void rrd_graph_script(int, char **, image_desc_t *, int);
-int rrd_graph_color(image_desc_t *, char *, char *, int);
-int bad_format(char *);
-int vdef_parse(struct graph_desc_t *,const char *const);
-int vdef_calc(image_desc_t *, int);
-int vdef_percent_compar(const void *,const void *);
-int graph_size_location(image_desc_t *, int
+int       gdes_alloc(
+    image_desc_t *);
+int       scan_for_col(
+    const char *const,
+    int,
+    char *const);
+int       rrd_graph(
+    int,
+    char **,
+    char ***,
+    int *,
+    int *,
+    FILE *,
+    double *,
+    double *);
+void      rrd_graph_init(
+    image_desc_t *);
+void      rrd_graph_options(
+    int,
+    char **,
+    image_desc_t *);
+void      rrd_graph_script(
+    int,
+    char **,
+    image_desc_t *,
+    int);
+int       rrd_graph_color(
+    image_desc_t *,
+    char *,
+    char *,
+    int);
+int       bad_format(
+    char *);
+int       vdef_parse(
+    struct graph_desc_t *,
+    const char *const);
+int       vdef_calc(
+    image_desc_t *,
+    int);
+int       vdef_percent_compar(
+    const void *,
+    const void *);
+int       graph_size_location(
+    image_desc_t *,
+    int
 #ifdef WITH_PIECHART
- ,int
+    ,
+    int
 #endif
-);
+    );
 
 #endif
index 20198ed..06a0ed1 100644 (file)
    image_desc_t *const im    - a fixed pointer to a changing image description
 */
 
-int rrd_parse_find_gf (const char * const, unsigned int *const, graph_desc_t *const);
-int rrd_parse_legend  (const char * const, unsigned int *const, graph_desc_t *const);
-int rrd_parse_color   (const char * const, graph_desc_t *const);
-int rrd_parse_CF      (const char * const, unsigned int *const, graph_desc_t *const, enum cf_en *const);
-int rrd_parse_print   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_shift   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_xport   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_PVHLAST (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_make_vname   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_find_vname   (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_def     (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_vdef    (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-int rrd_parse_cdef    (const char * const, unsigned int *const, graph_desc_t *const, image_desc_t *const);
-
-
-
-int
-rrd_parse_find_gf(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp) {
-    char funcname[11],c1=0;
-    int i=0;
+int       rrd_parse_find_gf(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const);
+int       rrd_parse_legend(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const);
+int       rrd_parse_color(
+    const char *const,
+    graph_desc_t * const);
+int       rrd_parse_CF(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    enum cf_en *const);
+int       rrd_parse_print(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_shift(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_xport(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_PVHLAST(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_make_vname(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_find_vname(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_def(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_vdef(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+int       rrd_parse_cdef(
+    const char *const,
+    unsigned int *const,
+    graph_desc_t * const,
+    image_desc_t * const);
+
+
+
+int rrd_parse_find_gf(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp)
+{
+    char      funcname[11], c1 = 0;
+    int       i = 0;
 
     /* start an argument with DEBUG to be able to see how it is parsed */
     sscanf(&line[*eaten], "DEBUG%n", &i);
     if (i) {
-       gdp->debug=1;
-       (*eaten)+=i;
-       i=0;
-       dprintf("Scanning line '%s'\n",&line[*eaten]);
+        gdp->debug = 1;
+        (*eaten) += i;
+        i = 0;
+        dprintf("Scanning line '%s'\n", &line[*eaten]);
     }
-    i=0;c1='\0';
+    i = 0;
+    c1 = '\0';
     sscanf(&line[*eaten], "%10[A-Z]%n%c", funcname, &i, &c1);
     if (!i) {
-       rrd_set_error("Could not make sense out of '%s'",line);
-       return 1;
+        rrd_set_error("Could not make sense out of '%s'", line);
+        return 1;
     }
-    (*eaten)+=i;
-    if ((int)(gdp->gf=gf_conv(funcname)) == -1) {
-       rrd_set_error("'%s' is not a valid function name", funcname);
-       return 1;
+    (*eaten) += i;
+    if ((int) (gdp->gf = gf_conv(funcname)) == -1) {
+        rrd_set_error("'%s' is not a valid function name", funcname);
+        return 1;
     } else {
-       dprintf("- found function name '%s'\n",funcname);
+        dprintf("- found function name '%s'\n", funcname);
     }
 
     if (c1 == '\0') {
-       rrd_set_error("Function %s needs parameters.  Line: %s\n",funcname,line);
-       return 1;
+        rrd_set_error("Function %s needs parameters.  Line: %s\n", funcname,
+                      line);
+        return 1;
     }
-    if (c1 == ':') (*eaten)++;
+    if (c1 == ':')
+        (*eaten)++;
 
     /* Some commands have a parameter before the colon
      * (currently only LINE)
      */
     switch (gdp->gf) {
-       case GF_LINE:
-           if (c1 == ':') {
-               gdp->linewidth=1;
-               dprintf("- - using default width of 1\n");
-           } else {
-               i=0;sscanf(&line[*eaten],"%lf:%n",&gdp->linewidth,&i);
-               if (!i) {
-                   rrd_set_error("Cannot parse line width '%s' in line '%s'\n",&line[*eaten],line);
-                   return 1;
-               } else {
-                   dprintf("- - scanned width %f\n",gdp->linewidth);
-                   if (isnan(gdp->linewidth)) {
-                       rrd_set_error("LINE width '%s' is not a number in line '%s'\n",&line[*eaten],line);
-                       return 1;
-                   }
-                   if (isinf(gdp->linewidth)) {
-                       rrd_set_error("LINE width '%s' is out of range in line '%s'\n",&line[*eaten],line);
-                       return 1;
-                   }
-                   if (gdp->linewidth<0) {
-                       rrd_set_error("LINE width '%s' is less than 0 in line '%s'\n",&line[*eaten],line);
-                       return 1;
-                   }
-               }
-               (*eaten)+=i;
-           }
-           break;
-       default:
-           if (c1 == ':') break;
-           rrd_set_error("Malformed '%s' command in line '%s'\n",&line[*eaten],line);
-           return 1;
+    case GF_LINE:
+        if (c1 == ':') {
+            gdp->linewidth = 1;
+            dprintf("- - using default width of 1\n");
+        } else {
+            i = 0;
+            sscanf(&line[*eaten], "%lf:%n", &gdp->linewidth, &i);
+            if (!i) {
+                rrd_set_error("Cannot parse line width '%s' in line '%s'\n",
+                              &line[*eaten], line);
+                return 1;
+            } else {
+                dprintf("- - scanned width %f\n", gdp->linewidth);
+                if (isnan(gdp->linewidth)) {
+                    rrd_set_error
+                        ("LINE width '%s' is not a number in line '%s'\n",
+                         &line[*eaten], line);
+                    return 1;
+                }
+                if (isinf(gdp->linewidth)) {
+                    rrd_set_error
+                        ("LINE width '%s' is out of range in line '%s'\n",
+                         &line[*eaten], line);
+                    return 1;
+                }
+                if (gdp->linewidth < 0) {
+                    rrd_set_error
+                        ("LINE width '%s' is less than 0 in line '%s'\n",
+                         &line[*eaten], line);
+                    return 1;
+                }
+            }
+            (*eaten) += i;
+        }
+        break;
+    default:
+        if (c1 == ':')
+            break;
+        rrd_set_error("Malformed '%s' command in line '%s'\n", &line[*eaten],
+                      line);
+        return 1;
     }
     if (line[*eaten] == '\0') {
-       rrd_set_error("Expected some arguments after '%s'\n",line);
-       return 1;
+        rrd_set_error("Expected some arguments after '%s'\n", line);
+        return 1;
     }
     return 0;
 }
 
-int
-rrd_parse_legend(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp) {
-    int i;
+int rrd_parse_legend(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp)
+{
+    int       i;
 
-    if (line[*eaten]=='\0' || line[*eaten]==':') {
-       dprintf("- no (or: empty) legend found\n");
-       return 0;
+    if (line[*eaten] == '\0' || line[*eaten] == ':') {
+        dprintf("- no (or: empty) legend found\n");
+        return 0;
     }
 
-    i=scan_for_col(&line[*eaten],FMT_LEG_LEN,gdp->legend);
+    i = scan_for_col(&line[*eaten], FMT_LEG_LEN, gdp->legend);
 
-    (*eaten)+=i;
+    (*eaten) += i;
 
-    if (line[*eaten]!='\0' && line[*eaten]!=':') {
-       rrd_set_error("Legend too long");
-       return 1;
+    if (line[*eaten] != '\0' && line[*eaten] != ':') {
+        rrd_set_error("Legend too long");
+        return 1;
     } else {
-       return 0;
+        return 0;
     }
 }
 
-int
-rrd_parse_color(const char *const string, graph_desc_t *const gdp) {
-    unsigned int r=0,g=0,b=0,a=0,i;
+int rrd_parse_color(
+    const char *const string,
+    graph_desc_t * const gdp)
+{
+    unsigned int r = 0, g = 0, b = 0, a = 0, i;
 
     /* matches the following formats:
-    ** RGB
-    ** RGBA
-    ** RRGGBB
-    ** RRGGBBAA
-    */
-
-    i=0;
-    while (string[i] && isxdigit((unsigned int)string[i])) i++;
-    if (string[i] != '\0') return 1; /* garbage follows hexdigits */
+     ** RGB
+     ** RGBA
+     ** RRGGBB
+     ** RRGGBBAA
+     */
+
+    i = 0;
+    while (string[i] && isxdigit((unsigned int) string[i]))
+        i++;
+    if (string[i] != '\0')
+        return 1;       /* garbage follows hexdigits */
     switch (i) {
-       case 3:
-       case 4:
-           sscanf(string, "%1x%1x%1x%1x",&r,&g,&b,&a);
-           r *= 0x11;
-           g *= 0x11;
-           b *= 0x11;
-           a *= 0x11;
-           if (i==3) a=0xFF;
-           break;
-       case 6:
-       case 8:
-           sscanf(string, "%02x%02x%02x%02x",&r,&g,&b,&a);
-           if (i==6) a=0xFF;
-           break;
-       default:
-           return 1;   /* wrong number of digits */
-    }
-    gdp->col = r<<24|g<<16|b<<8|a;
+    case 3:
+    case 4:
+        sscanf(string, "%1x%1x%1x%1x", &r, &g, &b, &a);
+        r *= 0x11;
+        g *= 0x11;
+        b *= 0x11;
+        a *= 0x11;
+        if (i == 3)
+            a = 0xFF;
+        break;
+    case 6:
+    case 8:
+        sscanf(string, "%02x%02x%02x%02x", &r, &g, &b, &a);
+        if (i == 6)
+            a = 0xFF;
+        break;
+    default:
+        return 1;       /* wrong number of digits */
+    }
+    gdp->col = r << 24 | g << 16 | b << 8 | a;
     return 0;
 }
 
-int
-rrd_parse_CF(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, enum cf_en *cf) {
-    char               symname[CF_NAM_SIZE];
-    int                        i=0;
-
-    sscanf(&line[*eaten], CF_NAM_FMT "%n", symname,&i);
-    if ((!i)||((line[(*eaten)+i]!='\0')&&(line[(*eaten)+i]!=':'))) {
-       rrd_set_error("Cannot parse CF in '%s'",line);
-       return 1;
+int rrd_parse_CF(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    enum cf_en *cf)
+{
+    char      symname[CF_NAM_SIZE];
+    int       i = 0;
+
+    sscanf(&line[*eaten], CF_NAM_FMT "%n", symname, &i);
+    if ((!i) || ((line[(*eaten) + i] != '\0') && (line[(*eaten) + i] != ':'))) {
+        rrd_set_error("Cannot parse CF in '%s'", line);
+        return 1;
     }
-    (*eaten)+=i;
-    dprintf("- using CF '%s'\n",symname);
+    (*eaten) += i;
+    dprintf("- using CF '%s'\n", symname);
 
-    if ((int)(*cf = cf_conv(symname))==-1) {
-       rrd_set_error("Unknown CF '%s' in '%s'",symname,line);
-       return 1;
+    if ((int) (*cf = cf_conv(symname)) == -1) {
+        rrd_set_error("Unknown CF '%s' in '%s'", symname, line);
+        return 1;
     }
 
-    if (line[*eaten]!='\0') (*eaten)++;
+    if (line[*eaten] != '\0')
+        (*eaten)++;
     return 0;
 }
 
@@ -227,138 +305,173 @@ rrd_parse_CF(const char *const line, unsigned int *const eaten, graph_desc_t *co
  *
  * *eaten is incremented only when a vname is found.
  */
-int
-rrd_parse_find_vname(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    char tmpstr[MAX_VNAME_LEN+1];
-    int i;
-    long vidx;
-
-    i=0;sscanf(&line[*eaten], DEF_NAM_FMT "%n", tmpstr,&i);
+int rrd_parse_find_vname(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    char      tmpstr[MAX_VNAME_LEN + 1];
+    int       i;
+    long      vidx;
+
+    i = 0;
+    sscanf(&line[*eaten], DEF_NAM_FMT "%n", tmpstr, &i);
     if (!i) {
-       rrd_set_error("Could not parse line '%s'",line);
-       return -1;
+        rrd_set_error("Could not parse line '%s'", line);
+        return -1;
     }
-    if (line[*eaten+i]!=':' && line[*eaten+i]!='\0') {
-       rrd_set_error("Could not parse line '%s'",line);
-       return -1;
+    if (line[*eaten + i] != ':' && line[*eaten + i] != '\0') {
+        rrd_set_error("Could not parse line '%s'", line);
+        return -1;
     }
-    dprintf("- Considering '%s'\n",tmpstr);
+    dprintf("- Considering '%s'\n", tmpstr);
 
-    if ((vidx=find_var(im,tmpstr))<0) {
-       dprintf("- Not a vname\n");
-       rrd_set_error("Not a valid vname: %s in line %s",tmpstr,line);
-       return -1;
+    if ((vidx = find_var(im, tmpstr)) < 0) {
+        dprintf("- Not a vname\n");
+        rrd_set_error("Not a valid vname: %s in line %s", tmpstr, line);
+        return -1;
     }
-    dprintf("- Found vname '%s' vidx '%li'\n",tmpstr,gdp->vidx);
-    if (line[*eaten+i]==':') i++;
-    (*eaten)+=i;
+    dprintf("- Found vname '%s' vidx '%li'\n", tmpstr, gdp->vidx);
+    if (line[*eaten + i] == ':')
+        i++;
+    (*eaten) += i;
     return vidx;
 }
 
 /* Parsing old-style xPRINT and new-style xPRINT */
-int
-rrd_parse_print(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
+int rrd_parse_print(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
     /* vname:CF:format in case of DEF-based vname
-    ** vname:CF:format in case of CDEF-based vname
-    ** vname:format[:strftime] in case of VDEF-based vname
-    */
-    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+     ** vname:CF:format in case of CDEF-based vname
+     ** vname:format[:strftime] in case of VDEF-based vname
+     */
+    if ((gdp->vidx = rrd_parse_find_vname(line, eaten, gdp, im)) < 0)
+        return 1;
+
     switch (im->gdes[gdp->vidx].gf) {
-       case GF_DEF:
-       case GF_CDEF:
-           dprintf("- vname is of type DEF or CDEF, looking for CF\n");
-           if (rrd_parse_CF(line,eaten,gdp,&gdp->cf)) return 1;
-           break;
-       case GF_VDEF:
-           dprintf("- vname is of type VDEF\n");
-           break;
-       default:
-           rrd_set_error("Encountered unknown type variable '%s'",im->gdes[gdp->vidx].vname);
-           return 1;
-    }
-
-    if (rrd_parse_legend(line,eaten,gdp)) return 1;
+    case GF_DEF:
+    case GF_CDEF:
+        dprintf("- vname is of type DEF or CDEF, looking for CF\n");
+        if (rrd_parse_CF(line, eaten, gdp, &gdp->cf))
+            return 1;
+        break;
+    case GF_VDEF:
+        dprintf("- vname is of type VDEF\n");
+        break;
+    default:
+        rrd_set_error("Encountered unknown type variable '%s'",
+                      im->gdes[gdp->vidx].vname);
+        return 1;
+    }
+
+    if (rrd_parse_legend(line, eaten, gdp))
+        return 1;
     /* for *PRINT the legend itself gets rendered later. We only
        get the format at this juncture */
-    strcpy(gdp->format,gdp->legend);
-    gdp->legend[0]='\0';       
+    strcpy(gdp->format, gdp->legend);
+    gdp->legend[0] = '\0';
     /* this is a very crud test, parsing :style flags should be in a function */
-    if (im->gdes[gdp->vidx].gf == GF_VDEF && strcmp(line+(*eaten),":strftime")==0){
-       gdp->strftm = 1;
-        (*eaten)+=strlen(":strftime");
+    if (im->gdes[gdp->vidx].gf == GF_VDEF
+        && strcmp(line + (*eaten), ":strftime") == 0) {
+        gdp->strftm = 1;
+        (*eaten) += strlen(":strftime");
     }
     return 0;
 }
 
 /* SHIFT:_def_or_cdef:_vdef_or_number_
  */
-int
-rrd_parse_shift(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    int i;
+int rrd_parse_shift(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    int       i;
 
-    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+    if ((gdp->vidx = rrd_parse_find_vname(line, eaten, gdp, im)) < 0)
+        return 1;
 
     switch (im->gdes[gdp->vidx].gf) {
-       case GF_DEF:
-       case GF_CDEF:
-           dprintf("- vname is of type DEF or CDEF, OK\n");
-           break;
-       case GF_VDEF:
-           rrd_set_error("Cannot shift a VDEF: '%s' in line '%s'\n",im->gdes[gdp->vidx].vname,line);
-           return 1;
-       default:
-           rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
-           return 1;
-    }
-
-    if ((gdp->shidx=rrd_parse_find_vname(line,eaten,gdp,im))>=0) {
-       switch (im->gdes[gdp->shidx].gf) {
-           case GF_DEF:
-           case GF_CDEF:
-               rrd_set_error("Offset cannot be a (C)DEF: '%s' in line '%s'\n",im->gdes[gdp->shidx].vname,line);
-               return 1;
-           case GF_VDEF:
-               dprintf("- vname is of type VDEF, OK\n");
-               break;
-           default:
-               rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
-               return 1;
-       }
+    case GF_DEF:
+    case GF_CDEF:
+        dprintf("- vname is of type DEF or CDEF, OK\n");
+        break;
+    case GF_VDEF:
+        rrd_set_error("Cannot shift a VDEF: '%s' in line '%s'\n",
+                      im->gdes[gdp->vidx].vname, line);
+        return 1;
+    default:
+        rrd_set_error("Encountered unknown type variable '%s' in line '%s'",
+                      im->gdes[gdp->vidx].vname, line);
+        return 1;
+    }
+
+    if ((gdp->shidx = rrd_parse_find_vname(line, eaten, gdp, im)) >= 0) {
+        switch (im->gdes[gdp->shidx].gf) {
+        case GF_DEF:
+        case GF_CDEF:
+            rrd_set_error("Offset cannot be a (C)DEF: '%s' in line '%s'\n",
+                          im->gdes[gdp->shidx].vname, line);
+            return 1;
+        case GF_VDEF:
+            dprintf("- vname is of type VDEF, OK\n");
+            break;
+        default:
+            rrd_set_error
+                ("Encountered unknown type variable '%s' in line '%s'",
+                 im->gdes[gdp->vidx].vname, line);
+            return 1;
+        }
     } else {
-       rrd_clear_error();
-       i=0; sscanf(&line[*eaten],"%li%n",&gdp->shval,&i);
-       if (i!=(int)strlen(&line[*eaten])) {
-           rrd_set_error("Not a valid offset: %s in line %s",&line[*eaten],line);
-           return 1;
-       }
-       (*eaten)+=i;
-       dprintf("- offset is number %li\n",gdp->shval);
-       gdp->shidx = -1;
+        rrd_clear_error();
+        i = 0;
+        sscanf(&line[*eaten], "%li%n", &gdp->shval, &i);
+        if (i != (int) strlen(&line[*eaten])) {
+            rrd_set_error("Not a valid offset: %s in line %s", &line[*eaten],
+                          line);
+            return 1;
+        }
+        (*eaten) += i;
+        dprintf("- offset is number %li\n", gdp->shval);
+        gdp->shidx = -1;
     }
     return 0;
 }
 
 /* XPORT:_def_or_cdef[:legend]
  */
-int
-rrd_parse_xport(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    if ((gdp->vidx=rrd_parse_find_vname(line,eaten,gdp,im))<0) return 1;
+int rrd_parse_xport(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    if ((gdp->vidx = rrd_parse_find_vname(line, eaten, gdp, im)) < 0)
+        return 1;
 
     switch (im->gdes[gdp->vidx].gf) {
-       case GF_DEF:
-       case GF_CDEF:
-           dprintf("- vname is of type DEF or CDEF, OK\n");
-           break;
-       case GF_VDEF:
-           rrd_set_error("Cannot xport a VDEF: '%s' in line '%s'\n",im->gdes[gdp->vidx].vname,line);
-           return 1;
-       default:
-           rrd_set_error("Encountered unknown type variable '%s' in line '%s'",im->gdes[gdp->vidx].vname,line);
-           return 1;
-    }
-    dprintf("- looking for legend in '%s'\n",&line[*eaten]);
-    if (rrd_parse_legend(line,eaten,gdp)) return 1;
+    case GF_DEF:
+    case GF_CDEF:
+        dprintf("- vname is of type DEF or CDEF, OK\n");
+        break;
+    case GF_VDEF:
+        rrd_set_error("Cannot xport a VDEF: '%s' in line '%s'\n",
+                      im->gdes[gdp->vidx].vname, line);
+        return 1;
+    default:
+        rrd_set_error("Encountered unknown type variable '%s' in line '%s'",
+                      im->gdes[gdp->vidx].vname, line);
+        return 1;
+    }
+    dprintf("- looking for legend in '%s'\n", &line[*eaten]);
+    if (rrd_parse_legend(line, eaten, gdp))
+        return 1;
     return 0;
 }
 
@@ -372,44 +485,61 @@ rrd_parse_xport(const char *const line, unsigned int *const eaten, graph_desc_t
 ** While this is arguable, so is entering fixed numbers
 ** with more than MAX_VNAME_LEN significant digits.
 */
-int
-rrd_parse_PVHLAST(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    int i,j,k;
-    int colorfound=0;
-    char tmpstr[MAX_VNAME_LEN + 10];   /* vname#RRGGBBAA\0 */
+int rrd_parse_PVHLAST(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    int       i, j, k;
+    int       colorfound = 0;
+    char      tmpstr[MAX_VNAME_LEN + 10];   /* vname#RRGGBBAA\0 */
     static int spacecnt = 0;
 
-    if (spacecnt == 0) {        
-       float one_space = gfx_get_text_width(im->canvas, 0,
-                               im->text_prop[TEXT_PROP_LEGEND].font,
-                               im->text_prop[TEXT_PROP_LEGEND].size,
-                               im->tabwidth,"    ", 0) / 4.0;
-       float target_space = gfx_get_text_width(im->canvas, 0,
-                               im->text_prop[TEXT_PROP_LEGEND].font,
-                               im->text_prop[TEXT_PROP_LEGEND].size,
-                               im->tabwidth,"oo", 0);
-       spacecnt =  target_space / one_space;   
-        dprintf("- spacecnt: %i onespace: %f targspace: %f\n",spacecnt,one_space,target_space);
+    if (spacecnt == 0) {
+        float     one_space = gfx_get_text_width(im->canvas, 0,
+                                                 im->
+                                                 text_prop[TEXT_PROP_LEGEND].
+                                                 font,
+                                                 im->
+                                                 text_prop[TEXT_PROP_LEGEND].
+                                                 size,
+                                                 im->tabwidth, "    ",
+                                                 0) / 4.0;
+        float     target_space = gfx_get_text_width(im->canvas, 0,
+                                                    im->
+                                                    text_prop
+                                                    [TEXT_PROP_LEGEND].font,
+                                                    im->
+                                                    text_prop
+                                                    [TEXT_PROP_LEGEND].size,
+                                                    im->tabwidth, "oo", 0);
+
+        spacecnt = target_space / one_space;
+        dprintf("- spacecnt: %i onespace: %f targspace: %f\n", spacecnt,
+                one_space, target_space);
     }
 
 
-    dprintf("- parsing '%s'\n",&line[*eaten]);
+    dprintf("- parsing '%s'\n", &line[*eaten]);
 
     /* have simpler code in the drawing section */
-    if ( gdp->gf == GF_STACK ){
-           gdp->stack=1;
+    if (gdp->gf == GF_STACK) {
+        gdp->stack = 1;
     }
 
-    i=scan_for_col(&line[*eaten],MAX_VNAME_LEN+9,tmpstr);
-    if (line[*eaten+i]!='\0' && line[*eaten+i]!=':') {
-       rrd_set_error("Cannot parse line '%s'",line);
-       return 1;
+    i = scan_for_col(&line[*eaten], MAX_VNAME_LEN + 9, tmpstr);
+    if (line[*eaten + i] != '\0' && line[*eaten + i] != ':') {
+        rrd_set_error("Cannot parse line '%s'", line);
+        return 1;
     }
 
-    j=i; while (j>0 && tmpstr[j]!='#') j--;
+    j = i;
+    while (j > 0 && tmpstr[j] != '#')
+        j--;
 
     if (j) {
-       tmpstr[j]='\0';
+        tmpstr[j] = '\0';
     }
     /* We now have:
      * tmpstr[0]    containing vname
@@ -423,301 +553,327 @@ rrd_parse_PVHLAST(const char *const line, unsigned int *const eaten, graph_desc_
      * valid type (need time for VRULE, not a float)
      * Else see if it parses as a number.
      */
-    dprintf("- examining string '%s'\n",tmpstr);
-    if ((gdp->vidx=find_var(im,tmpstr))>=0) {
-       dprintf("- found vname: '%s' vidx %li\n",tmpstr,gdp->vidx);
-       switch (gdp->gf) {
+    dprintf("- examining string '%s'\n", tmpstr);
+    if ((gdp->vidx = find_var(im, tmpstr)) >= 0) {
+        dprintf("- found vname: '%s' vidx %li\n", tmpstr, gdp->vidx);
+        switch (gdp->gf) {
 #ifdef WITH_PIECHART
-           case GF_PART:
+        case GF_PART:
 #endif
-           case GF_VRULE:
-           case GF_HRULE:
-               if (im->gdes[gdp->vidx].gf != GF_VDEF) {
-                   rrd_set_error("Using vname %s of wrong type in line %s\n",im->gdes[gdp->gf].vname,line);
-                   return 1;
-               }
-               break;
-           default:;
-       }
+        case GF_VRULE:
+        case GF_HRULE:
+            if (im->gdes[gdp->vidx].gf != GF_VDEF) {
+                rrd_set_error("Using vname %s of wrong type in line %s\n",
+                              im->gdes[gdp->gf].vname, line);
+                return 1;
+            }
+            break;
+        default:;
+        }
     } else {
-       dprintf("- it is not an existing vname\n");
-       switch (gdp->gf) {
-           case GF_VRULE:
-               k=0;sscanf(tmpstr,"%li%n",&gdp->xrule,&k);
-               if (((j!=0)&&(k==j))||((j==0)&&(k==i))) {
-                   dprintf("- found time: %li\n",gdp->xrule);
-               } else {
-                   dprintf("- is is not a valid number: %li\n",gdp->xrule);
-                   rrd_set_error("parameter '%s' does not represent time in line %s\n",tmpstr,line);
-                   return 1;
-               }
-           default:
-               k=0;sscanf(tmpstr,"%lf%n",&gdp->yrule,&k);
-               if (((j!=0)&&(k==j))||((j==0)&&(k==i))) {
-                   dprintf("- found number: %f\n",gdp->yrule);
-               } else {
-                   dprintf("- is is not a valid number: %li\n",gdp->xrule);
-                   rrd_set_error("parameter '%s' does not represent a number in line %s\n",tmpstr,line);
-                   return 1;
-               }
-       }
+        dprintf("- it is not an existing vname\n");
+        switch (gdp->gf) {
+        case GF_VRULE:
+            k = 0;
+            sscanf(tmpstr, "%li%n", &gdp->xrule, &k);
+            if (((j != 0) && (k == j)) || ((j == 0) && (k == i))) {
+                dprintf("- found time: %li\n", gdp->xrule);
+            } else {
+                dprintf("- is is not a valid number: %li\n", gdp->xrule);
+                rrd_set_error
+                    ("parameter '%s' does not represent time in line %s\n",
+                     tmpstr, line);
+                return 1;
+            }
+        default:
+            k = 0;
+            sscanf(tmpstr, "%lf%n", &gdp->yrule, &k);
+            if (((j != 0) && (k == j)) || ((j == 0) && (k == i))) {
+                dprintf("- found number: %f\n", gdp->yrule);
+            } else {
+                dprintf("- is is not a valid number: %li\n", gdp->xrule);
+                rrd_set_error
+                    ("parameter '%s' does not represent a number in line %s\n",
+                     tmpstr, line);
+                return 1;
+            }
+        }
     }
 
     if (j) {
-       j++;
-       dprintf("- examining color '%s'\n",&tmpstr[j]);
-       if (rrd_parse_color(&tmpstr[j],gdp)) {
-           rrd_set_error("Could not parse color in '%s'",&tmpstr[j]);
-           return 1;
-       }
-       dprintf("- parsed color 0x%08x\n",(unsigned int)gdp->col);
-       colorfound=1;
+        j++;
+        dprintf("- examining color '%s'\n", &tmpstr[j]);
+        if (rrd_parse_color(&tmpstr[j], gdp)) {
+            rrd_set_error("Could not parse color in '%s'", &tmpstr[j]);
+            return 1;
+        }
+        dprintf("- parsed color 0x%08x\n", (unsigned int) gdp->col);
+        colorfound = 1;
     } else {
-       dprintf("- no color present in '%s'\n",tmpstr);
+        dprintf("- no color present in '%s'\n", tmpstr);
     }
 
-    (*eaten) += i; /* after vname#color */
-    if (line[*eaten]!='\0') {
-       (*eaten)++;     /* after colon */
+    (*eaten) += i;      /* after vname#color */
+    if (line[*eaten] != '\0') {
+        (*eaten)++;     /* after colon */
     }
 
     if (gdp->gf == GF_TICK) {
-       dprintf("- parsing '%s'\n",&line[*eaten]);
-       dprintf("- looking for optional TICK number\n");
-       j=0;
-       sscanf(&line[*eaten],"%lf%n",&gdp->yrule,&j);
-       if (j) {
-           if (line[*eaten+j]!='\0' && line[*eaten+j]!=':') {
-               rrd_set_error("Cannot parse TICK fraction '%s'",line);
-               return 1;
-           }
-           dprintf("- found number %f\n",gdp->yrule);
-           if (gdp->yrule > 1.0 || gdp->yrule < -1.0) {
-               rrd_set_error("Tick factor should be <= 1.0");
-               return 1;
-           }
-           (*eaten)+=j;
-       } else {
+        dprintf("- parsing '%s'\n", &line[*eaten]);
+        dprintf("- looking for optional TICK number\n");
+        j = 0;
+        sscanf(&line[*eaten], "%lf%n", &gdp->yrule, &j);
+        if (j) {
+            if (line[*eaten + j] != '\0' && line[*eaten + j] != ':') {
+                rrd_set_error("Cannot parse TICK fraction '%s'", line);
+                return 1;
+            }
+            dprintf("- found number %f\n", gdp->yrule);
+            if (gdp->yrule > 1.0 || gdp->yrule < -1.0) {
+                rrd_set_error("Tick factor should be <= 1.0");
+                return 1;
+            }
+            (*eaten) += j;
+        } else {
             dprintf("- not found, defaulting to 0.1\n");
-            gdp->yrule=0.1;
-       }
-       if (line[*eaten] == '\0') {
-           dprintf("- done parsing line\n");
-           return 0;
-       } else { if (line[*eaten] == ':') {
-                   (*eaten)++;    
-                } else {
-                    rrd_set_error("Can't make sense of that TICK line");
-                  return 1;
-                 }
+            gdp->yrule = 0.1;
+        }
+        if (line[*eaten] == '\0') {
+            dprintf("- done parsing line\n");
+            return 0;
+        } else {
+            if (line[*eaten] == ':') {
+                (*eaten)++;
+            } else {
+                rrd_set_error("Can't make sense of that TICK line");
+                return 1;
+            }
         }
     }
 
-    dprintf("- parsing '%s'\n",&line[*eaten]);
+    dprintf("- parsing '%s'\n", &line[*eaten]);
 
     /* Legend is next.  A legend without a color is an error.
-    ** Stacking an item without having a legend is OK however
-    ** then an empty legend should be specified.
-    **   LINE:val#color:STACK  means legend is string "STACK"
-    **   LINE:val#color::STACK means no legend, and do STACK
-    **   LINE:val:STACK                is an error (legend but no color)
-    **   LINE:val::STACK       means no legend, and do STACK
-    */
+     ** Stacking an item without having a legend is OK however
+     ** then an empty legend should be specified.
+     **   LINE:val#color:STACK  means legend is string "STACK"
+     **   LINE:val#color::STACK means no legend, and do STACK
+     **   LINE:val:STACK        is an error (legend but no color)
+     **   LINE:val::STACK   means no legend, and do STACK
+     */
     if (colorfound) {
-       int err=0;
-        char *linecp = strdup(line);
-       dprintf("- looking for optional legend\n");
-       
-       dprintf("- examining '%s'\n",&line[*eaten]);
-       if (linecp[*eaten] != '\0' && linecp[*eaten] != ':') {
-           int spi;            
-           /* If the legend is not empty, it has to be prefixed with spacecnt ' ' characters. This then gets
-            * replaced by the color box later on. */
-           for (spi=0;spi<spacecnt && (*eaten) > 1;spi++){
-              linecp[--(*eaten)]=' ';
-           }
-       }
-
-       if (rrd_parse_legend(linecp, eaten, gdp)) err=1;
-       free(linecp);
-       if (err) return 1;
-
-       dprintf("- found legend '%s'\n", &gdp->legend[2]);
+        int       err = 0;
+        char     *linecp = strdup(line);
+
+        dprintf("- looking for optional legend\n");
+
+        dprintf("- examining '%s'\n", &line[*eaten]);
+        if (linecp[*eaten] != '\0' && linecp[*eaten] != ':') {
+            int       spi;
+
+            /* If the legend is not empty, it has to be prefixed with spacecnt ' ' characters. This then gets
+             * replaced by the color box later on. */
+            for (spi = 0; spi < spacecnt && (*eaten) > 1; spi++) {
+                linecp[--(*eaten)] = ' ';
+            }
+        }
+
+        if (rrd_parse_legend(linecp, eaten, gdp))
+            err = 1;
+        free(linecp);
+        if (err)
+            return 1;
+
+        dprintf("- found legend '%s'\n", &gdp->legend[2]);
     } else {
-       dprintf("- skipping empty legend\n");
-       if (line[*eaten] != '\0' && line[*eaten] != ':') {
-           rrd_set_error("Legend set but no color: %s",&line[*eaten]);
-           return 1;
-       }
+        dprintf("- skipping empty legend\n");
+        if (line[*eaten] != '\0' && line[*eaten] != ':') {
+            rrd_set_error("Legend set but no color: %s", &line[*eaten]);
+            return 1;
+        }
     }
-    if (line[*eaten]=='\0') {
-       dprintf("- done parsing line\n");
-       return 0;
+    if (line[*eaten] == '\0') {
+        dprintf("- done parsing line\n");
+        return 0;
     }
-    (*eaten)++;        /* after colon */
+    (*eaten)++;         /* after colon */
 
     /* PART, HRULE, VRULE and TICK cannot be stacked. */
-    if (   (gdp->gf == GF_HRULE)
-       || (gdp->gf == GF_VRULE)
+    if ((gdp->gf == GF_HRULE)
+        || (gdp->gf == GF_VRULE)
 #ifdef WITH_PIECHART
-       || (gdp->gf == GF_PART)
+        || (gdp->gf == GF_PART)
 #endif
-       || (gdp->gf == GF_TICK)
-       ) return 0;
-
-    dprintf("- parsing '%s'\n",&line[*eaten]);
-    if (line[*eaten]!='\0') {
-       dprintf("- still more, should be STACK\n");
-       j=scan_for_col(&line[*eaten],5,tmpstr);
-       if (line[*eaten+j]!='\0' && line[*eaten+j]!=':') {
-           /* not 5 chars */
-           rrd_set_error("Garbage found where STACK expected");
-           return 1;
-       }
-       if (!strcmp("STACK",tmpstr)) {
-           dprintf("- found STACK\n");
-           gdp->stack=1;
-           (*eaten)+=j;
-       } else {
-           rrd_set_error("Garbage found where STACK expected");
-           return 1;
-       }
-    }
-    if (line[*eaten]=='\0') {
-       dprintf("- done parsing line\n");
-       return 0;
+        || (gdp->gf == GF_TICK)
+        )
+        return 0;
+
+    dprintf("- parsing '%s'\n", &line[*eaten]);
+    if (line[*eaten] != '\0') {
+        dprintf("- still more, should be STACK\n");
+        j = scan_for_col(&line[*eaten], 5, tmpstr);
+        if (line[*eaten + j] != '\0' && line[*eaten + j] != ':') {
+            /* not 5 chars */
+            rrd_set_error("Garbage found where STACK expected");
+            return 1;
+        }
+        if (!strcmp("STACK", tmpstr)) {
+            dprintf("- found STACK\n");
+            gdp->stack = 1;
+            (*eaten) += j;
+        } else {
+            rrd_set_error("Garbage found where STACK expected");
+            return 1;
+        }
+    }
+    if (line[*eaten] == '\0') {
+        dprintf("- done parsing line\n");
+        return 0;
     }
     (*eaten)++;
-    dprintf("- parsing '%s'\n",&line[*eaten]);
+    dprintf("- parsing '%s'\n", &line[*eaten]);
 
     return 0;
 }
 
-int
-rrd_parse_make_vname(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    char tmpstr[MAX_VNAME_LEN + 10];
-    int i=0;
+int rrd_parse_make_vname(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    char      tmpstr[MAX_VNAME_LEN + 10];
+    int       i = 0;
 
-    sscanf(&line[*eaten], DEF_NAM_FMT "=%n", tmpstr,&i);
+    sscanf(&line[*eaten], DEF_NAM_FMT "=%n", tmpstr, &i);
     if (!i) {
-       rrd_set_error("Cannot parse vname from '%s'",line);
-       return 1;
+        rrd_set_error("Cannot parse vname from '%s'", line);
+        return 1;
     }
-    dprintf("- found candidate '%s'\n",tmpstr);
+    dprintf("- found candidate '%s'\n", tmpstr);
 
-    if ((gdp->vidx=find_var(im,tmpstr))>=0) {
-       rrd_set_error("Attempting to reuse '%s'",im->gdes[gdp->vidx].vname);
-       return 1;
+    if ((gdp->vidx = find_var(im, tmpstr)) >= 0) {
+        rrd_set_error("Attempting to reuse '%s'", im->gdes[gdp->vidx].vname);
+        return 1;
     }
-    strcpy(gdp->vname,tmpstr);
-    dprintf("- created vname '%s' vidx %lu\n", gdp->vname,im->gdes_c-1);
-    (*eaten)+=i;
+    strcpy(gdp->vname, tmpstr);
+    dprintf("- created vname '%s' vidx %lu\n", gdp->vname, im->gdes_c - 1);
+    (*eaten) += i;
     return 0;
 }
 
-int
-rrd_parse_def(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    int                        i=0;
-    char               command[7]; /* step, start, end, reduce */
-    char               tmpstr[256];
-    struct rrd_time_value      start_tv,end_tv;
-    time_t             start_tmp=0,end_tmp=0;
-    char               *parsetime_error=NULL;
-
-    start_tv.type   = end_tv.type=ABSOLUTE_TIME;
-    start_tv.offset = end_tv.offset=0;
+int rrd_parse_def(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    int       i = 0;
+    char      command[7];   /* step, start, end, reduce */
+    char      tmpstr[256];
+    struct rrd_time_value start_tv, end_tv;
+    time_t    start_tmp = 0, end_tmp = 0;
+    char     *parsetime_error = NULL;
+
+    start_tv.type = end_tv.type = ABSOLUTE_TIME;
+    start_tv.offset = end_tv.offset = 0;
     localtime_r(&gdp->start, &start_tv.tm);
     localtime_r(&gdp->end, &end_tv.tm);
-    
-    dprintf("- parsing '%s'\n",&line[*eaten]);
-    dprintf("- from line '%s'\n",line);
 
-    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
-    i=scan_for_col(&line[*eaten],sizeof(gdp->rrd)-1,gdp->rrd);
-    if (line[*eaten+i]!=':') {
-       rrd_set_error("Problems reading database name");
-       return 1;
+    dprintf("- parsing '%s'\n", &line[*eaten]);
+    dprintf("- from line '%s'\n", line);
+
+    if (rrd_parse_make_vname(line, eaten, gdp, im))
+        return 1;
+    i = scan_for_col(&line[*eaten], sizeof(gdp->rrd) - 1, gdp->rrd);
+    if (line[*eaten + i] != ':') {
+        rrd_set_error("Problems reading database name");
+        return 1;
     }
-    (*eaten)+=++i;
-    dprintf("- using file '%s'\n",gdp->rrd);
+    (*eaten) += ++i;
+    dprintf("- using file '%s'\n", gdp->rrd);
 
-    i=0;
-    sscanf(&line[*eaten], DS_NAM_FMT ":%n", gdp->ds_nam,&i);
+    i = 0;
+    sscanf(&line[*eaten], DS_NAM_FMT ":%n", gdp->ds_nam, &i);
     if (!i) {
-       rrd_set_error("Cannot parse DS in '%s'",line);
-       return 1;
+        rrd_set_error("Cannot parse DS in '%s'", line);
+        return 1;
     }
-    (*eaten)+=i;
-    dprintf("- using DS '%s'\n",gdp->ds_nam);
+    (*eaten) += i;
+    dprintf("- using DS '%s'\n", gdp->ds_nam);
 
-    if (rrd_parse_CF(line,eaten,gdp,&gdp->cf)) return 1;
+    if (rrd_parse_CF(line, eaten, gdp, &gdp->cf))
+        return 1;
     gdp->cf_reduce = gdp->cf;
-    
-    if (line[*eaten]=='\0') return 0;
+
+    if (line[*eaten] == '\0')
+        return 0;
 
     while (1) {
-       dprintf("- optional parameter follows: %s\n", &line[*eaten]);
-       i=0;
-       sscanf(&line[*eaten], "%6[a-z]=%n", command, &i);
-       if (!i) {
-           rrd_set_error("Parse error in '%s'",line);
-           return 1;
-       }
-       (*eaten)+=i;
-       dprintf("- processing '%s'\n",command);
-       if (!strcmp("reduce",command)) {
-         if (rrd_parse_CF(line,eaten,gdp,&gdp->cf_reduce)) return 1;
-         if (line[*eaten] != '\0')
-             (*eaten)--;
-       } else if (!strcmp("step",command)) {
-           i=0;
-           sscanf(&line[*eaten],"%lu%n",&gdp->step,&i);
-           gdp->step_orig = gdp->step;
-           (*eaten)+=i;
-           dprintf("- using step %lu\n",gdp->step);
-       } else if (!strcmp("start",command)) {
-           i=scan_for_col(&line[*eaten],255,tmpstr);
-           (*eaten)+=i;
-           if ((parsetime_error = parsetime(tmpstr, &start_tv))) {
-               rrd_set_error( "start time: %s", parsetime_error );
-               return 1;
-           }
-           dprintf("- done parsing:  '%s'\n",&line[*eaten]);
-       } else if (!strcmp("end",command)) {
-           i=scan_for_col(&line[*eaten],255,tmpstr);
-           (*eaten)+=i;
-           if ((parsetime_error = parsetime(tmpstr, &end_tv))) {
-               rrd_set_error( "end time: %s", parsetime_error );
-               return 1;
-           }
-           dprintf("- done parsing:  '%s'\n",&line[*eaten]);
-       } else {
-           rrd_set_error("Parse error in '%s'",line);
-           return 1;
-       }
-       if (line[*eaten]=='\0') break;
-       if (line[*eaten]!=':') {
-           dprintf("- Expected to see end of string but got '%s'\n",\
-                                                        &line[*eaten]);
-           rrd_set_error("Parse error in '%s'",line);
-           return 1;
-       }
-       (*eaten)++;
-    }
-    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
-       /* error string is set in parsetime.c */
-       return 1;
-    }
-    if (start_tmp < 3600*24*365*10) {
-       rrd_set_error("the first entry to fetch should be "
-                       "after 1980 (%ld)",start_tmp);
-       return 1;
+        dprintf("- optional parameter follows: %s\n", &line[*eaten]);
+        i = 0;
+        sscanf(&line[*eaten], "%6[a-z]=%n", command, &i);
+        if (!i) {
+            rrd_set_error("Parse error in '%s'", line);
+            return 1;
+        }
+        (*eaten) += i;
+        dprintf("- processing '%s'\n", command);
+        if (!strcmp("reduce", command)) {
+            if (rrd_parse_CF(line, eaten, gdp, &gdp->cf_reduce))
+                return 1;
+            if (line[*eaten] != '\0')
+                (*eaten)--;
+        } else if (!strcmp("step", command)) {
+            i = 0;
+            sscanf(&line[*eaten], "%lu%n", &gdp->step, &i);
+            gdp->step_orig = gdp->step;
+            (*eaten) += i;
+            dprintf("- using step %lu\n", gdp->step);
+        } else if (!strcmp("start", command)) {
+            i = scan_for_col(&line[*eaten], 255, tmpstr);
+            (*eaten) += i;
+            if ((parsetime_error = parsetime(tmpstr, &start_tv))) {
+                rrd_set_error("start time: %s", parsetime_error);
+                return 1;
+            }
+            dprintf("- done parsing:  '%s'\n", &line[*eaten]);
+        } else if (!strcmp("end", command)) {
+            i = scan_for_col(&line[*eaten], 255, tmpstr);
+            (*eaten) += i;
+            if ((parsetime_error = parsetime(tmpstr, &end_tv))) {
+                rrd_set_error("end time: %s", parsetime_error);
+                return 1;
+            }
+            dprintf("- done parsing:  '%s'\n", &line[*eaten]);
+        } else {
+            rrd_set_error("Parse error in '%s'", line);
+            return 1;
+        }
+        if (line[*eaten] == '\0')
+            break;
+        if (line[*eaten] != ':') {
+            dprintf("- Expected to see end of string but got '%s'\n",
+                    &line[*eaten]);
+            rrd_set_error("Parse error in '%s'", line);
+            return 1;
+        }
+        (*eaten)++;
+    }
+    if (proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+        /* error string is set in parsetime.c */
+        return 1;
+    }
+    if (start_tmp < 3600 * 24 * 365 * 10) {
+        rrd_set_error("the first entry to fetch should be "
+                      "after 1980 (%ld)", start_tmp);
+        return 1;
     }
 
     if (end_tmp < start_tmp) {
-       rrd_set_error("start (%ld) should be less than end (%ld)",
-                       start_tmp, end_tmp);
-       return 1;
+        rrd_set_error("start (%ld) should be less than end (%ld)",
+                      start_tmp, end_tmp);
+        return 1;
     }
 
     gdp->start = start_tmp;
@@ -725,142 +881,164 @@ rrd_parse_def(const char *const line, unsigned int *const eaten, graph_desc_t *c
     gdp->start_orig = start_tmp;
     gdp->end_orig = end_tmp;
 
-    dprintf("- start time %lu\n",gdp->start);
-    dprintf("- end   time %lu\n",gdp->end);
+    dprintf("- start time %lu\n", gdp->start);
+    dprintf("- end   time %lu\n", gdp->end);
 
     return 0;
 }
 
-int
-rrd_parse_vdef(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    char tmpstr[MAX_VNAME_LEN+1];      /* vname\0 */
-    int i=0;
+int rrd_parse_vdef(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    char      tmpstr[MAX_VNAME_LEN + 1];    /* vname\0 */
+    int       i = 0;
 
-    dprintf("- parsing '%s'\n",&line[*eaten]);
-    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
+    dprintf("- parsing '%s'\n", &line[*eaten]);
+    if (rrd_parse_make_vname(line, eaten, gdp, im))
+        return 1;
 
-    sscanf(&line[*eaten], DEF_NAM_FMT ",%n", tmpstr,&i);
+    sscanf(&line[*eaten], DEF_NAM_FMT ",%n", tmpstr, &i);
     if (!i) {
-       rrd_set_error("Cannot parse line '%s'",line);
-       return 1;
+        rrd_set_error("Cannot parse line '%s'", line);
+        return 1;
     }
-    if ((gdp->vidx=find_var(im,tmpstr))<0) {
-       rrd_set_error("Not a valid vname: %s in line %s",tmpstr,line);
-       return 1;
+    if ((gdp->vidx = find_var(im, tmpstr)) < 0) {
+        rrd_set_error("Not a valid vname: %s in line %s", tmpstr, line);
+        return 1;
     }
-    if (   im->gdes[gdp->vidx].gf != GF_DEF
-       && im->gdes[gdp->vidx].gf != GF_CDEF) {
-       rrd_set_error("variable '%s' not DEF nor "
-                       "CDEF in VDEF '%s'", tmpstr,gdp->vname);
-       return 1;
+    if (im->gdes[gdp->vidx].gf != GF_DEF && im->gdes[gdp->vidx].gf != GF_CDEF) {
+        rrd_set_error("variable '%s' not DEF nor "
+                      "CDEF in VDEF '%s'", tmpstr, gdp->vname);
+        return 1;
     }
-    dprintf("- found vname: '%s' vidx %li\n",tmpstr,gdp->vidx);
-    (*eaten)+=i;
+    dprintf("- found vname: '%s' vidx %li\n", tmpstr, gdp->vidx);
+    (*eaten) += i;
 
-    dprintf("- calling vdef_parse with param '%s'\n",&line[*eaten]);
-    vdef_parse(gdp,&line[*eaten]);
-    while (line[*eaten]!='\0'&&line[*eaten]!=':')
-       (*eaten)++;
+    dprintf("- calling vdef_parse with param '%s'\n", &line[*eaten]);
+    vdef_parse(gdp, &line[*eaten]);
+    while (line[*eaten] != '\0' && line[*eaten] != ':')
+        (*eaten)++;
 
     return 0;
 }
 
-int
-rrd_parse_cdef(const char *const line, unsigned int *const eaten, graph_desc_t *const gdp, image_desc_t *const im) {
-    dprintf("- parsing '%s'\n",&line[*eaten]);
-    if (rrd_parse_make_vname(line,eaten,gdp,im)) return 1;
-    if ((gdp->rpnp = rpn_parse(
-       (void *)im,
-       &line[*eaten],
-       &find_var_wrapper)
-    )==NULL) {
-       rrd_set_error("invalid rpn expression in: %s",&line[*eaten]);
-       return 1;
+int rrd_parse_cdef(
+    const char *const line,
+    unsigned int *const eaten,
+    graph_desc_t * const gdp,
+    image_desc_t * const im)
+{
+    dprintf("- parsing '%s'\n", &line[*eaten]);
+    if (rrd_parse_make_vname(line, eaten, gdp, im))
+        return 1;
+    if ((gdp->rpnp = rpn_parse((void *) im, &line[*eaten], &find_var_wrapper)
+        ) == NULL) {
+        rrd_set_error("invalid rpn expression in: %s", &line[*eaten]);
+        return 1;
     };
-    while (line[*eaten]!='\0'&&line[*eaten]!=':')
-       (*eaten)++;
+    while (line[*eaten] != '\0' && line[*eaten] != ':')
+        (*eaten)++;
     return 0;
 }
 
-void
-rrd_graph_script(int argc, char *argv[], image_desc_t *const im, int optno) {
-    int i;
+void rrd_graph_script(
+    int argc,
+    char *argv[],
+    image_desc_t * const im,
+    int optno)
+{
+    int       i;
+
     /* save state for STACK backward compat function */
-    enum gf_en     last_gf=GF_PRINT;
-    float          last_linewidth=0.0;
+    enum gf_en last_gf = GF_PRINT;
+    float     last_linewidth = 0.0;
 
-    for (i=optind+optno;i<argc;i++) {
-       graph_desc_t *gdp;
-       unsigned int eaten=0;
+    for (i = optind + optno; i < argc; i++) {
+        graph_desc_t *gdp;
+        unsigned int eaten = 0;
 
-       if (gdes_alloc(im)) return; /* the error string is already set */
-       gdp = &im->gdes[im->gdes_c-1];
+        if (gdes_alloc(im))
+            return;     /* the error string is already set */
+        gdp = &im->gdes[im->gdes_c - 1];
 #ifdef DEBUG
-       gdp->debug = 1;
+        gdp->debug = 1;
 #endif
 
-       if (rrd_parse_find_gf(argv[i],&eaten,gdp)) return;
-        
-       switch (gdp->gf) {
-           case GF_SHIFT:      /* vname:value */
-               if (rrd_parse_shift(argv[i],&eaten,gdp,im)) return;
-               break;
-           case GF_XPORT:
-               if (rrd_parse_xport(argv[i],&eaten,gdp,im)) return;
-               break;
-           case GF_PRINT:      /* vname:CF:format -or- vname:format */
-               im->prt_c++;            
-           case GF_GPRINT:     /* vname:CF:format -or- vname:format */
-               if (rrd_parse_print(argv[i],&eaten,gdp,im)) return;
-               break;
-            case GF_COMMENT:   /* text */
-               if (rrd_parse_legend(argv[i],&eaten,gdp)) return;
-               break;
+        if (rrd_parse_find_gf(argv[i], &eaten, gdp))
+            return;
+
+        switch (gdp->gf) {
+        case GF_SHIFT: /* vname:value */
+            if (rrd_parse_shift(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        case GF_XPORT:
+            if (rrd_parse_xport(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        case GF_PRINT: /* vname:CF:format -or- vname:format */
+            im->prt_c++;
+        case GF_GPRINT:    /* vname:CF:format -or- vname:format */
+            if (rrd_parse_print(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        case GF_COMMENT:   /* text */
+            if (rrd_parse_legend(argv[i], &eaten, gdp))
+                return;
+            break;
 #ifdef WITH_PIECHART
-           case GF_PART:       /* value[#color[:legend]] */
+        case GF_PART:  /* value[#color[:legend]] */
 #endif
-           case GF_VRULE:      /* value#color[:legend] */
-           case GF_HRULE:      /* value#color[:legend] */
-           case GF_LINE:       /* vname-or-value[#color[:legend]][:STACK] */
-           case GF_AREA:       /* vname-or-value[#color[:legend]][:STACK] */
-           case GF_TICK:       /* vname#color[:num[:legend]] */
-               if (rrd_parse_PVHLAST(argv[i],&eaten,gdp,im))return;
-                last_gf = gdp->gf;
-                last_linewidth = gdp->linewidth;
-               break;
-           case GF_STACK:      /* vname-or-value[#color[:legend]] */           
-               if (rrd_parse_PVHLAST(argv[i],&eaten,gdp,im))return;
-                if (last_gf == GF_LINE || last_gf == GF_AREA){
-                   gdp->gf = last_gf;
-                   gdp->linewidth = last_linewidth;
-                } else {
-                   rrd_set_error("STACK must follow LINE or AREA! command:\n%s",
-                        &argv[i][eaten],argv[i]);
-                   return;
-                }
-               break;
-       /* data acquisition */
-           case GF_DEF:        /* vname=x:DS:CF:[:step=#][:start=#][:end=#] */
-               if (rrd_parse_def(argv[i],&eaten,gdp,im)) return;
-               break;
-           case GF_CDEF:       /* vname=rpn-expression */
-               if (rrd_parse_cdef(argv[i],&eaten,gdp,im)) return;
-               break;
-           case GF_VDEF:       /* vname=rpn-expression */
-               if (rrd_parse_vdef(argv[i],&eaten,gdp,im)) return;
-               break;
-       }
-       if (gdp->debug) {
-           dprintf("used %i out of %i chars\n",eaten,strlen(argv[i]));
-           dprintf("parsed line: '%s'\n",argv[i]);
-           dprintf("remaining: '%s'\n",&argv[i][eaten]);
-           if (eaten >= strlen(argv[i]))
-               dprintf("Command finished successfully\n");
-       }
-       if (eaten < strlen(argv[i])) {
-           rrd_set_error("Garbage '%s' after command:\n%s",
-                       &argv[i][eaten],argv[i]);
-           return;
-       }
+        case GF_VRULE: /* value#color[:legend] */
+        case GF_HRULE: /* value#color[:legend] */
+        case GF_LINE:  /* vname-or-value[#color[:legend]][:STACK] */
+        case GF_AREA:  /* vname-or-value[#color[:legend]][:STACK] */
+        case GF_TICK:  /* vname#color[:num[:legend]] */
+            if (rrd_parse_PVHLAST(argv[i], &eaten, gdp, im))
+                return;
+            last_gf = gdp->gf;
+            last_linewidth = gdp->linewidth;
+            break;
+        case GF_STACK: /* vname-or-value[#color[:legend]] */
+            if (rrd_parse_PVHLAST(argv[i], &eaten, gdp, im))
+                return;
+            if (last_gf == GF_LINE || last_gf == GF_AREA) {
+                gdp->gf = last_gf;
+                gdp->linewidth = last_linewidth;
+            } else {
+                rrd_set_error("STACK must follow LINE or AREA! command:\n%s",
+                              &argv[i][eaten], argv[i]);
+                return;
+            }
+            break;
+            /* data acquisition */
+        case GF_DEF:   /* vname=x:DS:CF:[:step=#][:start=#][:end=#] */
+            if (rrd_parse_def(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        case GF_CDEF:  /* vname=rpn-expression */
+            if (rrd_parse_cdef(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        case GF_VDEF:  /* vname=rpn-expression */
+            if (rrd_parse_vdef(argv[i], &eaten, gdp, im))
+                return;
+            break;
+        }
+        if (gdp->debug) {
+            dprintf("used %i out of %i chars\n", eaten, strlen(argv[i]));
+            dprintf("parsed line: '%s'\n", argv[i]);
+            dprintf("remaining: '%s'\n", &argv[i][eaten]);
+            if (eaten >= strlen(argv[i]))
+                dprintf("Command finished successfully\n");
+        }
+        if (eaten < strlen(argv[i])) {
+            rrd_set_error("Garbage '%s' after command:\n%s",
+                          &argv[i][eaten], argv[i]);
+            return;
+        }
     }
 }
index 9218f59..e432fa2 100644 (file)
 /* #define DEBUG */
 
 /* private functions */
-unsigned long MyMod(signed long val, unsigned long mod);
-int update_hwpredict(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                 unsigned long ds_idx, unsigned short CDP_scratch_idx);
-int update_seasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                                unsigned long ds_idx, unsigned short CDP_scratch_idx, 
-                                rrd_value_t *seasonal_coef);
-int update_devpredict(rrd_t *rrd, unsigned long cdp_idx, 
-                                 unsigned long rra_idx, unsigned long ds_idx, unsigned short CDP_scratch_idx);
-int update_devseasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                      unsigned long ds_idx, unsigned short CDP_scratch_idx, 
-                                  rrd_value_t *seasonal_dev);
-int update_failures(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                               unsigned long ds_idx, unsigned short CDP_scratch_idx);
-
-int
-update_hwpredict(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                 unsigned long ds_idx, unsigned short CDP_scratch_idx)
+unsigned long MyMod(
+    signed long val,
+    unsigned long mod);
+int       update_hwpredict(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx);
+int       update_seasonal(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_coef);
+int       update_devpredict(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx);
+int       update_devseasonal(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_dev);
+int       update_failures(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx);
+
+int update_hwpredict(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx)
 {
-   rrd_value_t prediction, seasonal_coef;
-   unsigned long dependent_rra_idx, seasonal_cdp_idx;
-   unival *coefs = rrd -> cdp_prep[cdp_idx].scratch;
-   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
-
-   /* save coefficients from current prediction */
-   coefs[CDP_hw_last_intercept].u_val = coefs[CDP_hw_intercept].u_val;
-   coefs[CDP_hw_last_slope].u_val = coefs[CDP_hw_slope].u_val;
-   coefs[CDP_last_null_count].u_cnt = coefs[CDP_null_count].u_cnt;
-
-   /* retrieve the current seasonal coef */
-   dependent_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
-   seasonal_cdp_idx = dependent_rra_idx*(rrd -> stat_head -> ds_cnt) + ds_idx;
-   if (dependent_rra_idx < rra_idx)
-         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
-   else
-         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
-   
-   /* compute the prediction */
-   if (isnan(coefs[CDP_hw_intercept].u_val) || isnan(coefs[CDP_hw_slope].u_val)
-      || isnan(seasonal_coef))
-   {
-     prediction = DNAN;
-      
-     /* bootstrap initialization of slope and intercept */
-     if (isnan(coefs[CDP_hw_intercept].u_val) &&
-        !isnan(coefs[CDP_scratch_idx].u_val)) 
-     {
+    rrd_value_t prediction, seasonal_coef;
+    unsigned long dependent_rra_idx, seasonal_cdp_idx;
+    unival   *coefs = rrd->cdp_prep[cdp_idx].scratch;
+    rra_def_t *current_rra = &(rrd->rra_def[rra_idx]);
+
+    /* save coefficients from current prediction */
+    coefs[CDP_hw_last_intercept].u_val = coefs[CDP_hw_intercept].u_val;
+    coefs[CDP_hw_last_slope].u_val = coefs[CDP_hw_slope].u_val;
+    coefs[CDP_last_null_count].u_cnt = coefs[CDP_null_count].u_cnt;
+
+    /* retrieve the current seasonal coef */
+    dependent_rra_idx = current_rra->par[RRA_dependent_rra_idx].u_cnt;
+    seasonal_cdp_idx = dependent_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+    if (dependent_rra_idx < rra_idx)
+        seasonal_coef =
+            rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].
+            u_val;
+    else
+        seasonal_coef =
+            rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+
+    /* compute the prediction */
+    if (isnan(coefs[CDP_hw_intercept].u_val)
+        || isnan(coefs[CDP_hw_slope].u_val)
+        || isnan(seasonal_coef)) {
+        prediction = DNAN;
+
+        /* bootstrap initialization of slope and intercept */
+        if (isnan(coefs[CDP_hw_intercept].u_val) &&
+            !isnan(coefs[CDP_scratch_idx].u_val)) {
 #ifdef DEBUG
-       fprintf(stderr,"Initialization of slope/intercept\n");
+            fprintf(stderr, "Initialization of slope/intercept\n");
 #endif
-       coefs[CDP_hw_intercept].u_val = coefs[CDP_scratch_idx].u_val;
-       coefs[CDP_hw_last_intercept].u_val = coefs[CDP_scratch_idx].u_val;
-       /* initialize the slope to 0 */
-       coefs[CDP_hw_slope].u_val = 0.0;
-       coefs[CDP_hw_last_slope].u_val = 0.0;
-       /* initialize null count to 1 */
-       coefs[CDP_null_count].u_cnt = 1;
-       coefs[CDP_last_null_count].u_cnt = 1;
-     }
-     /* if seasonal coefficient is NA, then don't update intercept, slope */
-   } else {
-     prediction = coefs[CDP_hw_intercept].u_val + 
-       (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt)
-       + seasonal_coef;
+            coefs[CDP_hw_intercept].u_val = coefs[CDP_scratch_idx].u_val;
+            coefs[CDP_hw_last_intercept].u_val = coefs[CDP_scratch_idx].u_val;
+            /* initialize the slope to 0 */
+            coefs[CDP_hw_slope].u_val = 0.0;
+            coefs[CDP_hw_last_slope].u_val = 0.0;
+            /* initialize null count to 1 */
+            coefs[CDP_null_count].u_cnt = 1;
+            coefs[CDP_last_null_count].u_cnt = 1;
+        }
+        /* if seasonal coefficient is NA, then don't update intercept, slope */
+    } else {
+        prediction = coefs[CDP_hw_intercept].u_val +
+            (coefs[CDP_hw_slope].u_val) * (coefs[CDP_null_count].u_cnt)
+            + seasonal_coef;
 #ifdef DEBUG
-     fprintf(stderr,"computed prediction: %f\n",prediction);
+        fprintf(stderr, "computed prediction: %f\n", prediction);
 #endif
-     if (isnan(coefs[CDP_scratch_idx].u_val))
-     {
-       /* NA value, no updates of intercept, slope;
-           * increment the null count */
-       (coefs[CDP_null_count].u_cnt)++;
-     } else {
+        if (isnan(coefs[CDP_scratch_idx].u_val)) {
+            /* NA value, no updates of intercept, slope;
+             * increment the null count */
+            (coefs[CDP_null_count].u_cnt)++;
+        } else {
 #ifdef DEBUG
-       fprintf(stderr,"Updating intercept, slope\n");
+            fprintf(stderr, "Updating intercept, slope\n");
 #endif
-       /* update the intercept */
-       coefs[CDP_hw_intercept].u_val = (current_rra -> par[RRA_hw_alpha].u_val)*
-               (coefs[CDP_scratch_idx].u_val - seasonal_coef) +
-               (1 - current_rra -> par[RRA_hw_alpha].u_val)*(coefs[CDP_hw_intercept].u_val
-               + (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt));
-       /* update the slope */
-       coefs[CDP_hw_slope].u_val = (current_rra -> par[RRA_hw_beta].u_val)*
-               (coefs[CDP_hw_intercept].u_val - coefs[CDP_hw_last_intercept].u_val) +
-               (1 - current_rra -> par[RRA_hw_beta].u_val)*(coefs[CDP_hw_slope].u_val);
-       /* reset the null count */
-       coefs[CDP_null_count].u_cnt = 1;
-     }
-   }
-
-   /* store the prediction for writing */
-   coefs[CDP_scratch_idx].u_val = prediction;
-   return 0;
+            /* update the intercept */
+            coefs[CDP_hw_intercept].u_val =
+                (current_rra->par[RRA_hw_alpha].u_val) *
+                (coefs[CDP_scratch_idx].u_val - seasonal_coef) + (1 -
+                                                                  current_rra->
+                                                                  par
+                                                                  [RRA_hw_alpha].
+                                                                  u_val) *
+                (coefs[CDP_hw_intercept].u_val +
+                 (coefs[CDP_hw_slope].u_val) * (coefs[CDP_null_count].u_cnt));
+            /* update the slope */
+            coefs[CDP_hw_slope].u_val =
+                (current_rra->par[RRA_hw_beta].u_val) *
+                (coefs[CDP_hw_intercept].u_val -
+                 coefs[CDP_hw_last_intercept].u_val) + (1 -
+                                                        current_rra->
+                                                        par[RRA_hw_beta].
+                                                        u_val) *
+                (coefs[CDP_hw_slope].u_val);
+            /* reset the null count */
+            coefs[CDP_null_count].u_cnt = 1;
+        }
+    }
+
+    /* store the prediction for writing */
+    coefs[CDP_scratch_idx].u_val = prediction;
+    return 0;
 }
 
-int
-lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
-                               rrd_file_t* rrd_file, unsigned long offset, rrd_value_t **seasonal_coef)
+int lookup_seasonal(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long rra_start,
+    rrd_file_t * rrd_file,
+    unsigned long offset,
+    rrd_value_t ** seasonal_coef)
 {
-   unsigned long pos_tmp;
-   /* rra_ptr[].cur_row points to the rra row to be written; this function
-       * reads cur_row + offset */
-   unsigned long row_idx = rrd -> rra_ptr[rra_idx].cur_row + offset;
-   /* handle wrap around */
-   if (row_idx >= rrd -> rra_def[rra_idx].row_cnt)
-     row_idx = row_idx % (rrd -> rra_def[rra_idx].row_cnt);
-
-   /* rra_start points to the appropriate rra block in the file */
-   /* compute the pointer to the appropriate location in the file */
-   pos_tmp = rra_start + (row_idx)*(rrd -> stat_head -> ds_cnt)*sizeof(rrd_value_t);
-
-   /* allocate memory if need be */
-   if (*seasonal_coef == NULL)
-         *seasonal_coef = 
-            (rrd_value_t *) malloc((rrd -> stat_head -> ds_cnt)*sizeof(rrd_value_t));
-   if (*seasonal_coef == NULL) {
-         rrd_set_error("memory allocation failure: seasonal coef");
-         return -1;
-   }
-
-   if (!rrd_seek(rrd_file,pos_tmp,SEEK_SET))
-   {
-      if (rrd_read(rrd_file,*seasonal_coef,sizeof(rrd_value_t)*rrd->stat_head->ds_cnt)
-                 == (ssize_t)(sizeof(rrd_value_t)*rrd->stat_head->ds_cnt))
-         {
-                /* success! */
-         /* we can safely ignore the rule requiring a seek operation between read
-          * and write, because this read moves the file pointer to somewhere
-          * in the file other than the next write location.
-          * */
-                return 0;
-         } else {
-            rrd_set_error("read operation failed in lookup_seasonal(): %lu\n",pos_tmp);
-         }
-   } else {
-         rrd_set_error("seek operation failed in lookup_seasonal(): %lu\n",pos_tmp);
-   }
-   
-   return -1;
+    unsigned long pos_tmp;
+
+    /* rra_ptr[].cur_row points to the rra row to be written; this function
+     * reads cur_row + offset */
+    unsigned long row_idx = rrd->rra_ptr[rra_idx].cur_row + offset;
+
+    /* handle wrap around */
+    if (row_idx >= rrd->rra_def[rra_idx].row_cnt)
+        row_idx = row_idx % (rrd->rra_def[rra_idx].row_cnt);
+
+    /* rra_start points to the appropriate rra block in the file */
+    /* compute the pointer to the appropriate location in the file */
+    pos_tmp =
+        rra_start +
+        (row_idx) * (rrd->stat_head->ds_cnt) * sizeof(rrd_value_t);
+
+    /* allocate memory if need be */
+    if (*seasonal_coef == NULL)
+        *seasonal_coef =
+            (rrd_value_t *) malloc((rrd->stat_head->ds_cnt) *
+                                   sizeof(rrd_value_t));
+    if (*seasonal_coef == NULL) {
+        rrd_set_error("memory allocation failure: seasonal coef");
+        return -1;
+    }
+
+    if (!rrd_seek(rrd_file, pos_tmp, SEEK_SET)) {
+        if (rrd_read
+            (rrd_file, *seasonal_coef,
+             sizeof(rrd_value_t) * rrd->stat_head->ds_cnt)
+            == (ssize_t) (sizeof(rrd_value_t) * rrd->stat_head->ds_cnt)) {
+            /* success! */
+            /* we can safely ignore the rule requiring a seek operation between read
+             * and write, because this read moves the file pointer to somewhere
+             * in the file other than the next write location.
+             * */
+            return 0;
+        } else {
+            rrd_set_error("read operation failed in lookup_seasonal(): %lu\n",
+                          pos_tmp);
+        }
+    } else {
+        rrd_set_error("seek operation failed in lookup_seasonal(): %lu\n",
+                      pos_tmp);
+    }
+
+    return -1;
 }
 
-int
-update_seasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                                unsigned long ds_idx, unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef)
+int update_seasonal(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_coef)
 {
 /* TODO: extract common if subblocks in the wake of I/O optimization */
-   rrd_value_t intercept, seasonal;
-   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
-   rra_def_t *hw_rra = &(rrd -> rra_def[current_rra -> par[RRA_dependent_rra_idx].u_cnt]);
-   /* obtain cdp_prep index for HWPREDICT */
-   unsigned long hw_cdp_idx = (current_rra -> par[RRA_dependent_rra_idx].u_cnt)
-      * (rrd -> stat_head -> ds_cnt) + ds_idx;
-   unival *coefs = rrd -> cdp_prep[hw_cdp_idx].scratch;
-
-   /* update seasonal coefficient in cdp prep areas */
-   seasonal = rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val;
-   rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = seasonal;
-   rrd -> cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val =
-         seasonal_coef[ds_idx];
-
-   /* update seasonal value for disk */
-   if (current_rra -> par[RRA_dependent_rra_idx].u_cnt < rra_idx)
-         /* associated HWPREDICT has already been updated */
-         /* check for possible NA values */
-      if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
-         {
-                /* no update, store the old value unchanged,
-                 * doesn't matter if it is NA */
-            rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = seasonal;
-         } else if (isnan(coefs[CDP_hw_last_intercept].u_val) 
-                    || isnan(coefs[CDP_hw_last_slope].u_val))
-         {
-                /* this should never happen, as HWPREDICT was already updated */
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val= DNAN;
-         } else if (isnan(seasonal))
-         {
-                /* initialization: intercept is not currently being updated */
+    rrd_value_t intercept, seasonal;
+    rra_def_t *current_rra = &(rrd->rra_def[rra_idx]);
+    rra_def_t *hw_rra =
+        &(rrd->rra_def[current_rra->par[RRA_dependent_rra_idx].u_cnt]);
+    /* obtain cdp_prep index for HWPREDICT */
+    unsigned long hw_cdp_idx = (current_rra->par[RRA_dependent_rra_idx].u_cnt)
+        * (rrd->stat_head->ds_cnt) + ds_idx;
+    unival   *coefs = rrd->cdp_prep[hw_cdp_idx].scratch;
+
+    /* update seasonal coefficient in cdp prep areas */
+    seasonal = rrd->cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val;
+    rrd->cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = seasonal;
+    rrd->cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val =
+        seasonal_coef[ds_idx];
+
+    /* update seasonal value for disk */
+    if (current_rra->par[RRA_dependent_rra_idx].u_cnt < rra_idx)
+        /* associated HWPREDICT has already been updated */
+        /* check for possible NA values */
+        if (isnan(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)) {
+            /* no update, store the old value unchanged,
+             * doesn't matter if it is NA */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = seasonal;
+        } else if (isnan(coefs[CDP_hw_last_intercept].u_val)
+                   || isnan(coefs[CDP_hw_last_slope].u_val)) {
+            /* this should never happen, as HWPREDICT was already updated */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
+        } else if (isnan(seasonal)) {
+            /* initialization: intercept is not currently being updated */
 #ifdef DEBUG
-                fprintf(stderr,"Initialization of seasonal coef %lu\n",
-                       rrd -> rra_ptr[rra_idx].cur_row);
+            fprintf(stderr, "Initialization of seasonal coef %lu\n",
+                    rrd->rra_ptr[rra_idx].cur_row);
 #endif
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val 
-                       -= coefs[CDP_hw_last_intercept].u_val; 
-         } else {
-                intercept = coefs[CDP_hw_intercept].u_val;
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
+                -= coefs[CDP_hw_last_intercept].u_val;
+        } else {
+            intercept = coefs[CDP_hw_intercept].u_val;
 #ifdef DEBUG
-                fprintf(stderr,
-                       "Updating seasonal, params: gamma %f, new intercept %f, old seasonal %f\n",
-                       current_rra -> par[RRA_seasonal_gamma].u_val,
-                       intercept, seasonal);
+            fprintf(stderr,
+                    "Updating seasonal, params: gamma %f, new intercept %f, old seasonal %f\n",
+                    current_rra->par[RRA_seasonal_gamma].u_val,
+                    intercept, seasonal);
 #endif
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
-                       (current_rra -> par[RRA_seasonal_gamma].u_val)*
-                       (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - intercept) +
-                       (1 - current_rra -> par[RRA_seasonal_gamma].u_val)*seasonal;
-         }
-   else {
-         /* SEASONAL array is updated first, which means the new intercept
-          * hasn't be computed; so we compute it here. */
-
-         /* check for possible NA values */
-      if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
-         {
-                /* no update, simple store the old value unchanged,
-                 * doesn't matter if it is NA */
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =  seasonal;
-         } else if (isnan(coefs[CDP_hw_intercept].u_val) 
-                    || isnan(coefs[CDP_hw_slope].u_val))
-         {
-                /* Initialization of slope and intercept will occur.
-                 * force seasonal coefficient to 0. */
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val= 0.0;
-         } else if (isnan(seasonal))
-         {
-                /* initialization: intercept will not be updated
-                 * CDP_hw_intercept = CDP_hw_last_intercept; just need to 
-                 * subtract this baseline value. */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+                (current_rra->par[RRA_seasonal_gamma].u_val) *
+                (rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -
+                 intercept) + (1 -
+                               current_rra->par[RRA_seasonal_gamma].u_val) *
+                seasonal;
+    } else {
+        /* SEASONAL array is updated first, which means the new intercept
+         * hasn't be computed; so we compute it here. */
+
+        /* check for possible NA values */
+        if (isnan(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)) {
+            /* no update, simple store the old value unchanged,
+             * doesn't matter if it is NA */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = seasonal;
+        } else if (isnan(coefs[CDP_hw_intercept].u_val)
+                   || isnan(coefs[CDP_hw_slope].u_val)) {
+            /* Initialization of slope and intercept will occur.
+             * force seasonal coefficient to 0. */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 0.0;
+        } else if (isnan(seasonal)) {
+            /* initialization: intercept will not be updated
+             * CDP_hw_intercept = CDP_hw_last_intercept; just need to 
+             * subtract this baseline value. */
 #ifdef DEBUG
-                fprintf(stderr,"Initialization of seasonal coef %lu\n",
-                       rrd -> rra_ptr[rra_idx].cur_row);
+            fprintf(stderr, "Initialization of seasonal coef %lu\n",
+                    rrd->rra_ptr[rra_idx].cur_row);
 #endif
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -= coefs[CDP_hw_intercept].u_val; 
-         } else {
-                /* Note that we must get CDP_scratch_idx from SEASONAL array, as CDP_scratch_idx
-                 * for HWPREDICT array will be DNAN. */
-            intercept = (hw_rra -> par[RRA_hw_alpha].u_val)*
-                   (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - seasonal)
-                   + (1 - hw_rra -> par[RRA_hw_alpha].u_val)*(coefs[CDP_hw_intercept].u_val
-                   + (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt));
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
-                  (current_rra -> par[RRA_seasonal_gamma].u_val)*
-                  (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val - intercept) +
-                  (1 - current_rra -> par[RRA_seasonal_gamma].u_val)*seasonal;
-         }
-   }
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -=
+                coefs[CDP_hw_intercept].u_val;
+        } else {
+            /* Note that we must get CDP_scratch_idx from SEASONAL array, as CDP_scratch_idx
+             * for HWPREDICT array will be DNAN. */
+            intercept = (hw_rra->par[RRA_hw_alpha].u_val) *
+                (rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -
+                 seasonal)
+                + (1 -
+                   hw_rra->par[RRA_hw_alpha].u_val) *
+                (coefs[CDP_hw_intercept].u_val +
+                 (coefs[CDP_hw_slope].u_val) * (coefs[CDP_null_count].u_cnt));
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+                (current_rra->par[RRA_seasonal_gamma].u_val) *
+                (rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val -
+                 intercept) + (1 -
+                               current_rra->par[RRA_seasonal_gamma].u_val) *
+                seasonal;
+        }
+    }
 #ifdef DEBUG
-   fprintf(stderr,"seasonal coefficient set= %f\n",
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+    fprintf(stderr, "seasonal coefficient set= %f\n",
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
 #endif
-   return 0;
+    return 0;
 }
 
-int
-update_devpredict(rrd_t *rrd, unsigned long cdp_idx, 
-                                 unsigned long rra_idx, unsigned long ds_idx, unsigned short CDP_scratch_idx)
+int update_devpredict(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx)
 {
-   /* there really isn't any "update" here; the only reason this information
-    * is stored separately from DEVSEASONAL is to preserve deviation predictions
-    * for a longer duration than one seasonal cycle. */
-   unsigned long seasonal_cdp_idx = (rrd -> rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
-      * (rrd -> stat_head -> ds_cnt) + ds_idx;
-
-   if (rrd -> rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx)
-   {
-         /* associated DEVSEASONAL array already updated */
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
-                = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
-   } else {
-         /* associated DEVSEASONAL not yet updated */
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
-                = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_seasonal_deviation].u_val;
-   }
-   return 0;
+    /* there really isn't any "update" here; the only reason this information
+     * is stored separately from DEVSEASONAL is to preserve deviation predictions
+     * for a longer duration than one seasonal cycle. */
+    unsigned long seasonal_cdp_idx =
+        (rrd->rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+        * (rrd->stat_head->ds_cnt) + ds_idx;
+
+    if (rrd->rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx) {
+        /* associated DEVSEASONAL array already updated */
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
+            =
+            rrd->cdp_prep[seasonal_cdp_idx].
+            scratch[CDP_last_seasonal_deviation].u_val;
+    } else {
+        /* associated DEVSEASONAL not yet updated */
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val
+            =
+            rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_seasonal_deviation].
+            u_val;
+    }
+    return 0;
 }
 
-int
-update_devseasonal(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                      unsigned long ds_idx, unsigned short CDP_scratch_idx, 
-                                  rrd_value_t *seasonal_dev)
+int update_devseasonal(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_dev)
 {
-   rrd_value_t prediction = 0, seasonal_coef = DNAN;
-   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
-   /* obtain cdp_prep index for HWPREDICT */
-   unsigned long hw_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
-   unsigned long hw_cdp_idx = hw_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
-   unsigned long seasonal_cdp_idx;
-   unival *coefs = rrd -> cdp_prep[hw_cdp_idx].scratch;
-   rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val =
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val;
-   /* retrieve the next seasonal deviation value, could be NA */
-   rrd -> cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val =
-         seasonal_dev[ds_idx];
-
-   /* retrieve the current seasonal_coef (not to be confused with the
-       * current seasonal deviation). Could make this more readable by introducing
-       * some wrapper functions. */
-   seasonal_cdp_idx = (rrd -> rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt)
-         *(rrd -> stat_head -> ds_cnt) + ds_idx;
-   if (rrd -> rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx)
-         /* SEASONAL array already updated */
-         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
-   else
-         /* SEASONAL array not yet updated */
-         seasonal_coef = rrd -> cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
-   
-   /* compute the abs value of the difference between the prediction and
-       * observed value */
-   if (hw_rra_idx < rra_idx)
-   {
-         /* associated HWPREDICT has already been updated */
-         if (isnan(coefs[CDP_hw_last_intercept].u_val) ||
-             isnan(coefs[CDP_hw_last_slope].u_val) ||
-             isnan(seasonal_coef))
-         {
-                /* one of the prediction values is uinitialized */
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
-                return 0;
-         } else {
-            prediction = coefs[CDP_hw_last_intercept].u_val + 
-                  (coefs[CDP_hw_last_slope].u_val)*(coefs[CDP_last_null_count].u_cnt)
-                  + seasonal_coef;
-         }
-   } else {
-         /* associated HWPREDICT has NOT been updated */
-         if (isnan(coefs[CDP_hw_intercept].u_val) ||
-             isnan(coefs[CDP_hw_slope].u_val) ||
-             isnan(seasonal_coef))
-         {
-                /* one of the prediction values is uinitialized */
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
-                return 0;
-         } else {
-            prediction = coefs[CDP_hw_intercept].u_val + 
-                  (coefs[CDP_hw_slope].u_val)*(coefs[CDP_null_count].u_cnt) 
-                  + seasonal_coef;
-         }
-   }
-
-   if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
-   {
-      /* no update, store existing value unchanged, doesn't
-          * matter if it is NA */
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
-                rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
-   } else if (isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val))
-   {
-         /* initialization */
+    rrd_value_t prediction = 0, seasonal_coef = DNAN;
+    rra_def_t *current_rra = &(rrd->rra_def[rra_idx]);
+
+    /* obtain cdp_prep index for HWPREDICT */
+    unsigned long hw_rra_idx = current_rra->par[RRA_dependent_rra_idx].u_cnt;
+    unsigned long hw_cdp_idx = hw_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+    unsigned long seasonal_cdp_idx;
+    unival   *coefs = rrd->cdp_prep[hw_cdp_idx].scratch;
+
+    rrd->cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val =
+        rrd->cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val;
+    /* retrieve the next seasonal deviation value, could be NA */
+    rrd->cdp_prep[cdp_idx].scratch[CDP_seasonal_deviation].u_val =
+        seasonal_dev[ds_idx];
+
+    /* retrieve the current seasonal_coef (not to be confused with the
+     * current seasonal deviation). Could make this more readable by introducing
+     * some wrapper functions. */
+    seasonal_cdp_idx =
+        (rrd->rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+        * (rrd->stat_head->ds_cnt) + ds_idx;
+    if (rrd->rra_def[hw_rra_idx].par[RRA_dependent_rra_idx].u_cnt < rra_idx)
+        /* SEASONAL array already updated */
+        seasonal_coef =
+            rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_last_seasonal].
+            u_val;
+    else
+        /* SEASONAL array not yet updated */
+        seasonal_coef =
+            rrd->cdp_prep[seasonal_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+
+    /* compute the abs value of the difference between the prediction and
+     * observed value */
+    if (hw_rra_idx < rra_idx) {
+        /* associated HWPREDICT has already been updated */
+        if (isnan(coefs[CDP_hw_last_intercept].u_val) ||
+            isnan(coefs[CDP_hw_last_slope].u_val) || isnan(seasonal_coef)) {
+            /* one of the prediction values is uinitialized */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
+            return 0;
+        } else {
+            prediction = coefs[CDP_hw_last_intercept].u_val +
+                (coefs[CDP_hw_last_slope].u_val) *
+                (coefs[CDP_last_null_count].u_cnt)
+                + seasonal_coef;
+        }
+    } else {
+        /* associated HWPREDICT has NOT been updated */
+        if (isnan(coefs[CDP_hw_intercept].u_val) ||
+            isnan(coefs[CDP_hw_slope].u_val) || isnan(seasonal_coef)) {
+            /* one of the prediction values is uinitialized */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = DNAN;
+            return 0;
+        } else {
+            prediction = coefs[CDP_hw_intercept].u_val +
+                (coefs[CDP_hw_slope].u_val) * (coefs[CDP_null_count].u_cnt)
+                + seasonal_coef;
+        }
+    }
+
+    if (isnan(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)) {
+        /* no update, store existing value unchanged, doesn't
+         * matter if it is NA */
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+            rrd->cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
+    } else
+        if (isnan
+            (rrd->cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].
+             u_val)) {
+        /* initialization */
 #ifdef DEBUG
-         fprintf(stderr,"Initialization of seasonal deviation\n");
+        fprintf(stderr, "Initialization of seasonal deviation\n");
 #endif
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
-            fabs(prediction - rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
-   } else {
-         /* exponential smoothing update */
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
-           (rrd -> rra_def[rra_idx].par[RRA_seasonal_gamma].u_val)*
-           fabs(prediction - rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)
-           + (1 -  rrd -> rra_def[rra_idx].par[RRA_seasonal_gamma].u_val)*
-           (rrd -> cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].u_val);
-   }
-   return 0;
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+            fabs(prediction -
+                 rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+    } else {
+        /* exponential smoothing update */
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val =
+            (rrd->rra_def[rra_idx].par[RRA_seasonal_gamma].u_val) *
+            fabs(prediction -
+                 rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)
+            + (1 -
+               rrd->rra_def[rra_idx].par[RRA_seasonal_gamma].u_val) *
+            (rrd->cdp_prep[cdp_idx].scratch[CDP_last_seasonal_deviation].
+             u_val);
+    }
+    return 0;
 }
 
 /* Check for a failure based on a threshold # of violations within the specified
  * window. */
-int 
-update_failures(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx, 
-                               unsigned long ds_idx, unsigned short CDP_scratch_idx)
+int update_failures(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx)
 {
-   /* detection of a violation depends on 3 RRAs:
-       * HWPREDICT, SEASONAL, and DEVSEASONAL */
-   rra_def_t *current_rra = &(rrd -> rra_def[rra_idx]);
-   unsigned long dev_rra_idx = current_rra -> par[RRA_dependent_rra_idx].u_cnt;
-   rra_def_t *dev_rra = &(rrd -> rra_def[dev_rra_idx]);
-   unsigned long hw_rra_idx = dev_rra -> par[RRA_dependent_rra_idx].u_cnt;
-   rra_def_t *hw_rra =  &(rrd -> rra_def[hw_rra_idx]);
-   unsigned long seasonal_rra_idx = hw_rra -> par[RRA_dependent_rra_idx].u_cnt;
-   unsigned long temp_cdp_idx;
-   rrd_value_t deviation = DNAN;
-   rrd_value_t seasonal_coef = DNAN;
-   rrd_value_t prediction = DNAN;
-   char violation = 0; 
-   unsigned short violation_cnt = 0, i;
-   char *violations_array;
-
-   /* usual checks to determine the order of the RRAs */
-   temp_cdp_idx = dev_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
-   if (rra_idx < seasonal_rra_idx)
-   {
-         /* DEVSEASONAL not yet updated */
-         deviation = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_seasonal_deviation].u_val;
-   } else {
-         /* DEVSEASONAL already updated */
-         deviation = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_last_seasonal_deviation].u_val;
-   }
-   if (!isnan(deviation)) {
-
-   temp_cdp_idx = seasonal_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
-   if (rra_idx < seasonal_rra_idx)
-   {
-         /* SEASONAL not yet updated */
-         seasonal_coef = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_seasonal].u_val;
-   } else {
-         /* SEASONAL already updated */
-         seasonal_coef = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_seasonal].u_val;
-   }
-   /* in this code block, we know seasonal coef is not DNAN, because deviation is not
-       * null */
-
-   temp_cdp_idx = hw_rra_idx * (rrd -> stat_head -> ds_cnt) + ds_idx;
-   if (rra_idx < hw_rra_idx)
-   {
-         /* HWPREDICT not yet updated */
-         prediction = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_intercept].u_val + 
-            (rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_slope].u_val)
-                *(rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_null_count].u_cnt)
-                + seasonal_coef;
-   } else {
-         /* HWPREDICT already updated */
-         prediction = rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_intercept].u_val + 
-            (rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_slope].u_val)
-                *(rrd -> cdp_prep[temp_cdp_idx].scratch[CDP_last_null_count].u_cnt)
-                + seasonal_coef;
-   }
-
-   /* determine if the observed value is a violation */
-   if (!isnan(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val))
-   {
-         if (rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val > prediction + 
-                (current_rra -> par[RRA_delta_pos].u_val)*deviation
-            || rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val < prediction - 
-                (current_rra -> par[RRA_delta_neg].u_val)*deviation)
-                violation = 1;
-   } else {
-         violation = 1; /* count DNAN values as violations */
-   }
-
-   }
-
-   /* determine if a failure has occurred and update the failure array */
-   violation_cnt = violation;
-   violations_array = (char *) ((void *) rrd -> cdp_prep[cdp_idx].scratch);
-   for (i = current_rra -> par[RRA_window_len].u_cnt; i > 1; i--)
-   {
-         /* shift */
-         violations_array[i-1] = violations_array[i-2]; 
-         violation_cnt += violations_array[i-1];
-   }
-   violations_array[0] = violation;
-
-   if (violation_cnt < current_rra -> par[RRA_failure_threshold].u_cnt)
-         /* not a failure */
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 0.0;
-   else
-         rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 1.0;
-
-   return (rrd-> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
+    /* detection of a violation depends on 3 RRAs:
+     * HWPREDICT, SEASONAL, and DEVSEASONAL */
+    rra_def_t *current_rra = &(rrd->rra_def[rra_idx]);
+    unsigned long dev_rra_idx = current_rra->par[RRA_dependent_rra_idx].u_cnt;
+    rra_def_t *dev_rra = &(rrd->rra_def[dev_rra_idx]);
+    unsigned long hw_rra_idx = dev_rra->par[RRA_dependent_rra_idx].u_cnt;
+    rra_def_t *hw_rra = &(rrd->rra_def[hw_rra_idx]);
+    unsigned long seasonal_rra_idx = hw_rra->par[RRA_dependent_rra_idx].u_cnt;
+    unsigned long temp_cdp_idx;
+    rrd_value_t deviation = DNAN;
+    rrd_value_t seasonal_coef = DNAN;
+    rrd_value_t prediction = DNAN;
+    char      violation = 0;
+    unsigned short violation_cnt = 0, i;
+    char     *violations_array;
+
+    /* usual checks to determine the order of the RRAs */
+    temp_cdp_idx = dev_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+    if (rra_idx < seasonal_rra_idx) {
+        /* DEVSEASONAL not yet updated */
+        deviation =
+            rrd->cdp_prep[temp_cdp_idx].scratch[CDP_seasonal_deviation].u_val;
+    } else {
+        /* DEVSEASONAL already updated */
+        deviation =
+            rrd->cdp_prep[temp_cdp_idx].scratch[CDP_last_seasonal_deviation].
+            u_val;
+    }
+    if (!isnan(deviation)) {
+
+        temp_cdp_idx = seasonal_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+        if (rra_idx < seasonal_rra_idx) {
+            /* SEASONAL not yet updated */
+            seasonal_coef =
+                rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_seasonal].u_val;
+        } else {
+            /* SEASONAL already updated */
+            seasonal_coef =
+                rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_seasonal].
+                u_val;
+        }
+        /* in this code block, we know seasonal coef is not DNAN, because deviation is not
+         * null */
+
+        temp_cdp_idx = hw_rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+        if (rra_idx < hw_rra_idx) {
+            /* HWPREDICT not yet updated */
+            prediction =
+                rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_intercept].u_val +
+                (rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_slope].u_val)
+                * (rrd->cdp_prep[temp_cdp_idx].scratch[CDP_null_count].u_cnt)
+                + seasonal_coef;
+        } else {
+            /* HWPREDICT already updated */
+            prediction =
+                rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_intercept].
+                u_val +
+                (rrd->cdp_prep[temp_cdp_idx].scratch[CDP_hw_last_slope].u_val)
+                *
+                (rrd->cdp_prep[temp_cdp_idx].scratch[CDP_last_null_count].
+                 u_cnt)
+                + seasonal_coef;
+        }
+
+        /* determine if the observed value is a violation */
+        if (!isnan(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val)) {
+            if (rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val >
+                prediction +
+                (current_rra->par[RRA_delta_pos].u_val) * deviation
+                || rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val <
+                prediction -
+                (current_rra->par[RRA_delta_neg].u_val) * deviation)
+                violation = 1;
+        } else {
+            violation = 1;  /* count DNAN values as violations */
+        }
+
+    }
+
+    /* determine if a failure has occurred and update the failure array */
+    violation_cnt = violation;
+    violations_array = (char *) ((void *) rrd->cdp_prep[cdp_idx].scratch);
+    for (i = current_rra->par[RRA_window_len].u_cnt; i > 1; i--) {
+        /* shift */
+        violations_array[i - 1] = violations_array[i - 2];
+        violation_cnt += violations_array[i - 1];
+    }
+    violations_array[0] = violation;
+
+    if (violation_cnt < current_rra->par[RRA_failure_threshold].u_cnt)
+        /* not a failure */
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 0.0;
+    else
+        rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = 1.0;
+
+    return (rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val);
 }
 
 /* For the specified CDP prep area and the FAILURES RRA,
  * erase all history of past violations.
  */
-void
-erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx)
+void erase_violations(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx)
 {
-   unsigned short i;
-   char *violations_array;
-   /* check that rra_idx is a CF_FAILURES array */
-   if (cf_conv(rrd -> rra_def[rra_idx].cf_nam) != CF_FAILURES)
-   {
+    unsigned short i;
+    char     *violations_array;
+
+    /* check that rra_idx is a CF_FAILURES array */
+    if (cf_conv(rrd->rra_def[rra_idx].cf_nam) != CF_FAILURES) {
 #ifdef DEBUG
-         fprintf(stderr,"erase_violations called for non-FAILURES RRA: %s\n",
-            rrd -> rra_def[rra_idx].cf_nam);
+        fprintf(stderr, "erase_violations called for non-FAILURES RRA: %s\n",
+                rrd->rra_def[rra_idx].cf_nam);
 #endif
-         return;
-   }
-
+        return;
+    }
 #ifdef DEBUG
-   fprintf(stderr,"scratch buffer before erase:\n");
-   for (i = 0; i < MAX_CDP_PAR_EN; i++)
-   {
-         fprintf(stderr,"%lu ", rrd -> cdp_prep[cdp_idx].scratch[i].u_cnt);
-   }
-   fprintf(stderr,"\n");
+    fprintf(stderr, "scratch buffer before erase:\n");
+    for (i = 0; i < MAX_CDP_PAR_EN; i++) {
+        fprintf(stderr, "%lu ", rrd->cdp_prep[cdp_idx].scratch[i].u_cnt);
+    }
+    fprintf(stderr, "\n");
 #endif
 
-   /* WARNING: an array of longs on disk is treated as an array of chars
-    * in memory. */
-   violations_array = (char *) ((void *) rrd -> cdp_prep[cdp_idx].scratch);
-   /* erase everything in the part of the CDP scratch array that will be
-    * used to store violations for the current window */
-   for (i = rrd -> rra_def[rra_idx].par[RRA_window_len].u_cnt; i > 0; i--)
-   {
-         violations_array[i-1] = 0;
-   }
+    /* WARNING: an array of longs on disk is treated as an array of chars
+     * in memory. */
+    violations_array = (char *) ((void *) rrd->cdp_prep[cdp_idx].scratch);
+    /* erase everything in the part of the CDP scratch array that will be
+     * used to store violations for the current window */
+    for (i = rrd->rra_def[rra_idx].par[RRA_window_len].u_cnt; i > 0; i--) {
+        violations_array[i - 1] = 0;
+    }
 #ifdef DEBUG
-   fprintf(stderr,"scratch buffer after erase:\n");
-   for (i = 0; i < MAX_CDP_PAR_EN; i++)
-   {
-         fprintf(stderr,"%lu ", rrd -> cdp_prep[cdp_idx].scratch[i].u_cnt);
-   }
-   fprintf(stderr,"\n");
+    fprintf(stderr, "scratch buffer after erase:\n");
+    for (i = 0; i < MAX_CDP_PAR_EN; i++) {
+        fprintf(stderr, "%lu ", rrd->cdp_prep[cdp_idx].scratch[i].u_cnt);
+    }
+    fprintf(stderr, "\n");
 #endif
 }
 
 /* Smooth a periodic array with a moving average: equal weights and
  * length = 5% of the period. */
-int
-apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
-               rrd_file_t *rrd_file)
+int apply_smoother(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long rra_start,
+    rrd_file_t * rrd_file)
 {
-   unsigned long i, j, k;
-   unsigned long totalbytes;
-   rrd_value_t *rrd_values;
-   unsigned long row_length = rrd -> stat_head -> ds_cnt;
-   unsigned long row_count = rrd -> rra_def[rra_idx].row_cnt;
-   unsigned long offset;
-   FIFOqueue **buffers;
-   rrd_value_t *working_average;
-   rrd_value_t *baseline;
-
-   offset = floor(0.025*row_count);
-   if (offset == 0) return 0; /* no smoothing */
-
-   /* allocate memory */
-   totalbytes = sizeof(rrd_value_t)*row_length*row_count;
-   rrd_values = (rrd_value_t *) malloc(totalbytes);
-   if (rrd_values == NULL)
-   {
-         rrd_set_error("apply smoother: memory allocation failure");
-         return -1;
-   }
-
-   /* rra_start is at the beginning of this rra */
-   if (rrd_seek(rrd_file,rra_start,SEEK_SET))
-   {
-         rrd_set_error("seek to rra %d failed", rra_start);
-         free(rrd_values);
-         return -1;
-   }
-   rrd_flush(rrd_file);
-   /* could read all data in a single block, but we need to
-    * check for NA values */
-   for (i = 0; i < row_count; ++i)
-   {
-         for (j = 0; j < row_length; ++j)
-         {
-                if (rrd_read(rrd_file, &(rrd_values[i*row_length + j]),sizeof(rrd_value_t)*1)
-                        != (ssize_t)(sizeof(rrd_value_t)*1)) {
-                        rrd_set_error("reading value failed: %s", rrd_strerror(errno));
-                }
-                if (isnan(rrd_values[i*row_length + j])) {
-                       /* can't apply smoothing, still uninitialized values */
+    unsigned long i, j, k;
+    unsigned long totalbytes;
+    rrd_value_t *rrd_values;
+    unsigned long row_length = rrd->stat_head->ds_cnt;
+    unsigned long row_count = rrd->rra_def[rra_idx].row_cnt;
+    unsigned long offset;
+    FIFOqueue **buffers;
+    rrd_value_t *working_average;
+    rrd_value_t *baseline;
+
+    offset = floor(0.025 * row_count);
+    if (offset == 0)
+        return 0;       /* no smoothing */
+
+    /* allocate memory */
+    totalbytes = sizeof(rrd_value_t) * row_length * row_count;
+    rrd_values = (rrd_value_t *) malloc(totalbytes);
+    if (rrd_values == NULL) {
+        rrd_set_error("apply smoother: memory allocation failure");
+        return -1;
+    }
+
+    /* rra_start is at the beginning of this rra */
+    if (rrd_seek(rrd_file, rra_start, SEEK_SET)) {
+        rrd_set_error("seek to rra %d failed", rra_start);
+        free(rrd_values);
+        return -1;
+    }
+    rrd_flush(rrd_file);
+    /* could read all data in a single block, but we need to
+     * check for NA values */
+    for (i = 0; i < row_count; ++i) {
+        for (j = 0; j < row_length; ++j) {
+            if (rrd_read
+                (rrd_file, &(rrd_values[i * row_length + j]),
+                 sizeof(rrd_value_t) * 1)
+                != (ssize_t) (sizeof(rrd_value_t) * 1)) {
+                rrd_set_error("reading value failed: %s",
+                              rrd_strerror(errno));
+            }
+            if (isnan(rrd_values[i * row_length + j])) {
+                /* can't apply smoothing, still uninitialized values */
 #ifdef DEBUG
-                       fprintf(stderr,"apply_smoother: NA detected in seasonal array: %ld %ld\n",i,j);
+                fprintf(stderr,
+                        "apply_smoother: NA detected in seasonal array: %ld %ld\n",
+                        i, j);
 #endif
-                       free(rrd_values);
-                       return 0;
-                }
-         }
-   }
-
-   /* allocate queues, one for each data source */
-   buffers = (FIFOqueue **) malloc(sizeof(FIFOqueue *)*row_length);
-   for (i = 0; i < row_length; ++i)
-   {
-      queue_alloc(&(buffers[i]),2*offset + 1);
-   }
-   /* need working average initialized to 0 */
-   working_average = (rrd_value_t *) calloc(row_length,sizeof(rrd_value_t));
-   baseline = (rrd_value_t *) calloc(row_length,sizeof(rrd_value_t));
-
-   /* compute sums of the first 2*offset terms */ 
-   for (i = 0; i < 2*offset; ++i)
-   {
-         k = MyMod(i - offset,row_count);
-         for (j = 0; j < row_length; ++j)
-         {
-                queue_push(buffers[j],rrd_values[k*row_length + j]);
-                working_average[j] += rrd_values[k*row_length + j];
-         }
-   }
-
-   /* compute moving averages */
-   for (i = offset; i < row_count + offset; ++i)
-   {
-         for (j = 0; j < row_length; ++j)
-         {
-            k = MyMod(i,row_count);
-            /* add a term to the sum */
-            working_average[j] += rrd_values[k*row_length + j];
-            queue_push(buffers[j],rrd_values[k*row_length + j]);
-
-            /* reset k to be the center of the window */
-            k = MyMod(i - offset,row_count);
-            /* overwrite rdd_values entry, the old value is already
-             * saved in buffers */
-            rrd_values[k*row_length + j] = working_average[j]/(2*offset + 1);
-            baseline[j] += rrd_values[k*row_length + j];
-
-            /* remove a term from the sum */
-            working_average[j] -= queue_pop(buffers[j]);
-         }     
-   } 
-   for (i = 0; i < row_length; ++i)
-   {
-         queue_dealloc(buffers[i]);
-         baseline[i] /= row_count; 
-   }
-   free(buffers);
-   free(working_average);
-
-   if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
-   for (j = 0; j < row_length; ++j)
-   {
-   for (i = 0; i < row_count; ++i)
-   {
-        rrd_values[i*row_length + j] -= baseline[j];
-   }
-        /* update the baseline coefficient,
-         * first, compute the cdp_index. */
-        offset = (rrd->rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
-         * row_length + j;
-        (rrd->cdp_prep[offset]).scratch[CDP_hw_intercept].u_val += baseline[j];
-   }
-   /* flush cdp to disk */
-   rrd_flush(rrd_file);
-   if (rrd_seek(rrd_file,sizeof(stat_head_t) + 
-         rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
-         rrd->stat_head->rra_cnt * sizeof(rra_def_t) + 
-         sizeof(live_head_t) +
-         rrd->stat_head->ds_cnt * sizeof(pdp_prep_t),SEEK_SET))
-   {
-         rrd_set_error("apply_smoother: seek to cdp_prep failed");
-         free(rrd_values);
-         return -1;
-   }
-   if (rrd_write(rrd_file, rrd -> cdp_prep,
-         sizeof(cdp_prep_t)*
-                 (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt) 
-         != (ssize_t)(sizeof(cdp_prep_t)*(rrd->stat_head->rra_cnt) * (rrd->stat_head->ds_cnt)))
-   {
-         rrd_set_error("apply_smoother: cdp_prep write failed");
-         free(rrd_values);
-         return -1;
-   }
-   } /* endif CF_SEASONAL */ 
-
-   /* flush updated values to disk */
-   rrd_flush(rrd_file);
-   if (rrd_seek(rrd_file,rra_start,SEEK_SET))
-   {
-         rrd_set_error("apply_smoother: seek to pos %d failed", rra_start);
-         free(rrd_values);
-         return -1;
-   }
-   /* write as a single block */
-   if (rrd_write(rrd_file,rrd_values,sizeof(rrd_value_t)*row_length*row_count)
-         != (ssize_t)(sizeof(rrd_value_t)*row_length*row_count))
-   {
-         rrd_set_error("apply_smoother: write failed to %lu",rra_start);
-         free(rrd_values);
-         return -1;
-   }
-
-   rrd_flush(rrd_file);
-   free(rrd_values);
-   free(baseline);
-   return 0;
+                free(rrd_values);
+                return 0;
+            }
+        }
+    }
+
+    /* allocate queues, one for each data source */
+    buffers = (FIFOqueue **) malloc(sizeof(FIFOqueue *) * row_length);
+    for (i = 0; i < row_length; ++i) {
+        queue_alloc(&(buffers[i]), 2 * offset + 1);
+    }
+    /* need working average initialized to 0 */
+    working_average = (rrd_value_t *) calloc(row_length, sizeof(rrd_value_t));
+    baseline = (rrd_value_t *) calloc(row_length, sizeof(rrd_value_t));
+
+    /* compute sums of the first 2*offset terms */
+    for (i = 0; i < 2 * offset; ++i) {
+        k = MyMod(i - offset, row_count);
+        for (j = 0; j < row_length; ++j) {
+            queue_push(buffers[j], rrd_values[k * row_length + j]);
+            working_average[j] += rrd_values[k * row_length + j];
+        }
+    }
+
+    /* compute moving averages */
+    for (i = offset; i < row_count + offset; ++i) {
+        for (j = 0; j < row_length; ++j) {
+            k = MyMod(i, row_count);
+            /* add a term to the sum */
+            working_average[j] += rrd_values[k * row_length + j];
+            queue_push(buffers[j], rrd_values[k * row_length + j]);
+
+            /* reset k to be the center of the window */
+            k = MyMod(i - offset, row_count);
+            /* overwrite rdd_values entry, the old value is already
+             * saved in buffers */
+            rrd_values[k * row_length + j] =
+                working_average[j] / (2 * offset + 1);
+            baseline[j] += rrd_values[k * row_length + j];
+
+            /* remove a term from the sum */
+            working_average[j] -= queue_pop(buffers[j]);
+        }
+    }
+
+    for (i = 0; i < row_length; ++i) {
+        queue_dealloc(buffers[i]);
+        baseline[i] /= row_count;
+    }
+    free(buffers);
+    free(working_average);
+
+    if (cf_conv(rrd->rra_def[rra_idx].cf_nam) == CF_SEASONAL) {
+        for (j = 0; j < row_length; ++j) {
+            for (i = 0; i < row_count; ++i) {
+                rrd_values[i * row_length + j] -= baseline[j];
+            }
+            /* update the baseline coefficient,
+             * first, compute the cdp_index. */
+            offset = (rrd->rra_def[rra_idx].par[RRA_dependent_rra_idx].u_cnt)
+                * row_length + j;
+            (rrd->cdp_prep[offset]).scratch[CDP_hw_intercept].u_val +=
+                baseline[j];
+        }
+        /* flush cdp to disk */
+        rrd_flush(rrd_file);
+        if (rrd_seek(rrd_file, sizeof(stat_head_t) +
+                     rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
+                     rrd->stat_head->rra_cnt * sizeof(rra_def_t) +
+                     sizeof(live_head_t) +
+                     rrd->stat_head->ds_cnt * sizeof(pdp_prep_t), SEEK_SET)) {
+            rrd_set_error("apply_smoother: seek to cdp_prep failed");
+            free(rrd_values);
+            return -1;
+        }
+        if (rrd_write(rrd_file, rrd->cdp_prep,
+                      sizeof(cdp_prep_t) *
+                      (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt)
+            != (ssize_t) (sizeof(cdp_prep_t) * (rrd->stat_head->rra_cnt) *
+                          (rrd->stat_head->ds_cnt))) {
+            rrd_set_error("apply_smoother: cdp_prep write failed");
+            free(rrd_values);
+            return -1;
+        }
+    }
+
+    /* endif CF_SEASONAL */
+    /* flush updated values to disk */
+    rrd_flush(rrd_file);
+    if (rrd_seek(rrd_file, rra_start, SEEK_SET)) {
+        rrd_set_error("apply_smoother: seek to pos %d failed", rra_start);
+        free(rrd_values);
+        return -1;
+    }
+    /* write as a single block */
+    if (rrd_write
+        (rrd_file, rrd_values, sizeof(rrd_value_t) * row_length * row_count)
+        != (ssize_t) (sizeof(rrd_value_t) * row_length * row_count)) {
+        rrd_set_error("apply_smoother: write failed to %lu", rra_start);
+        free(rrd_values);
+        return -1;
+    }
+
+    rrd_flush(rrd_file);
+    free(rrd_values);
+    free(baseline);
+    return 0;
 }
 
 /* Reset aberrant behavior model coefficients, including intercept, slope,
  * seasonal, and seasonal deviation for the specified data source. */
-void
-reset_aberrant_coefficients(rrd_t *rrd, rrd_file_t *rrd_file, unsigned long ds_idx)
+void reset_aberrant_coefficients(
+    rrd_t *rrd,
+    rrd_file_t * rrd_file,
+    unsigned long ds_idx)
 {
-   unsigned long cdp_idx, rra_idx, i;
-   unsigned long cdp_start, rra_start;
-   rrd_value_t nan_buffer = DNAN;
-
-   /* compute the offset for the cdp area */
-   cdp_start = sizeof(stat_head_t) + 
-         rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
-         rrd->stat_head->rra_cnt * sizeof(rra_def_t) + 
-         sizeof(live_head_t) +
-         rrd->stat_head->ds_cnt * sizeof(pdp_prep_t);
-   /* compute the offset for the first rra */
-   rra_start = cdp_start + 
-         (rrd->stat_head->ds_cnt) * (rrd->stat_head->rra_cnt) * sizeof(cdp_prep_t) +
-         rrd->stat_head->rra_cnt * sizeof(rra_ptr_t);
-
-   /* loop over the RRAs */
-   for (rra_idx = 0; rra_idx < rrd -> stat_head -> rra_cnt; rra_idx++)
-   {
-         cdp_idx = rra_idx * (rrd-> stat_head-> ds_cnt) + ds_idx;
-         switch (cf_conv(rrd -> rra_def[rra_idx].cf_nam))
-         {
-                case CF_HWPREDICT:
-               init_hwpredict_cdp(&(rrd -> cdp_prep[cdp_idx]));
-                       break;
-                case CF_SEASONAL:
-                case CF_DEVSEASONAL:
-                       /* don't use init_seasonal because it will reset burn-in, which
-                        * means different data sources will be calling for the smoother
-                        * at different times. */
-               rrd->cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val = DNAN;
-               rrd->cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = DNAN;
-                       /* move to first entry of data source for this rra */
-                       rrd_seek(rrd_file,rra_start + ds_idx * sizeof(rrd_value_t),SEEK_SET);
-                       /* entries for the same data source are not contiguous, 
-                        * temporal entries are contiguous */
-               for (i = 0; i < rrd->rra_def[rra_idx].row_cnt; ++i)
-                       {
-                          if (rrd_write(rrd_file,&nan_buffer,sizeof(rrd_value_t)*1) != sizeof(rrd_value_t)*1)
-                          {
-                  rrd_set_error(
-                                 "reset_aberrant_coefficients: write failed data source %lu rra %s",
-                                 ds_idx,rrd->rra_def[rra_idx].cf_nam);
-                                 return;
-                          } 
-                          rrd_seek(rrd_file,(rrd->stat_head->ds_cnt - 1) * 
-                                 sizeof(rrd_value_t),SEEK_CUR);
-                       }
-                       break;
-                case CF_FAILURES:
-                       erase_violations(rrd,cdp_idx,rra_idx);
-                       break;
-                default:
-                       break;
-         }
-         /* move offset to the next rra */
-         rra_start += rrd->rra_def[rra_idx].row_cnt * rrd->stat_head->ds_cnt * 
-                sizeof(rrd_value_t);
-   }
-   rrd_seek(rrd_file,cdp_start,SEEK_SET);
-   if (rrd_write(rrd_file,rrd->cdp_prep,
-         sizeof(cdp_prep_t)*
-         (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt) 
-         != (ssize_t)(sizeof(cdp_prep_t)*(rrd->stat_head->rra_cnt) * (rrd->stat_head->ds_cnt)))
-   {
-         rrd_set_error("reset_aberrant_coefficients: cdp_prep write failed");
-         return;/*XXX: delme */
-   }
+    unsigned long cdp_idx, rra_idx, i;
+    unsigned long cdp_start, rra_start;
+    rrd_value_t nan_buffer = DNAN;
+
+    /* compute the offset for the cdp area */
+    cdp_start = sizeof(stat_head_t) +
+        rrd->stat_head->ds_cnt * sizeof(ds_def_t) +
+        rrd->stat_head->rra_cnt * sizeof(rra_def_t) +
+        sizeof(live_head_t) + rrd->stat_head->ds_cnt * sizeof(pdp_prep_t);
+    /* compute the offset for the first rra */
+    rra_start = cdp_start +
+        (rrd->stat_head->ds_cnt) * (rrd->stat_head->rra_cnt) *
+        sizeof(cdp_prep_t) + rrd->stat_head->rra_cnt * sizeof(rra_ptr_t);
+
+    /* loop over the RRAs */
+    for (rra_idx = 0; rra_idx < rrd->stat_head->rra_cnt; rra_idx++) {
+        cdp_idx = rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
+        switch (cf_conv(rrd->rra_def[rra_idx].cf_nam)) {
+        case CF_HWPREDICT:
+            init_hwpredict_cdp(&(rrd->cdp_prep[cdp_idx]));
+            break;
+        case CF_SEASONAL:
+        case CF_DEVSEASONAL:
+            /* don't use init_seasonal because it will reset burn-in, which
+             * means different data sources will be calling for the smoother
+             * at different times. */
+            rrd->cdp_prep[cdp_idx].scratch[CDP_hw_seasonal].u_val = DNAN;
+            rrd->cdp_prep[cdp_idx].scratch[CDP_hw_last_seasonal].u_val = DNAN;
+            /* move to first entry of data source for this rra */
+            rrd_seek(rrd_file, rra_start + ds_idx * sizeof(rrd_value_t),
+                     SEEK_SET);
+            /* entries for the same data source are not contiguous, 
+             * temporal entries are contiguous */
+            for (i = 0; i < rrd->rra_def[rra_idx].row_cnt; ++i) {
+                if (rrd_write(rrd_file, &nan_buffer, sizeof(rrd_value_t) * 1)
+                    != sizeof(rrd_value_t) * 1) {
+                    rrd_set_error
+                        ("reset_aberrant_coefficients: write failed data source %lu rra %s",
+                         ds_idx, rrd->rra_def[rra_idx].cf_nam);
+                    return;
+                }
+                rrd_seek(rrd_file, (rrd->stat_head->ds_cnt - 1) *
+                         sizeof(rrd_value_t), SEEK_CUR);
+            }
+            break;
+        case CF_FAILURES:
+            erase_violations(rrd, cdp_idx, rra_idx);
+            break;
+        default:
+            break;
+        }
+        /* move offset to the next rra */
+        rra_start += rrd->rra_def[rra_idx].row_cnt * rrd->stat_head->ds_cnt *
+            sizeof(rrd_value_t);
+    }
+    rrd_seek(rrd_file, cdp_start, SEEK_SET);
+    if (rrd_write(rrd_file, rrd->cdp_prep,
+                  sizeof(cdp_prep_t) *
+                  (rrd->stat_head->rra_cnt) * rrd->stat_head->ds_cnt)
+        != (ssize_t) (sizeof(cdp_prep_t) * (rrd->stat_head->rra_cnt) *
+                      (rrd->stat_head->ds_cnt))) {
+        rrd_set_error("reset_aberrant_coefficients: cdp_prep write failed");
+        return;         /*XXX: delme */
+    }
 }
 
-void init_hwpredict_cdp(cdp_prep_t *cdp)
+void init_hwpredict_cdp(
+    cdp_prep_t * cdp)
 {
-   cdp->scratch[CDP_hw_intercept].u_val = DNAN;
-   cdp->scratch[CDP_hw_last_intercept].u_val = DNAN;
-   cdp->scratch[CDP_hw_slope].u_val = DNAN;
-   cdp->scratch[CDP_hw_last_slope].u_val = DNAN;
-   cdp->scratch[CDP_null_count].u_cnt = 1;
-   cdp->scratch[CDP_last_null_count].u_cnt = 1;
+    cdp->scratch[CDP_hw_intercept].u_val = DNAN;
+    cdp->scratch[CDP_hw_last_intercept].u_val = DNAN;
+    cdp->scratch[CDP_hw_slope].u_val = DNAN;
+    cdp->scratch[CDP_hw_last_slope].u_val = DNAN;
+    cdp->scratch[CDP_null_count].u_cnt = 1;
+    cdp->scratch[CDP_last_null_count].u_cnt = 1;
 }
 
-void init_seasonal_cdp(cdp_prep_t *cdp)
+void init_seasonal_cdp(
+    cdp_prep_t * cdp)
 {
-   cdp->scratch[CDP_hw_seasonal].u_val = DNAN;
-   cdp->scratch[CDP_hw_last_seasonal].u_val = DNAN;
-   cdp->scratch[CDP_init_seasonal].u_cnt = 1;
+    cdp->scratch[CDP_hw_seasonal].u_val = DNAN;
+    cdp->scratch[CDP_hw_last_seasonal].u_val = DNAN;
+    cdp->scratch[CDP_init_seasonal].u_cnt = 1;
 }
 
-int
-update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf, 
-                 unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx, 
-                 unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef)
+int update_aberrant_CF(
+    rrd_t *rrd,
+    rrd_value_t pdp_val,
+    enum cf_en current_cf,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_coef)
 {
-   rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = pdp_val;
-   switch (current_cf) {
-   case CF_AVERAGE:
-   default:
-        return 0;
-   case CF_HWPREDICT:
-     return update_hwpredict(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
-   case CF_DEVPREDICT:
-        return update_devpredict(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
-   case CF_SEASONAL:
-     return update_seasonal(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx,seasonal_coef);
-   case CF_DEVSEASONAL:
-     return update_devseasonal(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx,seasonal_coef);
-   case CF_FAILURES:
-     return update_failures(rrd,cdp_idx,rra_idx,ds_idx,CDP_scratch_idx);
-   }
-   return -1;
+    rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val = pdp_val;
+    switch (current_cf) {
+    case CF_AVERAGE:
+    default:
+        return 0;
+    case CF_HWPREDICT:
+        return update_hwpredict(rrd, cdp_idx, rra_idx, ds_idx,
+                                CDP_scratch_idx);
+    case CF_DEVPREDICT:
+        return update_devpredict(rrd, cdp_idx, rra_idx, ds_idx,
+                                 CDP_scratch_idx);
+    case CF_SEASONAL:
+        return update_seasonal(rrd, cdp_idx, rra_idx, ds_idx, CDP_scratch_idx,
+                               seasonal_coef);
+    case CF_DEVSEASONAL:
+        return update_devseasonal(rrd, cdp_idx, rra_idx, ds_idx,
+                                  CDP_scratch_idx, seasonal_coef);
+    case CF_FAILURES:
+        return update_failures(rrd, cdp_idx, rra_idx, ds_idx,
+                               CDP_scratch_idx);
+    }
+    return -1;
 }
 
-unsigned long MyMod(signed long val, unsigned long mod)
+unsigned long MyMod(
+    signed long val,
+    unsigned long mod)
 {
-   unsigned long new_val;
-   if (val < 0)
-     new_val = ((unsigned long) abs(val)) % mod;
-   else
-     new_val = (val % mod);
-   
-   if (val < 0) 
-     return (mod - new_val);
-   else
-     return (new_val);
+    unsigned long new_val;
+
+    if (val < 0)
+        new_val = ((unsigned long) abs(val)) % mod;
+    else
+        new_val = (val % mod);
+
+    if (val < 0)
+        return (mod - new_val);
+    else
+        return (new_val);
 }
 
 /* a standard fixed-capacity FIF0 queue implementation
  * No overflow checking is performed. */
-int queue_alloc(FIFOqueue **q,int capacity)
+int queue_alloc(
+    FIFOqueue ** q,
+    int capacity)
 {
-   *q = (FIFOqueue *) malloc(sizeof(FIFOqueue));
-   if (*q == NULL) return -1;
-   (*q) -> queue = (rrd_value_t *) malloc(sizeof(rrd_value_t)*capacity);
-   if ((*q) -> queue == NULL)
-   {
-         free(*q);
-         return -1;
-   }
-   (*q) -> capacity = capacity;
-   (*q) -> head = capacity;
-   (*q) -> tail = 0;
-   return 0;
+    *q = (FIFOqueue *) malloc(sizeof(FIFOqueue));
+    if (*q == NULL)
+        return -1;
+    (*q)->queue = (rrd_value_t *) malloc(sizeof(rrd_value_t) * capacity);
+    if ((*q)->queue == NULL) {
+        free(*q);
+        return -1;
+    }
+    (*q)->capacity = capacity;
+    (*q)->head = capacity;
+    (*q)->tail = 0;
+    return 0;
 }
 
-int queue_isempty(FIFOqueue *q)
+int queue_isempty(
+    FIFOqueue * q)
 {
-   return (q -> head % q -> capacity == q -> tail);
+    return (q->head % q->capacity == q->tail);
 }
 
-void queue_push(FIFOqueue *q, rrd_value_t value)
+void queue_push(
+    FIFOqueue * q,
+    rrd_value_t value)
 {
-   q -> queue[(q -> tail)++] = value;
-   q -> tail = q -> tail % q -> capacity;
+    q->queue[(q->tail)++] = value;
+    q->tail = q->tail % q->capacity;
 }
 
-rrd_value_t queue_pop(FIFOqueue *q)
+rrd_value_t queue_pop(
+    FIFOqueue * q)
 {
-   q -> head = q -> head % q -> capacity;
-   return q -> queue[(q -> head)++];
+    q->head = q->head % q->capacity;
+    return q->queue[(q->head)++];
 }
 
-void queue_dealloc(FIFOqueue *q)
+void queue_dealloc(
+    FIFOqueue * q)
 {
-   free(q -> queue);
-   free(q);
+    free(q->queue);
+    free(q);
 }
index bd5502c..06314b6 100644 (file)
@@ -5,29 +5,61 @@
  *****************************************************************************/
 
 /* functions implemented in rrd_hw.c */
-int update_aberrant_CF(rrd_t *rrd, rrd_value_t pdp_val, enum cf_en current_cf,
-   unsigned long cdp_idx, unsigned long rra_idx, unsigned long ds_idx,
-   unsigned short CDP_scratch_idx, rrd_value_t *seasonal_coef);
-int create_hw_contingent_rras(rrd_t *rrd, unsigned short period, 
-   unsigned long hashed_name);
-int lookup_seasonal(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
-   rrd_file_t* rrd_file, unsigned long offset, rrd_value_t **seasonal_coef);
-void erase_violations(rrd_t *rrd, unsigned long cdp_idx, unsigned long rra_idx);
-int apply_smoother(rrd_t *rrd, unsigned long rra_idx, unsigned long rra_start,
-   rrd_file_t *rrd_file);
-void reset_aberrant_coefficients(rrd_t *rrd, rrd_file_t *rrd_file, unsigned long ds_idx);
-void init_hwpredict_cdp(cdp_prep_t *);
-void init_seasonal_cdp(cdp_prep_t *);
+int       update_aberrant_CF(
+    rrd_t *rrd,
+    rrd_value_t pdp_val,
+    enum cf_en current_cf,
+    unsigned long cdp_idx,
+    unsigned long rra_idx,
+    unsigned long ds_idx,
+    unsigned short CDP_scratch_idx,
+    rrd_value_t * seasonal_coef);
+int       create_hw_contingent_rras(
+    rrd_t *rrd,
+    unsigned short period,
+    unsigned long hashed_name);
+int       lookup_seasonal(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long rra_start,
+    rrd_file_t * rrd_file,
+    unsigned long offset,
+    rrd_value_t ** seasonal_coef);
+void      erase_violations(
+    rrd_t *rrd,
+    unsigned long cdp_idx,
+    unsigned long rra_idx);
+int       apply_smoother(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long rra_start,
+    rrd_file_t * rrd_file);
+void      reset_aberrant_coefficients(
+    rrd_t *rrd,
+    rrd_file_t * rrd_file,
+    unsigned long ds_idx);
+void      init_hwpredict_cdp(
+    cdp_prep_t *);
+void      init_seasonal_cdp(
+    cdp_prep_t *);
+
 #define BURNIN_CYCLES 3
 
 /* a standard fixed-capacity FIFO queue implementation */
 typedef struct FIFOqueue {
-   rrd_value_t *queue;
-   int capacity, head, tail;
+    rrd_value_t *queue;
+    int       capacity, head, tail;
 } FIFOqueue;
 
-int queue_alloc(FIFOqueue **q,int capacity);
-void queue_dealloc(FIFOqueue *q);
-void queue_push(FIFOqueue *q, rrd_value_t value);
-int queue_isempty(FIFOqueue *q);
-rrd_value_t queue_pop(FIFOqueue *q);
+int       queue_alloc(
+    FIFOqueue ** q,
+    int capacity);
+void      queue_dealloc(
+    FIFOqueue * q);
+void      queue_push(
+    FIFOqueue * q,
+    rrd_value_t value);
+int       queue_isempty(
+    FIFOqueue * q);
+rrd_value_t queue_pop(
+    FIFOqueue * q);
index 2160962..4582e2a 100644 (file)
 #include <stdarg.h>
 
 /* proto */
-info_t *rrd_info(int, char **);
-info_t *rrd_info_r(char *filename);
+info_t   *rrd_info(
+    int,
+    char **);
+info_t   *rrd_info_r(
+    char *filename);
 
 /* allocate memory for string */
-char *
-sprintf_alloc(char *fmt, ...) {
-#ifdef HAVE_VSNPRINTF    
-    int maxlen = 50;
+char     *sprintf_alloc(
+    char *fmt,
+    ...)
+{
+#ifdef HAVE_VSNPRINTF
+    int       maxlen = 50;
 #else
-    int maxlen = 1000;
+    int       maxlen = 1000;
 #endif
-    char *str = NULL;
-    va_list argp;
-    str = malloc(sizeof(char)*(strlen(fmt)+maxlen));
+    char     *str = NULL;
+    va_list   argp;
+    str = malloc(sizeof(char) * (strlen(fmt) + maxlen));
     if (str != NULL) {
-       va_start(argp, fmt);
+        va_start(argp, fmt);
 #ifdef HAVE_VSNPRINTF
-       vsnprintf(str, maxlen-1, fmt, argp);
+        vsnprintf(str, maxlen - 1, fmt, argp);
 #else
-       vsprintf(str, fmt, argp);
+        vsprintf(str, fmt, argp);
 #endif
     }
     va_end(argp);
     return str;
 }
+
 /* the function formerly known as push was renamed info_push because
  * it is now used outside the scope of this file */
-info_t 
-*info_push(info_t *info, char *key, enum info_type type, infoval value){
-    info_t *next;
+info_t
+         *info_push(
+    info_t *info,
+    char *key,
+    enum info_type type,
+    infoval value)
+{
+    info_t   *next;
+
     next = malloc(sizeof(*next));
     next->next = (info_t *) 0;
-    if( info )
-       info->next = next;
+    if (info)
+        info->next = next;
     next->type = type;
-    next->key  = key;
+    next->key = key;
     switch (type) {
     case RD_I_VAL:
-       next->value.u_val = value.u_val;
-       break;
+        next->value.u_val = value.u_val;
+        break;
     case RD_I_CNT:
-       next->value.u_cnt = value.u_cnt;
-       break;
+        next->value.u_cnt = value.u_cnt;
+        break;
     case RD_I_INT:
-       next->value.u_int = value.u_int;
-       break;
+        next->value.u_int = value.u_int;
+        break;
     case RD_I_STR:
-       next->value.u_str = malloc(sizeof(char)*(strlen(value.u_str)+1));
-       strcpy(next->value.u_str,value.u_str);
-       break;
+        next->value.u_str = malloc(sizeof(char) * (strlen(value.u_str) + 1));
+        strcpy(next->value.u_str, value.u_str);
+        break;
     }
-    return(next);
+    return (next);
 }
 
 
-info_t *
-rrd_info(int argc, char **argv) {   
-    info_t             *info;
+info_t   *rrd_info(
+    int argc,
+    char **argv)
+{
+    info_t   *info;
 
-    if(argc < 2){
+    if (argc < 2) {
         rrd_set_error("please specify an rrd");
         return NULL;
     }
 
     info = rrd_info_r(argv[1]);
 
-    return(info);
+    return (info);
 }
 
 
-  
-info_t *
-rrd_info_r(char *filename) {   
-    unsigned int i,ii=0;
-    rrd_t        rrd;
-    info_t       *data,*cd;
-    infoval      info;
-    rrd_file_t*  rrd_file;
-       enum cf_en   current_cf;
-       enum dst_en  current_ds;
 
-    rrd_file = rrd_open(filename,&rrd, RRD_READONLY);
+info_t   *rrd_info_r(
+    char *filename)
+{
+    unsigned int i, ii = 0;
+    rrd_t     rrd;
+    info_t   *data, *cd;
+    infoval   info;
+    rrd_file_t *rrd_file;
+    enum cf_en current_cf;
+    enum dst_en current_ds;
+
+    rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL) {
-       return(NULL);
+        return (NULL);
     }
     close(rrd_file->fd);
 
-    info.u_str=filename;
-    cd=info_push(NULL,sprintf_alloc("filename"),    RD_I_STR, info);
-    data=cd;
-
-    info.u_str=rrd.stat_head->version;
-    cd=info_push(cd,sprintf_alloc("rrd_version"),    RD_I_STR, info);
-
-    info.u_cnt=rrd.stat_head->pdp_step;
-    cd=info_push(cd,sprintf_alloc("step"),       RD_I_CNT, info);
-
-    info.u_cnt=rrd.live_head->last_up;
-    cd=info_push(cd,sprintf_alloc("last_update"), RD_I_CNT, info);
-
-    for(i=0;i<rrd.stat_head->ds_cnt;i++){
-
-       info.u_str=rrd.ds_def[i].dst;
-       cd=info_push(cd,sprintf_alloc("ds[%s].type",             rrd.ds_def[i].ds_nam), RD_I_STR, info);
-  
-       current_ds = dst_conv(rrd.ds_def[i].dst);
-    switch (current_ds) {
-          case DST_CDEF:
-                 {
-                 char *buffer = NULL;
-                 rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),
-                        rrd.ds_def, &buffer);
-                 info.u_str = buffer;
-                 cd=info_push(cd,sprintf_alloc("ds[%s].cdef",rrd.ds_def[i].ds_nam),RD_I_STR,info);
-                 free(buffer);
-                 }
-                 break;
-          default:
-          info.u_cnt=rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt;
-          cd=info_push(cd,sprintf_alloc("ds[%s].minimal_heartbeat",rrd.ds_def[i].ds_nam), RD_I_CNT, info);
-
-          info.u_val=rrd.ds_def[i].par[DS_min_val].u_val;
-          cd=info_push(cd,sprintf_alloc("ds[%s].min",rrd.ds_def[i].ds_nam), RD_I_VAL, info);
-       
-          info.u_val=rrd.ds_def[i].par[DS_max_val].u_val;
-          cd=info_push(cd,sprintf_alloc("ds[%s].max",rrd.ds_def[i].ds_nam), RD_I_VAL, info);
-          break;
-       }
-       
-       info.u_str=rrd.pdp_prep[i].last_ds;
-       cd=info_push(cd,sprintf_alloc("ds[%s].last_ds",          rrd.ds_def[i].ds_nam), RD_I_STR, info);
-
-       info.u_val=rrd.pdp_prep[i].scratch[PDP_val].u_val;
-        cd=info_push(cd,sprintf_alloc("ds[%s].value",            rrd.ds_def[i].ds_nam), RD_I_VAL, info);
-
-       info.u_cnt=rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt;
-       cd=info_push(cd,sprintf_alloc("ds[%s].unknown_sec",      rrd.ds_def[i].ds_nam), RD_I_CNT, info);
+    info.u_str = filename;
+    cd = info_push(NULL, sprintf_alloc("filename"), RD_I_STR, info);
+    data = cd;
+
+    info.u_str = rrd.stat_head->version;
+    cd = info_push(cd, sprintf_alloc("rrd_version"), RD_I_STR, info);
+
+    info.u_cnt = rrd.stat_head->pdp_step;
+    cd = info_push(cd, sprintf_alloc("step"), RD_I_CNT, info);
+
+    info.u_cnt = rrd.live_head->last_up;
+    cd = info_push(cd, sprintf_alloc("last_update"), RD_I_CNT, info);
+
+    for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+
+        info.u_str = rrd.ds_def[i].dst;
+        cd = info_push(cd, sprintf_alloc("ds[%s].type", rrd.ds_def[i].ds_nam),
+                       RD_I_STR, info);
+
+        current_ds = dst_conv(rrd.ds_def[i].dst);
+        switch (current_ds) {
+        case DST_CDEF:
+        {
+            char     *buffer = NULL;
+
+            rpn_compact2str((rpn_cdefds_t *) & (rrd.ds_def[i].par[DS_cdef]),
+                            rrd.ds_def, &buffer);
+            info.u_str = buffer;
+            cd = info_push(cd,
+                           sprintf_alloc("ds[%s].cdef", rrd.ds_def[i].ds_nam),
+                           RD_I_STR, info);
+            free(buffer);
+        }
+            break;
+        default:
+            info.u_cnt = rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt;
+            cd = info_push(cd,
+                           sprintf_alloc("ds[%s].minimal_heartbeat",
+                                         rrd.ds_def[i].ds_nam), RD_I_CNT,
+                           info);
+
+            info.u_val = rrd.ds_def[i].par[DS_min_val].u_val;
+            cd = info_push(cd,
+                           sprintf_alloc("ds[%s].min", rrd.ds_def[i].ds_nam),
+                           RD_I_VAL, info);
+
+            info.u_val = rrd.ds_def[i].par[DS_max_val].u_val;
+            cd = info_push(cd,
+                           sprintf_alloc("ds[%s].max", rrd.ds_def[i].ds_nam),
+                           RD_I_VAL, info);
+            break;
+        }
+
+        info.u_str = rrd.pdp_prep[i].last_ds;
+        cd = info_push(cd,
+                       sprintf_alloc("ds[%s].last_ds", rrd.ds_def[i].ds_nam),
+                       RD_I_STR, info);
+
+        info.u_val = rrd.pdp_prep[i].scratch[PDP_val].u_val;
+        cd = info_push(cd,
+                       sprintf_alloc("ds[%s].value", rrd.ds_def[i].ds_nam),
+                       RD_I_VAL, info);
+
+        info.u_cnt = rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt;
+        cd = info_push(cd,
+                       sprintf_alloc("ds[%s].unknown_sec",
+                                     rrd.ds_def[i].ds_nam), RD_I_CNT, info);
     }
 
-    for(i=0;i<rrd.stat_head->rra_cnt;i++){
-       info.u_str=rrd.rra_def[i].cf_nam;
-       cd=info_push(cd,sprintf_alloc("rra[%d].cf",         i),  RD_I_STR,   info);
-       current_cf = cf_conv(rrd.rra_def[i].cf_nam);
-
-       info.u_cnt=rrd.rra_def[i].row_cnt;
-       cd=info_push(cd,sprintf_alloc("rra[%d].rows",i),  RD_I_CNT,   info);
-
-       info.u_cnt=rrd.rra_def[i].pdp_cnt;
-       cd=info_push(cd,sprintf_alloc("rra[%d].pdp_per_row",i),  RD_I_CNT,   info);
-
-       switch(current_cf)
-       {
-          case CF_HWPREDICT:
-                 info.u_val=rrd.rra_def[i].par[RRA_hw_alpha].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].alpha",i),RD_I_VAL,info);
-                 info.u_val=rrd.rra_def[i].par[RRA_hw_beta].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].beta",i),RD_I_VAL,info);
-                 break;
-          case CF_SEASONAL:
-          case CF_DEVSEASONAL:
-                 info.u_val=rrd.rra_def[i].par[RRA_seasonal_gamma].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].gamma",i),RD_I_VAL,info);
-                 break;
-          case CF_FAILURES:
-                 info.u_val=rrd.rra_def[i].par[RRA_delta_pos].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].delta_pos",i),RD_I_VAL,info);
-                 info.u_val=rrd.rra_def[i].par[RRA_delta_neg].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].delta_neg",i),RD_I_VAL,info);
-                 info.u_cnt=rrd.rra_def[i].par[RRA_failure_threshold].u_cnt;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].failure_threshold",i),RD_I_CNT,info);
-                 info.u_cnt=rrd.rra_def[i].par[RRA_window_len].u_cnt;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].window_length",i),RD_I_CNT,info);
-                 break;
-          case CF_DEVPREDICT:
-                 break;
-          default:
-                 info.u_val=rrd.rra_def[i].par[RRA_cdp_xff_val].u_val;
-                 cd=info_push(cd,sprintf_alloc("rra[%d].xff",i),RD_I_VAL,info);
-                 break;
-       }
-
-       for(ii=0;ii<rrd.stat_head->ds_cnt;ii++){
-        switch(current_cf)
-               {
-               case CF_HWPREDICT:
-           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_intercept].u_val;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].intercept",i,ii), RD_I_VAL, info);
-           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_slope].u_val;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].slope",i,ii), RD_I_VAL, info);
-           info.u_cnt=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_null_count].u_cnt;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].NaN_count",i,ii), RD_I_CNT, info);
-                  break;
-               case CF_SEASONAL:
-           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_hw_seasonal].u_val;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].seasonal",i,ii), RD_I_VAL, info);
-                  break;
-               case CF_DEVSEASONAL:
-           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_seasonal_deviation].u_val;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].deviation",i,ii), RD_I_VAL, info);
-                  break;
-               case CF_DEVPREDICT:
-                  break;
-               case CF_FAILURES:
-                  {
-                         unsigned short j;
-                         char *violations_array;
-                         char history[MAX_FAILURES_WINDOW_LEN+1];
-                         violations_array = (char*) rrd.cdp_prep[i*rrd.stat_head->ds_cnt +ii].scratch;
-                         for (j = 0; j < rrd.rra_def[i].par[RRA_window_len].u_cnt; ++j)
-                                history[j] = (violations_array[j] == 1) ? '1' : '0';
-                     history[j] = '\0';
-                     info.u_str = history;
-                         cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].history",i,ii), RD_I_STR, info);
-                  }
-                  break;
-               default:
-           info.u_val=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_val].u_val;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].value",i,ii), RD_I_VAL, info);
-           info.u_cnt=rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_unkn_pdp_cnt].u_cnt;
-           cd=info_push(cd,sprintf_alloc("rra[%d].cdp_prep[%d].unknown_datapoints",i,ii), RD_I_CNT, info);
-                  break;
+    for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
+        info.u_str = rrd.rra_def[i].cf_nam;
+        cd = info_push(cd, sprintf_alloc("rra[%d].cf", i), RD_I_STR, info);
+        current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+
+        info.u_cnt = rrd.rra_def[i].row_cnt;
+        cd = info_push(cd, sprintf_alloc("rra[%d].rows", i), RD_I_CNT, info);
+
+        info.u_cnt = rrd.rra_def[i].pdp_cnt;
+        cd = info_push(cd, sprintf_alloc("rra[%d].pdp_per_row", i), RD_I_CNT,
+                       info);
+
+        switch (current_cf) {
+        case CF_HWPREDICT:
+            info.u_val = rrd.rra_def[i].par[RRA_hw_alpha].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].alpha", i), RD_I_VAL,
+                           info);
+            info.u_val = rrd.rra_def[i].par[RRA_hw_beta].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].beta", i), RD_I_VAL,
+                           info);
+            break;
+        case CF_SEASONAL:
+        case CF_DEVSEASONAL:
+            info.u_val = rrd.rra_def[i].par[RRA_seasonal_gamma].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].gamma", i), RD_I_VAL,
+                           info);
+            break;
+        case CF_FAILURES:
+            info.u_val = rrd.rra_def[i].par[RRA_delta_pos].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].delta_pos", i),
+                           RD_I_VAL, info);
+            info.u_val = rrd.rra_def[i].par[RRA_delta_neg].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].delta_neg", i),
+                           RD_I_VAL, info);
+            info.u_cnt = rrd.rra_def[i].par[RRA_failure_threshold].u_cnt;
+            cd = info_push(cd, sprintf_alloc("rra[%d].failure_threshold", i),
+                           RD_I_CNT, info);
+            info.u_cnt = rrd.rra_def[i].par[RRA_window_len].u_cnt;
+            cd = info_push(cd, sprintf_alloc("rra[%d].window_length", i),
+                           RD_I_CNT, info);
+            break;
+        case CF_DEVPREDICT:
+            break;
+        default:
+            info.u_val = rrd.rra_def[i].par[RRA_cdp_xff_val].u_val;
+            cd = info_push(cd, sprintf_alloc("rra[%d].xff", i), RD_I_VAL,
+                           info);
+            break;
+        }
+
+        for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) {
+            switch (current_cf) {
+            case CF_HWPREDICT:
+                info.u_val =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_intercept].u_val;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].intercept",
+                                             i, ii), RD_I_VAL, info);
+                info.u_val =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_slope].u_val;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].slope", i,
+                                             ii), RD_I_VAL, info);
+                info.u_cnt =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_null_count].u_cnt;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].NaN_count",
+                                             i, ii), RD_I_CNT, info);
+                break;
+            case CF_SEASONAL:
+                info.u_val =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_hw_seasonal].u_val;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].seasonal",
+                                             i, ii), RD_I_VAL, info);
+                break;
+            case CF_DEVSEASONAL:
+                info.u_val =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_seasonal_deviation].u_val;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].deviation",
+                                             i, ii), RD_I_VAL, info);
+                break;
+            case CF_DEVPREDICT:
+                break;
+            case CF_FAILURES:
+            {
+                unsigned short j;
+                char     *violations_array;
+                char      history[MAX_FAILURES_WINDOW_LEN + 1];
+
+                violations_array =
+                    (char *) rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                          ii].scratch;
+                for (j = 0; j < rrd.rra_def[i].par[RRA_window_len].u_cnt; ++j)
+                    history[j] = (violations_array[j] == 1) ? '1' : '0';
+                history[j] = '\0';
+                info.u_str = history;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].history",
+                                             i, ii), RD_I_STR, info);
+            }
+                break;
+            default:
+                info.u_val =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_val].u_val;
+                cd = info_push(cd,
+                               sprintf_alloc("rra[%d].cdp_prep[%d].value", i,
+                                             ii), RD_I_VAL, info);
+                info.u_cnt =
+                    rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                 ii].scratch[CDP_unkn_pdp_cnt].u_cnt;
+                cd = info_push(cd,
+                               sprintf_alloc
+                               ("rra[%d].cdp_prep[%d].unknown_datapoints", i,
+                                ii), RD_I_CNT, info);
+                break;
+            }
         }
     }
-       }
-       rrd_free(&rrd);
+    rrd_free(&rrd);
     rrd_close(rrd_file);
-    return(data);
+    return (data);
 
 }
index 6fe480e..db84e95 100644 (file)
@@ -13,7 +13,7 @@
 #define _RRD_IS_THREAD_SAFE_H
 
 #ifdef  __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 #undef strerror
@@ -25,5 +25,4 @@ extern "C" {
 #ifdef  __cplusplus
 }
 #endif
-
 #endif /*_RRD_IS_THREAD_SAFE_H */
index 0f9ab9b..99ff125 100644 (file)
@@ -8,34 +8,33 @@
 
 #include "rrd_tool.h"
 
-time_t
-rrd_last(int argc, char **argv)
+time_t rrd_last(
+    int argc,
+    char **argv)
 {
-    if(argc < 2){
+    if (argc < 2) {
         rrd_set_error("please specify an rrd");
-        return(-1);
+        return (-1);
     }
 
-    return( rrd_last_r(argv[1]) );
+    return (rrd_last_r(argv[1]));
 }
 
-time_t
-rrd_last_r(const char *filename)
+
+time_t rrd_last_r(
+    const char *filename)
 {
-    time_t       lastup;
-    rrd_file_t*        rrd_file;
+    time_t    lastup;
+    rrd_file_t *rrd_file;
 
-    rrd_t       rrd;
+    rrd_t     rrd;
 
     rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL)
-        return(-1);
+        return (-1);
 
     lastup = rrd.live_head->last_up;
     rrd_free(&rrd);
     rrd_close(rrd_file);
-    return(lastup);
+    return (lastup);
 }
-
-
index abba277..47ecec7 100644 (file)
@@ -8,15 +8,20 @@
 #include "rrd_rpncalc.h"
 #include <stdarg.h>
 
-int
-rrd_lastupdate(int argc, char **argv, time_t *last_update,
-                 unsigned long *ds_cnt, char ***ds_namv, char ***last_ds) {
-    unsigned long i=0;
-    char        *filename;
-    rrd_t        rrd;
-    rrd_file_t*        rrd_file;
-
-    if(argc < 2){
+int rrd_lastupdate(
+    int argc,
+    char **argv,
+    time_t *last_update,
+    unsigned long *ds_cnt,
+    char ***ds_namv,
+    char ***last_ds)
+{
+    unsigned long i = 0;
+    char     *filename;
+    rrd_t     rrd;
+    rrd_file_t *rrd_file;
+
+    if (argc < 2) {
         rrd_set_error("please specify an rrd");
         return -1;
     }
@@ -24,31 +29,31 @@ rrd_lastupdate(int argc, char **argv, time_t *last_update,
 
     rrd_file = rrd_open(filename, &rrd, RRD_READONLY);
     if (rrd_file == NULL)
-       return(-1);
+        return (-1);
 
-    *last_update=rrd.live_head->last_up;
+    *last_update = rrd.live_head->last_up;
     *ds_cnt = rrd.stat_head->ds_cnt;
     if (((*ds_namv) =
-               (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
+         (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
         rrd_set_error("malloc fetch ds_namv array");
-       rrd_free(&rrd);
-       return(-1);
-    } 
+        rrd_free(&rrd);
+        return (-1);
+    }
 
     if (((*last_ds) =
-               (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char*)))==NULL){
+         (char **) malloc(rrd.stat_head->ds_cnt * sizeof(char *))) == NULL) {
         rrd_set_error("malloc fetch last_ds array");
-       rrd_free(&rrd);
-       free(*ds_namv);
-       return(-1);
-    } 
-
-    for(i=0;i<rrd.stat_head->ds_cnt;i++){
-       (*ds_namv)[i] = sprintf_alloc("%s", rrd.ds_def[i].ds_nam);
-       (*last_ds)[i] = sprintf_alloc("%s", rrd.pdp_prep[i].last_ds);
+        rrd_free(&rrd);
+        free(*ds_namv);
+        return (-1);
+    }
+
+    for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+        (*ds_namv)[i] = sprintf_alloc("%s", rrd.ds_def[i].ds_nam);
+        (*last_ds)[i] = sprintf_alloc("%s", rrd.pdp_prep[i].last_ds);
     }
 
     rrd_free(&rrd);
     rrd_close(rrd_file);
-    return(0); 
+    return (0);
 }
index 2a5ac14..9eae726 100644 (file)
@@ -1,10 +1,10 @@
 #include "rrd_nan_inf.h"
 
-int done_nan = 0;
-int done_inf = 0;
+int       done_nan = 0;
+int       done_inf = 0;
 
-double dnan;
-double dinf;
+double    dnan;
+double    dinf;
 
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
 #include <math.h>
@@ -19,14 +19,22 @@ double dinf;
 
 #endif
 
-double set_to_DNAN(void)
+double set_to_DNAN(
+    void)
 {
-  if ( !done_nan ) { dnan = NAN_FUNC; done_nan = 1; }
-  return dnan;
+    if (!done_nan) {
+        dnan = NAN_FUNC;
+        done_nan = 1;
+    }
+    return dnan;
 }
 
-double set_to_DINF(void)
+double set_to_DINF(
+    void)
 {
-  if ( !done_inf ) { dinf = INF_FUNC; done_inf = 1; }
-  return dinf;
+    if (!done_inf) {
+        dinf = INF_FUNC;
+        done_inf = 1;
+    }
+    return dinf;
 }
index 7934fdb..bc37c48 100644 (file)
@@ -1,5 +1,7 @@
 #define DNAN          set_to_DNAN()
 #define DINF          set_to_DINF()
 
-double set_to_DNAN(void);
-double set_to_DINF(void);
+double    set_to_DNAN(
+    void);
+double    set_to_DINF(
+    void);
index b2b5227..a18f9d7 100644 (file)
 #define MAXLEN 4096
 #define ERRBUFLEN 256
 
-static char rrd_error[MAXLEN+10];
-static char rrd_liberror[ERRBUFLEN+10];
-static int  rrd_context_init = 0;
+static char rrd_error[MAXLEN + 10];
+static char rrd_liberror[ERRBUFLEN + 10];
+static int rrd_context_init = 0;
+
 /* The global context is very useful in the transition period to even
    more thread-safe stuff, it can be used whereever we need a context
    and do not need to worry about concurrency. */
 static struct rrd_context global_ctx = {
     MAXLEN,
     ERRBUFLEN,
-    rrd_error, 
+    rrd_error,
     rrd_liberror
 };
+
 /* #include <stdarg.h> */
 
-struct rrd_context *rrd_get_context(void) {
-    if (! rrd_context_init ){
-       rrd_context_init = 1;
-        global_ctx.rrd_error[0]='\0';
-        global_ctx.lib_errstr[0]='\0';
+struct rrd_context *rrd_get_context(
+    void)
+{
+    if (!rrd_context_init) {
+        rrd_context_init = 1;
+        global_ctx.rrd_error[0] = '\0';
+        global_ctx.lib_errstr[0] = '\0';
     }
     return &global_ctx;
 }
@@ -42,6 +46,8 @@ struct rrd_context *rrd_get_context(void) {
    silently turning misplaced strerror into rrd_strerror, but here
    this turns recursive! */
 #undef strerror
-const char *rrd_strerror(int err) {
+const char *rrd_strerror(
+    int err)
+{
     return strerror(err);
 }
index c29741c..e7eed20 100644 (file)
 /* open a database file, return its header and a open filehandle */
 /* positioned to the first cdp in the first rra */
 
-rrd_file_t*
-rrd_open(const char * const file_name, rrd_t *rrd, unsigned rdwr)
+rrd_file_t *rrd_open(
+    const char *const file_name,
+    rrd_t *rrd,
+    unsigned rdwr)
 {
-       int flags = 0;
-       mode_t mode = S_IRUSR;
-       int version, prot = PROT_READ;
-       off_t offset = 0;
-       char *data;
-       struct stat statb;
-       rrd_file_t *rrd_file = malloc(sizeof(rrd_file_t));
-       if (rrd_file == NULL) {
-               rrd_set_error("allocating rrd_file descriptor for '%s'",
-                       file_name);
-               return NULL;
-       }
-       memset(rrd_file, 0, sizeof(rrd_file_t));
-       rrd_init(rrd);
-       if (rdwr == RRD_READWRITE) {
-               mode |= S_IWUSR;
-               prot |= PROT_WRITE;
-       } else if (rdwr == RRD_CREAT) {
-               mode |= S_IWUSR;
-               prot |= PROT_WRITE;
-               flags |= (O_CREAT|O_TRUNC);
-       }
+    int       flags = 0;
+    mode_t    mode = S_IRUSR;
+    int       version, prot = PROT_READ;
+    off_t     offset = 0;
+    char     *data;
+    struct stat statb;
+    rrd_file_t *rrd_file = malloc(sizeof(rrd_file_t));
+
+    if (rrd_file == NULL) {
+        rrd_set_error("allocating rrd_file descriptor for '%s'", file_name);
+        return NULL;
+    }
+    memset(rrd_file, 0, sizeof(rrd_file_t));
+    rrd_init(rrd);
+    if (rdwr == RRD_READWRITE) {
+        mode |= S_IWUSR;
+        prot |= PROT_WRITE;
+    } else if (rdwr == RRD_CREAT) {
+        mode |= S_IWUSR;
+        prot |= PROT_WRITE;
+        flags |= (O_CREAT | O_TRUNC);
+    }
 #ifdef O_NONBLOCK
-       flags |= O_NONBLOCK;
+    flags |= O_NONBLOCK;
 #endif
 
-       if ((rrd_file->fd = open(file_name, flags, mode)) < 0 ){
-               rrd_set_error("opening '%s': %s",file_name, rrd_strerror(errno));
-               return NULL;
-       }
+    if ((rrd_file->fd = open(file_name, flags, mode)) < 0) {
+        rrd_set_error("opening '%s': %s", file_name, rrd_strerror(errno));
+        return NULL;
+    }
 
-       /* ???: length = lseek(rrd_file->fd, 0, SEEK_END); */
-       /* ??? locking the whole area of the file may overdo it a bit, does it? */
-       if ((fstat(rrd_file->fd, &statb)) < 0) {
-               rrd_set_error("fstat '%s': %s",file_name, rrd_strerror(errno));
-               goto out_close;
-       }
-       rrd_file->file_len = statb.st_size;
+    /* ???: length = lseek(rrd_file->fd, 0, SEEK_END); */
+    /* ??? locking the whole area of the file may overdo it a bit, does it? */
+    if ((fstat(rrd_file->fd, &statb)) < 0) {
+        rrd_set_error("fstat '%s': %s", file_name, rrd_strerror(errno));
+        goto out_close;
+    }
+    rrd_file->file_len = statb.st_size;
 
 #ifdef HAVE_POSIX_FADVISE
     /* In general we need no read-ahead when dealing with rrd_files.
@@ -117,9 +119,10 @@ rrd_open(const char * const file_name, rrd_t *rrd, unsigned rdwr)
        In this manner we actually save time and diskaccess (and buffer cache).
        Thanks to Dave Plonka for the Idea of using POSIX_FADV_RANDOM here. */
     if (0 != posix_fadvise(rrd_file->fd, 0, 0, POSIX_FADV_RANDOM)) {
-        rrd_set_error("setting POSIX_FADV_RANDOM on '%s': %s",file_name, rrd_strerror(errno));
+        rrd_set_error("setting POSIX_FADV_RANDOM on '%s': %s", file_name,
+                      rrd_strerror(errno));
         goto out_close;
-     }
+    }
 #endif
 
 /*
@@ -131,187 +134,212 @@ rrd_open(const char * const file_name, rrd_t *rrd, unsigned rdwr)
            }
         }
 */
-       data = mmap(0, rrd_file->file_len, prot, MAP_SHARED,
-               rrd_file->fd, offset);
-
-       /* lets see if the first read worked */
-       if (data == MAP_FAILED) {
-               rrd_set_error("error mmaping file '%s'",file_name);
-               goto out_close;
-       }
-       rrd_file->file_start = data;
+    data = mmap(0, rrd_file->file_len, prot, MAP_SHARED,
+                rrd_file->fd, offset);
+
+    /* lets see if the first read worked */
+    if (data == MAP_FAILED) {
+        rrd_set_error("error mmaping file '%s'", file_name);
+        goto out_close;
+    }
+    rrd_file->file_start = data;
 #ifdef USE_MADVISE
-       if (rrd == NULL) { /*XXX: currently not used! */
-               /* We will read everything in a moment (copying) */
-               madvise(data, rrd_file->file_len, MADV_WILLNEED|MADV_SEQUENTIAL);
-               goto out_done;
-       }
-       /* We do not need to read anything in for the moment */
-       madvise(data, rrd_file->file_len, MADV_DONTNEED);
+    if (rrd == NULL) {  /*XXX: currently not used! */
+        /* We will read everything in a moment (copying) */
+        madvise(data, rrd_file->file_len, MADV_WILLNEED | MADV_SEQUENTIAL);
+        goto out_done;
+    }
+    /* We do not need to read anything in for the moment */
+    madvise(data, rrd_file->file_len, MADV_DONTNEED);
 #endif
 
 #ifdef USE_MADVISE
-       /* the stat_head will be needed soonish, so hint accordingly */
-       madvise(data+offset, sizeof(stat_head_t), MADV_WILLNEED);
+    /* the stat_head will be needed soonish, so hint accordingly */
+    madvise(data + offset, sizeof(stat_head_t), MADV_WILLNEED);
 #endif
 
-       rrd->stat_head = (stat_head_t*)(data + offset);
-       offset += sizeof(stat_head_t);
-
-        /* lets do some test if we are on track ... */
-       if (memcmp(rrd->stat_head->cookie,RRD_COOKIE,sizeof(RRD_COOKIE)) != 0) {
-               rrd_set_error("'%s' is not an RRD file",file_name);
-               goto out_nullify_head;
-       }
+    rrd->stat_head = (stat_head_t *) (data + offset);
+    offset += sizeof(stat_head_t);
 
-       if (rrd->stat_head->float_cookie != FLOAT_COOKIE){
-               rrd_set_error("This RRD was created on other architecture");
-               goto out_nullify_head;
-       }
+    /* lets do some test if we are on track ... */
+    if (memcmp(rrd->stat_head->cookie, RRD_COOKIE, sizeof(RRD_COOKIE)) != 0) {
+        rrd_set_error("'%s' is not an RRD file", file_name);
+        goto out_nullify_head;
+    }
 
-       version = atoi(rrd->stat_head->version);
+    if (rrd->stat_head->float_cookie != FLOAT_COOKIE) {
+        rrd_set_error("This RRD was created on other architecture");
+        goto out_nullify_head;
+    }
 
-       if (version > atoi(RRD_VERSION)) {
-            rrd_set_error("can't handle RRD file version %s",
-                        rrd->stat_head->version);
-            goto out_nullify_head;
-       }
+    version = atoi(rrd->stat_head->version);
 
+    if (version > atoi(RRD_VERSION)) {
+        rrd_set_error("can't handle RRD file version %s",
+                      rrd->stat_head->version);
+        goto out_nullify_head;
+    }
 #ifdef USE_MADVISE
-       /* the ds_def will be needed soonish, so hint accordingly */
-       madvise(data+offset, sizeof(ds_def_t)*rrd->stat_head->ds_cnt, MADV_WILLNEED);
+    /* the ds_def will be needed soonish, so hint accordingly */
+    madvise(data + offset, sizeof(ds_def_t) * rrd->stat_head->ds_cnt,
+            MADV_WILLNEED);
 #endif
-       rrd->ds_def = (ds_def_t*)(data + offset);
-       offset += sizeof(ds_def_t) * rrd->stat_head->ds_cnt;
+    rrd->ds_def = (ds_def_t *) (data + offset);
+    offset += sizeof(ds_def_t) * rrd->stat_head->ds_cnt;
 
 #ifdef USE_MADVISE
-       /* the rra_def will be needed soonish, so hint accordingly */
-       madvise(data+offset, sizeof(rra_def_t)*rrd->stat_head->rra_cnt, MADV_WILLNEED);
+    /* the rra_def will be needed soonish, so hint accordingly */
+    madvise(data + offset, sizeof(rra_def_t) * rrd->stat_head->rra_cnt,
+            MADV_WILLNEED);
 #endif
-       rrd->rra_def = (rra_def_t*)(data + offset);
-       offset += sizeof(rra_def_t) * rrd->stat_head->rra_cnt;
+    rrd->rra_def = (rra_def_t *) (data + offset);
+    offset += sizeof(rra_def_t) * rrd->stat_head->rra_cnt;
 
     /* handle different format for the live_head */
-       if (version < 3) {
-            rrd->live_head = (live_head_t *)malloc(sizeof(live_head_t));
-            if (rrd->live_head == NULL) {
-                rrd_set_error("live_head_t malloc");
-                goto out_close;
-            }
-               memmove(&rrd->live_head->last_up, data+offset, sizeof(long));
-               rrd->live_head->last_up_usec = 0;
-       } else {
+    if (version < 3) {
+        rrd->live_head = (live_head_t *) malloc(sizeof(live_head_t));
+        if (rrd->live_head == NULL) {
+            rrd_set_error("live_head_t malloc");
+            goto out_close;
+        }
+        memmove(&rrd->live_head->last_up, data + offset, sizeof(long));
+        rrd->live_head->last_up_usec = 0;
+    } else {
 #ifdef USE_MADVISE
-               /* the live_head will be needed soonish, so hint accordingly */
-               madvise(data+offset, sizeof(live_head_t), MADV_WILLNEED);
+        /* the live_head will be needed soonish, so hint accordingly */
+        madvise(data + offset, sizeof(live_head_t), MADV_WILLNEED);
 #endif
-               rrd->live_head = (live_head_t*)(data + offset);
-               offset += sizeof(live_head_t);
-       }
+        rrd->live_head = (live_head_t *) (data + offset);
+        offset += sizeof(live_head_t);
+    }
 // This doesn't look like it needs madvise
-       rrd->pdp_prep = (pdp_prep_t*)(data + offset);
-       offset += sizeof(pdp_prep_t) * rrd->stat_head->ds_cnt;
+    rrd->pdp_prep = (pdp_prep_t *) (data + offset);
+    offset += sizeof(pdp_prep_t) * rrd->stat_head->ds_cnt;
 
 // This could benefit from madvise()ing
-       rrd->cdp_prep = (cdp_prep_t*)(data + offset);
-       offset += sizeof(cdp_prep_t) *
-                               (rrd->stat_head->rra_cnt * rrd->stat_head->ds_cnt);
+    rrd->cdp_prep = (cdp_prep_t *) (data + offset);
+    offset += sizeof(cdp_prep_t) *
+        (rrd->stat_head->rra_cnt * rrd->stat_head->ds_cnt);
 
 // This could benefit from madvise()ing
-       rrd->rra_ptr = (rra_ptr_t*)(data + offset);
-       offset += sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt;
+    rrd->rra_ptr = (rra_ptr_t *) (data + offset);
+    offset += sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt;
 #ifdef USE_MADVISE
-out_done:
+  out_done:
 #endif
-       rrd_file->header_len = offset;
-       rrd_file->pos = offset;
+    rrd_file->header_len = offset;
+    rrd_file->pos = offset;
 /* we could close(rrd_file->fd); here, the mapping is still valid anyway */
-       return (rrd_file);
-out_nullify_head:
-       rrd->stat_head = NULL;
-out_close:
-       close(rrd_file->fd);
-       return NULL;
+    return (rrd_file);
+  out_nullify_head:
+    rrd->stat_head = NULL;
+  out_close:
+    close(rrd_file->fd);
+    return NULL;
 }
 
 /* Close a reference to an rrd_file.  */
-int rrd_close(rrd_file_t* rrd_file) {
-       int ret = 0;
+int rrd_close(
+    rrd_file_t * rrd_file)
+{
+    int       ret = 0;
+
 #ifdef HAVE_MMAP
-       ret = munmap(rrd_file->file_start, rrd_file->file_len);
-//     if (ret != 0)
-//             rrd_set_error("munmap rrd_file");
+    ret = munmap(rrd_file->file_start, rrd_file->file_len);
+//  if (ret != 0)
+//      rrd_set_error("munmap rrd_file");
 #endif
-       free(rrd_file);
-       rrd_file = NULL;
-       return ret;
+    free(rrd_file);
+    rrd_file = NULL;
+    return ret;
 }
 
 /* Set position of rrd_file.  */
-off_t rrd_seek(rrd_file_t* rrd_file, off_t off, int whence) {
-       off_t ret = 0;
+off_t rrd_seek(
+    rrd_file_t * rrd_file,
+    off_t off,
+    int whence)
+{
+    off_t     ret = 0;
+
 #ifdef HAVE_MMAP
-       if (whence == SEEK_SET)
-               rrd_file->pos = off;
-       else if (whence == SEEK_CUR)
-               rrd_file->pos += off;
-       else if (whence == SEEK_END)
-               rrd_file->pos = rrd_file->file_len + off;
+    if (whence == SEEK_SET)
+        rrd_file->pos = off;
+    else if (whence == SEEK_CUR)
+        rrd_file->pos += off;
+    else if (whence == SEEK_END)
+        rrd_file->pos = rrd_file->file_len + off;
 #else
-       ret = lseek(rrd_file->fd, off, whence);
-       if (ret < 0)
-               rrd_set_error("lseek: %s", rrd_strerror(errno));
-       rrd_file->pos = ret;
+    ret = lseek(rrd_file->fd, off, whence);
+    if (ret < 0)
+        rrd_set_error("lseek: %s", rrd_strerror(errno));
+    rrd_file->pos = ret;
 #endif
 //XXX: mimic fseek, which returns 0 upon success
-       return ret == -1; //XXX: or just ret to mimic lseek
+    return ret == -1;   //XXX: or just ret to mimic lseek
 }
 
 /* Get current position in rrd_file.  */
-off_t rrd_tell(rrd_file_t* rrd_file) {
-       return rrd_file->pos;
+off_t rrd_tell(
+    rrd_file_t * rrd_file)
+{
+    return rrd_file->pos;
 }
 
 /* read count bytes into buffer buf, starting at rrd_file->pos.
  * Returns the number of bytes read.  */
-ssize_t rrd_read(rrd_file_t* rrd_file, void*buf, size_t count) {
+ssize_t rrd_read(
+    rrd_file_t * rrd_file,
+    void *buf,
+    size_t count)
+{
 #ifdef HAVE_MMAP
-       char* pos = rrd_file->file_start + rrd_file->pos;
-       buf = memmove(buf, pos, count);
-       return count;
+    char     *pos = rrd_file->file_start + rrd_file->pos;
+
+    buf = memmove(buf, pos, count);
+    return count;
 #else
-       ssize_t ret;
-       ret = read(rrd_file->fd, buf, count);
-       //XXX: eventually add generic rrd_set_error(""); here
-       return ret;
+    ssize_t   ret;
+
+    ret = read(rrd_file->fd, buf, count);
+    //XXX: eventually add generic rrd_set_error(""); here
+    return ret;
 #endif
 }
 
 /* write count bytes from buffer buf to the current position
  * rrd_file->pos of rrd_file->fd.  */
-ssize_t rrd_write(rrd_file_t * rrd_file, const void*buf, size_t count) {
-       ssize_t ret = count;
+ssize_t rrd_write(
+    rrd_file_t * rrd_file,
+    const void *buf,
+    size_t count)
+{
+    ssize_t   ret = count;
+
 #ifdef HAVE_MMAP
-       char *off, *new_pos;
-       off = rrd_file->file_start + rrd_file->pos;
-       new_pos = memmove(rrd_file->file_start + rrd_file->pos, buf, count);
-       ret = new_pos - off;
+    char     *off, *new_pos;
+
+    off = rrd_file->file_start + rrd_file->pos;
+    new_pos = memmove(rrd_file->file_start + rrd_file->pos, buf, count);
+    ret = new_pos - off;
 #else
-       ret = write(rrd_file->fd, buf, count)
+    ret = write(rrd_file->fd, buf, count)
 #endif
-       return ret;
+        return ret;
 }
 
 /* flush all data pending to be written to FD.  */
-void rrd_flush(rrd_file_t* rrd_file)
+void rrd_flush(
+    rrd_file_t * rrd_file)
 {
-       if (fdatasync(rrd_file->fd) != 0) {
-               rrd_set_error("flushing fd %d: %s", rrd_file->fd,
-                       rrd_strerror(errno));
-       }
+    if (fdatasync(rrd_file->fd) != 0) {
+        rrd_set_error("flushing fd %d: %s", rrd_file->fd,
+                      rrd_strerror(errno));
+    }
 }
 
-void rrd_init(rrd_t *rrd)
+void rrd_init(
+    rrd_t *rrd)
 {
     rrd->stat_head = NULL;
     rrd->ds_def = NULL;
@@ -323,11 +351,12 @@ void rrd_init(rrd_t *rrd)
     rrd->rrd_value = NULL;
 }
 
-void rrd_free(rrd_t UNUSED(*rrd))
+void rrd_free(
+    rrd_t UNUSED(*rrd))
 {
 #ifndef HAVE_MMAP
     if (atoi(rrd->stat_head->version) < 3)
-           free(rrd->live_head);
+        free(rrd->live_head);
     free(rrd->stat_head);
     free(rrd->ds_def);
     free(rrd->rra_def);
@@ -340,50 +369,65 @@ void rrd_free(rrd_t UNUSED(*rrd))
 
 /* routine used by external libraries to free memory allocated by
  * rrd library */
-void rrd_freemem(void *mem)
+void rrd_freemem(
+    void *mem)
 {
-       free(mem);
+    free(mem);
 }
 
-int readfile(const char *file_name, char **buffer, int skipfirst){
-    long writecnt=0,totalcnt = MEMBLK;
-     long offset = 0;
-    FILE *input=NULL;
-    char c ;
-    if ((strcmp("-",file_name) == 0)) { input = stdin; }
-    else {
-      if ((input = fopen(file_name,"rb")) == NULL ){
-        rrd_set_error("opening '%s': %s",file_name,rrd_strerror(errno));
-        return (-1);
-      }
+int readfile(
+    const char *file_name,
+    char **buffer,
+    int skipfirst)
+{
+    long      writecnt = 0, totalcnt = MEMBLK;
+    long      offset = 0;
+    FILE     *input = NULL;
+    char      c;
+
+    if ((strcmp("-", file_name) == 0)) {
+        input = stdin;
+    } else {
+        if ((input = fopen(file_name, "rb")) == NULL) {
+            rrd_set_error("opening '%s': %s", file_name, rrd_strerror(errno));
+            return (-1);
+        }
     }
-    if (skipfirst){
-      do { c = getc(input); offset++; } while (c != '\n' && ! feof(input));
+    if (skipfirst) {
+        do {
+            c = getc(input);
+            offset++;
+        } while (c != '\n' && !feof(input));
     }
-    if (strcmp("-",file_name)) {
-      fseek(input, 0, SEEK_END);
-      /* have extra space for detecting EOF without realloc */
-      totalcnt = (ftell(input) + 1) / sizeof(char) - offset;
-      if (totalcnt < MEMBLK)
-        totalcnt = MEMBLK; /* sanitize */
-      fseek(input, offset * sizeof(char), SEEK_SET);
+    if (strcmp("-", file_name)) {
+        fseek(input, 0, SEEK_END);
+        /* have extra space for detecting EOF without realloc */
+        totalcnt = (ftell(input) + 1) / sizeof(char) - offset;
+        if (totalcnt < MEMBLK)
+            totalcnt = MEMBLK;  /* sanitize */
+        fseek(input, offset * sizeof(char), SEEK_SET);
     }
-    if (((*buffer) = (char *) malloc((totalcnt+4) * sizeof(char))) == NULL) {
+    if (((*buffer) = (char *) malloc((totalcnt + 4) * sizeof(char))) == NULL) {
         perror("Allocate Buffer:");
         exit(1);
     };
-    do{
-      writecnt += fread((*buffer)+writecnt, 1, (totalcnt - writecnt) * sizeof(char),input);
-      if (writecnt >= totalcnt){
-        totalcnt += MEMBLK;
-        if (((*buffer)=rrd_realloc((*buffer), (totalcnt+4) * sizeof(char)))==NULL){
-            perror("Realloc Buffer:");
-            exit(1);
-        };
-      }
-    } while (! feof(input));
+    do {
+        writecnt +=
+            fread((*buffer) + writecnt, 1,
+                  (totalcnt - writecnt) * sizeof(char), input);
+        if (writecnt >= totalcnt) {
+            totalcnt += MEMBLK;
+            if (((*buffer) =
+                 rrd_realloc((*buffer),
+                             (totalcnt + 4) * sizeof(char))) == NULL) {
+                perror("Realloc Buffer:");
+                exit(1);
+            };
+        }
+    } while (!feof(input));
     (*buffer)[writecnt] = '\0';
-    if (strcmp("-",file_name) != 0) {fclose(input);};
+    if (strcmp("-", file_name) != 0) {
+        fclose(input);
+    };
     return writecnt;
 }
-
index 9fdd7c1..1778f42 100644 (file)
 
 #include "rrd_tool.h"
 
-int
-rrd_resize(int argc, char **argv)
+int rrd_resize(
+    int argc,
+    char **argv)
 {
-    char               *infilename,outfilename[11]="resize.rrd";
-    rrd_t              rrdold,rrdnew;
-    rrd_value_t                buffer;
-    int                        version;
-    unsigned long      l,rra;
-    long               modify;
-    unsigned long      target_rra;
-    int                        grow=0,shrink=0;
-    char               *endptr;
-    rrd_file_t         *rrd_file, *rrd_out_file;
-
-    infilename=argv[1];
-    if (!strcmp(infilename,"resize.rrd")) {
+    char     *infilename, outfilename[11] = "resize.rrd";
+    rrd_t     rrdold, rrdnew;
+    rrd_value_t buffer;
+    int       version;
+    unsigned long l, rra;
+    long      modify;
+    unsigned long target_rra;
+    int       grow = 0, shrink = 0;
+    char     *endptr;
+    rrd_file_t *rrd_file, *rrd_out_file;
+
+    infilename = argv[1];
+    if (!strcmp(infilename, "resize.rrd")) {
         rrd_set_error("resize.rrd is a reserved name");
-        return(-1);
+        return (-1);
     }
-    if (argc!=5) {
+    if (argc != 5) {
         rrd_set_error("wrong number of parameters");
-        return(-1);
+        return (-1);
     }
 
-    target_rra=strtol(argv[2],&endptr,0);
+    target_rra = strtol(argv[2], &endptr, 0);
 
-    if (!strcmp(argv[3],"GROW")) grow=1;
-    else if (!strcmp(argv[3],"SHRINK")) shrink=1;
+    if (!strcmp(argv[3], "GROW"))
+        grow = 1;
+    else if (!strcmp(argv[3], "SHRINK"))
+        shrink = 1;
     else {
         rrd_set_error("I can only GROW or SHRINK");
-        return(-1);
+        return (-1);
     }
 
-    modify=strtol(argv[4],&endptr,0);
+    modify = strtol(argv[4], &endptr, 0);
 
-    if ((modify<1)) {
+    if ((modify < 1)) {
         rrd_set_error("Please grow or shrink with at least 1 row");
-        return(-1);
+        return (-1);
     }
 
-    if (shrink) modify = -modify;
+    if (shrink)
+        modify = -modify;
 
 
     rrd_file = rrd_open(infilename, &rrdold, RRD_READWRITE);
     if (rrd_file == NULL) {
         rrd_set_error("could not open RRD");
-        return(-1);
+        return (-1);
     }
     if (LockRRD(rrd_file->fd) != 0) {
         rrd_set_error("could not lock original RRD");
         rrd_free(&rrdold);
         close(rrd_file->fd);
-        return(-1);
+        return (-1);
     }
 
     if (target_rra >= rrdold.stat_head->rra_cnt) {
         rrd_set_error("no such RRA in this RRD");
         rrd_free(&rrdold);
         close(rrd_file->fd);
-        return(-1);
+        return (-1);
     }
 
     if (modify < 0)
-       if ((long)rrdold.rra_def[target_rra].row_cnt <= -modify) {
-           rrd_set_error("This RRA is not that big");
-           rrd_free(&rrdold);
-           close(rrd_file->fd);
-           return(-1);
-       }
+        if ((long) rrdold.rra_def[target_rra].row_cnt <= -modify) {
+            rrd_set_error("This RRA is not that big");
+            rrd_free(&rrdold);
+            close(rrd_file->fd);
+            return (-1);
+        }
 
     rrd_out_file = rrd_open(outfilename, &rrdnew, RRD_CREAT);
     if (rrd_out_file == NULL) {
-        rrd_set_error("Can't create '%s': %s",outfilename, rrd_strerror(errno));
-        return(-1);
+        rrd_set_error("Can't create '%s': %s", outfilename,
+                      rrd_strerror(errno));
+        return (-1);
     }
     if (LockRRD(rrd_out_file->fd) != 0) {
         rrd_set_error("could not lock new RRD");
         rrd_free(&rrdold);
         close(rrd_file->fd);
         close(rrd_out_file->fd);
-        return(-1);
+        return (-1);
     }
 /*XXX: do one write for those parts of header that are unchanged */
     rrdnew.stat_head = rrdold.stat_head;
-    rrdnew.ds_def    = rrdold.ds_def;
-    rrdnew.rra_def   = rrdold.rra_def;
+    rrdnew.ds_def = rrdold.ds_def;
+    rrdnew.rra_def = rrdold.rra_def;
     rrdnew.live_head = rrdold.live_head;
-    rrdnew.pdp_prep  = rrdold.pdp_prep;
-    rrdnew.cdp_prep  = rrdold.cdp_prep;
-    rrdnew.rra_ptr   = rrdold.rra_ptr;
+    rrdnew.pdp_prep = rrdold.pdp_prep;
+    rrdnew.cdp_prep = rrdold.cdp_prep;
+    rrdnew.rra_ptr = rrdold.rra_ptr;
 
     version = atoi(rrdold.stat_head->version);
     switch (version) {
-       case 3: break;
-       case 1: rrdold.stat_head->version[3]='3';
-               break;
-       default: {
-               rrd_set_error("Do not know how to handle RRD version %s",rrdold.stat_head->version);
-               rrd_free(&rrdold);      
-               close(rrd_file->fd);
-               return(-1);
-               }
+    case 3:
+        break;
+    case 1:
+        rrdold.stat_head->version[3] = '3';
+        break;
+    default:{
+        rrd_set_error("Do not know how to handle RRD version %s",
+                      rrdold.stat_head->version);
+        rrd_free(&rrdold);
+        close(rrd_file->fd);
+        return (-1);
+    }
     }
 
 
 /* XXX: Error checking? */
-    rrd_write(rrd_out_file,rrdnew.stat_head, sizeof(stat_head_t)*1);
-    rrd_write(rrd_out_file,rrdnew.ds_def,sizeof(ds_def_t)*rrdnew.stat_head->ds_cnt);
-    rrd_write(rrd_out_file,rrdnew.rra_def,sizeof(rra_def_t)*rrdnew.stat_head->rra_cnt);
-    rrd_write(rrd_out_file,rrdnew.live_head,sizeof(live_head_t)*1);
-    rrd_write(rrd_out_file,rrdnew.pdp_prep,sizeof(pdp_prep_t)*rrdnew.stat_head->ds_cnt);
-    rrd_write(rrd_out_file,rrdnew.cdp_prep,sizeof(cdp_prep_t)*rrdnew.stat_head->ds_cnt*rrdnew.stat_head->rra_cnt);
-    rrd_write(rrd_out_file,rrdnew.rra_ptr,sizeof(rra_ptr_t)*rrdnew.stat_head->rra_cnt);
+    rrd_write(rrd_out_file, rrdnew.stat_head, sizeof(stat_head_t) * 1);
+    rrd_write(rrd_out_file, rrdnew.ds_def,
+              sizeof(ds_def_t) * rrdnew.stat_head->ds_cnt);
+    rrd_write(rrd_out_file, rrdnew.rra_def,
+              sizeof(rra_def_t) * rrdnew.stat_head->rra_cnt);
+    rrd_write(rrd_out_file, rrdnew.live_head, sizeof(live_head_t) * 1);
+    rrd_write(rrd_out_file, rrdnew.pdp_prep,
+              sizeof(pdp_prep_t) * rrdnew.stat_head->ds_cnt);
+    rrd_write(rrd_out_file, rrdnew.cdp_prep,
+              sizeof(cdp_prep_t) * rrdnew.stat_head->ds_cnt *
+              rrdnew.stat_head->rra_cnt);
+    rrd_write(rrd_out_file, rrdnew.rra_ptr,
+              sizeof(rra_ptr_t) * rrdnew.stat_head->rra_cnt);
 
     /* Move the CDPs from the old to the new database.
-    ** This can be made (much) faster but isn't worth the effort. Clarity
-    ** is much more important.
-    */
+     ** This can be made (much) faster but isn't worth the effort. Clarity
+     ** is much more important.
+     */
 
     /* Move data in unmodified RRAs
-    */
-    l=0;
-    for (rra=0;rra<target_rra;rra++) {
-        l+=rrdnew.stat_head->ds_cnt * rrdnew.rra_def[rra].row_cnt;
+     */
+    l = 0;
+    for (rra = 0; rra < target_rra; rra++) {
+        l += rrdnew.stat_head->ds_cnt * rrdnew.rra_def[rra].row_cnt;
     }
-    while (l>0) {
-        rrd_read(rrd_file,&buffer,sizeof(rrd_value_t)*1);
-        rrd_write(rrd_out_file,&buffer,sizeof(rrd_value_t)*1);
+    while (l > 0) {
+        rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1);
+        rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
         l--;
     }
     /* Move data in this RRA, either removing or adding some rows
-    */
-    if (modify>0) {
+     */
+    if (modify > 0) {
         /* Adding extra rows; insert unknown values just after the
-        ** current row number.
-        */
-        l = rrdnew.stat_head->ds_cnt * (rrdnew.rra_ptr[target_rra].cur_row+1);
-        while (l>0) {
-            rrd_read(rrd_file,&buffer,sizeof(rrd_value_t)*1);
-            rrd_write(rrd_out_file,&buffer,sizeof(rrd_value_t)*1);
+         ** current row number.
+         */
+        l = rrdnew.stat_head->ds_cnt * (rrdnew.rra_ptr[target_rra].cur_row +
+                                        1);
+        while (l > 0) {
+            rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1);
+            rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
             l--;
         }
-        buffer=DNAN;
-        l=rrdnew.stat_head->ds_cnt * modify;
-        while (l>0) {
-            rrd_write(rrd_out_file,&buffer,sizeof(rrd_value_t)*1);
+        buffer = DNAN;
+        l = rrdnew.stat_head->ds_cnt * modify;
+        while (l > 0) {
+            rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
             l--;
         }
     } else {
         /* Removing rows. Normally this would be just after the cursor
-        ** however this may also mean that we wrap to the beginning of
-        ** the array.
-        */
-        signed long int remove_end=0;
-
-        remove_end=(rrdnew.rra_ptr[target_rra].cur_row-modify)%rrdnew.rra_def[target_rra].row_cnt;
-        if (remove_end <= (signed long int)rrdnew.rra_ptr[target_rra].cur_row) {
+         ** however this may also mean that we wrap to the beginning of
+         ** the array.
+         */
+        signed long int remove_end = 0;
+
+        remove_end =
+            (rrdnew.rra_ptr[target_rra].cur_row -
+             modify) % rrdnew.rra_def[target_rra].row_cnt;
+        if (remove_end <=
+            (signed long int) rrdnew.rra_ptr[target_rra].cur_row) {
             while (remove_end >= 0) {
-                rrd_seek(rrd_file,sizeof(rrd_value_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
+                rrd_seek(rrd_file,
+                         sizeof(rrd_value_t) * rrdnew.stat_head->ds_cnt,
+                         SEEK_CUR);
                 rrdnew.rra_ptr[target_rra].cur_row--;
                 rrdnew.rra_def[target_rra].row_cnt--;
                 remove_end--;
                 modify++;
             }
-            remove_end=rrdnew.rra_def[target_rra].row_cnt-1;
+            remove_end = rrdnew.rra_def[target_rra].row_cnt - 1;
         }
-        for (l=0;l<=rrdnew.rra_ptr[target_rra].cur_row;l++) {
+        for (l = 0; l <= rrdnew.rra_ptr[target_rra].cur_row; l++) {
             unsigned int tmp;
-            for (tmp=0;tmp<rrdnew.stat_head->ds_cnt;tmp++) {
-                rrd_read(rrd_file,&buffer,sizeof(rrd_value_t)*1);
-                rrd_write(rrd_out_file,&buffer,sizeof(rrd_value_t)*1);
+
+            for (tmp = 0; tmp < rrdnew.stat_head->ds_cnt; tmp++) {
+                rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1);
+                rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
             }
         }
-        while (modify<0) {
-            rrd_seek(rrd_file,sizeof(rrd_value_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
+        while (modify < 0) {
+            rrd_seek(rrd_file, sizeof(rrd_value_t) * rrdnew.stat_head->ds_cnt,
+                     SEEK_CUR);
             rrdnew.rra_def[target_rra].row_cnt--;
             modify++;
         }
     }
     /* Move the rest of the CDPs
-    */
+     */
     while (1) {
-       if (rrd_read(rrd_file,&buffer,sizeof(rrd_value_t)*1) <= 0)
-           break;
-        rrd_write(rrd_out_file,&buffer,sizeof(rrd_value_t)*1);
+        if (rrd_read(rrd_file, &buffer, sizeof(rrd_value_t) * 1) <= 0)
+            break;
+        rrd_write(rrd_out_file, &buffer, sizeof(rrd_value_t) * 1);
     }
     rrdnew.rra_def[target_rra].row_cnt += modify;
-    rrd_seek(rrd_out_file,sizeof(stat_head_t)+sizeof(ds_def_t)*rrdnew.stat_head->ds_cnt,SEEK_SET);
-    rrd_write(rrd_out_file,rrdnew.rra_def,sizeof(rra_def_t)*rrdnew.stat_head->rra_cnt);
-    rrd_seek(rrd_out_file,sizeof(live_head_t),SEEK_CUR);
-    rrd_seek(rrd_out_file,sizeof(pdp_prep_t)*rrdnew.stat_head->ds_cnt,SEEK_CUR);
-    rrd_seek(rrd_out_file,sizeof(cdp_prep_t)*rrdnew.stat_head->ds_cnt*rrdnew.stat_head->rra_cnt,SEEK_CUR);
-    rrd_write(rrd_out_file,rrdnew.rra_ptr,sizeof(rra_ptr_t)*rrdnew.stat_head->rra_cnt);
+    rrd_seek(rrd_out_file,
+             sizeof(stat_head_t) +
+             sizeof(ds_def_t) * rrdnew.stat_head->ds_cnt, SEEK_SET);
+    rrd_write(rrd_out_file, rrdnew.rra_def,
+              sizeof(rra_def_t) * rrdnew.stat_head->rra_cnt);
+    rrd_seek(rrd_out_file, sizeof(live_head_t), SEEK_CUR);
+    rrd_seek(rrd_out_file, sizeof(pdp_prep_t) * rrdnew.stat_head->ds_cnt,
+             SEEK_CUR);
+    rrd_seek(rrd_out_file,
+             sizeof(cdp_prep_t) * rrdnew.stat_head->ds_cnt *
+             rrdnew.stat_head->rra_cnt, SEEK_CUR);
+    rrd_write(rrd_out_file, rrdnew.rra_ptr,
+              sizeof(rra_ptr_t) * rrdnew.stat_head->rra_cnt);
 
     close(rrd_out_file->fd);
     rrd_free(&rrdold);
     close(rrd_file->fd);
-    return(0);
+    return (0);
 }
index b283f91..368f7bc 100644 (file)
 
 /* Prototypes */
 
-void xml_lc(char*);
-int skip(char **);
-int skipxml(char **);
-int eat_tag(char **, char *);
-int read_tag(char **, char *, char *, void *);
-int xml2rrd(char*, rrd_t*, char);
-int rrd_creat(char *, rrd_t *, char);
-void parse_patch1028_RRA_params(char **buf, rrd_t *rrd, int rra_index);
-void parse_patch1028_CDP_params(char **buf, rrd_t *rrd, int rra_index, int ds_index);
-void parse_FAILURES_history(char **buf, rrd_t *rrd, int rra_index, int ds_index);
+void      xml_lc(
+    char *);
+int       skip(
+    char **);
+int       skipxml(
+    char **);
+int       eat_tag(
+    char **,
+    char *);
+int       read_tag(
+    char **,
+    char *,
+    char *,
+    void *);
+int       xml2rrd(
+    char *,
+    rrd_t *,
+    char);
+int       rrd_creat(
+    char *,
+    rrd_t *,
+    char);
+void      parse_patch1028_RRA_params(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index);
+void      parse_patch1028_CDP_params(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index,
+    int ds_index);
+void      parse_FAILURES_history(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index,
+    int ds_index);
 
 /* convert all occurrences of <BlaBlaBla> to <blablabla> */
 
-void xml_lc(char* buf){
-  int intag=0;
-  while((*buf)){
-    if (intag ==0 && (*buf) == '<') {
-      intag = 1;
-    }
-    else if (intag ==1 && (*buf) == '>') {
-      intag = 0;
-      continue;
-    } else  if (intag ==1) {
-      *buf = tolower(*buf);
+void xml_lc(
+    char *buf)
+{
+    int       intag = 0;
+
+    while ((*buf)) {
+        if (intag == 0 && (*buf) == '<') {
+            intag = 1;
+        } else if (intag == 1 && (*buf) == '>') {
+            intag = 0;
+            continue;
+        } else if (intag == 1) {
+            *buf = tolower(*buf);
+        }
+        buf++;
     }
-    buf++;    
-  }
 }
 
-int skipxml(char **buf){
-  char *ptr;  
-  ptr=(*buf);
-  do {
-    (*buf)=ptr;
-    while((*(ptr+1)) && ((*ptr)==' ' ||  (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++;
-    if (strncmp(ptr,"<?xml",4) == 0) {
-      ptr= strstr(ptr,"?>");
-      if (ptr) ptr+=2; else {
-       rrd_set_error("Dangling XML header");
-       (*buf) = NULL;
-       return -1;
-      }
-    }
-  } while ((*buf)!=ptr);  
-  return 1;
+int skipxml(
+    char **buf)
+{
+    char     *ptr;
+
+    ptr = (*buf);
+    do {
+        (*buf) = ptr;
+        while ((*(ptr + 1))
+               && ((*ptr) == ' ' || (*ptr) == '\r' || (*ptr) == '\n'
+                   || (*ptr) == '\t'))
+            ptr++;
+        if (strncmp(ptr, "<?xml", 4) == 0) {
+            ptr = strstr(ptr, "?>");
+            if (ptr)
+                ptr += 2;
+            else {
+                rrd_set_error("Dangling XML header");
+                (*buf) = NULL;
+                return -1;
+            }
+        }
+    } while ((*buf) != ptr);
+    return 1;
 }
 
-int skip(char **buf){
-  char *ptr;
-  if ((buf == NULL) || (*buf == NULL))
-    return -1;  
-  ptr=(*buf);
-  do {
-    (*buf)=ptr;
-    while((*(ptr+1)) && ((*ptr)==' ' ||  (*ptr)=='\r' || (*ptr)=='\n' || (*ptr)=='\t')) ptr++;
-    if (strncmp(ptr,"<!--",4) == 0) {
-      ptr= strstr(ptr,"-->");
-      if (ptr) ptr+=3; else {
-       rrd_set_error("Dangling Comment");
-       (*buf) = NULL;
-       return -1;
-      }
-    }
-  } while ((*buf)!=ptr);  
-  return 1;
+int skip(
+    char **buf)
+{
+    char     *ptr;
+
+    if ((buf == NULL) || (*buf == NULL))
+        return -1;
+    ptr = (*buf);
+    do {
+        (*buf) = ptr;
+        while ((*(ptr + 1))
+               && ((*ptr) == ' ' || (*ptr) == '\r' || (*ptr) == '\n'
+                   || (*ptr) == '\t'))
+            ptr++;
+        if (strncmp(ptr, "<!--", 4) == 0) {
+            ptr = strstr(ptr, "-->");
+            if (ptr)
+                ptr += 3;
+            else {
+                rrd_set_error("Dangling Comment");
+                (*buf) = NULL;
+                return -1;
+            }
+        }
+    } while ((*buf) != ptr);
+    return 1;
 }
 
-int eat_tag(char **buf, char *tag){ 
-  if ((*buf)==NULL) return -1;   /* fall though clause */
-
-  rrd_clear_error();
-  skip(buf);
-  if ((**buf)=='<' 
-      && strncmp((*buf)+1,tag,strlen(tag)) == 0 
-      && *((*buf)+strlen(tag)+1)=='>') {
-    (*buf) += strlen(tag)+2;
-  }
-  else {
-    rrd_set_error("No <%s> tag found",tag);
-    (*buf) = NULL;
-    return -1;
-  }
-  skip(buf);
-  return 1;
+int eat_tag(
+    char **buf,
+    char *tag)
+{
+    if ((*buf) == NULL)
+        return -1;      /* fall though clause */
+
+    rrd_clear_error();
+    skip(buf);
+    if ((**buf) == '<'
+        && strncmp((*buf) + 1, tag, strlen(tag)) == 0
+        && *((*buf) + strlen(tag) + 1) == '>') {
+        (*buf) += strlen(tag) + 2;
+    } else {
+        rrd_set_error("No <%s> tag found", tag);
+        (*buf) = NULL;
+        return -1;
+    }
+    skip(buf);
+    return 1;
 }
 
-int read_tag(char **buf, char *tag, char *format, void *value){
-    char *end_tag;
-    int matches;
-    if ((*buf)==NULL) return -1;   /* fall though clause */
+int read_tag(
+    char **buf,
+    char *tag,
+    char *format,
+    void *value)
+{
+    char     *end_tag;
+    int       matches;
+
+    if ((*buf) == NULL)
+        return -1;      /* fall though clause */
     rrd_clear_error();
-    if (eat_tag(buf,tag)==1){
-       char *temp;
-       temp = (*buf);
-       while(*((*buf)+1) && (*(*buf) != '<')) (*buf)++; /*find start of endtag*/
-       *(*buf) = '\0';
-       matches =sscanf(temp,format,value);
-       *(*buf) = '<';
-       end_tag = malloc((strlen(tag)+2)*sizeof(char));
-       sprintf(end_tag,"/%s",tag);
-       eat_tag(buf,end_tag);
-       free(end_tag);
-       if (matches == 0 && strcmp(format,"%lf") == 0)
-           (*((double* )(value))) = DNAN;
-       if (matches != 1)       return 0;       
-       return 1;
+    if (eat_tag(buf, tag) == 1) {
+        char     *temp;
+
+        temp = (*buf);
+        while (*((*buf) + 1) && (*(*buf) != '<'))
+            (*buf)++;   /*find start of endtag */
+        *(*buf) = '\0';
+        matches = sscanf(temp, format, value);
+        *(*buf) = '<';
+        end_tag = malloc((strlen(tag) + 2) * sizeof(char));
+        sprintf(end_tag, "/%s", tag);
+        eat_tag(buf, end_tag);
+        free(end_tag);
+        if (matches == 0 && strcmp(format, "%lf") == 0)
+            (*((double *) (value))) = DNAN;
+        if (matches != 1)
+            return 0;
+        return 1;
     }
     return -1;
 }
 
 
 /* parse the data stored in buf and return a filled rrd structure */
-int xml2rrd(char* buf, rrd_t* rrd, char rc){
-  /* pass 1 identify number of RRAs  */
-  char *ptr,*ptr2,*ptr3; /* walks thought the buffer */
-  long rows=0,mempool=0,i=0;
-  int rra_index;
-  int input_version;
-  xml_lc(buf); /* lets lowercase all active parts of the xml */
-  ptr=buf;
-  ptr2=buf;
-  ptr3=buf;
-  /* start with an RRD tag */
-  
-  skipxml(&ptr);
-
-  eat_tag(&ptr,"rrd");
-  /* allocate static header */
-  if((rrd->stat_head = calloc(1,sizeof(stat_head_t)))==NULL){
-    rrd_set_error("allocating rrd.stat_head");
-    return -1;    
-  };
-
-  strcpy(rrd->stat_head->cookie,RRD_COOKIE);
-  read_tag(&ptr,"version","%4[0-9]",rrd->stat_head->version);
-  input_version = atoi(rrd->stat_head->version);
-  /* added primitive version checking */
-  if (input_version > atoi(RRD_VERSION) || input_version < 1)
-  {
-    rrd_set_error("Incompatible file version, detected version %s. This is not supported by the version %s restore tool.\n",
-                 rrd -> stat_head -> version, RRD_VERSION );
-    free(rrd -> stat_head); 
-    rrd->stat_head = NULL; 
-    return -1;
-  }
-  /* make sure we output the right version */
-  strcpy(rrd->stat_head->version,RRD_VERSION);
+int xml2rrd(
+    char *buf,
+    rrd_t *rrd,
+    char rc)
+{
+    /* pass 1 identify number of RRAs  */
+    char     *ptr, *ptr2, *ptr3;    /* walks thought the buffer */
+    long      rows = 0, mempool = 0, i = 0;
+    int       rra_index;
+    int       input_version;
+
+    xml_lc(buf);        /* lets lowercase all active parts of the xml */
+    ptr = buf;
+    ptr2 = buf;
+    ptr3 = buf;
+    /* start with an RRD tag */
+
+    skipxml(&ptr);
+
+    eat_tag(&ptr, "rrd");
+    /* allocate static header */
+    if ((rrd->stat_head = calloc(1, sizeof(stat_head_t))) == NULL) {
+        rrd_set_error("allocating rrd.stat_head");
+        return -1;
+    };
 
-  /*  if (atoi(rrd -> stat_head -> version) < 2) 
-  {
-    rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.",  rrd -> stat_head -> version );
-    return -1;
-  } */
-
-  rrd->stat_head->float_cookie = FLOAT_COOKIE;
-  rrd->stat_head->ds_cnt = 0;
-  rrd->stat_head->rra_cnt = 0;
-  read_tag(&ptr,"step","%lu",&(rrd->stat_head->pdp_step));
-
-  /* allocate live head */
-  if((rrd->live_head = calloc(1,sizeof(live_head_t)))==NULL){
-    rrd_set_error("allocating rrd.live_head");
-    return -1;    
-  }
-  read_tag(&ptr,"lastupdate","%lu",&(rrd->live_head->last_up));
-
-  /* Data Source Definition Part */
-  ptr2 = ptr;
-  while (eat_tag(&ptr2,"ds") == 1){
-      rrd->stat_head->ds_cnt++;
-      if((rrd->ds_def = rrd_realloc(rrd->ds_def,rrd->stat_head->ds_cnt*sizeof(ds_def_t)))==NULL){
-         rrd_set_error("allocating rrd.ds_def");
-         return -1;
-      };
-      /* clean out memory to make sure no data gets stored from previous tasks */
-      memset(&(rrd->ds_def[rrd->stat_head->ds_cnt-1]), 0, sizeof(ds_def_t));
-      if((rrd->pdp_prep = rrd_realloc(rrd->pdp_prep,rrd->stat_head->ds_cnt
-                                 *sizeof(pdp_prep_t)))==NULL){
-       rrd_set_error("allocating pdp_prep");
-       return(-1);
-      }
-      /* clean out memory to make sure no data gets stored from previous tasks */
-      memset(&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1]), 0, sizeof(pdp_prep_t));
-
-      read_tag(&ptr2,"name",DS_NAM_FMT,rrd->ds_def[rrd->stat_head->ds_cnt-1].ds_nam);
-
-      read_tag(&ptr2,"type",DST_FMT,rrd->ds_def[rrd->stat_head->ds_cnt-1].dst);
-      /* test for valid type */
-      if( (int)dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) == -1) return -1;      
-
-         if (dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt-1].dst) != DST_CDEF)
-         {
-      read_tag(&ptr2,"minimal_heartbeat","%lu",
-              &(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_mrhb_cnt].u_cnt));
-      read_tag(&ptr2,"min","%lf",&(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_min_val].u_val));
-      read_tag(&ptr2,"max","%lf",&(rrd->ds_def[rrd->stat_head->ds_cnt-1].par[DS_max_val].u_val));
-         } else { /* DST_CDEF */
-                char buffer[1024];
-                read_tag(&ptr2,"cdef","%1000s",buffer);
-                parseCDEF_DS(buffer,rrd,rrd -> stat_head -> ds_cnt - 1);
-                if (rrd_test_error()) return -1;
-         }
-
-      read_tag(&ptr2,"last_ds","%30s",rrd->pdp_prep[rrd->stat_head->ds_cnt-1].last_ds);
-      read_tag(&ptr2,"value","%lf",&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1].scratch[PDP_val].u_val));
-      read_tag(&ptr2,"unknown_sec","%lu",&(rrd->pdp_prep[rrd->stat_head->ds_cnt-1].scratch[PDP_unkn_sec_cnt].u_cnt));      
-      eat_tag(&ptr2,"/ds");
-      ptr=ptr2;
-  }
-  
-  ptr2 = ptr;
-  while (eat_tag(&ptr2,"rra") == 1){
-      rrd->stat_head->rra_cnt++;
-
-      /* allocate and reset rra definition areas */
-      if((rrd->rra_def = rrd_realloc(rrd->rra_def,rrd->stat_head->rra_cnt*sizeof(rra_def_t)))==NULL){
-         rrd_set_error("allocating rra_def"); return -1; }      
-      memset(&(rrd->rra_def[rrd->stat_head->rra_cnt-1]), 0, sizeof(rra_def_t));
-
-      /* allocate and reset consolidation point areas */
-      if((rrd->cdp_prep = rrd_realloc(rrd->cdp_prep,
-                                 rrd->stat_head->rra_cnt
-                                 *rrd->stat_head->ds_cnt*sizeof(cdp_prep_t)))==NULL){
-         rrd_set_error("allocating cdp_prep"); return -1; }
-
-      memset(&(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rrd->stat_head->rra_cnt-1)]), 
-            0, rrd->stat_head->ds_cnt*sizeof(cdp_prep_t));
-
-      
-      read_tag(&ptr2,"cf",CF_NAM_FMT,rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam);
-      /* test for valid type */
-      if( (int)cf_conv(rrd->rra_def[rrd->stat_head->rra_cnt-1].cf_nam) == -1) return -1;
-
-      read_tag(&ptr2,"pdp_per_row","%lu",&(rrd->rra_def[rrd->stat_head->rra_cnt-1].pdp_cnt));
-      /* support to read RRA parameters */
-      rra_index = rrd->stat_head->rra_cnt - 1;
-      if ( input_version < 2 ){
-         read_tag(&ptr2, "xff","%lf",
-            &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val));
-      } else {
-        if (eat_tag(&ptr2, "params") != 1) {
-         rrd_set_error("could not find params tag to eat and skip");
-          return -1;
+    strcpy(rrd->stat_head->cookie, RRD_COOKIE);
+    read_tag(&ptr, "version", "%4[0-9]", rrd->stat_head->version);
+    input_version = atoi(rrd->stat_head->version);
+    /* added primitive version checking */
+    if (input_version > atoi(RRD_VERSION) || input_version < 1) {
+        rrd_set_error
+            ("Incompatible file version, detected version %s. This is not supported by the version %s restore tool.\n",
+             rrd->stat_head->version, RRD_VERSION);
+        free(rrd->stat_head);
+        rrd->stat_head = NULL;
+        return -1;
+    }
+    /* make sure we output the right version */
+    strcpy(rrd->stat_head->version, RRD_VERSION);
+
+    /*  if (atoi(rrd -> stat_head -> version) < 2) 
+       {
+       rrd_set_error("Can only restore version >= 2 (Not %s). Dump your old rrd using a current rrdtool dump.",  rrd -> stat_head -> version );
+       return -1;
+       } */
+
+    rrd->stat_head->float_cookie = FLOAT_COOKIE;
+    rrd->stat_head->ds_cnt = 0;
+    rrd->stat_head->rra_cnt = 0;
+    read_tag(&ptr, "step", "%lu", &(rrd->stat_head->pdp_step));
+
+    /* allocate live head */
+    if ((rrd->live_head = calloc(1, sizeof(live_head_t))) == NULL) {
+        rrd_set_error("allocating rrd.live_head");
+        return -1;
+    }
+    read_tag(&ptr, "lastupdate", "%lu", &(rrd->live_head->last_up));
+
+    /* Data Source Definition Part */
+    ptr2 = ptr;
+    while (eat_tag(&ptr2, "ds") == 1) {
+        rrd->stat_head->ds_cnt++;
+        if ((rrd->ds_def =
+             rrd_realloc(rrd->ds_def,
+                         rrd->stat_head->ds_cnt * sizeof(ds_def_t))) ==
+            NULL) {
+            rrd_set_error("allocating rrd.ds_def");
+            return -1;
+        };
+        /* clean out memory to make sure no data gets stored from previous tasks */
+        memset(&(rrd->ds_def[rrd->stat_head->ds_cnt - 1]), 0,
+               sizeof(ds_def_t));
+        if ((rrd->pdp_prep =
+             rrd_realloc(rrd->pdp_prep,
+                         rrd->stat_head->ds_cnt * sizeof(pdp_prep_t))) ==
+            NULL) {
+            rrd_set_error("allocating pdp_prep");
+            return (-1);
         }
-        skip(&ptr2);
-        /* backwards compatibility w/ old patch */
-      if (strncmp(ptr2, "<value>",7) == 0) {
-          parse_patch1028_RRA_params(&ptr2,rrd,rra_index); 
-      } else {
-      switch(cf_conv(rrd -> rra_def[rra_index].cf_nam)) {
-      case CF_HWPREDICT:
-         read_tag(&ptr2, "hw_alpha", "%lf", 
-            &(rrd->rra_def[rra_index].par[RRA_hw_alpha].u_val));
-         read_tag(&ptr2, "hw_beta", "%lf", 
-            &(rrd->rra_def[rra_index].par[RRA_hw_beta].u_val));
-         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
-         break;
-      case CF_SEASONAL:
-      case CF_DEVSEASONAL:
-         read_tag(&ptr2, "seasonal_gamma", "%lf", 
-            &(rrd->rra_def[rra_index].par[RRA_seasonal_gamma].u_val));
-         read_tag(&ptr2, "seasonal_smooth_idx", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_seasonal_smooth_idx].u_cnt));
-         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
-         break;
-      case CF_FAILURES:
-         read_tag(&ptr2, "delta_pos", "%lf", 
-            &(rrd->rra_def[rra_index].par[RRA_delta_pos].u_val));
-         read_tag(&ptr2, "delta_neg", "%lf", 
-            &(rrd->rra_def[rra_index].par[RRA_delta_neg].u_val));
-         read_tag(&ptr2, "window_len", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_window_len].u_cnt));
-         read_tag(&ptr2, "failure_threshold", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_failure_threshold].u_cnt));
-         /* fall thru */
-      case CF_DEVPREDICT:
-         read_tag(&ptr2, "dependent_rra_idx", "%lu", 
-            &(rrd->rra_def[rra_index].par[RRA_dependent_rra_idx].u_cnt));
-         break;
-      case CF_AVERAGE:
-      case CF_MAXIMUM:
-      case CF_MINIMUM:
-      case CF_LAST:
-      default:
-         read_tag(&ptr2, "xff","%lf",
-            &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val));
-      }
-      }
-      eat_tag(&ptr2, "/params");
-   }
-
-
-      eat_tag(&ptr2,"cdp_prep");
-      for(i=0;i< (int)rrd->stat_head->ds_cnt;i++)
-      {
-      eat_tag(&ptr2,"ds");
-      /* support to read CDP parameters */
-      rra_index = rrd->stat_head->rra_cnt-1; 
-      skip(&ptr2);
-      if ( input_version < 2 ){
-          rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)+i].scratch[CDP_primary_val].u_val = 0.0;
-          rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)+i].scratch[CDP_secondary_val].u_val = 0.0;
-          read_tag(&ptr2,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
-               *(rra_index) +i].scratch[CDP_val].u_val));
-          read_tag(&ptr2,"unknown_datapoints","%lu",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
-              *(rra_index) +i].scratch[CDP_unkn_pdp_cnt].u_cnt));
-      } else {
-
-      if (strncmp(ptr2, "<value>",7) == 0) {
-         parse_patch1028_CDP_params(&ptr2,rrd,rra_index,i);
-      } else {
-         read_tag(&ptr2, "primary_value","%lf",
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_primary_val].u_val));
-         read_tag(&ptr2, "secondary_value","%lf",
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_secondary_val].u_val));
-         switch(cf_conv(rrd->rra_def[rra_index].cf_nam)) {
-         case CF_HWPREDICT:
-            read_tag(&ptr2,"intercept","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_intercept].u_val));
-            read_tag(&ptr2,"last_intercept","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_last_intercept].u_val));
-            read_tag(&ptr2,"slope","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_slope].u_val));
-            read_tag(&ptr2,"last_slope","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_last_slope].u_val));
-            read_tag(&ptr2,"nan_count","%lu", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_null_count].u_cnt));
-            read_tag(&ptr2,"last_nan_count","%lu", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_last_null_count].u_cnt));
-            break;
-         case CF_SEASONAL:
-         case CF_DEVSEASONAL:
-            read_tag(&ptr2,"seasonal","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_seasonal].u_val));
-            read_tag(&ptr2,"last_seasonal","%lf", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_hw_last_seasonal].u_val));
-            read_tag(&ptr2,"init_flag","%lu", 
-               &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-               +i].scratch[CDP_init_seasonal].u_cnt));
-            break;
-         case CF_DEVPREDICT:
-            break;
-         case CF_FAILURES:
-            parse_FAILURES_history(&ptr2,rrd,rra_index,i); 
-            break;
-         case CF_AVERAGE:
-         case CF_MAXIMUM:
-         case CF_MINIMUM:
-         case CF_LAST:
-         default:
-            read_tag(&ptr2,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
-               *(rra_index) +i].scratch[CDP_val].u_val));
-            read_tag(&ptr2,"unknown_datapoints","%lu",&(rrd->cdp_prep[rrd->stat_head->ds_cnt
-               *(rra_index) +i].scratch[CDP_unkn_pdp_cnt].u_cnt));
-            break;
-        }
-      }
-      }
-      eat_tag(&ptr2,"/ds");
-      }
-      eat_tag(&ptr2,"/cdp_prep");
-      rrd->rra_def[rrd->stat_head->rra_cnt-1].row_cnt=0;
-      eat_tag(&ptr2,"database");
-      ptr3 = ptr2;      
-      while (eat_tag(&ptr3,"row") == 1){
-       
-         if(mempool==0){
-           mempool = 1000;
-           if((rrd->rrd_value = rrd_realloc(rrd->rrd_value,
-                                        (rows+mempool)*(rrd->stat_head->ds_cnt)
-                                        *sizeof(rrd_value_t)))==NULL) {
-             rrd_set_error("allocating rrd_values"); return -1; }
-         }
-         rows++;
-         mempool--;
-         rrd->rra_def[rrd->stat_head->rra_cnt-1].row_cnt++;
-         for(i=0;i< (int)rrd->stat_head->ds_cnt;i++){
-
-                 rrd_value_t  * value = &(rrd->rrd_value[(rows-1)*rrd->stat_head->ds_cnt+i]);
-
-                 read_tag(&ptr3,"v","%lf", value);
-                 
-                 if (
-                         (rc == 1)                     /* do we have to check for the ranges */
-                         &&
-                     (!isnan(*value))  /* not a NAN value */
-                     &&
-                         (dst_conv(rrd->ds_def[i].dst) != DST_CDEF)
-                         &&
-                     (                                 /* min defined and in the range ? */
-                         (!isnan(rrd->ds_def[i].par[DS_min_val].u_val) 
-                               && (*value < rrd->ds_def[i].par[DS_min_val].u_val)) 
-                         ||                            /* max defined and in the range ? */
-                         (!isnan(rrd->ds_def[i].par[DS_max_val].u_val) 
-                               && (*value > rrd->ds_def[i].par[DS_max_val].u_val))
-                     )
-                 ) {
-                     fprintf (stderr, "out of range found [ds: %lu], [value : %0.10e]\n", i, *value);
-                     *value = DNAN;
-                 }
-         }
-         eat_tag(&ptr3,"/row");                  
-         ptr2=ptr3;
-      }
-      eat_tag(&ptr2,"/database");
-      eat_tag(&ptr2,"/rra");                  
-      ptr=ptr2;
-  }  
-  eat_tag(&ptr,"/rrd");
-
-  if((rrd->rra_ptr = calloc(1,sizeof(rra_ptr_t)*rrd->stat_head->rra_cnt)) == NULL) {
-      rrd_set_error("allocating rra_ptr");
-      return(-1);
-  }
-
-  for(i=0; i < (int)rrd->stat_head->rra_cnt; i++) {
-         /* last row in the xml file is the most recent; as
-          * rrd_update increments the current row pointer, set cur_row
-          * here to the last row. */
-      rrd->rra_ptr[i].cur_row = rrd->rra_def[i].row_cnt-1;
-  }
-  if (ptr==NULL)
-      return -1;
-  return 1;
+        /* clean out memory to make sure no data gets stored from previous tasks */
+        memset(&(rrd->pdp_prep[rrd->stat_head->ds_cnt - 1]), 0,
+               sizeof(pdp_prep_t));
+
+        read_tag(&ptr2, "name", DS_NAM_FMT,
+                 rrd->ds_def[rrd->stat_head->ds_cnt - 1].ds_nam);
+
+        read_tag(&ptr2, "type", DST_FMT,
+                 rrd->ds_def[rrd->stat_head->ds_cnt - 1].dst);
+        /* test for valid type */
+        if ((int) dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt - 1].dst) == -1)
+            return -1;
+
+        if (dst_conv(rrd->ds_def[rrd->stat_head->ds_cnt - 1].dst) != DST_CDEF) {
+            read_tag(&ptr2, "minimal_heartbeat", "%lu",
+                     &(rrd->ds_def[rrd->stat_head->ds_cnt - 1].
+                       par[DS_mrhb_cnt].u_cnt));
+            read_tag(&ptr2, "min", "%lf",
+                     &(rrd->ds_def[rrd->stat_head->ds_cnt - 1].
+                       par[DS_min_val].u_val));
+            read_tag(&ptr2, "max", "%lf",
+                     &(rrd->ds_def[rrd->stat_head->ds_cnt - 1].
+                       par[DS_max_val].u_val));
+        } else {        /* DST_CDEF */
+            char      buffer[1024];
+
+            read_tag(&ptr2, "cdef", "%1000s", buffer);
+            parseCDEF_DS(buffer, rrd, rrd->stat_head->ds_cnt - 1);
+            if (rrd_test_error())
+                return -1;
+        }
+
+        read_tag(&ptr2, "last_ds", "%30s",
+                 rrd->pdp_prep[rrd->stat_head->ds_cnt - 1].last_ds);
+        read_tag(&ptr2, "value", "%lf",
+                 &(rrd->pdp_prep[rrd->stat_head->ds_cnt - 1].scratch[PDP_val].
+                   u_val));
+        read_tag(&ptr2, "unknown_sec", "%lu",
+                 &(rrd->pdp_prep[rrd->stat_head->ds_cnt - 1].
+                   scratch[PDP_unkn_sec_cnt].u_cnt));
+        eat_tag(&ptr2, "/ds");
+        ptr = ptr2;
+    }
+
+    ptr2 = ptr;
+    while (eat_tag(&ptr2, "rra") == 1) {
+        rrd->stat_head->rra_cnt++;
+
+        /* allocate and reset rra definition areas */
+        if ((rrd->rra_def =
+             rrd_realloc(rrd->rra_def,
+                         rrd->stat_head->rra_cnt * sizeof(rra_def_t))) ==
+            NULL) {
+            rrd_set_error("allocating rra_def");
+            return -1;
+        }
+        memset(&(rrd->rra_def[rrd->stat_head->rra_cnt - 1]), 0,
+               sizeof(rra_def_t));
+
+        /* allocate and reset consolidation point areas */
+        if ((rrd->cdp_prep = rrd_realloc(rrd->cdp_prep,
+                                         rrd->stat_head->rra_cnt
+                                         * rrd->stat_head->ds_cnt *
+                                         sizeof(cdp_prep_t))) == NULL) {
+            rrd_set_error("allocating cdp_prep");
+            return -1;
+        }
+
+        memset(&
+               (rrd->
+                cdp_prep[rrd->stat_head->ds_cnt *
+                         (rrd->stat_head->rra_cnt - 1)]), 0,
+               rrd->stat_head->ds_cnt * sizeof(cdp_prep_t));
+
+
+        read_tag(&ptr2, "cf", CF_NAM_FMT,
+                 rrd->rra_def[rrd->stat_head->rra_cnt - 1].cf_nam);
+        /* test for valid type */
+        if ((int) cf_conv(rrd->rra_def[rrd->stat_head->rra_cnt - 1].cf_nam) ==
+            -1)
+            return -1;
+
+        read_tag(&ptr2, "pdp_per_row", "%lu",
+                 &(rrd->rra_def[rrd->stat_head->rra_cnt - 1].pdp_cnt));
+        /* support to read RRA parameters */
+        rra_index = rrd->stat_head->rra_cnt - 1;
+        if (input_version < 2) {
+            read_tag(&ptr2, "xff", "%lf",
+                     &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].u_val));
+        } else {
+            if (eat_tag(&ptr2, "params") != 1) {
+                rrd_set_error("could not find params tag to eat and skip");
+                return -1;
+            }
+            skip(&ptr2);
+            /* backwards compatibility w/ old patch */
+            if (strncmp(ptr2, "<value>", 7) == 0) {
+                parse_patch1028_RRA_params(&ptr2, rrd, rra_index);
+            } else {
+                switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
+                case CF_HWPREDICT:
+                    read_tag(&ptr2, "hw_alpha", "%lf",
+                             &(rrd->rra_def[rra_index].par[RRA_hw_alpha].
+                               u_val));
+                    read_tag(&ptr2, "hw_beta", "%lf",
+                             &(rrd->rra_def[rra_index].par[RRA_hw_beta].
+                               u_val));
+                    read_tag(&ptr2, "dependent_rra_idx", "%lu",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_dependent_rra_idx].u_cnt));
+                    break;
+                case CF_SEASONAL:
+                case CF_DEVSEASONAL:
+                    read_tag(&ptr2, "seasonal_gamma", "%lf",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_seasonal_gamma].u_val));
+                    read_tag(&ptr2, "seasonal_smooth_idx", "%lu",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_seasonal_smooth_idx].u_cnt));
+                    read_tag(&ptr2, "dependent_rra_idx", "%lu",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_dependent_rra_idx].u_cnt));
+                    break;
+                case CF_FAILURES:
+                    read_tag(&ptr2, "delta_pos", "%lf",
+                             &(rrd->rra_def[rra_index].par[RRA_delta_pos].
+                               u_val));
+                    read_tag(&ptr2, "delta_neg", "%lf",
+                             &(rrd->rra_def[rra_index].par[RRA_delta_neg].
+                               u_val));
+                    read_tag(&ptr2, "window_len", "%lu",
+                             &(rrd->rra_def[rra_index].par[RRA_window_len].
+                               u_cnt));
+                    read_tag(&ptr2, "failure_threshold", "%lu",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_failure_threshold].u_cnt));
+                    /* fall thru */
+                case CF_DEVPREDICT:
+                    read_tag(&ptr2, "dependent_rra_idx", "%lu",
+                             &(rrd->rra_def[rra_index].
+                               par[RRA_dependent_rra_idx].u_cnt));
+                    break;
+                case CF_AVERAGE:
+                case CF_MAXIMUM:
+                case CF_MINIMUM:
+                case CF_LAST:
+                default:
+                    read_tag(&ptr2, "xff", "%lf",
+                             &(rrd->rra_def[rra_index].par[RRA_cdp_xff_val].
+                               u_val));
+                }
+            }
+            eat_tag(&ptr2, "/params");
+        }
+
+
+        eat_tag(&ptr2, "cdp_prep");
+        for (i = 0; i < (int) rrd->stat_head->ds_cnt; i++) {
+            eat_tag(&ptr2, "ds");
+            /* support to read CDP parameters */
+            rra_index = rrd->stat_head->rra_cnt - 1;
+            skip(&ptr2);
+            if (input_version < 2) {
+                rrd->cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                              i].scratch[CDP_primary_val].u_val = 0.0;
+                rrd->cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                              i].scratch[CDP_secondary_val].u_val = 0.0;
+                read_tag(&ptr2, "value", "%lf",
+                         &(rrd->
+                           cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                                    i].scratch[CDP_val].u_val));
+                read_tag(&ptr2, "unknown_datapoints", "%lu",
+                         &(rrd->
+                           cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                                    i].scratch[CDP_unkn_pdp_cnt].u_cnt));
+            } else {
+
+                if (strncmp(ptr2, "<value>", 7) == 0) {
+                    parse_patch1028_CDP_params(&ptr2, rrd, rra_index, i);
+                } else {
+                    read_tag(&ptr2, "primary_value", "%lf",
+                             &(rrd->
+                               cdp_prep[rrd->stat_head->ds_cnt * (rra_index)
+                                        + i].scratch[CDP_primary_val].u_val));
+                    read_tag(&ptr2, "secondary_value", "%lf",
+                             &(rrd->
+                               cdp_prep[rrd->stat_head->ds_cnt * (rra_index)
+                                        +
+                                        i].scratch[CDP_secondary_val].u_val));
+                    switch (cf_conv(rrd->rra_def[rra_index].cf_nam)) {
+                    case CF_HWPREDICT:
+                        read_tag(&ptr2, "intercept", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_intercept].
+                                   u_val));
+                        read_tag(&ptr2, "last_intercept", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_last_intercept].
+                                   u_val));
+                        read_tag(&ptr2, "slope", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_slope].u_val));
+                        read_tag(&ptr2, "last_slope", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_last_slope].
+                                   u_val));
+                        read_tag(&ptr2, "nan_count", "%lu",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_null_count].
+                                   u_cnt));
+                        read_tag(&ptr2, "last_nan_count", "%lu",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_last_null_count].
+                                   u_cnt));
+                        break;
+                    case CF_SEASONAL:
+                    case CF_DEVSEASONAL:
+                        read_tag(&ptr2, "seasonal", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_seasonal].
+                                   u_val));
+                        read_tag(&ptr2, "last_seasonal", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_hw_last_seasonal].
+                                   u_val));
+                        read_tag(&ptr2, "init_flag", "%lu",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index)
+                                            +
+                                            i].scratch[CDP_init_seasonal].
+                                   u_cnt));
+                        break;
+                    case CF_DEVPREDICT:
+                        break;
+                    case CF_FAILURES:
+                        parse_FAILURES_history(&ptr2, rrd, rra_index, i);
+                        break;
+                    case CF_AVERAGE:
+                    case CF_MAXIMUM:
+                    case CF_MINIMUM:
+                    case CF_LAST:
+                    default:
+                        read_tag(&ptr2, "value", "%lf",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index) +
+                                            i].scratch[CDP_val].u_val));
+                        read_tag(&ptr2, "unknown_datapoints", "%lu",
+                                 &(rrd->
+                                   cdp_prep[rrd->stat_head->ds_cnt *
+                                            (rra_index) +
+                                            i].scratch[CDP_unkn_pdp_cnt].
+                                   u_cnt));
+                        break;
+                    }
+                }
+            }
+            eat_tag(&ptr2, "/ds");
+        }
+        eat_tag(&ptr2, "/cdp_prep");
+        rrd->rra_def[rrd->stat_head->rra_cnt - 1].row_cnt = 0;
+        eat_tag(&ptr2, "database");
+        ptr3 = ptr2;
+        while (eat_tag(&ptr3, "row") == 1) {
+
+            if (mempool == 0) {
+                mempool = 1000;
+                if ((rrd->rrd_value = rrd_realloc(rrd->rrd_value,
+                                                  (rows +
+                                                   mempool) *
+                                                  (rrd->stat_head->ds_cnt)
+                                                  * sizeof(rrd_value_t))) ==
+                    NULL) {
+                    rrd_set_error("allocating rrd_values");
+                    return -1;
+                }
+            }
+            rows++;
+            mempool--;
+            rrd->rra_def[rrd->stat_head->rra_cnt - 1].row_cnt++;
+            for (i = 0; i < (int) rrd->stat_head->ds_cnt; i++) {
+
+                rrd_value_t *value =
+                    &(rrd->
+                      rrd_value[(rows - 1) * rrd->stat_head->ds_cnt + i]);
+
+                read_tag(&ptr3, "v", "%lf", value);
+
+                if ((rc == 1)   /* do we have to check for the ranges */
+                    &&(!isnan(*value))  /* not a NAN value */
+                    &&(dst_conv(rrd->ds_def[i].dst) != DST_CDEF)
+                    && (    /* min defined and in the range ? */
+                           (!isnan(rrd->ds_def[i].par[DS_min_val].u_val)
+                            && (*value <
+                                rrd->ds_def[i].par[DS_min_val].u_val))
+                           ||   /* max defined and in the range ? */
+                           (!isnan(rrd->ds_def[i].par[DS_max_val].u_val)
+                            && (*value >
+                                rrd->ds_def[i].par[DS_max_val].u_val))
+                    )
+                    ) {
+                    fprintf(stderr,
+                            "out of range found [ds: %lu], [value : %0.10e]\n",
+                            i, *value);
+                    *value = DNAN;
+                }
+            }
+            eat_tag(&ptr3, "/row");
+            ptr2 = ptr3;
+        }
+        eat_tag(&ptr2, "/database");
+        eat_tag(&ptr2, "/rra");
+        ptr = ptr2;
+    }
+    eat_tag(&ptr, "/rrd");
+
+    if ((rrd->rra_ptr =
+         calloc(1, sizeof(rra_ptr_t) * rrd->stat_head->rra_cnt)) == NULL) {
+        rrd_set_error("allocating rra_ptr");
+        return (-1);
+    }
+
+    for (i = 0; i < (int) rrd->stat_head->rra_cnt; i++) {
+        /* last row in the xml file is the most recent; as
+         * rrd_update increments the current row pointer, set cur_row
+         * here to the last row. */
+        rrd->rra_ptr[i].cur_row = rrd->rra_def[i].row_cnt - 1;
+    }
+    if (ptr == NULL)
+        return -1;
+    return 1;
 }
-  
-    
+
+
 
 
 
 /* create and empty rrd file according to the specs given */
 
-int
-rrd_creat(char *file_name, rrd_t *rrd, char force_overwrite)
+int rrd_creat(
+    char *file_name,
+    rrd_t *rrd,
+    char force_overwrite)
 {
-    unsigned long    i,ii,val_cnt;
-    FILE             *rrd_file=NULL;
-    int                        fdflags;
-    int                        fd;
+    unsigned long i, ii, val_cnt;
+    FILE     *rrd_file = NULL;
+    int       fdflags;
+    int       fd;
 
-    if (strcmp("-",file_name)==0){
-      rrd_file= stdout;
+    if (strcmp("-", file_name) == 0) {
+        rrd_file = stdout;
     } else {
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-      fdflags = O_RDWR|O_BINARY|O_CREAT;
+        fdflags = O_RDWR | O_BINARY | O_CREAT;
 #else
-      fdflags = O_WRONLY|O_CREAT;
-#endif            
-      if (force_overwrite == 0) {
-       fdflags |= O_EXCL;
-      }
-      fd = open(file_name,fdflags,0666);
-      if (fd == -1 || (rrd_file = fdopen(fd,"wb")) == NULL) {
-       rrd_set_error("creating '%s': %s",file_name,rrd_strerror(errno));
-        if (fd != -1)
-          close(fd);
-       return(-1);
-      }
+        fdflags = O_WRONLY | O_CREAT;
+#endif
+        if (force_overwrite == 0) {
+            fdflags |= O_EXCL;
+        }
+        fd = open(file_name, fdflags, 0666);
+        if (fd == -1 || (rrd_file = fdopen(fd, "wb")) == NULL) {
+            rrd_set_error("creating '%s': %s", file_name,
+                          rrd_strerror(errno));
+            if (fd != -1)
+                close(fd);
+            return (-1);
+        }
     }
-    fwrite(rrd->stat_head,
-          sizeof(stat_head_t), 1, rrd_file);
+    fwrite(rrd->stat_head, sizeof(stat_head_t), 1, rrd_file);
 
-    fwrite(rrd->ds_def,
-          sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
+    fwrite(rrd->ds_def, sizeof(ds_def_t), rrd->stat_head->ds_cnt, rrd_file);
 
     fwrite(rrd->rra_def,
-          sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
+           sizeof(rra_def_t), rrd->stat_head->rra_cnt, rrd_file);
+
+    fwrite(rrd->live_head, sizeof(live_head_t), 1, rrd_file);
 
-    fwrite(rrd->live_head, sizeof(live_head_t),1, rrd_file);
+    fwrite(rrd->pdp_prep, sizeof(pdp_prep_t), rrd->stat_head->ds_cnt,
+           rrd_file);
 
-    fwrite( rrd->pdp_prep, sizeof(pdp_prep_t),rrd->stat_head->ds_cnt,rrd_file);
-    
-    fwrite( rrd->cdp_prep, sizeof(cdp_prep_t),rrd->stat_head->rra_cnt*
-           rrd->stat_head->ds_cnt,rrd_file);
-    fwrite( rrd->rra_ptr, sizeof(rra_ptr_t), rrd->stat_head->rra_cnt,rrd_file);
+    fwrite(rrd->cdp_prep, sizeof(cdp_prep_t), rrd->stat_head->rra_cnt *
+           rrd->stat_head->ds_cnt, rrd_file);
+    fwrite(rrd->rra_ptr, sizeof(rra_ptr_t), rrd->stat_head->rra_cnt,
+           rrd_file);
 
 
 
     /* calculate the number of rrd_values to dump */
-    val_cnt=0;
-    for(i=0; i <  rrd->stat_head->rra_cnt; i++)
-       for(ii=0; ii <  rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt;ii++)
-           val_cnt++;
-    fwrite( rrd->rrd_value, sizeof(rrd_value_t),val_cnt,rrd_file);
+    val_cnt = 0;
+    for (i = 0; i < rrd->stat_head->rra_cnt; i++)
+        for (ii = 0; ii < rrd->rra_def[i].row_cnt * rrd->stat_head->ds_cnt;
+             ii++)
+            val_cnt++;
+    fwrite(rrd->rrd_value, sizeof(rrd_value_t), val_cnt, rrd_file);
 
     /* lets see if we had an error */
-    if(ferror(rrd_file)){
-       rrd_set_error("a file error occurred while creating '%s'",file_name);
-       fclose(rrd_file);       
-       return(-1);
+    if (ferror(rrd_file)) {
+        rrd_set_error("a file error occurred while creating '%s'", file_name);
+        fclose(rrd_file);
+        return (-1);
     }
-    
-    fclose(rrd_file);    
+
+    fclose(rrd_file);
     return 0;
 }
 
 
-int
-rrd_restore(int argc, char **argv) 
+int rrd_restore(
+    int argc,
+    char **argv)
 {
-    rrd_t          rrd;
-    char          *buf;
-       char                    rc = 0;
-       char                    force_overwrite = 0;    
+    rrd_t     rrd;
+    char     *buf;
+    char      rc = 0;
+    char      force_overwrite = 0;
 
     /* init rrd clean */
-    optind = 0; opterr = 0;  /* initialize getopt */
-       while (1) {
-               static struct option long_options[] =
-               {
-                       {"range-check",      no_argument, 0,  'r'},
-                       {"force-overwrite",  no_argument, 0,  'f'},
-                       {0,0,0,0}
-               };
-               int option_index = 0;
-               int opt;
-               
-               
-               opt = getopt_long(argc, argv, "rf", long_options, &option_index);
-               
-               if (opt == EOF)
-                       break;
-               
-               switch(opt) {
-               case 'r':
-                       rc=1;
-                       break;
-               case 'f':
-                       force_overwrite=1;
-                       break;
-               default:
-                       rrd_set_error("usage rrdtool %s [--range-check|-r] [--force-overwrite/-f]  file.xml file.rrd",argv[0]);
-                       return -1;
-                       break;
-               }
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
+    while (1) {
+        static struct option long_options[] = {
+            {"range-check", no_argument, 0, 'r'},
+            {"force-overwrite", no_argument, 0, 'f'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+
+        opt = getopt_long(argc, argv, "rf", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 'r':
+            rc = 1;
+            break;
+        case 'f':
+            force_overwrite = 1;
+            break;
+        default:
+            rrd_set_error
+                ("usage rrdtool %s [--range-check|-r] [--force-overwrite/-f]  file.xml file.rrd",
+                 argv[0]);
+            return -1;
+            break;
+        }
     }
 
-    if (argc-optind != 2) {
-               rrd_set_error("usage rrdtool %s [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd",argv[0]);
-               return -1;
+    if (argc - optind != 2) {
+        rrd_set_error
+            ("usage rrdtool %s [--range-check/-r] [--force-overwrite/-f] file.xml file.rrd",
+             argv[0]);
+        return -1;
     }
-       
-    if (readfile(argv[optind],&buf,0)==-1){
-      return -1;
+
+    if (readfile(argv[optind], &buf, 0) == -1) {
+        return -1;
     }
 
     rrd_init(&rrd);
 
-    if (xml2rrd(buf,&rrd,rc)==-1) {
-       rrd_free(&rrd);
-       free(buf);
-       return -1;
+    if (xml2rrd(buf, &rrd, rc) == -1) {
+        rrd_free(&rrd);
+        free(buf);
+        return -1;
     }
 
     free(buf);
 
-    if(rrd_creat(argv[optind+1],&rrd,force_overwrite)==-1){
-       rrd_free(&rrd); 
-       return -1;      
+    if (rrd_creat(argv[optind + 1], &rrd, force_overwrite) == -1) {
+        rrd_free(&rrd);
+        return -1;
     };
-    rrd_free(&rrd);    
+    rrd_free(&rrd);
     return 0;
 }
 
 /* a backwards compatibility routine that will parse the RRA params section
  * generated by the aberrant patch to 1.0.28. */
 
-void
-parse_patch1028_RRA_params(char **buf, rrd_t *rrd, int rra_index)
+void parse_patch1028_RRA_params(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index)
 {
-   int i;
-   for (i = 0; i < MAX_RRA_PAR_EN; i++)
-   {
-   if (i == RRA_dependent_rra_idx ||
-       i == RRA_seasonal_smooth_idx ||
-       i == RRA_failure_threshold)
-      read_tag(buf, "value","%lu",
-         &(rrd->rra_def[rra_index].par[i].u_cnt));
-   else
-      read_tag(buf, "value","%lf",
-         &(rrd->rra_def[rra_index].par[i].u_val));
-   }
+    int       i;
+
+    for (i = 0; i < MAX_RRA_PAR_EN; i++) {
+        if (i == RRA_dependent_rra_idx ||
+            i == RRA_seasonal_smooth_idx || i == RRA_failure_threshold)
+            read_tag(buf, "value", "%lu",
+                     &(rrd->rra_def[rra_index].par[i].u_cnt));
+        else
+            read_tag(buf, "value", "%lf",
+                     &(rrd->rra_def[rra_index].par[i].u_val));
+    }
 }
 
 /* a backwards compatibility routine that will parse the CDP params section
  * generated by the aberrant patch to 1.0.28. */
-void
-parse_patch1028_CDP_params(char **buf, rrd_t *rrd, int rra_index, int ds_index)
+void parse_patch1028_CDP_params(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index,
+    int ds_index)
 {
-   int ii;
-   for (ii = 0; ii < MAX_CDP_PAR_EN; ii++)
-   {
-   if (cf_conv(rrd->rra_def[rra_index].cf_nam) == CF_FAILURES ||
-       ii == CDP_unkn_pdp_cnt ||
-       ii == CDP_null_count ||
-       ii == CDP_last_null_count)
-   {
-      read_tag(buf,"value","%lu",
-       &(rrd->cdp_prep[rrd->stat_head->ds_cnt*(rra_index) + ds_index].scratch[ii].u_cnt));
-   } else {
-      read_tag(buf,"value","%lf",&(rrd->cdp_prep[rrd->stat_head->ds_cnt*
-       (rra_index) + ds_index].scratch[ii].u_val));
-   }
-   }
+    int       ii;
+
+    for (ii = 0; ii < MAX_CDP_PAR_EN; ii++) {
+        if (cf_conv(rrd->rra_def[rra_index].cf_nam) == CF_FAILURES ||
+            ii == CDP_unkn_pdp_cnt ||
+            ii == CDP_null_count || ii == CDP_last_null_count) {
+            read_tag(buf, "value", "%lu",
+                     &(rrd->
+                       cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                                ds_index].scratch[ii].u_cnt));
+        } else {
+            read_tag(buf, "value", "%lf",
+                     &(rrd->
+                       cdp_prep[rrd->stat_head->ds_cnt * (rra_index) +
+                                ds_index].scratch[ii].u_val));
+        }
+    }
 }
 
-void
-parse_FAILURES_history(char **buf, rrd_t *rrd, int rra_index, int ds_index)
+void parse_FAILURES_history(
+    char **buf,
+    rrd_t *rrd,
+    int rra_index,
+    int ds_index)
 {
-   char history[MAX_FAILURES_WINDOW_LEN + 1];
-   char *violations_array;
-   unsigned short i;
-
-   /* 28 = MAX_FAILURES_WINDOW_LEN */ 
-   read_tag(buf, "history", "%28[0-1]", history);
-   violations_array = (char*) rrd -> cdp_prep[rrd->stat_head->ds_cnt*(rra_index)
-      + ds_index].scratch;
-   
-   for (i = 0; i < rrd -> rra_def[rra_index].par[RRA_window_len].u_cnt; ++i)
-      violations_array[i] = (history[i] == '1') ? 1 : 0;
+    char      history[MAX_FAILURES_WINDOW_LEN + 1];
+    char     *violations_array;
+    unsigned short i;
+
+    /* 28 = MAX_FAILURES_WINDOW_LEN */
+    read_tag(buf, "history", "%28[0-1]", history);
+    violations_array =
+        (char *) rrd->cdp_prep[rrd->stat_head->ds_cnt * (rra_index)
+                               + ds_index].scratch;
+
+    for (i = 0; i < rrd->rra_def[rra_index].par[RRA_window_len].u_cnt; ++i)
+        violations_array[i] = (history[i] == '1') ? 1 : 0;
 
 }
index eb7c94b..d1ab0de 100644 (file)
@@ -9,40 +9,49 @@
 #include "rrd_graph.h"
 #include <limits.h>
 
-short addop2str(enum op_en op, enum op_en op_type, char *op_str, 
-           char **result_str, unsigned short *offset);
-int tzoffset(time_t); /* used to implement LTIME */
+short     addop2str(
+    enum op_en op,
+    enum op_en op_type,
+    char *op_str,
+    char **result_str,
+    unsigned short *offset);
+int       tzoffset(
+    time_t);            /* used to implement LTIME */
 
-short rpn_compact(rpnp_t *rpnp, rpn_cdefds_t **rpnc, short *count)
+short rpn_compact(
+    rpnp_t * rpnp,
+    rpn_cdefds_t ** rpnc,
+    short *count)
 {
-    short i;
+    short     i;
+
     *count = 0;
     /* count the number of rpn nodes */
-    while(rpnp[*count].op != OP_END) (*count)++;
+    while (rpnp[*count].op != OP_END)
+        (*count)++;
     if (++(*count) > DS_CDEF_MAX_RPN_NODES) {
         rrd_set_error("Maximum %d RPN nodes permitted",
                       DS_CDEF_MAX_RPN_NODES);
         return -1;
     }
-    
+
     /* allocate memory */
-    *rpnc = (rpn_cdefds_t *) calloc(*count,sizeof(rpn_cdefds_t));
-    for (i = 0; rpnp[i].op != OP_END; i++)
-    {
+    *rpnc = (rpn_cdefds_t *) calloc(*count, sizeof(rpn_cdefds_t));
+    for (i = 0; rpnp[i].op != OP_END; i++) {
         (*rpnc)[i].op = (char) rpnp[i].op;
         if (rpnp[i].op == OP_NUMBER) {
             /* rpnp.val is a double, rpnc.val is a short */
-            double temp = floor(rpnp[i].val);
+            double    temp = floor(rpnp[i].val);
+
             if (temp < SHRT_MIN || temp > SHRT_MAX) {
-                rrd_set_error(
-                   "constants must be integers in the interval (%d, %d)",
-                    SHRT_MIN, SHRT_MAX);
-                free(*rpnc);   
+                rrd_set_error
+                    ("constants must be integers in the interval (%d, %d)",
+                     SHRT_MIN, SHRT_MAX);
+                free(*rpnc);
                 return -1;
             }
             (*rpnc)[i].val = (short) temp;
-         } else if (rpnp[i].op == OP_VARIABLE ||
-                                rpnp[i].op == OP_PREV_OTHER) {
+        } else if (rpnp[i].op == OP_VARIABLE || rpnp[i].op == OP_PREV_OTHER) {
             (*rpnc)[i].val = (short) rpnp[i].ptr;
         }
     }
@@ -51,22 +60,22 @@ short rpn_compact(rpnp_t *rpnp, rpn_cdefds_t **rpnc, short *count)
     return 0;
 }
 
-rpnp_t * rpn_expand(rpn_cdefds_t *rpnc)
+rpnp_t   *rpn_expand(
+    rpn_cdefds_t * rpnc)
 {
-    short i;
-    rpnp_t *rpnp;
-    
+    short     i;
+    rpnp_t   *rpnp;
+
     /* DS_CDEF_MAX_RPN_NODES is small, so at the expense of some wasted
      * memory we avoid any reallocs */
-    rpnp = (rpnp_t *) calloc(DS_CDEF_MAX_RPN_NODES,sizeof(rpnp_t));
-    if (rpnp == NULL) return NULL;
-    for (i = 0; rpnc[i].op != OP_END; ++i)
-    {
+    rpnp = (rpnp_t *) calloc(DS_CDEF_MAX_RPN_NODES, sizeof(rpnp_t));
+    if (rpnp == NULL)
+        return NULL;
+    for (i = 0; rpnc[i].op != OP_END; ++i) {
         rpnp[i].op = (long) rpnc[i].op;
         if (rpnp[i].op == OP_NUMBER) {
             rpnp[i].val = (double) rpnc[i].val;
-         } else if (rpnp[i].op == OP_VARIABLE ||
-                                rpnp[i].op == OP_PREV_OTHER) {
+        } else if (rpnp[i].op == OP_VARIABLE || rpnp[i].op == OP_PREV_OTHER) {
             rpnp[i].ptr = (long) rpnc[i].val;
         }
     }
@@ -83,118 +92,131 @@ rpnp_t * rpn_expand(rpn_cdefds_t *rpnc)
  *   for lookup of data source names by index
  *  str: out string, memory is allocated by the function, must be freed by the
  *   the caller */
-void rpn_compact2str(rpn_cdefds_t *rpnc,ds_def_t *ds_def,char **str)
+void rpn_compact2str(
+    rpn_cdefds_t * rpnc,
+    ds_def_t * ds_def,
+    char **str)
 {
-    unsigned short i,offset = 0;
-    char buffer[7]; /* short as a string */
-    
-    for (i = 0; rpnc[i].op != OP_END; i++)
-    {
-        if (i > 0) (*str)[offset++] = ',';
-        
+    unsigned short i, offset = 0;
+    char      buffer[7];    /* short as a string */
+
+    for (i = 0; rpnc[i].op != OP_END; i++) {
+        if (i > 0)
+            (*str)[offset++] = ',';
+
 #define add_op(VV,VVV) \
          if (addop2str(rpnc[i].op, VV, VVV, str, &offset) == 1) continue;
-        
+
         if (rpnc[i].op == OP_NUMBER) {
             /* convert a short into a string */
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-            _itoa(rpnc[i].val,buffer,10);
+            _itoa(rpnc[i].val, buffer, 10);
 #else
-            sprintf(buffer,"%d",rpnc[i].val);
+            sprintf(buffer, "%d", rpnc[i].val);
 #endif
-            add_op(OP_NUMBER,buffer)
-                }
-        
+            add_op(OP_NUMBER, buffer)
+        }
+
         if (rpnc[i].op == OP_VARIABLE) {
-            char *ds_name = ds_def[rpnc[i].val].ds_nam;
+            char     *ds_name = ds_def[rpnc[i].val].ds_nam;
+
             add_op(OP_VARIABLE, ds_name)
-                }
+        }
 
-         if (rpnc[i].op == OP_PREV_OTHER) {
-               char *ds_name = ds_def[rpnc[i].val].ds_nam;
-               add_op(OP_VARIABLE, ds_name)
-         }
+        if (rpnc[i].op == OP_PREV_OTHER) {
+            char     *ds_name = ds_def[rpnc[i].val].ds_nam;
 
+            add_op(OP_VARIABLE, ds_name)
+        }
 #undef add_op
-        
+
 #define add_op(VV,VVV) \
          if (addop2str(rpnc[i].op, VV, #VVV, str, &offset) == 1) continue;
-        
-          add_op(OP_ADD,+)
-          add_op(OP_SUB,-)
-          add_op(OP_MUL,*)
-          add_op(OP_DIV,/)
-          add_op(OP_MOD,%)
-          add_op(OP_SIN,SIN)
-          add_op(OP_COS,COS)
-          add_op(OP_LOG,LOG)
-          add_op(OP_FLOOR,FLOOR)
-         add_op(OP_CEIL,CEIL)
-         add_op(OP_EXP,EXP)
-         add_op(OP_DUP,DUP)
-         add_op(OP_EXC,EXC)
-         add_op(OP_POP,POP)
-         add_op(OP_LT,LT)
-          add_op(OP_LE,LE)
-         add_op(OP_GT,GT)
-         add_op(OP_GE,GE)
-         add_op(OP_EQ,EQ)
-         add_op(OP_IF,IF)
-         add_op(OP_MIN,MIN)
-         add_op(OP_MAX,MAX)
-         add_op(OP_LIMIT,LIMIT)
-         add_op(OP_UNKN,UNKN)
-         add_op(OP_UN,UN)
-         add_op(OP_NEGINF,NEGINF)
-         add_op(OP_NE,NE)
-         add_op(OP_PREV,PREV)
-         add_op(OP_INF,INF)
-         add_op(OP_ISINF,ISINF)
-         add_op(OP_NOW,NOW)
-         add_op(OP_LTIME,LTIME)
-         add_op(OP_TIME,TIME)
-         add_op(OP_ATAN2,ATAN2)
-         add_op(OP_ATAN,ATAN)
-         add_op(OP_SQRT,SQRT)
-         add_op(OP_SORT,SORT)
-         add_op(OP_REV,REV)
-         add_op(OP_TREND,TREND)
-         add_op(OP_RAD2DEG,RAD2DEG)
-         add_op(OP_DEG2RAD,DEG2RAD)
-         add_op(OP_AVG,AVG)
-         add_op(OP_ABS,ABS)
+
+        add_op(OP_ADD, +)
+            add_op(OP_SUB, -)
+            add_op(OP_MUL, *)
+            add_op(OP_DIV, /)
+            add_op(OP_MOD, %)
+            add_op(OP_SIN, SIN)
+            add_op(OP_COS, COS)
+            add_op(OP_LOG, LOG)
+            add_op(OP_FLOOR, FLOOR)
+            add_op(OP_CEIL, CEIL)
+            add_op(OP_EXP, EXP)
+            add_op(OP_DUP, DUP)
+            add_op(OP_EXC, EXC)
+            add_op(OP_POP, POP)
+            add_op(OP_LT, LT)
+            add_op(OP_LE, LE)
+            add_op(OP_GT, GT)
+            add_op(OP_GE, GE)
+            add_op(OP_EQ, EQ)
+            add_op(OP_IF, IF)
+            add_op(OP_MIN, MIN)
+            add_op(OP_MAX, MAX)
+            add_op(OP_LIMIT, LIMIT)
+            add_op(OP_UNKN, UNKN)
+            add_op(OP_UN, UN)
+            add_op(OP_NEGINF, NEGINF)
+            add_op(OP_NE, NE)
+            add_op(OP_PREV, PREV)
+            add_op(OP_INF, INF)
+            add_op(OP_ISINF, ISINF)
+            add_op(OP_NOW, NOW)
+            add_op(OP_LTIME, LTIME)
+            add_op(OP_TIME, TIME)
+            add_op(OP_ATAN2, ATAN2)
+            add_op(OP_ATAN, ATAN)
+            add_op(OP_SQRT, SQRT)
+            add_op(OP_SORT, SORT)
+            add_op(OP_REV, REV)
+            add_op(OP_TREND, TREND)
+            add_op(OP_RAD2DEG, RAD2DEG)
+            add_op(OP_DEG2RAD, DEG2RAD)
+            add_op(OP_AVG, AVG)
+            add_op(OP_ABS, ABS)
 #undef add_op
-              }
+    }
     (*str)[offset] = '\0';
 
 }
 
-short addop2str(enum op_en op, enum op_en op_type, char *op_str, 
-                char **result_str, unsigned short *offset)
+short addop2str(
+    enum op_en op,
+    enum op_en op_type,
+    char *op_str,
+    char **result_str,
+    unsigned short *offset)
 {
     if (op == op_type) {
-        short op_len;
+        short     op_len;
+
         op_len = strlen(op_str);
-        *result_str =  (char *) rrd_realloc(*result_str,
-                                            (op_len + 1 + *offset)*sizeof(char));
+        *result_str = (char *) rrd_realloc(*result_str,
+                                           (op_len + 1 +
+                                            *offset) * sizeof(char));
         if (*result_str == NULL) {
             rrd_set_error("failed to alloc memory in addop2str");
             return -1;
         }
-        strncpy(&((*result_str)[*offset]),op_str,op_len);
+        strncpy(&((*result_str)[*offset]), op_str, op_len);
         *offset += op_len;
         return 1;
     }
     return 0;
 }
 
-void parseCDEF_DS(const char *def,rrd_t *rrd, int ds_idx)
+void parseCDEF_DS(
+    const char *def,
+    rrd_t *rrd,
+    int ds_idx)
 {
-    rpnp_t *rpnp = NULL;
+    rpnp_t   *rpnp = NULL;
     rpn_cdefds_t *rpnc = NULL;
-    short count, i;
-    
-    rpnp = rpn_parse((void*) rrd, def, &lookup_DS);
+    short     count, i;
+
+    rpnp = rpn_parse((void *) rrd, def, &lookup_DS);
     if (rpnp == NULL) {
         rrd_set_error("failed to parse computed data source");
         return;
@@ -204,22 +226,21 @@ void parseCDEF_DS(const char *def,rrd_t *rrd, int ds_idx)
      * COMPUTE DS specific. This is less efficient, but creation doesn't
      * occur too often. */
     for (i = 0; rpnp[i].op != OP_END; i++) {
-        if (rpnp[i].op == OP_TIME || rpnp[i].op == OP_LTIME || 
-            rpnp[i].op == OP_PREV || rpnp[i].op == OP_COUNT)
-        {
-            rrd_set_error(
-                "operators time, ltime, prev and count not supported with DS COMPUTE");
+        if (rpnp[i].op == OP_TIME || rpnp[i].op == OP_LTIME ||
+            rpnp[i].op == OP_PREV || rpnp[i].op == OP_COUNT) {
+            rrd_set_error
+                ("operators time, ltime, prev and count not supported with DS COMPUTE");
             free(rpnp);
             return;
         }
     }
-    if (rpn_compact(rpnp,&rpnc,&count) == -1) {
+    if (rpn_compact(rpnp, &rpnc, &count) == -1) {
         free(rpnp);
         return;
     }
     /* copy the compact rpn representation over the ds_def par array */
-    memcpy((void*) &(rrd -> ds_def[ds_idx].par[DS_cdef]),
-           (void*) rpnc, count*sizeof(rpn_cdefds_t));
+    memcpy((void *) &(rrd->ds_def[ds_idx].par[DS_cdef]),
+           (void *) rpnc, count * sizeof(rpn_cdefds_t));
     free(rpnp);
     free(rpnc);
 }
@@ -229,16 +250,17 @@ void parseCDEF_DS(const char *def,rrd_t *rrd, int ds_idx)
  * (1) need a void * pointer to the rrd
  * (2) error handling is left to the caller
  */
-long lookup_DS(void *rrd_vptr,char *ds_name)
+long lookup_DS(
+    void *rrd_vptr,
+    char *ds_name)
 {
     unsigned int i;
-    rrd_t *rrd; 
-    
+    rrd_t    *rrd;
+
     rrd = (rrd_t *) rrd_vptr;
-    
-    for (i = 0; i < rrd -> stat_head -> ds_cnt; ++i)
-    {
-        if(strcmp(ds_name,rrd -> ds_def[i].ds_nam) == 0)
+
+    for (i = 0; i < rrd->stat_head->ds_cnt; ++i) {
+        if (strcmp(ds_name, rrd->ds_def[i].ds_nam) == 0)
             return i;
     }
     /* the caller handles a bad data source name in the rpn string */
@@ -253,28 +275,32 @@ long lookup_DS(void *rrd_vptr,char *ds_name)
  * expr: the string RPN expression, including variable names
  * lookup(): a function that retrieves a numeric key given a variable name
  */
-rpnp_t * 
-rpn_parse(void *key_hash,const char *const expr_const,long (*lookup)(void *,char*)){
-    int pos=0;
-    char *expr;
-    long steps=-1;    
-    rpnp_t  *rpnp;
-    char vname[MAX_VNAME_LEN+10];
-    
-    rpnp=NULL;
-    expr=(char *)expr_const;
-    
-    while(*expr){
-       if ((rpnp = (rpnp_t *) rrd_realloc(rpnp, (++steps + 2)* 
-                                      sizeof(rpnp_t)))==NULL){
-           return NULL;
-       }
-        
-       else if((sscanf(expr,"%lf%n",&rpnp[steps].val,&pos) == 1) && (expr[pos] == ',')){
-           rpnp[steps].op = OP_NUMBER;
-           expr+=pos;
-       } 
-       
+rpnp_t   *rpn_parse(
+    void *key_hash,
+    const char *const expr_const,
+    long (*lookup) (void *,
+                    char *))
+{
+    int       pos = 0;
+    char     *expr;
+    long      steps = -1;
+    rpnp_t   *rpnp;
+    char      vname[MAX_VNAME_LEN + 10];
+
+    rpnp = NULL;
+    expr = (char *) expr_const;
+
+    while (*expr) {
+        if ((rpnp = (rpnp_t *) rrd_realloc(rpnp, (++steps + 2) *
+                                           sizeof(rpnp_t))) == NULL) {
+            return NULL;
+        }
+
+        else if ((sscanf(expr, "%lf%n", &rpnp[steps].val, &pos) == 1)
+                 && (expr[pos] == ',')) {
+            rpnp[steps].op = OP_NUMBER;
+            expr += pos;
+        }
 #define match_op(VV,VVV) \
         else if (strncmp(expr, #VVV, strlen(#VVV))==0 && ( expr[strlen(#VVV)] == ',' || expr[strlen(#VVV)] == '\0' )){ \
             rpnp[steps].op = VV; \
@@ -296,101 +322,100 @@ rpn_parse(void *key_hash,const char *const expr_const,long (*lookup)(void *,char
           } \
         }
 
-       match_op(OP_ADD,+)
-       match_op(OP_SUB,-)
-       match_op(OP_MUL,*)
-       match_op(OP_DIV,/)
-       match_op(OP_MOD,%)
-       match_op(OP_SIN,SIN)
-       match_op(OP_COS,COS)
-       match_op(OP_LOG,LOG)
-       match_op(OP_FLOOR,FLOOR)
-       match_op(OP_CEIL,CEIL)
-       match_op(OP_EXP,EXP)
-       match_op(OP_DUP,DUP)
-       match_op(OP_EXC,EXC)
-       match_op(OP_POP,POP)
-       match_op(OP_LTIME,LTIME)
-       match_op(OP_LT,LT)
-       match_op(OP_LE,LE)
-       match_op(OP_GT,GT)
-       match_op(OP_GE,GE)
-       match_op(OP_EQ,EQ)
-       match_op(OP_IF,IF)
-       match_op(OP_MIN,MIN)
-       match_op(OP_MAX,MAX)
-       match_op(OP_LIMIT,LIMIT)
-         /* order is important here ! .. match longest first */
-       match_op(OP_UNKN,UNKN)
-       match_op(OP_UN,UN)
-       match_op(OP_NEGINF,NEGINF)
-       match_op(OP_NE,NE)
-       match_op(OP_COUNT,COUNT)
-       match_op_param(OP_PREV_OTHER,PREV)
-       match_op(OP_PREV,PREV)
-       match_op(OP_INF,INF)
-       match_op(OP_ISINF,ISINF)
-       match_op(OP_NOW,NOW)
-       match_op(OP_TIME,TIME)
-       match_op(OP_ATAN2,ATAN2)
-       match_op(OP_ATAN,ATAN)
-       match_op(OP_SQRT,SQRT)
-       match_op(OP_SORT,SORT)
-       match_op(OP_REV,REV)
-       match_op(OP_TREND,TREND)
-       match_op(OP_RAD2DEG,RAD2DEG)
-       match_op(OP_DEG2RAD,DEG2RAD)
-       match_op(OP_AVG,AVG)
-       match_op(OP_ABS,ABS)
+        match_op(OP_ADD, +)
+            match_op(OP_SUB, -)
+            match_op(OP_MUL, *)
+            match_op(OP_DIV, /)
+            match_op(OP_MOD, %)
+            match_op(OP_SIN, SIN)
+            match_op(OP_COS, COS)
+            match_op(OP_LOG, LOG)
+            match_op(OP_FLOOR, FLOOR)
+            match_op(OP_CEIL, CEIL)
+            match_op(OP_EXP, EXP)
+            match_op(OP_DUP, DUP)
+            match_op(OP_EXC, EXC)
+            match_op(OP_POP, POP)
+            match_op(OP_LTIME, LTIME)
+            match_op(OP_LT, LT)
+            match_op(OP_LE, LE)
+            match_op(OP_GT, GT)
+            match_op(OP_GE, GE)
+            match_op(OP_EQ, EQ)
+            match_op(OP_IF, IF)
+            match_op(OP_MIN, MIN)
+            match_op(OP_MAX, MAX)
+            match_op(OP_LIMIT, LIMIT)
+            /* order is important here ! .. match longest first */
+            match_op(OP_UNKN, UNKN)
+            match_op(OP_UN, UN)
+            match_op(OP_NEGINF, NEGINF)
+            match_op(OP_NE, NE)
+            match_op(OP_COUNT, COUNT)
+            match_op_param(OP_PREV_OTHER, PREV)
+            match_op(OP_PREV, PREV)
+            match_op(OP_INF, INF)
+            match_op(OP_ISINF, ISINF)
+            match_op(OP_NOW, NOW)
+            match_op(OP_TIME, TIME)
+            match_op(OP_ATAN2, ATAN2)
+            match_op(OP_ATAN, ATAN)
+            match_op(OP_SQRT, SQRT)
+            match_op(OP_SORT, SORT)
+            match_op(OP_REV, REV)
+            match_op(OP_TREND, TREND)
+            match_op(OP_RAD2DEG, RAD2DEG)
+            match_op(OP_DEG2RAD, DEG2RAD)
+            match_op(OP_AVG, AVG)
+            match_op(OP_ABS, ABS)
 #undef match_op
+            else if ((sscanf(expr, DEF_NAM_FMT "%n", vname, &pos) == 1)
+                     && ((rpnp[steps].ptr = (*lookup) (key_hash, vname)) !=
+                         -1)) {
+            rpnp[steps].op = OP_VARIABLE;
+            expr += pos;
+        }
 
-
-            else if ((sscanf(expr, DEF_NAM_FMT "%n",
-                             vname,&pos) == 1) 
-                     && ((rpnp[steps].ptr = (*lookup)(key_hash,vname)) != -1)){
-                rpnp[steps].op = OP_VARIABLE;
-                expr+=pos;
-            }     
-        
-       else {
-           free(rpnp);
-           return NULL;
-       }
-       if (*expr == 0)
-            break;
-       if (*expr == ',')
-           expr++;
-       else {
-           free(rpnp);
-           return NULL;
-       }  
+        else {
+            free(rpnp);
+            return NULL;
+        }
+        if (*expr == 0)
+            break;
+        if (*expr == ',')
+            expr++;
+        else {
+            free(rpnp);
+            return NULL;
+        }
     }
-    rpnp[steps+1].op = OP_END;
+    rpnp[steps + 1].op = OP_END;
     return rpnp;
 }
 
-void
-rpnstack_init(rpnstack_t *rpnstack)
+void rpnstack_init(
+    rpnstack_t * rpnstack)
 {
-    rpnstack -> s = NULL;
-    rpnstack -> dc_stacksize = 0;
-    rpnstack -> dc_stackblock = 100;
+    rpnstack->s = NULL;
+    rpnstack->dc_stacksize = 0;
+    rpnstack->dc_stackblock = 100;
 }
 
-void
-rpnstack_free(rpnstack_t *rpnstack)
+void rpnstack_free(
+    rpnstack_t * rpnstack)
 {
-   if (rpnstack -> s != NULL)
-         free(rpnstack -> s);
-   rpnstack -> dc_stacksize = 0;
+    if (rpnstack->s != NULL)
+        free(rpnstack->s);
+    rpnstack->dc_stacksize = 0;
 }
 
-static int
-rpn_compare_double(const void *x, const void *y)
+static int rpn_compare_double(
+    const void *x,
+    const void *y)
 {
-       double  diff = *((const double *)x) - *((const double *)y);
-       
-       return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
+    double    diff = *((const double *) x) - *((const double *) y);
+
+    return (diff < 0) ? -1 : (diff > 0) ? 1 : 0;
 }
 
 /* rpn_calc: run the RPN calculator; also performs variable substitution;
@@ -408,405 +433,407 @@ rpn_compare_double(const void *x, const void *y)
  * returns: -1 if the computation failed (also calls rrd_set_error)
  *           0 on success
  */
-short
-rpn_calc(rpnp_t *rpnp, rpnstack_t *rpnstack, long data_idx, 
-               rrd_value_t *output, int output_idx)
+short rpn_calc(
+    rpnp_t * rpnp,
+    rpnstack_t * rpnstack,
+    long data_idx,
+    rrd_value_t * output,
+    int output_idx)
 {
-    int rpi;
-    long stptr = -1;
-   
-    /* process each op from the rpn in turn */
-    for (rpi=0; rpnp[rpi].op != OP_END; rpi++){
-       /* allocate or grow the stack */
-       if (stptr + 5 > rpnstack -> dc_stacksize){
-           /* could move this to a separate function */
-           rpnstack -> dc_stacksize += rpnstack -> dc_stackblock;              
-           rpnstack -> s = rrd_realloc(rpnstack -> s,
-                       (rpnstack -> dc_stacksize)*sizeof(*(rpnstack -> s)));
-           if (rpnstack -> s == NULL){
-               rrd_set_error("RPN stack overflow");
-               return -1;
-           }
-       }
+    int       rpi;
+    long      stptr = -1;
 
+    /* process each op from the rpn in turn */
+    for (rpi = 0; rpnp[rpi].op != OP_END; rpi++) {
+        /* allocate or grow the stack */
+        if (stptr + 5 > rpnstack->dc_stacksize) {
+            /* could move this to a separate function */
+            rpnstack->dc_stacksize += rpnstack->dc_stackblock;
+            rpnstack->s = rrd_realloc(rpnstack->s,
+                                      (rpnstack->dc_stacksize) *
+                                      sizeof(*(rpnstack->s)));
+            if (rpnstack->s == NULL) {
+                rrd_set_error("RPN stack overflow");
+                return -1;
+            }
+        }
 #define stackunderflow(MINSIZE)                                \
        if(stptr<MINSIZE){                              \
            rrd_set_error("RPN stack underflow");       \
            return -1;                                  \
        }
 
-       switch (rpnp[rpi].op){
-           case OP_NUMBER:
-               rpnstack -> s[++stptr] = rpnp[rpi].val;
-               break;
-           case OP_VARIABLE:
-            case OP_PREV_OTHER:
-           /* Sanity check: VDEFs shouldn't make it here */
-               if (rpnp[rpi].ds_cnt == 0) {
-                   rrd_set_error("VDEF made it into rpn_calc... aborting");
-                   return -1;
-               } else {
-                   /* make sure we pull the correct value from
-                    * the *.data array. Adjust the pointer into
-                    * the array acordingly. Advance the ptr one
-                    * row in the rra (skip over non-relevant
-                    * data sources)
-                    */
-                   if (rpnp[rpi].op == OP_VARIABLE) {
-                       rpnstack -> s[++stptr] =  *(rpnp[rpi].data);
-                   } else {
-                       if ((output_idx) <= 0) {
-                           rpnstack -> s[++stptr] = DNAN;
-                       } else {                            
-                           rpnstack -> s[++stptr] =  *(rpnp[rpi].data-rpnp[rpi].ds_cnt);
-                       }
-                      
-                   }              
-                   if (data_idx % rpnp[rpi].step == 0){
-                       rpnp[rpi].data += rpnp[rpi].ds_cnt;
-                   }
-               }
-               break;
-           case OP_COUNT:
-               rpnstack -> s[++stptr] = (output_idx+1); /* Note: Counter starts at 1 */
-               break;
-           case OP_PREV:
-               if ((output_idx) <= 0) {
-                   rpnstack -> s[++stptr] = DNAN;
-               } else {
-                   rpnstack -> s[++stptr] = output[output_idx-1];
-               }
-               break;
-        case OP_UNKN:
-               rpnstack -> s[++stptr] = DNAN; 
-               break;
-           case OP_INF:
-               rpnstack -> s[++stptr] = DINF; 
-               break;
-           case OP_NEGINF:
-               rpnstack -> s[++stptr] = -DINF; 
-               break;
-           case OP_NOW:
-               rpnstack -> s[++stptr] = (double)time(NULL);
-               break;
-           case OP_TIME:
-               /* HACK: this relies on the data_idx being the time,
-               ** which the within-function scope is unaware of */
-               rpnstack -> s[++stptr] = (double) data_idx;
-               break;
-           case OP_LTIME:
-               rpnstack -> s[++stptr] =
-                       (double) tzoffset(data_idx) + (double)data_idx;
-               break;
-           case OP_ADD:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1] 
-                                       + rpnstack -> s[stptr];
-               stptr--;
-               break;
-           case OP_SUB:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1]
-                                       - rpnstack -> s[stptr];
-               stptr--;
-               break;
-           case OP_MUL:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]  = (rpnstack -> s[stptr-1])
-                                       * (rpnstack -> s[stptr]);
-               stptr--;
-               break;
-           case OP_DIV:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]  = rpnstack -> s[stptr-1]
-                                       / rpnstack -> s[stptr];
-               stptr--;
-               break;
-           case OP_MOD:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]= fmod(   rpnstack -> s[stptr-1]
-                                               ,rpnstack -> s[stptr]);
-               stptr--;
-               break;
-           case OP_SIN:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = sin(rpnstack -> s[stptr]);
-               break;
-           case OP_ATAN:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = atan(rpnstack -> s[stptr]);
-               break;
-           case OP_RAD2DEG:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = 57.29577951 * rpnstack -> s[stptr];
-               break;
-           case OP_DEG2RAD:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = 0.0174532952 * rpnstack -> s[stptr];
-               break;
-           case OP_ATAN2:
-               stackunderflow(1);
-               rpnstack -> s[stptr-1]= atan2(
-                               rpnstack -> s[stptr-1],
-                               rpnstack -> s[stptr]);
-               stptr--;
-               break;
-           case OP_COS:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = cos(rpnstack -> s[stptr]);
-               break;
-           case OP_CEIL:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = ceil(rpnstack -> s[stptr]);
-               break;
-           case OP_FLOOR:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = floor(rpnstack -> s[stptr]);
-               break;
-           case OP_LOG:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = log(rpnstack -> s[stptr]);
-               break;
-           case OP_DUP:
-               stackunderflow(0);
-               rpnstack -> s[stptr+1] = rpnstack -> s[stptr];
-               stptr++;
-               break;
-           case OP_POP:
-               stackunderflow(0);
-               stptr--;
-               break;
-           case OP_EXC:
-               stackunderflow(1);
-               {
-                   double dummy;
-                   dummy = rpnstack -> s[stptr] ;
-                   rpnstack -> s[stptr] = rpnstack -> s[stptr-1];
-                   rpnstack -> s[stptr-1] = dummy;
-               }
-               break;
-           case OP_EXP:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = exp(rpnstack -> s[stptr]);
-               break;
-           case OP_LT:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] <
-                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
-               stptr--;
-               break;
-           case OP_LE:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] <=
-                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
-               stptr--;
-               break;
-           case OP_GT:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >
-                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
-               stptr--;
-               break;
-           case OP_GE:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                           rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] >=
-                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
-               stptr--;
-               break;
-           case OP_NE:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1]))
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] ==
-                                       rpnstack -> s[stptr] ? 0.0 : 1.0;
-               stptr--;
-               break;
-           case OP_EQ:
-               stackunderflow(1);
-               if (isnan(rpnstack -> s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack -> s[stptr]))
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr];
-               else
-                   rpnstack -> s[stptr-1] = rpnstack -> s[stptr-1] ==
-                                       rpnstack -> s[stptr] ? 1.0 : 0.0;
-               stptr--;
-               break;
-           case OP_IF:
-               stackunderflow(2);
-               rpnstack->s[stptr-2] = rpnstack->s[stptr-2] != 0.0 ?
-                               rpnstack->s[stptr-1] : rpnstack->s[stptr];
-               stptr--;
-               stptr--;
-               break;
-           case OP_MIN:
-               stackunderflow(1);
-               if (isnan(rpnstack->s[stptr-1])) 
-                   ;
-               else if (isnan(rpnstack->s[stptr]))
-                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
-               else if (rpnstack->s[stptr-1] > rpnstack->s[stptr])
-                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
-               stptr--;
-               break;
-           case OP_MAX:
-               stackunderflow(1);
-               if (isnan(rpnstack->s[stptr-1])) 
-               ;
-               else if (isnan(rpnstack->s[stptr]))
-                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
-               else if (rpnstack->s[stptr-1] < rpnstack->s[stptr])
-                   rpnstack->s[stptr-1] = rpnstack->s[stptr];
-               stptr--;
-               break;
-           case OP_LIMIT:
-               stackunderflow(2);
-               if (isnan(rpnstack->s[stptr-2])) 
-                   ;
-               else if (isnan(rpnstack->s[stptr-1]))
-                   rpnstack->s[stptr-2] = rpnstack->s[stptr-1];
-               else if (isnan(rpnstack->s[stptr]))
-                   rpnstack->s[stptr-2] = rpnstack->s[stptr];
-               else if (rpnstack->s[stptr-2] < rpnstack->s[stptr-1])
-                   rpnstack->s[stptr-2] = DNAN;
-               else if (rpnstack->s[stptr-2] > rpnstack->s[stptr])
-                   rpnstack->s[stptr-2] = DNAN;
-               stptr-=2;
-                       break;
-           case OP_UN:
-               stackunderflow(0);
-               rpnstack->s[stptr] = isnan(rpnstack->s[stptr]) ? 1.0 : 0.0;
-               break;
-           case OP_ISINF:
-               stackunderflow(0);
-               rpnstack->s[stptr] = isinf(rpnstack->s[stptr]) ? 1.0 : 0.0;
-               break;
-           case OP_SQRT:
-               stackunderflow(0);
-               rpnstack -> s[stptr] = sqrt(rpnstack -> s[stptr]);
-               break;
-           case OP_SORT:
-               stackunderflow(0);
-               {
-                   int spn = (int)rpnstack -> s[stptr--];
-
-                   stackunderflow(spn-1);
-                   qsort(rpnstack -> s + stptr-spn+1, spn, sizeof(double),
-                         rpn_compare_double);
-               }
-               break;
-           case OP_REV:
-               stackunderflow(0);
-               {
-                   int spn = (int)rpnstack -> s[stptr--];
-                   double *p, *q;
-
-                   stackunderflow(spn-1);
-
-                   p = rpnstack -> s + stptr-spn+1;
-                   q = rpnstack -> s + stptr;
-                   while (p < q) {
-                           double      x = *q;
-                           
-                           *q-- = *p;
-                           *p++ = x;
-                   }
-               }
-               break;
-           case OP_TREND:
-               stackunderflow(1);
-               if ((rpi < 2) || (rpnp[rpi-2].op != OP_VARIABLE)) {
-                   rrd_set_error("malformed trend arguments");
-                   return -1;
-               } else {
-                   time_t dur = (time_t)rpnstack -> s[stptr];
-                   time_t step = (time_t)rpnp[rpi-2].step;
-
-                   if (output_idx > (int)ceil((float)dur / (float)step)) {
-                       double accum = 0.0;
-                       int i = 0;
-               
-                       do {
-                           accum += rpnp[rpi-2].data[rpnp[rpi-2].ds_cnt * i--];
-                           dur -= step;
-                       } while (dur > 0);
-
-                       rpnstack -> s[--stptr] = (accum / -i);
-                   } else
-                       rpnstack -> s[--stptr] = DNAN;
-               }
-               break;
-           case OP_AVG:
-               stackunderflow(0);
-                {
-                   int i=(int)rpnstack -> s[stptr--];
-                   double sum=0;
-                   int count=0;
-                   stackunderflow(i-1);
-                   while(i>0) {
-                     double val=rpnstack -> s[stptr--];
-                     i--;
-                    if (isnan(val)) { continue; }
-                     count++;
-                     sum+=val;
-                   }
-                   /* now push the result back on stack */
-                   if (count>0) {
-                     rpnstack -> s[++stptr]=sum/count;
-                   } else {
-                     rpnstack -> s[++stptr]=DNAN;
-                   }
+        switch (rpnp[rpi].op) {
+        case OP_NUMBER:
+            rpnstack->s[++stptr] = rpnp[rpi].val;
+            break;
+        case OP_VARIABLE:
+        case OP_PREV_OTHER:
+            /* Sanity check: VDEFs shouldn't make it here */
+            if (rpnp[rpi].ds_cnt == 0) {
+                rrd_set_error("VDEF made it into rpn_calc... aborting");
+                return -1;
+            } else {
+                /* make sure we pull the correct value from
+                 * the *.data array. Adjust the pointer into
+                 * the array acordingly. Advance the ptr one
+                 * row in the rra (skip over non-relevant
+                 * data sources)
+                 */
+                if (rpnp[rpi].op == OP_VARIABLE) {
+                    rpnstack->s[++stptr] = *(rpnp[rpi].data);
+                } else {
+                    if ((output_idx) <= 0) {
+                        rpnstack->s[++stptr] = DNAN;
+                    } else {
+                        rpnstack->s[++stptr] =
+                            *(rpnp[rpi].data - rpnp[rpi].ds_cnt);
+                    }
+
                 }
-                break;
-            case OP_ABS:
-                stackunderflow(0);
-                rpnstack -> s[stptr] = fabs(rpnstack -> s[stptr]);
-                break;
-           case OP_END:
-               break;
-       }
+                if (data_idx % rpnp[rpi].step == 0) {
+                    rpnp[rpi].data += rpnp[rpi].ds_cnt;
+                }
+            }
+            break;
+        case OP_COUNT:
+            rpnstack->s[++stptr] = (output_idx + 1);    /* Note: Counter starts at 1 */
+            break;
+        case OP_PREV:
+            if ((output_idx) <= 0) {
+                rpnstack->s[++stptr] = DNAN;
+            } else {
+                rpnstack->s[++stptr] = output[output_idx - 1];
+            }
+            break;
+        case OP_UNKN:
+            rpnstack->s[++stptr] = DNAN;
+            break;
+        case OP_INF:
+            rpnstack->s[++stptr] = DINF;
+            break;
+        case OP_NEGINF:
+            rpnstack->s[++stptr] = -DINF;
+            break;
+        case OP_NOW:
+            rpnstack->s[++stptr] = (double) time(NULL);
+            break;
+        case OP_TIME:
+            /* HACK: this relies on the data_idx being the time,
+             ** which the within-function scope is unaware of */
+            rpnstack->s[++stptr] = (double) data_idx;
+            break;
+        case OP_LTIME:
+            rpnstack->s[++stptr] =
+                (double) tzoffset(data_idx) + (double) data_idx;
+            break;
+        case OP_ADD:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1]
+                + rpnstack->s[stptr];
+            stptr--;
+            break;
+        case OP_SUB:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1]
+                - rpnstack->s[stptr];
+            stptr--;
+            break;
+        case OP_MUL:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = (rpnstack->s[stptr - 1])
+                * (rpnstack->s[stptr]);
+            stptr--;
+            break;
+        case OP_DIV:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1]
+                / rpnstack->s[stptr];
+            stptr--;
+            break;
+        case OP_MOD:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = fmod(rpnstack->s[stptr - 1]
+                                          , rpnstack->s[stptr]);
+            stptr--;
+            break;
+        case OP_SIN:
+            stackunderflow(0);
+            rpnstack->s[stptr] = sin(rpnstack->s[stptr]);
+            break;
+        case OP_ATAN:
+            stackunderflow(0);
+            rpnstack->s[stptr] = atan(rpnstack->s[stptr]);
+            break;
+        case OP_RAD2DEG:
+            stackunderflow(0);
+            rpnstack->s[stptr] = 57.29577951 * rpnstack->s[stptr];
+            break;
+        case OP_DEG2RAD:
+            stackunderflow(0);
+            rpnstack->s[stptr] = 0.0174532952 * rpnstack->s[stptr];
+            break;
+        case OP_ATAN2:
+            stackunderflow(1);
+            rpnstack->s[stptr - 1] = atan2(rpnstack->s[stptr - 1],
+                                           rpnstack->s[stptr]);
+            stptr--;
+            break;
+        case OP_COS:
+            stackunderflow(0);
+            rpnstack->s[stptr] = cos(rpnstack->s[stptr]);
+            break;
+        case OP_CEIL:
+            stackunderflow(0);
+            rpnstack->s[stptr] = ceil(rpnstack->s[stptr]);
+            break;
+        case OP_FLOOR:
+            stackunderflow(0);
+            rpnstack->s[stptr] = floor(rpnstack->s[stptr]);
+            break;
+        case OP_LOG:
+            stackunderflow(0);
+            rpnstack->s[stptr] = log(rpnstack->s[stptr]);
+            break;
+        case OP_DUP:
+            stackunderflow(0);
+            rpnstack->s[stptr + 1] = rpnstack->s[stptr];
+            stptr++;
+            break;
+        case OP_POP:
+            stackunderflow(0);
+            stptr--;
+            break;
+        case OP_EXC:
+            stackunderflow(1);
+            {
+                double    dummy;
+
+                dummy = rpnstack->s[stptr];
+                rpnstack->s[stptr] = rpnstack->s[stptr - 1];
+                rpnstack->s[stptr - 1] = dummy;
+            }
+            break;
+        case OP_EXP:
+            stackunderflow(0);
+            rpnstack->s[stptr] = exp(rpnstack->s[stptr]);
+            break;
+        case OP_LT:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] <
+                    rpnstack->s[stptr] ? 1.0 : 0.0;
+            stptr--;
+            break;
+        case OP_LE:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] <=
+                    rpnstack->s[stptr] ? 1.0 : 0.0;
+            stptr--;
+            break;
+        case OP_GT:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] >
+                    rpnstack->s[stptr] ? 1.0 : 0.0;
+            stptr--;
+            break;
+        case OP_GE:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] >=
+                    rpnstack->s[stptr] ? 1.0 : 0.0;
+            stptr--;
+            break;
+        case OP_NE:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] ==
+                    rpnstack->s[stptr] ? 0.0 : 1.0;
+            stptr--;
+            break;
+        case OP_EQ:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr - 1] ==
+                    rpnstack->s[stptr] ? 1.0 : 0.0;
+            stptr--;
+            break;
+        case OP_IF:
+            stackunderflow(2);
+            rpnstack->s[stptr - 2] = rpnstack->s[stptr - 2] != 0.0 ?
+                rpnstack->s[stptr - 1] : rpnstack->s[stptr];
+            stptr--;
+            stptr--;
+            break;
+        case OP_MIN:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else if (rpnstack->s[stptr - 1] > rpnstack->s[stptr])
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            stptr--;
+            break;
+        case OP_MAX:
+            stackunderflow(1);
+            if (isnan(rpnstack->s[stptr - 1]));
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            else if (rpnstack->s[stptr - 1] < rpnstack->s[stptr])
+                rpnstack->s[stptr - 1] = rpnstack->s[stptr];
+            stptr--;
+            break;
+        case OP_LIMIT:
+            stackunderflow(2);
+            if (isnan(rpnstack->s[stptr - 2]));
+            else if (isnan(rpnstack->s[stptr - 1]))
+                rpnstack->s[stptr - 2] = rpnstack->s[stptr - 1];
+            else if (isnan(rpnstack->s[stptr]))
+                rpnstack->s[stptr - 2] = rpnstack->s[stptr];
+            else if (rpnstack->s[stptr - 2] < rpnstack->s[stptr - 1])
+                rpnstack->s[stptr - 2] = DNAN;
+            else if (rpnstack->s[stptr - 2] > rpnstack->s[stptr])
+                rpnstack->s[stptr - 2] = DNAN;
+            stptr -= 2;
+            break;
+        case OP_UN:
+            stackunderflow(0);
+            rpnstack->s[stptr] = isnan(rpnstack->s[stptr]) ? 1.0 : 0.0;
+            break;
+        case OP_ISINF:
+            stackunderflow(0);
+            rpnstack->s[stptr] = isinf(rpnstack->s[stptr]) ? 1.0 : 0.0;
+            break;
+        case OP_SQRT:
+            stackunderflow(0);
+            rpnstack->s[stptr] = sqrt(rpnstack->s[stptr]);
+            break;
+        case OP_SORT:
+            stackunderflow(0);
+            {
+                int       spn = (int) rpnstack->s[stptr--];
+
+                stackunderflow(spn - 1);
+                qsort(rpnstack->s + stptr - spn + 1, spn, sizeof(double),
+                      rpn_compare_double);
+            }
+            break;
+        case OP_REV:
+            stackunderflow(0);
+            {
+                int       spn = (int) rpnstack->s[stptr--];
+                double   *p, *q;
+
+                stackunderflow(spn - 1);
+
+                p = rpnstack->s + stptr - spn + 1;
+                q = rpnstack->s + stptr;
+                while (p < q) {
+                    double    x = *q;
+
+                    *q-- = *p;
+                    *p++ = x;
+                }
+            }
+            break;
+        case OP_TREND:
+            stackunderflow(1);
+            if ((rpi < 2) || (rpnp[rpi - 2].op != OP_VARIABLE)) {
+                rrd_set_error("malformed trend arguments");
+                return -1;
+            } else {
+                time_t    dur = (time_t) rpnstack->s[stptr];
+                time_t    step = (time_t) rpnp[rpi - 2].step;
+
+                if (output_idx > (int) ceil((float) dur / (float) step)) {
+                    double    accum = 0.0;
+                    int       i = 0;
+
+                    do {
+                        accum +=
+                            rpnp[rpi - 2].data[rpnp[rpi - 2].ds_cnt * i--];
+                        dur -= step;
+                    } while (dur > 0);
+
+                    rpnstack->s[--stptr] = (accum / -i);
+                } else
+                    rpnstack->s[--stptr] = DNAN;
+            }
+            break;
+        case OP_AVG:
+            stackunderflow(0);
+            {
+                int       i = (int) rpnstack->s[stptr--];
+                double    sum = 0;
+                int       count = 0;
+
+                stackunderflow(i - 1);
+                while (i > 0) {
+                    double    val = rpnstack->s[stptr--];
+
+                    i--;
+                    if (isnan(val)) {
+                        continue;
+                    }
+                    count++;
+                    sum += val;
+                }
+                /* now push the result back on stack */
+                if (count > 0) {
+                    rpnstack->s[++stptr] = sum / count;
+                } else {
+                    rpnstack->s[++stptr] = DNAN;
+                }
+            }
+            break;
+        case OP_ABS:
+            stackunderflow(0);
+            rpnstack->s[stptr] = fabs(rpnstack->s[stptr]);
+            break;
+        case OP_END:
+            break;
+        }
 #undef stackunderflow
-   }
-   if(stptr!=0){
-       rrd_set_error("RPN final stack size != 1");
-       return -1;
-   }
-   
-   output[output_idx] = rpnstack->s[0];
-   return 0;
+    }
+    if (stptr != 0) {
+        rrd_set_error("RPN final stack size != 1");
+        return -1;
+    }
+
+    output[output_idx] = rpnstack->s[0];
+    return 0;
 }
 
 /* figure out what the local timezone offset for any point in
    time was. Return it in seconds */
-int
-tzoffset( time_t now ){
-    int gm_sec, gm_min, gm_hour, gm_yday, gm_year,
+int tzoffset(
+    time_t now)
+{
+    int       gm_sec, gm_min, gm_hour, gm_yday, gm_year,
         l_sec, l_min, l_hour, l_yday, l_year;
     struct tm t;
-    int off;
+    int       off;
+
     gmtime_r(&now, &t);
     gm_sec = t.tm_sec;
     gm_min = t.tm_min;
@@ -819,12 +846,12 @@ tzoffset( time_t now ){
     l_hour = t.tm_hour;
     l_yday = t.tm_yday;
     l_year = t.tm_year;
-    off = (l_sec-gm_sec)+(l_min-gm_min)*60+(l_hour-gm_hour)*3600; 
-    if ( l_yday > gm_yday || l_year > gm_year){
-        off += 24*3600;
-    } else if ( l_yday < gm_yday || l_year < gm_year){
-        off -= 24*3600;
+    off =
+        (l_sec - gm_sec) + (l_min - gm_min) * 60 + (l_hour - gm_hour) * 3600;
+    if (l_yday > gm_yday || l_year > gm_year) {
+        off += 24 * 3600;
+    } else if (l_yday < gm_yday || l_year < gm_year) {
+        off -= 24 * 3600;
     }
-   return off;
+    return off;
 }
-
index 17264dc..516718c 100644 (file)
  * This is because COMPUTE (CDEF) DS store OP nodes by number (name is not
  * an option due to limited par array size). OP nodes must have the same
  * numeric values, otherwise the stored numbers will mean something different. */
-enum op_en {OP_NUMBER=0,OP_VARIABLE,OP_INF,OP_PREV,OP_NEGINF,
-           OP_UNKN,OP_NOW,OP_TIME,OP_ADD,OP_MOD,OP_SUB,OP_MUL,
-           OP_DIV,OP_SIN, OP_DUP, OP_EXC, OP_POP,
-           OP_COS,OP_LOG,OP_EXP,OP_LT,OP_LE,OP_GT,OP_GE,OP_EQ,OP_IF,
-           OP_MIN,OP_MAX,OP_LIMIT, OP_FLOOR, OP_CEIL,
-           OP_UN,OP_END,OP_LTIME,OP_NE,OP_ISINF,OP_PREV_OTHER,OP_COUNT,
-           OP_ATAN,OP_SQRT,OP_SORT,OP_REV,OP_TREND,
-           OP_ATAN2,OP_RAD2DEG,OP_DEG2RAD,
-           OP_AVG,OP_ABS};
+enum op_en { OP_NUMBER = 0, OP_VARIABLE, OP_INF, OP_PREV, OP_NEGINF,
+    OP_UNKN, OP_NOW, OP_TIME, OP_ADD, OP_MOD, OP_SUB, OP_MUL,
+    OP_DIV, OP_SIN, OP_DUP, OP_EXC, OP_POP,
+    OP_COS, OP_LOG, OP_EXP, OP_LT, OP_LE, OP_GT, OP_GE, OP_EQ, OP_IF,
+    OP_MIN, OP_MAX, OP_LIMIT, OP_FLOOR, OP_CEIL,
+    OP_UN, OP_END, OP_LTIME, OP_NE, OP_ISINF, OP_PREV_OTHER, OP_COUNT,
+    OP_ATAN, OP_SQRT, OP_SORT, OP_REV, OP_TREND,
+    OP_ATAN2, OP_RAD2DEG, OP_DEG2RAD,
+    OP_AVG, OP_ABS
+};
 
 typedef struct rpnp_t {
-    enum op_en   op;
-    double val; /* value for a OP_NUMBER */
-    long ptr; /* pointer into the gdes array for OP_VAR */
-    double *data; /* pointer to the current value from OP_VAR DAS*/
-    long ds_cnt;   /* data source count for data pointer */
-    long step; /* time step for OP_VAR das */
+    enum op_en op;
+    double    val;      /* value for a OP_NUMBER */
+    long      ptr;      /* pointer into the gdes array for OP_VAR */
+    double   *data;     /* pointer to the current value from OP_VAR DAS */
+    long      ds_cnt;   /* data source count for data pointer */
+    long      step;     /* time step for OP_VAR das */
 } rpnp_t;
 
 /* a compact representation of rpnp_t for computed data sources */
 typedef struct rpn_cdefds_t {
-    char op;  /* rpn operator type */
-    short val; /* used by OP_NUMBER and OP_VARIABLE */
+    char      op;       /* rpn operator type */
+    short     val;      /* used by OP_NUMBER and OP_VARIABLE */
 } rpn_cdefds_t;
 
 /* limit imposed by sizeof(rpn_cdefs_t) and rrd.ds_def.par */
-#define DS_CDEF_MAX_RPN_NODES 26 
+#define DS_CDEF_MAX_RPN_NODES 26
 
 typedef struct rpnstack_t {
-    double *s;
-    long dc_stacksize;
-    long dc_stackblock;
+    double   *s;
+    long      dc_stacksize;
+    long      dc_stackblock;
 } rpnstack_t;
 
-void rpnstack_init(rpnstack_t *rpnstack);
-void rpnstack_free(rpnstack_t *rpnstack);
+void      rpnstack_init(
+    rpnstack_t * rpnstack);
+void      rpnstack_free(
+    rpnstack_t * rpnstack);
 
-void parseCDEF_DS(const char *def, rrd_t *rrd, int ds_idx);
-long lookup_DS(void *rrd_vptr, char *ds_name);
+void      parseCDEF_DS(
+    const char *def,
+    rrd_t *rrd,
+    int ds_idx);
+long      lookup_DS(
+    void *rrd_vptr,
+    char *ds_name);
 
-short rpn_compact(rpnp_t *rpnp,rpn_cdefds_t **rpnc,short *count);
-rpnp_t * rpn_expand(rpn_cdefds_t *rpnc);
-void rpn_compact2str(rpn_cdefds_t *rpnc,ds_def_t *ds_def,char **str);
-rpnp_t * rpn_parse(void *key_hash,const char *const expr, long (*lookup)(void *,char *));
-short rpn_calc(rpnp_t *rpnp, rpnstack_t *rpnstack, long data_idx, rrd_value_t *output, int output_idx);
+short     rpn_compact(
+    rpnp_t * rpnp,
+    rpn_cdefds_t ** rpnc,
+    short *count);
+rpnp_t   *rpn_expand(
+    rpn_cdefds_t * rpnc);
+void      rpn_compact2str(
+    rpn_cdefds_t * rpnc,
+    ds_def_t * ds_def,
+    char **str);
+rpnp_t   *rpn_parse(
+    void *key_hash,
+    const char *const expr,
+    long      (*lookup) (void *,
+                         char *));
+short     rpn_calc(
+    rpnp_t * rpnp,
+    rpnstack_t * rpnstack,
+    long data_idx,
+    rrd_value_t * output,
+    int output_idx);
 
 #endif
index 189b579..4bd9e5b 100644 (file)
@@ -6,65 +6,68 @@
 
 #include "rrd_tool.h"
 
-XXX: This file is not compiled. Is this on purpose?
+XXX:This file is not compiled.Is this on purpose ? extern char *tzname[2];
 
-extern char *tzname[2];
+stat_node rrd_stat(
+    int argc,
+    char **argv)
+{
+    int       i, ii, ix, iii = 0;
+    time_t    now;
+    char      somestring[255];
+    rrd_value_t my_cdp;
+    long      rra_base, rra_start, rra_next;
+    rrd_t     rrd;
+    rrd_file_t *rrd_file;
 
-stat_node
-rrd_stat(int argc, char **argv)    
-{   
-    int          i,ii,ix,iii=0;
-    time_t       now;
-    char         somestring[255];
-    rrd_value_t  my_cdp;
-    long         rra_base, rra_start, rra_next;
-    rrd_t             rrd;
-    rrd_file_t  *rrd_file;
 
-
-    rrd_file = rrd_open(argv[1],&rrd, RRD_READONLY);
+    rrd_file = rrd_open(argv[1], &rrd, RRD_READONLY);
     if (rrd_file == NULL) {
-       return(-1);
+        return (-1);
     }
     puts("<!-- Round Robin Database Dump -->");
     puts("<rrd>");
-    printf("\t<version> %s </version>\n",rrd.stat_head->version);
-    printf("\t<step> %lu </step> <!-- Seconds -->\n",rrd.stat_head->pdp_step);
+    printf("\t<version> %s </version>\n", rrd.stat_head->version);
+    printf("\t<step> %lu </step> <!-- Seconds -->\n",
+           rrd.stat_head->pdp_step);
 #if HAVE_STRFTIME
-    strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z",
-            localtime_r(&rrd.live_head->last_up, &tm));
+    strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z",
+             localtime_r(&rrd.live_head->last_up, &tm));
 #else
 # error "Need strftime"
 #endif
     printf("\t<lastupdate> %ld </lastupdate> <!-- %s -->\n\n",
-          rrd.live_head->last_up,somestring);
-    for(i=0;i<rrd.stat_head->ds_cnt;i++){
-       printf("\t<ds>\n");
-       printf("\t\t<name> %s </name>\n",rrd.ds_def[i].ds_nam);
-       printf("\t\t<type> %s </type>\n",rrd.ds_def[i].dst);
-       printf("\t\t<minimal_heartbeat> %lu </minimal_heartbeat>\n",
-              rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
-       if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)){
-         printf("\t\t<min> NaN </min>\n");
-       } else {
-         printf("\t\t<min> %0.10e </min>\n",rrd.ds_def[i].par[DS_min_val].u_val);
-       }
-       if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)){
-         printf("\t\t<max> NaN </max>\n");
-       } else {
-         printf("\t\t<max> %0.10e </max>\n",rrd.ds_def[i].par[DS_max_val].u_val);
-       }
-       printf("\n\t\t<!-- PDP Status -->\n");
-       printf("\t\t<last_ds> %s </last_ds>\n",rrd.pdp_prep[i].last_ds);
-       if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)){
-         printf("\t\t<value> NaN </value>\n");
-       } else {
-         printf("\t\t<value> %0.10e </value>\n",rrd.pdp_prep[i].scratch[PDP_val].u_val);
-       }
-       printf("\t\t<unknown_sec> %lu </unknown_sec>\n",
-              rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
-       
-       printf("\t</ds>\n\n");
+           rrd.live_head->last_up, somestring);
+    for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+        printf("\t<ds>\n");
+        printf("\t\t<name> %s </name>\n", rrd.ds_def[i].ds_nam);
+        printf("\t\t<type> %s </type>\n", rrd.ds_def[i].dst);
+        printf("\t\t<minimal_heartbeat> %lu </minimal_heartbeat>\n",
+               rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
+        if (isnan(rrd.ds_def[i].par[DS_min_val].u_val)) {
+            printf("\t\t<min> NaN </min>\n");
+        } else {
+            printf("\t\t<min> %0.10e </min>\n",
+                   rrd.ds_def[i].par[DS_min_val].u_val);
+        }
+        if (isnan(rrd.ds_def[i].par[DS_max_val].u_val)) {
+            printf("\t\t<max> NaN </max>\n");
+        } else {
+            printf("\t\t<max> %0.10e </max>\n",
+                   rrd.ds_def[i].par[DS_max_val].u_val);
+        }
+        printf("\n\t\t<!-- PDP Status -->\n");
+        printf("\t\t<last_ds> %s </last_ds>\n", rrd.pdp_prep[i].last_ds);
+        if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)) {
+            printf("\t\t<value> NaN </value>\n");
+        } else {
+            printf("\t\t<value> %0.10e </value>\n",
+                   rrd.pdp_prep[i].scratch[PDP_val].u_val);
+        }
+        printf("\t\t<unknown_sec> %lu </unknown_sec>\n",
+               rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+
+        printf("\t</ds>\n\n");
     }
 
     puts("<!-- Round Robin Archives -->");
@@ -72,77 +75,77 @@ rrd_stat(int argc, char **argv)
     rra_base = rrd_file->header_len;
     rra_next = rra_base;
 
-    for(i=0;i<rrd.stat_head->rra_cnt;i++){
-       
-       long timer=0;
-       rra_start= rra_next;
-       rra_next +=  ( rrd.stat_head->ds_cnt
-                      * rrd.rra_def[i].row_cnt
-                      * sizeof(rrd_value_t));
-       printf("\t<rra>\n");
-       printf("\t\t<cf> %s </cf>\n",rrd.rra_def[i].cf_nam);
-       printf("\t\t<pdp_per_row> %lu </pdp_per_row> <!-- %lu seconds -->\n\n",
-              rrd.rra_def[i].pdp_cnt, rrd.rra_def[i].pdp_cnt
-              *rrd.stat_head->pdp_step);
-       printf("\t\t<cdp_prep>\n");
-       for(ii=0;ii<rrd.stat_head->ds_cnt;ii++){
-           double value = rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_val].u_val;
-           printf("\t\t\t<ds>");       
-           if (isnan(value)){
-             printf("<value> NaN </value>");
-           } else {
-             printf("<value> %0.10e </value>", value);
-           }
-           printf("  <unknown_datapoints> %lu </unknown_datapoints>",
-                   rrd.cdp_prep[i*rrd.stat_head->ds_cnt+ii].scratch[CDP_unkn_pdp_cnt].u_cnt);
-          printf("</ds>\n");    
+    for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
+
+        long      timer = 0;
+
+        rra_start = rra_next;
+        rra_next += (rrd.stat_head->ds_cnt
+                     * rrd.rra_def[i].row_cnt * sizeof(rrd_value_t));
+        printf("\t<rra>\n");
+        printf("\t\t<cf> %s </cf>\n", rrd.rra_def[i].cf_nam);
+        printf
+            ("\t\t<pdp_per_row> %lu </pdp_per_row> <!-- %lu seconds -->\n\n",
+             rrd.rra_def[i].pdp_cnt,
+             rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step);
+        printf("\t\t<cdp_prep>\n");
+        for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) {
+            double    value =
+                rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                             ii].scratch[CDP_val].u_val;
+            printf("\t\t\t<ds>");
+            if (isnan(value)) {
+                printf("<value> NaN </value>");
+            } else {
+                printf("<value> %0.10e </value>", value);
+            }
+            printf("  <unknown_datapoints> %lu </unknown_datapoints>",
+                   rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                ii].scratch[CDP_unkn_pdp_cnt].u_cnt);
+            printf("</ds>\n");
         }
-       printf("\t\t</cdp_prep>\n");
+        printf("\t\t</cdp_prep>\n");
 
-       printf("\t\t<database>\n");
-       rrd_seek(rrd_file,(rra_start
-                      +(rrd.rra_ptr[i].cur_row+1)
-                      * rrd.stat_head->ds_cnt
-                      * sizeof(rrd_value_t)),SEEK_SET);
-       timer = - (rrd.rra_def[i].row_cnt-1);
-       ii=rrd.rra_ptr[i].cur_row;
-       for(ix=0;ix<rrd.rra_def[i].row_cnt;ix++){           
-           ii++;
-           if (ii>=rrd.rra_def[i].row_cnt) {
-               rrd_seek(rrd_file,rra_start,SEEK_SET);
-               ii=0; /* wrap if max row cnt is reached */
-           }
-           now = (rrd.live_head->last_up 
-                  - rrd.live_head->last_up 
-                  % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step)) 
-               + (timer*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
+        printf("\t\t<database>\n");
+        rrd_seek(rrd_file, (rra_start + (rrd.rra_ptr[i].cur_row + 1)
+                            * rrd.stat_head->ds_cnt
+                            * sizeof(rrd_value_t)), SEEK_SET);
+        timer = -(rrd.rra_def[i].row_cnt - 1);
+        ii = rrd.rra_ptr[i].cur_row;
+        for (ix = 0; ix < rrd.rra_def[i].row_cnt; ix++) {
+            ii++;
+            if (ii >= rrd.rra_def[i].row_cnt) {
+                rrd_seek(rrd_file, rra_start, SEEK_SET);
+                ii = 0; /* wrap if max row cnt is reached */
+            }
+            now = (rrd.live_head->last_up
+                   - rrd.live_head->last_up
+                   % (rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step))
+                + (timer * rrd.rra_def[i].pdp_cnt * rrd.stat_head->pdp_step);
 
-           timer++;
+            timer++;
 #if HAVE_STRFTIME
-           strftime(somestring,200,"%Y-%m-%d %H:%M:%S %Z", localtime_r(&now, &tm));
+            strftime(somestring, 200, "%Y-%m-%d %H:%M:%S %Z",
+                     localtime_r(&now, &tm));
 #else
 # error "Need strftime"
 #endif
-           printf("\t\t\t<!-- %s --> <row>",somestring);
-           for(iii=0;iii<rrd.stat_head->ds_cnt;iii++){                  
-               rrd_read(rrd_file,&my_cdp,sizeof(rrd_value_t)*1);
-               if (isnan(my_cdp)){
-                 printf("<v> NaN </v>");
-               } else {
-                 printf("<v> %0.10e </v>",my_cdp);
-               };
-           }
-           printf("</row>\n");
-       }
-       printf("\t\t</database>\n\t</rra>\n");
-       
+            printf("\t\t\t<!-- %s --> <row>", somestring);
+            for (iii = 0; iii < rrd.stat_head->ds_cnt; iii++) {
+                rrd_read(rrd_file, &my_cdp, sizeof(rrd_value_t) * 1);
+                if (isnan(my_cdp)) {
+                    printf("<v> NaN </v>");
+                } else {
+                    printf("<v> %0.10e </v>", my_cdp);
+                };
+            }
+            printf("</row>\n");
+        }
+        printf("\t\t</database>\n\t</rra>\n");
+
     }
     printf("</rrd>\n");
     rrd_free(&rrd);
     close(rrd_file->fd);
-    return(0);
+    return (0);
 }
-
-
-
-
index 4714327..074a873 100644 (file)
@@ -24,49 +24,60 @@ static pthread_once_t context_key_once = PTHREAD_ONCE_INIT;
 /* Free the thread-specific rrd_context - we might actually use
    rrd_free_context instead...
  */
-static void context_destroy_context(void *ctx_)
+static void context_destroy_context(
+    void *ctx_)
 {
     struct rrd_context *ctx = ctx_;
-    if (ctx) rrd_free_context(ctx);
+
+    if (ctx)
+        rrd_free_context(ctx);
 }
 
 /* Allocate the key */
-static void context_get_key()
+static void context_get_key(
+    )
 {
     pthread_key_create(&context_key, context_destroy_context);
 }
 
-struct rrd_context *rrd_get_context(void) {
+struct rrd_context *rrd_get_context(
+    void)
+{
     struct rrd_context *ctx;
 
     pthread_once(&context_key_once, context_get_key);
     ctx = pthread_getspecific(context_key);
     if (!ctx) {
-       ctx = rrd_new_context();
-       pthread_setspecific(context_key, ctx);
-    } 
+        ctx = rrd_new_context();
+        pthread_setspecific(context_key, ctx);
+    }
     return ctx;
 }
 
 #ifdef HAVE_STRERROR_R
-const char *rrd_strerror(int err) {
+const char *rrd_strerror(
+    int err)
+{
     struct rrd_context *ctx = rrd_get_context();
-    if (strerror_r(err, ctx->lib_errstr, ctx->errlen)) 
-         return "strerror_r failed. sorry!"; 
-    else 
-         return ctx->lib_errstr; 
+
+    if (strerror_r(err, ctx->lib_errstr, ctx->errlen))
+        return "strerror_r failed. sorry!";
+    else
+        return ctx->lib_errstr;
 }
 #else
 #undef strerror
-const char *rrd_strerror(int err) {
+const char *rrd_strerror(
+    int err)
+{
     static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
     struct rrd_context *ctx;
+
     ctx = rrd_get_context();
     pthread_mutex_lock(&mtx);
     strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
-    ctx->lib_errstr[ctx->errlen]='\0';
+    ctx->lib_errstr[ctx->errlen] = '\0';
     pthread_mutex_unlock(&mtx);
     return ctx->lib_errstr;
 }
 #endif
-
index 53ebda3..4786f2c 100644 (file)
@@ -18,7 +18,7 @@
 
 /* Key for the thread-specific rrd_context */
 static DWORD context_key;
-static CRITICAL_SECTION CriticalSection; 
+static CRITICAL_SECTION CriticalSection;
 
 
 /* Once-only initialisation of the key */
@@ -28,89 +28,112 @@ static DWORD context_key_once = 0;
 /* Free the thread-specific rrd_context - we might actually use
    rrd_free_context instead...
  */
-static void context_destroy_context(void)
+static void context_destroy_context(
+    void)
 {
-       DeleteCriticalSection(&CriticalSection);
+    DeleteCriticalSection(&CriticalSection);
     TlsFree(context_key);
-       context_key_once=0;
+    context_key_once = 0;
 }
-static void context_init_context(void)
+static void context_init_context(
+    void)
 {
-       if (!InterlockedExchange(&context_key_once, 1)) {
-               context_key = TlsAlloc();
-               InitializeCriticalSection(&CriticalSection);
-               atexit(context_destroy_context);
-       }
+    if (!InterlockedExchange(&context_key_once, 1)) {
+        context_key = TlsAlloc();
+        InitializeCriticalSection(&CriticalSection);
+        atexit(context_destroy_context);
+    }
 }
-struct rrd_context *rrd_get_context(void) {
+struct rrd_context *rrd_get_context(
+    void)
+{
     struct rrd_context *ctx;
-               
-       context_init_context();
+
+    context_init_context();
+
     ctx = TlsGetValue(context_key);
     if (!ctx) {
-               ctx = rrd_new_context();
-               TlsSetValue(context_key, ctx);
-    } 
+        ctx = rrd_new_context();
+        TlsSetValue(context_key, ctx);
+    }
     return ctx;
 }
+
 #undef strerror
-const char *rrd_strerror(int err) {
+const char *rrd_strerror(
+    int err)
+{
     struct rrd_context *ctx;
-       context_init_context();
 
-       ctx = rrd_get_context();
+    context_init_context();
+
+    ctx = rrd_get_context();
 
-    EnterCriticalSection(&CriticalSection); 
+    EnterCriticalSection(&CriticalSection);
     strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
     ctx->lib_errstr[ctx->errlen] = '\0';
-    LeaveCriticalSection(&CriticalSection); 
+    LeaveCriticalSection(&CriticalSection);
 
     return ctx->lib_errstr;
 }
+
 /*
  * there much be a re-entrant version of these somewhere in win32 land
  */
-struct tm* localtime_r(const time_t *timep, struct tm* result)
+struct tm *localtime_r(
+    const time_t *timep,
+    struct tm *result)
 {
-       struct tm *local;
-       context_init_context();
-
-       EnterCriticalSection(&CriticalSection);
-       local = localtime(timep);
-       memcpy(result,local,sizeof(struct tm));
-       LeaveCriticalSection(&CriticalSection);
-       return result;
+    struct tm *local;
+
+    context_init_context();
+
+    EnterCriticalSection(&CriticalSection);
+    local = localtime(timep);
+    memcpy(result, local, sizeof(struct tm));
+    LeaveCriticalSection(&CriticalSection);
+    return result;
 }
-char* ctime_r(const time_t *timep, char* result)
+
+char     *ctime_r(
+    const time_t *timep,
+    char *result)
 {
-       char *local;
-       context_init_context();
-
-       EnterCriticalSection(&CriticalSection);
-       local = ctime(timep);
-       strcpy(result,local);
-       LeaveCriticalSection(&CriticalSection);
-       return result;
+    char     *local;
+
+    context_init_context();
+
+    EnterCriticalSection(&CriticalSection);
+    local = ctime(timep);
+    strcpy(result, local);
+    LeaveCriticalSection(&CriticalSection);
+    return result;
 }
 
-struct tm* gmtime_r(const time_t *timep, struct tm* result)
+struct tm *gmtime_r(
+    const time_t *timep,
+    struct tm *result)
 {
-       struct tm *local;
-       context_init_context();
-
-       EnterCriticalSection(&CriticalSection);
-       local = gmtime(timep);
-       memcpy(result,local,sizeof(struct tm));
-       LeaveCriticalSection(&CriticalSection);
-       return result;
+    struct tm *local;
+
+    context_init_context();
+
+    EnterCriticalSection(&CriticalSection);
+    local = gmtime(timep);
+    memcpy(result, local, sizeof(struct tm));
+    LeaveCriticalSection(&CriticalSection);
+    return result;
 }
 
 /* implementation from Apache's APR library */
-char *strtok_r(char *str, const char *sep, char **last)
+char     *strtok_r(
+    char *str,
+    const char *sep,
+    char **last)
 {
-    char *token;
-       context_init_context();
+    char     *token;
+
+    context_init_context();
 
 
     if (!str)           /* subsequent call */
@@ -130,7 +153,7 @@ char *strtok_r(char *str, const char *sep, char **last)
      */
     *last = token + 1;
     while (**last && !strchr(sep, **last))
-        ++*last;
+        ++ * last;
 
     if (**last) {
         **last = '\0';
@@ -139,4 +162,3 @@ char *strtok_r(char *str, const char *sep, char **last)
 
     return token;
 }
-
index f1eb116..ba561ce 100644 (file)
 #include "rrd_tool.h"
 #include "rrd_xport.h"
 
-void PrintUsage(char *cmd);
-int CountArgs(char *aLine);
-int CreateArgs(char *, char *, int, char **);
-int HandleInputLine(int, char **, FILE*);
-int RemoteMode=0;
-int ChangeRoot=0;
+void      PrintUsage(
+    char *cmd);
+int       CountArgs(
+    char *aLine);
+int       CreateArgs(
+    char *,
+    char *,
+    int,
+    char **);
+int       HandleInputLine(
+    int,
+    char **,
+    FILE *);
+int       RemoteMode = 0;
+int       ChangeRoot = 0;
+
 #define TRUE           1
 #define FALSE          0
 #define MAX_LENGTH     10000
 
 
-void PrintUsage(char *cmd)
+void PrintUsage(
+    char *cmd)
 {
 
-    char help_main[] =
-          "RRDtool " PACKAGE_VERSION "  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n"
-           "               Compiled " __DATE__ " " __TIME__ "\n\n"
-          "Usage: rrdtool [options] command command_options\n\n";
-
-    char help_list[] =
-          "Valid commands: create, update, updatev, graph, dump, restore,\n"
-          "\t\tlast, lastupdate, first, info, fetch, tune,\n"
-          "\t\tresize, xport\n\n";
-
-    char help_listremote[] =
-           "Valid remote commands: quit, ls, cd, mkdir, pwd\n\n";
-
-
-    char help_create[] =
-          "* create - create a new RRD\n\n"
-          "\trrdtool create filename [--start|-b start time]\n"
-          "\t\t[--step|-s step]\n"
-          "\t\t[DS:ds-name:DST:dst arguments]\n" 
-          "\t\t[RRA:CF:cf arguments]\n\n";
-
-    char help_dump[] =
-          "* dump - dump an RRD to XML\n\n"
-          "\trrdtool dump filename.rrd >filename.xml\n\n";
-
-    char help_info[] =
-          "* info - returns the configuration and status of the RRD\n\n"
-          "\trrdtool info filename.rrd\n\n";
-
-    char help_restore[] =
-          "* restore - restore an RRD file from its XML form\n\n"
-          "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n";
-
-    char help_last[] =
-           "* last - show last update time for RRD\n\n"
-           "\trrdtool last filename.rrd\n\n";
-
-    char help_lastupdate[] =
-          "* lastupdate - returns the most recent datum stored for\n"
-          "  each DS in an RRD\n\n"
-          "\trrdtool lastupdate filename.rrd\n\n"; 
-
-    char help_first[] =
-           "* first - show first update time for RRA within an RRD\n\n"
-           "\trrdtool first filename.rrd [--rraindex number]\n\n";
-
-    char help_update[] =
-          "* update - update an RRD\n\n"
-          "\trrdtool update filename\n"
-          "\t\t--template|-t ds-name:ds-name:...\n"
-          "\t\ttime|N:value[:value...]\n\n"
-           "\t\tat-time@value[:value...]\n\n"
-          "\t\t[ time:value[:value...] ..]\n\n";
-    
-       char help_updatev[] =
-          "* updatev - a verbose version of update\n"
-          "\treturns information about values, RRAs, and datasources updated\n\n"
-          "\trrdtool updatev filename\n"
-          "\t\t--template|-t ds-name:ds-name:...\n"
-          "\t\ttime|N:value[:value...]\n\n"
-           "\t\tat-time@value[:value...]\n\n"
-          "\t\t[ time:value[:value...] ..]\n\n";
-    char help_fetch[] =
-          "* fetch - fetch data out of an RRD\n\n"
-          "\trrdtool fetch filename.rrd CF\n"
-          "\t\t[-r|--resolution resolution]\n"
-          "\t\t[-s|--start start] [-e|--end end]\n\n";
+    char      help_main[] =
+        "RRDtool " PACKAGE_VERSION
+        "  Copyright 1997-2007 by Tobias Oetiker <tobi@oetiker.ch>\n"
+        "               Compiled " __DATE__ " " __TIME__ "\n\n"
+        "Usage: rrdtool [options] command command_options\n\n";
+
+    char      help_list[] =
+        "Valid commands: create, update, updatev, graph, dump, restore,\n"
+        "\t\tlast, lastupdate, first, info, fetch, tune,\n"
+        "\t\tresize, xport\n\n";
+
+    char      help_listremote[] =
+        "Valid remote commands: quit, ls, cd, mkdir, pwd\n\n";
+
+
+    char      help_create[] =
+        "* create - create a new RRD\n\n"
+        "\trrdtool create filename [--start|-b start time]\n"
+        "\t\t[--step|-s step]\n"
+        "\t\t[DS:ds-name:DST:dst arguments]\n"
+        "\t\t[RRA:CF:cf arguments]\n\n";
+
+    char      help_dump[] =
+        "* dump - dump an RRD to XML\n\n"
+        "\trrdtool dump filename.rrd >filename.xml\n\n";
+
+    char      help_info[] =
+        "* info - returns the configuration and status of the RRD\n\n"
+        "\trrdtool info filename.rrd\n\n";
+
+    char      help_restore[] =
+        "* restore - restore an RRD file from its XML form\n\n"
+        "\trrdtool restore [--range-check|-r] [--force-overwrite|-f] filename.xml filename.rrd\n\n";
+
+    char      help_last[] =
+        "* last - show last update time for RRD\n\n"
+        "\trrdtool last filename.rrd\n\n";
+
+    char      help_lastupdate[] =
+        "* lastupdate - returns the most recent datum stored for\n"
+        "  each DS in an RRD\n\n" "\trrdtool lastupdate filename.rrd\n\n";
+
+    char      help_first[] =
+        "* first - show first update time for RRA within an RRD\n\n"
+        "\trrdtool first filename.rrd [--rraindex number]\n\n";
+
+    char      help_update[] =
+        "* update - update an RRD\n\n"
+        "\trrdtool update filename\n"
+        "\t\t--template|-t ds-name:ds-name:...\n"
+        "\t\ttime|N:value[:value...]\n\n"
+        "\t\tat-time@value[:value...]\n\n"
+        "\t\t[ time:value[:value...] ..]\n\n";
+
+    char      help_updatev[] =
+        "* updatev - a verbose version of update\n"
+        "\treturns information about values, RRAs, and datasources updated\n\n"
+        "\trrdtool updatev filename\n"
+        "\t\t--template|-t ds-name:ds-name:...\n"
+        "\t\ttime|N:value[:value...]\n\n"
+        "\t\tat-time@value[:value...]\n\n"
+        "\t\t[ time:value[:value...] ..]\n\n";
+
+    char      help_fetch[] =
+        "* fetch - fetch data out of an RRD\n\n"
+        "\trrdtool fetch filename.rrd CF\n"
+        "\t\t[-r|--resolution resolution]\n"
+        "\t\t[-s|--start start] [-e|--end end]\n\n";
 
 /* break up very large strings (help_graph, help_tune) for ISO C89 compliance*/
 
-    char help_graph1[] =
-          "* graph - generate a graph from one or several RRD\n\n"
-          "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
-          "\t\t[-x|--x-grid x-axis grid and label]\n"
-          "\t\t[-Y|--alt-y-grid]\n"
-          "\t\t[-y|--y-grid y-axis grid and label]\n"
-          "\t\t[-v|--vertical-label string] [-w|--width pixels]\n"
-          "\t\t[-h|--height pixels] [-o|--logarithmic]\n"
-          "\t\t[-u|--upper-limit value] [-z|--lazy]\n"
-          "\t\t[-l|--lower-limit value] [-r|--rigid]\n"
-           "\t\t[-g|--no-legend]\n"
-          "\t\t[-F|--force-rules-legend]\n"
-           "\t\t[-j|--only-graph]\n";
-    char help_graph2[] =
-          "\t\t[-n|--font FONTTAG:size:font]\n"
-           "\t\t[-m|--zoom factor]\n"       
-          "\t\t[-A|--alt-autoscale]\n"
-          "\t\t[-M|--alt-autoscale-max]\n"
-          "\t\t[-R|--font-render-mode {normal,light,mono}]\n"
-          "\t\t[-B|--font-smoothing-threshold size]\n"
-          "\t\t[-E|--slope-mode]\n"
-          "\t\t[-N|--no-gridfit]\n"
-          "\t\t[-X|--units-exponent value]\n"
-          "\t\t[-L|--units-length value]\n"
-          "\t\t[-S|--step seconds]\n"     
-          "\t\t[-f|--imginfo printfstr]\n"
-          "\t\t[-a|--imgformat PNG]\n"
-          "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
-          "\t\t[-W|--watermark string]\n"
-          "\t\t[DEF:vname=rrd:ds-name:CF]\n";
-    char help_graph3[] =
-          "\t\t[CDEF:vname=rpn-expression]\n"
-          "\t\t[VDEF:vdefname=rpn-expression]\n"
-          "\t\t[PRINT:vdefname:format]\n"
-          "\t\t[GPRINT:vdefname:format]\n"
-          "\t\t[COMMENT:text]\n"
-          "\t\t[SHIFT:vname:offset]\n"
-          "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n"
-          "\t\t[HRULE:value#rrggbb[aa][:legend]]\n"
-          "\t\t[VRULE:value#rrggbb[aa][:legend]]\n"
-          "\t\t[LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
-          "\t\t[AREA:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
-          "\t\t[PRINT:vname:CF:format] (deprecated)\n"
-          "\t\t[GPRINT:vname:CF:format] (deprecated)\n"
-          "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n";
-
-    char help_tune1[] =
-          " * tune -  Modify some basic properties of an RRD\n\n"
-          "\trrdtool tune filename\n"
-          "\t\t[--heartbeat|-h ds-name:heartbeat]\n"
-          "\t\t[--data-source-type|-d ds-name:DST]\n"
-          "\t\t[--data-source-rename|-r old-name:new-name]\n"
-          "\t\t[--minimum|-i ds-name:min] [--maximum|-a ds-name:max]\n"
-          "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
-          "\t\t[--failure-threshold integer]\n"
-          "\t\t[--window-length integer]\n"
-          "\t\t[--alpha adaptation-parameter]\n";
-    char help_tune2[] =
-          " * tune -  Modify some basic properties of an RRD\n\n"
-          "\t\t[--beta adaptation-parameter]\n"
-          "\t\t[--gamma adaptation-parameter]\n"
-          "\t\t[--gamma-deviation adaptation-parameter]\n"
-          "\t\t[--aberrant-reset ds-name]\n\n";
-
-    char help_resize[] =
-          " * resize - alter the length of one of the RRAs in an RRD\n\n"
-          "\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
-
-    char help_xport[] =
-          "* xport - generate XML dump from one or several RRD\n\n"
-          "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n"
-          "\t\t[-m|--maxrows rows]\n"
-          "\t\t[--step seconds]\n"        
-          "\t\t[--enumds]\n"      
-          "\t\t[DEF:vname=rrd:ds-name:CF]\n"
-          "\t\t[CDEF:vname=rpn-expression]\n"
-           "\t\t[XPORT:vname:legend]\n\n";
-
-    char help_quit[] =
-          " * quit - closing a session in remote mode\n\n"
-          "\trrdtool quit\n\n";
-
-    char help_ls[] =
-          " * ls - lists all *.rrd files in current directory\n\n"
-          "\trrdtool ls\n\n";
-
-    char help_cd[] =
-          " * cd - changes the current directory\n\n"
-          "\trrdtool cd new directory\n\n";
-
-    char help_mkdir[] =
-          " * mkdir - creates a new directory\n\n"
-          "\trrdtool mkdir newdirectoryname\n\n";
-
-    char help_pwd[] =
-          " * pwd - returns the current working directory\n\n"
-          "\trrdtool pwd\n\n";
-
-    char help_lic[] =
-          "RRDtool is distributed under the Terms of the GNU General\n"
-          "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n"
-
-          "For more information read the RRD manpages\n\n";
+    char      help_graph1[] =
+        "* graph - generate a graph from one or several RRD\n\n"
+        "\trrdtool graph filename [-s|--start seconds] [-e|--end seconds]\n"
+        "\t\t[-x|--x-grid x-axis grid and label]\n"
+        "\t\t[-Y|--alt-y-grid]\n"
+        "\t\t[-y|--y-grid y-axis grid and label]\n"
+        "\t\t[-v|--vertical-label string] [-w|--width pixels]\n"
+        "\t\t[-h|--height pixels] [-o|--logarithmic]\n"
+        "\t\t[-u|--upper-limit value] [-z|--lazy]\n"
+        "\t\t[-l|--lower-limit value] [-r|--rigid]\n"
+        "\t\t[-g|--no-legend]\n"
+        "\t\t[-F|--force-rules-legend]\n" "\t\t[-j|--only-graph]\n";
+    char      help_graph2[] =
+        "\t\t[-n|--font FONTTAG:size:font]\n"
+        "\t\t[-m|--zoom factor]\n"
+        "\t\t[-A|--alt-autoscale]\n"
+        "\t\t[-M|--alt-autoscale-max]\n"
+        "\t\t[-R|--font-render-mode {normal,light,mono}]\n"
+        "\t\t[-B|--font-smoothing-threshold size]\n"
+        "\t\t[-E|--slope-mode]\n"
+        "\t\t[-N|--no-gridfit]\n"
+        "\t\t[-X|--units-exponent value]\n"
+        "\t\t[-L|--units-length value]\n"
+        "\t\t[-S|--step seconds]\n"
+        "\t\t[-f|--imginfo printfstr]\n"
+        "\t\t[-a|--imgformat PNG]\n"
+        "\t\t[-c|--color COLORTAG#rrggbb[aa]] [-t|--title string]\n"
+        "\t\t[-W|--watermark string]\n" "\t\t[DEF:vname=rrd:ds-name:CF]\n";
+    char      help_graph3[] =
+        "\t\t[CDEF:vname=rpn-expression]\n"
+        "\t\t[VDEF:vdefname=rpn-expression]\n"
+        "\t\t[PRINT:vdefname:format]\n"
+        "\t\t[GPRINT:vdefname:format]\n"
+        "\t\t[COMMENT:text]\n"
+        "\t\t[SHIFT:vname:offset]\n"
+        "\t\t[TICK:vname#rrggbb[aa][:[fraction][:legend]]]\n"
+        "\t\t[HRULE:value#rrggbb[aa][:legend]]\n"
+        "\t\t[VRULE:value#rrggbb[aa][:legend]]\n"
+        "\t\t[LINE[width]:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
+        "\t\t[AREA:vname[#rrggbb[aa][:[legend][:STACK]]]]\n"
+        "\t\t[PRINT:vname:CF:format] (deprecated)\n"
+        "\t\t[GPRINT:vname:CF:format] (deprecated)\n"
+        "\t\t[STACK:vname[#rrggbb[aa][:legend]]] (deprecated)\n\n";
+
+    char      help_tune1[] =
+        " * tune -  Modify some basic properties of an RRD\n\n"
+        "\trrdtool tune filename\n"
+        "\t\t[--heartbeat|-h ds-name:heartbeat]\n"
+        "\t\t[--data-source-type|-d ds-name:DST]\n"
+        "\t\t[--data-source-rename|-r old-name:new-name]\n"
+        "\t\t[--minimum|-i ds-name:min] [--maximum|-a ds-name:max]\n"
+        "\t\t[--deltapos scale-value] [--deltaneg scale-value]\n"
+        "\t\t[--failure-threshold integer]\n"
+        "\t\t[--window-length integer]\n"
+        "\t\t[--alpha adaptation-parameter]\n";
+    char      help_tune2[] =
+        " * tune -  Modify some basic properties of an RRD\n\n"
+        "\t\t[--beta adaptation-parameter]\n"
+        "\t\t[--gamma adaptation-parameter]\n"
+        "\t\t[--gamma-deviation adaptation-parameter]\n"
+        "\t\t[--aberrant-reset ds-name]\n\n";
+
+    char      help_resize[] =
+        " * resize - alter the length of one of the RRAs in an RRD\n\n"
+        "\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
+
+    char      help_xport[] =
+        "* xport - generate XML dump from one or several RRD\n\n"
+        "\trrdtool xport [-s|--start seconds] [-e|--end seconds]\n"
+        "\t\t[-m|--maxrows rows]\n"
+        "\t\t[--step seconds]\n"
+        "\t\t[--enumds]\n"
+        "\t\t[DEF:vname=rrd:ds-name:CF]\n"
+        "\t\t[CDEF:vname=rpn-expression]\n" "\t\t[XPORT:vname:legend]\n\n";
+
+    char      help_quit[] =
+        " * quit - closing a session in remote mode\n\n" "\trrdtool quit\n\n";
+
+    char      help_ls[] =
+        " * ls - lists all *.rrd files in current directory\n\n"
+        "\trrdtool ls\n\n";
+
+    char      help_cd[] =
+        " * cd - changes the current directory\n\n"
+        "\trrdtool cd new directory\n\n";
+
+    char      help_mkdir[] =
+        " * mkdir - creates a new directory\n\n"
+        "\trrdtool mkdir newdirectoryname\n\n";
+
+    char      help_pwd[] =
+        " * pwd - returns the current working directory\n\n"
+        "\trrdtool pwd\n\n";
+
+    char      help_lic[] =
+        "RRDtool is distributed under the Terms of the GNU General\n"
+        "Public License Version 2. (www.gnu.org/copyleft/gpl.html)\n\n"
+        "For more information read the RRD manpages\n\n";
 
     enum { C_NONE, C_CREATE, C_DUMP, C_INFO, C_RESTORE, C_LAST,
-          C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE,
-          C_RESIZE, C_XPORT, C_QUIT, C_LS, C_CD, C_MKDIR, C_PWD,
-          C_UPDATEV };
-
-    int help_cmd = C_NONE;
-
-    if (cmd)
-       {
-           if (!strcmp(cmd,"create"))
-               help_cmd = C_CREATE;
-           else if (!strcmp(cmd,"dump"))
-               help_cmd = C_DUMP;
-           else if (!strcmp(cmd,"info"))
-               help_cmd = C_INFO;
-           else if (!strcmp(cmd,"restore"))
-               help_cmd = C_RESTORE;
-           else if (!strcmp(cmd,"last"))
-               help_cmd = C_LAST;
-           else if (!strcmp(cmd,"lastupdate"))
-               help_cmd = C_LASTUPDATE;
-           else if (!strcmp(cmd,"first"))
-               help_cmd = C_FIRST;
-           else if (!strcmp(cmd,"update"))
-               help_cmd = C_UPDATE;
-           else if (!strcmp(cmd,"updatev"))
-               help_cmd = C_UPDATEV;
-           else if (!strcmp(cmd,"fetch"))
-               help_cmd = C_FETCH;
-           else if (!strcmp(cmd,"graph"))
-               help_cmd = C_GRAPH;
-           else if (!strcmp(cmd,"tune"))
-               help_cmd = C_TUNE;
-           else if (!strcmp(cmd,"resize"))
-               help_cmd = C_RESIZE;
-           else if (!strcmp(cmd,"xport"))
-               help_cmd = C_XPORT;
-            else if (!strcmp(cmd,"quit"))
-                help_cmd = C_QUIT;
-            else if (!strcmp(cmd,"ls"))
-                help_cmd = C_LS;
-            else if (!strcmp(cmd,"cd"))
-                help_cmd = C_CD;
-            else if (!strcmp(cmd,"mkdir"))
-                help_cmd = C_MKDIR;
-            else if (!strcmp(cmd,"pwd"))
-                help_cmd = C_PWD;
-       }
+        C_LASTUPDATE, C_FIRST, C_UPDATE, C_FETCH, C_GRAPH, C_TUNE,
+        C_RESIZE, C_XPORT, C_QUIT, C_LS, C_CD, C_MKDIR, C_PWD,
+        C_UPDATEV
+    };
+
+    int       help_cmd = C_NONE;
+
+    if (cmd) {
+        if (!strcmp(cmd, "create"))
+            help_cmd = C_CREATE;
+        else if (!strcmp(cmd, "dump"))
+            help_cmd = C_DUMP;
+        else if (!strcmp(cmd, "info"))
+            help_cmd = C_INFO;
+        else if (!strcmp(cmd, "restore"))
+            help_cmd = C_RESTORE;
+        else if (!strcmp(cmd, "last"))
+            help_cmd = C_LAST;
+        else if (!strcmp(cmd, "lastupdate"))
+            help_cmd = C_LASTUPDATE;
+        else if (!strcmp(cmd, "first"))
+            help_cmd = C_FIRST;
+        else if (!strcmp(cmd, "update"))
+            help_cmd = C_UPDATE;
+        else if (!strcmp(cmd, "updatev"))
+            help_cmd = C_UPDATEV;
+        else if (!strcmp(cmd, "fetch"))
+            help_cmd = C_FETCH;
+        else if (!strcmp(cmd, "graph"))
+            help_cmd = C_GRAPH;
+        else if (!strcmp(cmd, "tune"))
+            help_cmd = C_TUNE;
+        else if (!strcmp(cmd, "resize"))
+            help_cmd = C_RESIZE;
+        else if (!strcmp(cmd, "xport"))
+            help_cmd = C_XPORT;
+        else if (!strcmp(cmd, "quit"))
+            help_cmd = C_QUIT;
+        else if (!strcmp(cmd, "ls"))
+            help_cmd = C_LS;
+        else if (!strcmp(cmd, "cd"))
+            help_cmd = C_CD;
+        else if (!strcmp(cmd, "mkdir"))
+            help_cmd = C_MKDIR;
+        else if (!strcmp(cmd, "pwd"))
+            help_cmd = C_PWD;
+    }
     fputs(help_main, stdout);
-    switch (help_cmd)
-       {
-           case C_NONE:
-               fputs(help_list, stdout);
-                if (RemoteMode){
-                   fputs(help_listremote, stdout);
-                }
-               break;
-           case C_CREATE:
-               fputs(help_create, stdout);
-               break;
-           case C_DUMP:
-               fputs(help_dump, stdout);
-               break;
-           case C_INFO:
-               fputs(help_info, stdout);
-               break;
-           case C_RESTORE:
-               fputs(help_restore, stdout);
-               break;
-           case C_LAST:
-               fputs(help_last, stdout);
-               break;
-           case C_LASTUPDATE:
-               fputs(help_lastupdate, stdout);
-               break;
-           case C_FIRST:
-               fputs(help_first, stdout);
-               break;
-           case C_UPDATE:
-               fputs(help_update, stdout);
-               break;
-           case C_UPDATEV:
-               fputs(help_updatev, stdout);
-               break;
-           case C_FETCH:
-               fputs(help_fetch, stdout);
-               break;
-           case C_GRAPH:
-               fputs(help_graph1, stdout);
-               fputs(help_graph2, stdout);
-               fputs(help_graph3, stdout);
-               break;
-           case C_TUNE:
-               fputs(help_tune1, stdout);
-               fputs(help_tune2, stdout);
-               break;
-           case C_RESIZE:
-               fputs(help_resize, stdout);
-               break;
-           case C_XPORT:
-               fputs(help_xport, stdout);
-               break;
-           case C_QUIT:
-               fputs(help_quit, stdout);
-               break;
-           case C_LS:
-               fputs(help_ls, stdout);
-               break;
-           case C_CD:
-               fputs(help_cd, stdout);
-               break;
-           case C_MKDIR:
-               fputs(help_mkdir, stdout);
-               break;
-           case C_PWD:
-               fputs(help_pwd, stdout);
-               break;
-       }
+    switch (help_cmd) {
+    case C_NONE:
+        fputs(help_list, stdout);
+        if (RemoteMode) {
+            fputs(help_listremote, stdout);
+        }
+        break;
+    case C_CREATE:
+        fputs(help_create, stdout);
+        break;
+    case C_DUMP:
+        fputs(help_dump, stdout);
+        break;
+    case C_INFO:
+        fputs(help_info, stdout);
+        break;
+    case C_RESTORE:
+        fputs(help_restore, stdout);
+        break;
+    case C_LAST:
+        fputs(help_last, stdout);
+        break;
+    case C_LASTUPDATE:
+        fputs(help_lastupdate, stdout);
+        break;
+    case C_FIRST:
+        fputs(help_first, stdout);
+        break;
+    case C_UPDATE:
+        fputs(help_update, stdout);
+        break;
+    case C_UPDATEV:
+        fputs(help_updatev, stdout);
+        break;
+    case C_FETCH:
+        fputs(help_fetch, stdout);
+        break;
+    case C_GRAPH:
+        fputs(help_graph1, stdout);
+        fputs(help_graph2, stdout);
+        fputs(help_graph3, stdout);
+        break;
+    case C_TUNE:
+        fputs(help_tune1, stdout);
+        fputs(help_tune2, stdout);
+        break;
+    case C_RESIZE:
+        fputs(help_resize, stdout);
+        break;
+    case C_XPORT:
+        fputs(help_xport, stdout);
+        break;
+    case C_QUIT:
+        fputs(help_quit, stdout);
+        break;
+    case C_LS:
+        fputs(help_ls, stdout);
+        break;
+    case C_CD:
+        fputs(help_cd, stdout);
+        break;
+    case C_MKDIR:
+        fputs(help_mkdir, stdout);
+        break;
+    case C_PWD:
+        fputs(help_pwd, stdout);
+        break;
+    }
     fputs(help_lic, stdout);
 }
 
-static char *fgetslong(char **aLinePtr, FILE *stream)
+static char *fgetslong(
+    char **aLinePtr,
+    FILE * stream)
 {
-   char *linebuf;
-   size_t bufsize = MAX_LENGTH;
-   int eolpos = 0;
-
-   if (feof(stream)) return *aLinePtr = 0;
-   if (!(linebuf = malloc(bufsize))) {
-      perror("fgetslong: malloc");
-      exit(1);
-   }
-   linebuf[0] = '\0';
-   while (fgets(linebuf + eolpos, MAX_LENGTH, stream)) {
-      eolpos += strlen(linebuf + eolpos);
-      if (linebuf[eolpos - 1] == '\n') return *aLinePtr = linebuf;
-      bufsize += MAX_LENGTH;
-      if (!(linebuf = realloc(linebuf, bufsize))) {
-         perror("fgetslong: realloc");
-         exit(1);
-      }
-   }
-   return *aLinePtr = linebuf[0] ? linebuf : 0;
+    char     *linebuf;
+    size_t    bufsize = MAX_LENGTH;
+    int       eolpos = 0;
+
+    if (feof(stream))
+        return *aLinePtr = 0;
+    if (!(linebuf = malloc(bufsize))) {
+        perror("fgetslong: malloc");
+        exit(1);
+    }
+    linebuf[0] = '\0';
+    while (fgets(linebuf + eolpos, MAX_LENGTH, stream)) {
+        eolpos += strlen(linebuf + eolpos);
+        if (linebuf[eolpos - 1] == '\n')
+            return *aLinePtr = linebuf;
+        bufsize += MAX_LENGTH;
+        if (!(linebuf = realloc(linebuf, bufsize))) {
+            perror("fgetslong: realloc");
+            exit(1);
+        }
+    }
+    return *aLinePtr = linebuf[0] ? linebuf : 0;
 }
 
-int main(int argc, char *argv[])
+int main(
+    int argc,
+    char *argv[])
 {
-    char **myargv;
-    char *aLine;
-    char *firstdir="";
+    char    **myargv;
+    char     *aLine;
+    char     *firstdir = "";
+
 #ifdef MUST_DISABLE_SIGFPE
-    signal(SIGFPE,SIG_IGN);
+    signal(SIGFPE, SIG_IGN);
 #endif
 #ifdef MUST_DISABLE_FPMASK
     fpsetmask(0);
 #endif
-    if (argc == 1)
-       {
-           PrintUsage("");
-           return 0;
-       }
-    
-    if (((argc == 2)||(argc == 3)) && !strcmp("-",argv[1]))
-       {
+    if (argc == 1) {
+        PrintUsage("");
+        return 0;
+    }
+
+    if (((argc == 2) || (argc == 3)) && !strcmp("-", argv[1])) {
 #if HAVE_GETRUSAGE
-         struct rusage  myusage;
-         struct timeval starttime;
-         struct timeval currenttime;
+        struct rusage myusage;
+        struct timeval starttime;
+        struct timeval currenttime;
 
-         gettimeofday(&starttime, NULL);
+        gettimeofday(&starttime, NULL);
 #endif
-         RemoteMode=1;
-          if ((argc == 3) && strcmp("",argv[2])){
+        RemoteMode = 1;
+        if ((argc == 3) && strcmp("", argv[2])) {
 
-             if (
+            if (
 #ifdef HAVE_GETUID
-                getuid()
+                   getuid()
 #else
-                1
+                   1
 #endif
-                == 0 ){
+                   == 0) {
 
 #ifdef HAVE_CHROOT
                 chroot(argv[2]);
-                if (errno!=0){
-                   fprintf(stderr,"ERROR: can't change root to '%s' errno=%d\n",
-                           argv[2],errno);
+                if (errno != 0) {
+                    fprintf(stderr,
+                            "ERROR: can't change root to '%s' errno=%d\n",
+                            argv[2], errno);
                     exit(errno);
                 }
-                ChangeRoot=1;
-                firstdir="/";
+                ChangeRoot = 1;
+                firstdir = "/";
 #else
-                fprintf(stderr,"ERROR: change root is not supported by your OS "
-                         "or at least by this copy of rrdtool\n");
+                fprintf(stderr,
+                        "ERROR: change root is not supported by your OS "
+                        "or at least by this copy of rrdtool\n");
                 exit(1);
 #endif
-             } else {
-                firstdir=argv[2];
-             }
-          }
-          if (strcmp(firstdir,"")){
-             chdir(firstdir);
-             if (errno!=0){
-                fprintf(stderr,"ERROR: %s\n",rrd_strerror(errno));
+            } else {
+                firstdir = argv[2];
+            }
+        }
+        if (strcmp(firstdir, "")) {
+            chdir(firstdir);
+            if (errno != 0) {
+                fprintf(stderr, "ERROR: %s\n", rrd_strerror(errno));
                 exit(errno);
-             }
-          }
-
-           while (fgetslong(&aLine, stdin)){
-               if ((argc = CountArgs(aLine)) == 0)  {
-                   printf("ERROR: not enough arguments\n");
-               }
-               if ((myargv = (char **) malloc((argc+1) * 
-                                              sizeof(char *))) == NULL)   {
-                   perror("malloc");
-                   exit(1);
-               }
-               if ((argc=CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
-                   printf("ERROR: creating arguments\n");
-               } else {
-                   int ret = HandleInputLine(argc, myargv, stdout);
-                   free(myargv);
-                   if (ret == 0){
-                       
+            }
+        }
+
+        while (fgetslong(&aLine, stdin)) {
+            if ((argc = CountArgs(aLine)) == 0) {
+                printf("ERROR: not enough arguments\n");
+            }
+            if ((myargv = (char **) malloc((argc + 1) *
+                                           sizeof(char *))) == NULL) {
+                perror("malloc");
+                exit(1);
+            }
+            if ((argc = CreateArgs(argv[0], aLine, argc, myargv)) < 0) {
+                printf("ERROR: creating arguments\n");
+            } else {
+                int       ret = HandleInputLine(argc, myargv, stdout);
+
+                free(myargv);
+                if (ret == 0) {
+
 
 #if HAVE_GETRUSAGE
-                    getrusage(RUSAGE_SELF,&myusage);
-                    gettimeofday(&currenttime,NULL);
-                    printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
-                      (double)myusage.ru_utime.tv_sec+
-                      (double)myusage.ru_utime.tv_usec/1000000.0,
-                      (double)myusage.ru_stime.tv_sec+
-                      (double)myusage.ru_stime.tv_usec/1000000.0,
-                      (double)(currenttime.tv_sec-starttime.tv_sec)
-                      +(double)(currenttime.tv_usec-starttime.tv_usec)
-                      /1000000.0);
+                    getrusage(RUSAGE_SELF, &myusage);
+                    gettimeofday(&currenttime, NULL);
+                    printf("OK u:%1.2f s:%1.2f r:%1.2f\n",
+                           (double) myusage.ru_utime.tv_sec +
+                           (double) myusage.ru_utime.tv_usec / 1000000.0,
+                           (double) myusage.ru_stime.tv_sec +
+                           (double) myusage.ru_stime.tv_usec / 1000000.0,
+                           (double) (currenttime.tv_sec - starttime.tv_sec)
+                           + (double) (currenttime.tv_usec -
+                                       starttime.tv_usec)
+                           / 1000000.0);
 #else
-                     printf("OK\n");
-                   
-#endif          
-                 }
-               }
-               fflush(stdout); /* this is important for pipes to work */
-                free(aLine);
-           }
-       }
-    else if (argc == 2)
-       {
-               PrintUsage(argv[1]);
-               exit(0);
-       }
-    else if (argc == 3 && !strcmp(argv[1],"help"))
-       {
-               PrintUsage(argv[2]);
-               exit(0);
-       }
-    else {
+                    printf("OK\n");
+
+#endif
+                }
+            }
+            fflush(stdout); /* this is important for pipes to work */
+            free(aLine);
+        }
+    } else if (argc == 2) {
+        PrintUsage(argv[1]);
+        exit(0);
+    } else if (argc == 3 && !strcmp(argv[1], "help")) {
+        PrintUsage(argv[2]);
+        exit(0);
+    } else {
         exit(HandleInputLine(argc, argv, stderr));
     }
     return 0;
@@ -460,344 +469,369 @@ int main(int argc, char *argv[])
 
 /* HandleInputLine is NOT thread safe - due to readdir issues,
    resolving them portably is not really simple. */
-int HandleInputLine(int argc, char **argv, FILE* out)
+int HandleInputLine(
+    int argc,
+    char **argv,
+    FILE * out)
 {
 #if defined(HAVE_OPENDIR) && defined (HAVE_READDIR)
-    DIR           *curdir; /* to read current dir with ls */
+    DIR      *curdir;   /* to read current dir with ls */
     struct dirent *dent;
 #endif
 #if defined(HAVE_SYS_STAT_H)
-    struct stat   st;
+    struct stat st;
 #endif
-    char* cwd; /* To hold current working dir on call to pwd */
+    char     *cwd;      /* To hold current working dir on call to pwd */
 
     /* Reset errno to 0 before we start.
-    */
+     */
     errno = 0;
 
-    if (RemoteMode){
-       if (argc>1 && strcmp("quit", argv[1]) == 0){
-          if (argc>2){
-             printf("ERROR: invalid parameter count for quit\n");
-             return(1);
-          }
-          exit(0);
-       }
+    if (RemoteMode) {
+        if (argc > 1 && strcmp("quit", argv[1]) == 0) {
+            if (argc > 2) {
+                printf("ERROR: invalid parameter count for quit\n");
+                return (1);
+            }
+            exit(0);
+        }
 #if defined(HAVE_OPENDIR) && defined(HAVE_READDIR) && defined(HAVE_CHDIR)
-       if (argc>1 && strcmp("cd", argv[1]) == 0){
-          if (argc>3){
-             printf("ERROR: invalid parameter count for cd\n");
-             return(1);
-          }
+        if (argc > 1 && strcmp("cd", argv[1]) == 0) {
+            if (argc > 3) {
+                printf("ERROR: invalid parameter count for cd\n");
+                return (1);
+            }
 #if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
-          if (getuid()==0 && ! ChangeRoot){
-             printf("ERROR: chdir security problem - rrdtool is running as "
-                    "root but not chroot!\n");
-             return(1); 
-          }
+            if (getuid() == 0 && !ChangeRoot) {
+                printf
+                    ("ERROR: chdir security problem - rrdtool is running as "
+                     "root but not chroot!\n");
+                return (1);
+            }
 #endif
-          chdir(argv[2]);
-          if (errno!=0){
-             printf("ERROR: %s\n",rrd_strerror(errno));
-            return(1);
-          }
-          return(0);
-       }
-       if (argc>1 && strcmp("pwd", argv[1]) == 0){
-          if (argc>2){
-             printf("ERROR: invalid parameter count for pwd\n");
-             return(1);
-          }
-          cwd = getcwd(NULL, MAXPATH);
-          if(cwd == NULL) {
-             printf("ERROR: %s\n",rrd_strerror(errno));
-             return(1);
-          }
-          printf("%s\n", cwd);
-          free(cwd);
-          return(0);
-       }
-       if (argc>1 && strcmp("mkdir", argv[1]) == 0){
-          if (argc>3){
-             printf("ERROR: invalid parameter count for mkdir\n");
-             return(1);
-          }
+            chdir(argv[2]);
+            if (errno != 0) {
+                printf("ERROR: %s\n", rrd_strerror(errno));
+                return (1);
+            }
+            return (0);
+        }
+        if (argc > 1 && strcmp("pwd", argv[1]) == 0) {
+            if (argc > 2) {
+                printf("ERROR: invalid parameter count for pwd\n");
+                return (1);
+            }
+            cwd = getcwd(NULL, MAXPATH);
+            if (cwd == NULL) {
+                printf("ERROR: %s\n", rrd_strerror(errno));
+                return (1);
+            }
+            printf("%s\n", cwd);
+            free(cwd);
+            return (0);
+        }
+        if (argc > 1 && strcmp("mkdir", argv[1]) == 0) {
+            if (argc > 3) {
+                printf("ERROR: invalid parameter count for mkdir\n");
+                return (1);
+            }
 #if ! defined(HAVE_CHROOT) || ! defined(HAVE_GETUID)
-          if (getuid()==0 && ! ChangeRoot){
-             printf("ERROR: mkdir security problem - rrdtool is running as "
-                    "root but not chroot!\n");
-             return(1); 
-          }
+            if (getuid() == 0 && !ChangeRoot) {
+                printf
+                    ("ERROR: mkdir security problem - rrdtool is running as "
+                     "root but not chroot!\n");
+                return (1);
+            }
 #endif
-          mkdir(argv[2],0777);
-          if (errno!=0){
-             printf("ERROR: %s\n",rrd_strerror(errno));
-             return(1);
-          }
-          return(0);
-       }
-       if (argc>1 && strcmp("ls", argv[1]) == 0){
-          if (argc>2){
-             printf("ERROR: invalid parameter count for ls\n");
-             return(1);
-          }
-          if ((curdir=opendir("."))!=NULL){
-             while((dent=readdir(curdir))!=NULL){
-                if (!stat(dent->d_name,&st)){
-                   if (S_ISDIR(st.st_mode)){
-                      printf("d %s\n",dent->d_name);
-                   }
-                   if (strlen(dent->d_name)>4 && S_ISREG(st.st_mode)){
-                      if (!strcmp(dent->d_name+NAMLEN(dent)-4,".rrd") ||
-                          !strcmp(dent->d_name+NAMLEN(dent)-4,".RRD")){
-                         printf("- %s\n",dent->d_name);
-                      }
-                   }
+            mkdir(argv[2], 0777);
+            if (errno != 0) {
+                printf("ERROR: %s\n", rrd_strerror(errno));
+                return (1);
+            }
+            return (0);
+        }
+        if (argc > 1 && strcmp("ls", argv[1]) == 0) {
+            if (argc > 2) {
+                printf("ERROR: invalid parameter count for ls\n");
+                return (1);
+            }
+            if ((curdir = opendir(".")) != NULL) {
+                while ((dent = readdir(curdir)) != NULL) {
+                    if (!stat(dent->d_name, &st)) {
+                        if (S_ISDIR(st.st_mode)) {
+                            printf("d %s\n", dent->d_name);
+                        }
+                        if (strlen(dent->d_name) > 4 && S_ISREG(st.st_mode)) {
+                            if (!strcmp
+                                (dent->d_name + NAMLEN(dent) - 4, ".rrd")
+                                || !strcmp(dent->d_name + NAMLEN(dent) - 4,
+                                           ".RRD")) {
+                                printf("- %s\n", dent->d_name);
+                            }
+                        }
+                    }
                 }
-             }
-            closedir(curdir);
-          }
-          else{
-             printf("ERROR: %s\n",rrd_strerror(errno));
-             return(errno);
-          }
-          return(0);
-       }
-#endif /* opendir and readdir */
+                closedir(curdir);
+            } else {
+                printf("ERROR: %s\n", rrd_strerror(errno));
+                return (errno);
+            }
+            return (0);
+        }
+#endif                          /* opendir and readdir */
 
     }
-    if (argc < 3 
-       || strcmp("help", argv[1]) == 0
-       || strcmp("--help", argv[1]) == 0
-       || strcmp("-help", argv[1]) == 0
-       || strcmp("-?", argv[1]) == 0
-       || strcmp("-h", argv[1]) == 0 ) {
-       PrintUsage("");
-       return 0;
+    if (argc < 3
+        || strcmp("help", argv[1]) == 0
+        || strcmp("--help", argv[1]) == 0
+        || strcmp("-help", argv[1]) == 0
+        || strcmp("-?", argv[1]) == 0 || strcmp("-h", argv[1]) == 0) {
+        PrintUsage("");
+        return 0;
     }
-    
-    if (strcmp("create", argv[1]) == 0)        
-       rrd_create(argc-1, &argv[1]);
+
+    if (strcmp("create", argv[1]) == 0)
+        rrd_create(argc - 1, &argv[1]);
     else if (strcmp("dump", argv[1]) == 0)
-       rrd_dump(argc-1, &argv[1]);
-    else if (strcmp("info", argv[1]) == 0 
-               || strcmp("updatev", argv[1]) == 0){
-       info_t *data,*save;
-       if (strcmp("info",argv[1]) == 0)
-          data=rrd_info(argc-1, &argv[1]);
-    else
-          data=rrd_update_v(argc-1, &argv[1]);
-       while (data) {
-           save=data;
-           printf ("%s = ", data->key);
-           free(data->key);
-           
-           switch (data->type) {
-           case RD_I_VAL:
-               if (isnan (data->value.u_val))
-                   printf("NaN");
-               else
-                   printf ("%0.10e", data->value.u_val);
-               break;
-           case RD_I_CNT:
-               printf ("%lu", data->value.u_cnt);
-               break;
-           case RD_I_INT:
-               printf ("%d", data->value.u_int);
-               break;
-           case RD_I_STR:
-               printf ("\"%s\"", data->value.u_str);
-               free(data->value.u_str);
-               break;
-           }
-           data = data->next;
-           free(save);
-           printf ("\n");
-       }
-       free(data);
+        rrd_dump(argc - 1, &argv[1]);
+    else if (strcmp("info", argv[1]) == 0 || strcmp("updatev", argv[1]) == 0) {
+        info_t   *data, *save;
+
+        if (strcmp("info", argv[1]) == 0)
+            data = rrd_info(argc - 1, &argv[1]);
+        else
+            data = rrd_update_v(argc - 1, &argv[1]);
+        while (data) {
+            save = data;
+            printf("%s = ", data->key);
+            free(data->key);
+
+            switch (data->type) {
+            case RD_I_VAL:
+                if (isnan(data->value.u_val))
+                    printf("NaN");
+                else
+                    printf("%0.10e", data->value.u_val);
+                break;
+            case RD_I_CNT:
+                printf("%lu", data->value.u_cnt);
+                break;
+            case RD_I_INT:
+                printf("%d", data->value.u_int);
+                break;
+            case RD_I_STR:
+                printf("\"%s\"", data->value.u_str);
+                free(data->value.u_str);
+                break;
+            }
+            data = data->next;
+            free(save);
+            printf("\n");
+        }
+        free(data);
     }
 
     else if (strcmp("--version", argv[1]) == 0 ||
-            strcmp("version", argv[1]) == 0 || 
-            strcmp("v", argv[1]) == 0 ||
-            strcmp("-v", argv[1]) == 0  ||
-            strcmp("-version", argv[1]) == 0  )
-        printf("RRDtool " PACKAGE_VERSION "  Copyright by Tobi Oetiker, 1997-2005 (%f)\n",
+             strcmp("version", argv[1]) == 0 ||
+             strcmp("v", argv[1]) == 0 ||
+             strcmp("-v", argv[1]) == 0 || strcmp("-version", argv[1]) == 0)
+        printf("RRDtool " PACKAGE_VERSION
+               "  Copyright by Tobi Oetiker, 1997-2005 (%f)\n",
                rrd_version());
     else if (strcmp("restore", argv[1]) == 0)
-       rrd_restore(argc-1, &argv[1]);
+        rrd_restore(argc - 1, &argv[1]);
     else if (strcmp("resize", argv[1]) == 0)
-       rrd_resize(argc-1, &argv[1]);
+        rrd_resize(argc - 1, &argv[1]);
     else if (strcmp("last", argv[1]) == 0)
-        printf("%ld\n",rrd_last(argc-1, &argv[1]));
+        printf("%ld\n", rrd_last(argc - 1, &argv[1]));
     else if (strcmp("lastupdate", argv[1]) == 0) {
-          time_t      last_update;
-           char        **ds_namv;
-           char        **last_ds;
-           unsigned long ds_cnt,
-                       i;
-          if (rrd_lastupdate(argc-1, &argv[1], &last_update,
-                       &ds_cnt, &ds_namv, &last_ds) == 0) {
-               for (i=0; i<ds_cnt; i++)
-                       printf(" %s", ds_namv[i]);
-               printf("\n\n");
-               printf("%10lu:", last_update);
-               for (i=0; i<ds_cnt; i++) {
-                       printf(" %s", last_ds[i]);
-                       free(last_ds[i]);
-                       free(ds_namv[i]);
-               }
-               printf("\n");
-               free(last_ds);
-               free(ds_namv);
-          }
+        time_t    last_update;
+        char    **ds_namv;
+        char    **last_ds;
+        unsigned long ds_cnt, i;
+
+        if (rrd_lastupdate(argc - 1, &argv[1], &last_update,
+                           &ds_cnt, &ds_namv, &last_ds) == 0) {
+            for (i = 0; i < ds_cnt; i++)
+                printf(" %s", ds_namv[i]);
+            printf("\n\n");
+            printf("%10lu:", last_update);
+            for (i = 0; i < ds_cnt; i++) {
+                printf(" %s", last_ds[i]);
+                free(last_ds[i]);
+                free(ds_namv[i]);
+            }
+            printf("\n");
+            free(last_ds);
+            free(ds_namv);
+        }
     } else if (strcmp("first", argv[1]) == 0)
-        printf("%ld\n",rrd_first(argc-1, &argv[1]));
+        printf("%ld\n", rrd_first(argc - 1, &argv[1]));
     else if (strcmp("update", argv[1]) == 0)
-       rrd_update(argc-1, &argv[1]);
+        rrd_update(argc - 1, &argv[1]);
     else if (strcmp("fetch", argv[1]) == 0) {
-       time_t        start,end, ti;
-       unsigned long step, ds_cnt,i,ii;
-       rrd_value_t   *data,*datai;
-       char          **ds_namv;
-       if (rrd_fetch(argc-1, &argv[1],&start,&end,&step,&ds_cnt,&ds_namv,&data) != -1) {
-           datai=data;
-           printf("           ");
-           for (i = 0; i<ds_cnt;i++)
-               printf("%20s",ds_namv[i]);
-           printf ("\n\n");
-           for (ti = start+step; ti <= end; ti += step){
-               printf("%10lu:", ti);
-               for (ii = 0; ii < ds_cnt; ii++)
-                   printf(" %0.10e", *(datai++));
-               printf("\n");
-           }
-           for (i=0;i<ds_cnt;i++)
-                 free(ds_namv[i]);
-           free(ds_namv);
-           free (data);
-       }
+        time_t    start, end, ti;
+        unsigned long step, ds_cnt, i, ii;
+        rrd_value_t *data, *datai;
+        char    **ds_namv;
+
+        if (rrd_fetch
+            (argc - 1, &argv[1], &start, &end, &step, &ds_cnt, &ds_namv,
+             &data) != -1) {
+            datai = data;
+            printf("           ");
+            for (i = 0; i < ds_cnt; i++)
+                printf("%20s", ds_namv[i]);
+            printf("\n\n");
+            for (ti = start + step; ti <= end; ti += step) {
+                printf("%10lu:", ti);
+                for (ii = 0; ii < ds_cnt; ii++)
+                    printf(" %0.10e", *(datai++));
+                printf("\n");
+            }
+            for (i = 0; i < ds_cnt; i++)
+                free(ds_namv[i]);
+            free(ds_namv);
+            free(data);
+        }
     } else if (strcmp("xport", argv[1]) == 0) {
-        int xxsize;
-       unsigned long int j = 0;
-       time_t        start,end, ti;
-       unsigned long step, col_cnt,row_cnt;
-       rrd_value_t   *data,*ptr;
-       char          **legend_v;
-        int           enumds = 0;
-        int           i;
-        size_t       vtag_s = strlen(COL_DATA_TAG) + 10; 
-        char         *vtag = malloc(vtag_s); 
-       for ( i = 2; i < argc; i++){
-               if (strcmp("--enumds", argv[i]) == 0)
-                       enumds = 1;
-       }
-
-        if(rrd_xport(argc-1, &argv[1], &xxsize,&start,&end,&step,&col_cnt,&legend_v,&data) != -1) {
-         row_cnt = (end-start)/step;
-         ptr = data;
-         printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n\n", XML_ENCODING);
-         printf("<%s>\n", ROOT_TAG);
-         printf("  <%s>\n", META_TAG);
-         printf("    <%s>%lu</%s>\n", META_START_TAG, start+step, META_START_TAG);
-         printf("    <%s>%lu</%s>\n", META_STEP_TAG, step, META_STEP_TAG);
-         printf("    <%s>%lu</%s>\n", META_END_TAG, end, META_END_TAG);
-         printf("    <%s>%lu</%s>\n", META_ROWS_TAG, row_cnt, META_ROWS_TAG);
-         printf("    <%s>%lu</%s>\n", META_COLS_TAG, col_cnt, META_COLS_TAG);
-         printf("    <%s>\n", LEGEND_TAG);
-         for (j = 0; j < col_cnt; j++) {
-           char *entry = NULL;
-           entry = legend_v[j];
-           printf("      <%s>%s</%s>\n", LEGEND_ENTRY_TAG, entry, LEGEND_ENTRY_TAG);
-           free(entry);
-         }
-         free(legend_v);
-         printf("    </%s>\n", LEGEND_TAG);
-         printf("  </%s>\n", META_TAG);
-         printf("  <%s>\n", DATA_TAG);
-         for (ti = start+step; ti <= end; ti += step) {
-           printf ("    <%s>", DATA_ROW_TAG);
-           printf ("<%s>%lu</%s>", COL_TIME_TAG, ti, COL_TIME_TAG);
-           for (j = 0; j < col_cnt; j++) {
-             rrd_value_t newval = DNAN;
-              if (enumds == 1)
-               snprintf(vtag,vtag_s,"%s%lu", COL_DATA_TAG, j);
-             else
-               snprintf(vtag,vtag_s,"%s",COL_DATA_TAG);
-              
-             newval = *ptr;
-             if(isnan(newval)){
-                printf("<%s>NaN</%s>", vtag,vtag);
-             } else {
-               printf("<%s>%0.10e</%s>", vtag, newval, vtag);
-             };
-             ptr++;
-           }
-           printf("</%s>\n", DATA_ROW_TAG);
-         }
-         free(data);
-         printf("  </%s>\n", DATA_TAG);
-         printf("</%s>\n", ROOT_TAG);
-       }
+        int       xxsize;
+        unsigned long int j = 0;
+        time_t    start, end, ti;
+        unsigned long step, col_cnt, row_cnt;
+        rrd_value_t *data, *ptr;
+        char    **legend_v;
+        int       enumds = 0;
+        int       i;
+        size_t    vtag_s = strlen(COL_DATA_TAG) + 10;
+        char     *vtag = malloc(vtag_s);
+
+        for (i = 2; i < argc; i++) {
+            if (strcmp("--enumds", argv[i]) == 0)
+                enumds = 1;
+        }
+
+        if (rrd_xport
+            (argc - 1, &argv[1], &xxsize, &start, &end, &step, &col_cnt,
+             &legend_v, &data) != -1) {
+            row_cnt = (end - start) / step;
+            ptr = data;
+            printf("<?xml version=\"1.0\" encoding=\"%s\"?>\n\n",
+                   XML_ENCODING);
+            printf("<%s>\n", ROOT_TAG);
+            printf("  <%s>\n", META_TAG);
+            printf("    <%s>%lu</%s>\n", META_START_TAG, start + step,
+                   META_START_TAG);
+            printf("    <%s>%lu</%s>\n", META_STEP_TAG, step, META_STEP_TAG);
+            printf("    <%s>%lu</%s>\n", META_END_TAG, end, META_END_TAG);
+            printf("    <%s>%lu</%s>\n", META_ROWS_TAG, row_cnt,
+                   META_ROWS_TAG);
+            printf("    <%s>%lu</%s>\n", META_COLS_TAG, col_cnt,
+                   META_COLS_TAG);
+            printf("    <%s>\n", LEGEND_TAG);
+            for (j = 0; j < col_cnt; j++) {
+                char     *entry = NULL;
+
+                entry = legend_v[j];
+                printf("      <%s>%s</%s>\n", LEGEND_ENTRY_TAG, entry,
+                       LEGEND_ENTRY_TAG);
+                free(entry);
+            }
+            free(legend_v);
+            printf("    </%s>\n", LEGEND_TAG);
+            printf("  </%s>\n", META_TAG);
+            printf("  <%s>\n", DATA_TAG);
+            for (ti = start + step; ti <= end; ti += step) {
+                printf("    <%s>", DATA_ROW_TAG);
+                printf("<%s>%lu</%s>", COL_TIME_TAG, ti, COL_TIME_TAG);
+                for (j = 0; j < col_cnt; j++) {
+                    rrd_value_t newval = DNAN;
+
+                    if (enumds == 1)
+                        snprintf(vtag, vtag_s, "%s%lu", COL_DATA_TAG, j);
+                    else
+                        snprintf(vtag, vtag_s, "%s", COL_DATA_TAG);
+
+                    newval = *ptr;
+                    if (isnan(newval)) {
+                        printf("<%s>NaN</%s>", vtag, vtag);
+                    } else {
+                        printf("<%s>%0.10e</%s>", vtag, newval, vtag);
+                    };
+                    ptr++;
+                }
+                printf("</%s>\n", DATA_ROW_TAG);
+            }
+            free(data);
+            printf("  </%s>\n", DATA_TAG);
+            printf("</%s>\n", ROOT_TAG);
+        }
         free(vtag);
-    }
-    else if (strcmp("graph", argv[1]) == 0) {
-       char **calcpr;
-#ifdef notused  /*XXX*/
-       const char *imgfile = argv[2]; /* rrd_graph changes argv pointer */
+    } else if (strcmp("graph", argv[1]) == 0) {
+        char    **calcpr;
+
+#ifdef notused /*XXX*/
+        const char *imgfile = argv[2];  /* rrd_graph changes argv pointer */
 #endif
-       int xsize, ysize;
-       double ymin,ymax;
-       int i;
-       int tostdout = (strcmp(argv[2],"-") == 0);      
-       int imginfo = 0;
-       for (i=2;i<argc;i++){
-               if (strcmp(argv[i],"--imginfo") == 0 || strcmp(argv[i],"-f") == 0){
-                       imginfo = 1;
-                       break;
-               }
-       }
-       if( rrd_graph(argc-1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) != -1 ) {
-           if (!tostdout && !imginfo) 
-               printf ("%dx%d\n",xsize,ysize);
-           if (calcpr) {
-               for(i=0;calcpr[i];i++){
-                   if (!tostdout) 
-                       printf("%s\n",calcpr[i]);
-                   free(calcpr[i]);
-               } 
-               free(calcpr);
-           }
-       }
-       
-    } else if (strcmp("tune", argv[1]) == 0) 
-               rrd_tune(argc-1, &argv[1]);
+        int       xsize, ysize;
+        double    ymin, ymax;
+        int       i;
+        int       tostdout = (strcmp(argv[2], "-") == 0);
+        int       imginfo = 0;
+
+        for (i = 2; i < argc; i++) {
+            if (strcmp(argv[i], "--imginfo") == 0
+                || strcmp(argv[i], "-f") == 0) {
+                imginfo = 1;
+                break;
+            }
+        }
+        if (rrd_graph
+            (argc - 1, &argv[1], &calcpr, &xsize, &ysize, NULL, &ymin,
+             &ymax) != -1) {
+            if (!tostdout && !imginfo)
+                printf("%dx%d\n", xsize, ysize);
+            if (calcpr) {
+                for (i = 0; calcpr[i]; i++) {
+                    if (!tostdout)
+                        printf("%s\n", calcpr[i]);
+                    free(calcpr[i]);
+                }
+                free(calcpr);
+            }
+        }
+
+    } else if (strcmp("tune", argv[1]) == 0)
+        rrd_tune(argc - 1, &argv[1]);
     else {
-               rrd_set_error("unknown function '%s'",argv[1]);
+        rrd_set_error("unknown function '%s'", argv[1]);
     }
     if (rrd_test_error()) {
-       fprintf(out, "ERROR: %s\n",rrd_get_error());
-       rrd_clear_error();
-       return 1;
+        fprintf(out, "ERROR: %s\n", rrd_get_error());
+        rrd_clear_error();
+        return 1;
     }
-    return(0);
+    return (0);
 }
 
-int CountArgs(char *aLine)
+int CountArgs(
+    char *aLine)
 {
-    int i=0;
-    int aCount = 0;
-    int inarg = 0;
-    while (aLine[i] == ' ') i++;
-    while (aLine[i] != 0){       
-       if((aLine[i]== ' ') && inarg){
-           inarg = 0;
-       }
-       if((aLine[i]!= ' ') && ! inarg){
-           inarg = 1;
-           aCount++;
-       }
-       i++;
+    int       i = 0;
+    int       aCount = 0;
+    int       inarg = 0;
+
+    while (aLine[i] == ' ')
+        i++;
+    while (aLine[i] != 0) {
+        if ((aLine[i] == ' ') && inarg) {
+            inarg = 0;
+        }
+        if ((aLine[i] != ' ') && !inarg) {
+            inarg = 1;
+            aCount++;
+        }
+        i++;
     }
     return aCount;
 }
@@ -805,70 +839,73 @@ int CountArgs(char *aLine)
 /*
  * CreateArgs - take a string (aLine) and tokenize
  */
-int CreateArgs(char *pName, char *aLine, int argc, char **argv)
+int CreateArgs(
+    char *pName,
+    char *aLine,
+    int argc,
+    char **argv)
 {
-    char       *getP, *putP;
-    char       **pargv = argv;
-    char        Quote = 0;
-    int inArg = 0;
-    int        len;
+    char     *getP, *putP;
+    char    **pargv = argv;
+    char      Quote = 0;
+    int       inArg = 0;
+    int       len;
 
     len = strlen(aLine);
     /* remove trailing space and newlines */
     while (len && aLine[len] <= ' ') {
-       aLine[len] = 0 ; len--;
+        aLine[len] = 0;
+        len--;
     }
     /* sikp leading blanks */
-    while (*aLine && *aLine <= ' ') aLine++;
+    while (*aLine && *aLine <= ' ')
+        aLine++;
 
     pargv[0] = pName;
     argc = 1;
     getP = aLine;
     putP = aLine;
-    while (*getP){
-       switch (*getP) {
-       case ' ': 
-           if (Quote){
-               *(putP++)=*getP;
-           } else 
-               if(inArg) {
-                   *(putP++) = 0;
-                   inArg = 0;
-               }
-           break;
-       case '"':
-       case '\'':
-           if (Quote != 0) {
-               if (Quote == *getP) 
-                   Quote = 0;
-               else {
-                   *(putP++)=*getP;
-               }
-           } else {
-               if(!inArg){
-                   pargv[argc++] = putP;
-                   inArg=1;
-               }           
-               Quote = *getP;
-           }
-           break;
-       default:
-           if(!inArg){
-               pargv[argc++] = putP;
-               inArg=1;
-           }
-           *(putP++)=*getP;
-           break;
-       }
-       getP++;
+    while (*getP) {
+        switch (*getP) {
+        case ' ':
+            if (Quote) {
+                *(putP++) = *getP;
+            } else if (inArg) {
+                *(putP++) = 0;
+                inArg = 0;
+            }
+            break;
+        case '"':
+        case '\'':
+            if (Quote != 0) {
+                if (Quote == *getP)
+                    Quote = 0;
+                else {
+                    *(putP++) = *getP;
+                }
+            } else {
+                if (!inArg) {
+                    pargv[argc++] = putP;
+                    inArg = 1;
+                }
+                Quote = *getP;
+            }
+            break;
+        default:
+            if (!inArg) {
+                pargv[argc++] = putP;
+                inArg = 1;
+            }
+            *(putP++) = *getP;
+            break;
+        }
+        getP++;
     }
 
     *putP = '\0';
 
-    if (Quote) 
-       return -1;
+    if (Quote)
+        return -1;
     else
-       return argc;
+        return argc;
 }
-
-
index f8ab9c4..020ff40 100644 (file)
@@ -4,7 +4,7 @@
  * rrd_tool.h   Common Header File
  *****************************************************************************/
 #ifdef  __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 #ifndef _RRD_TOOL_H
@@ -22,19 +22,29 @@ extern "C" {
 
 /* Win32 only includes */
 
-#include <float.h>        /* for _isnan  */
-#include <io.h>           /* for chdir   */
-
-struct tm* localtime_r(const time_t *timep, struct tm* result);
-char* ctime_r(const time_t *timep, char* result);
-struct tm* gmtime_r(const time_t *timep, struct tm* result);
-char *strtok_r(char *str, const char *sep, char **last);
+#include <float.h>      /* for _isnan  */
+#include <io.h>         /* for chdir   */
+
+    struct tm *localtime_r(
+    const time_t *timep,
+    struct tm *result);
+    char     *ctime_r(
+    const time_t *timep,
+    char *result);
+    struct tm *gmtime_r(
+    const time_t *timep,
+    struct tm *result);
+    char     *strtok_r(
+    char *str,
+    const char *sep,
+    char **last);
 
 #else
 
 /* unix-only includes */
 #if !defined isnan && !defined HAVE_ISNAN
-int isnan(double value);
+    int       isnan(
+    double value);
 #endif
 
 #endif
@@ -54,70 +64,122 @@ int isnan(double value);
 #define DIM(x) (sizeof(x)/sizeof(x[0]))
 
 /* rrd info interface */
-enum info_type   { RD_I_VAL=0,
-              RD_I_CNT,
-              RD_I_STR, 
-                  RD_I_INT };
-
-typedef union infoval { 
-    unsigned long u_cnt; 
-    rrd_value_t   u_val;
-    char         *u_str;
-    int                  u_int;
-} infoval;
-
-typedef struct info_t {
-    char            *key;
-    enum info_type  type;
-    union infoval   value;
-    struct info_t   *next;
-} info_t;
-
-info_t *rrd_info(int, char **);
-int rrd_lastupdate(int argc, char **argv, time_t *last_update,
-                unsigned long *ds_cnt, char ***ds_namv, char ***last_ds);
-info_t *rrd_update_v(int, char **);
-char * sprintf_alloc(char *, ...);
-info_t *info_push(info_t *, char *, enum info_type, infoval);
+    enum info_type { RD_I_VAL = 0,
+        RD_I_CNT,
+        RD_I_STR,
+        RD_I_INT
+    };
+
+    typedef union infoval {
+        unsigned long u_cnt;
+        rrd_value_t u_val;
+        char     *u_str;
+        int       u_int;
+    } infoval;
+
+    typedef struct info_t {
+        char     *key;
+        enum info_type type;
+        union infoval value;
+        struct info_t *next;
+    } info_t;
+
+    info_t   *rrd_info(
+    int,
+    char **);
+    int       rrd_lastupdate(
+    int argc,
+    char **argv,
+    time_t *last_update,
+    unsigned long *ds_cnt,
+    char ***ds_namv,
+    char ***last_ds);
+    info_t   *rrd_update_v(
+    int,
+    char **);
+    char     *sprintf_alloc(
+    char *,
+    ...);
+    info_t   *info_push(
+    info_t *,
+    char *,
+    enum info_type,
+    infoval);
 
 /* HELPER FUNCTIONS */
 
-int PngSize(FILE *, long *, long *);
-
-int rrd_create_fn(const char *file_name, rrd_t *rrd);
-int rrd_fetch_fn(const char *filename, enum cf_en cf_idx,
-                time_t *start,time_t *end,
-                unsigned long *step,
-                unsigned long *ds_cnt,
-                char        ***ds_namv,
-                rrd_value_t **data);
-
-void rrd_free(rrd_t *rrd);
-void rrd_freemem(void *mem);
-void rrd_init(rrd_t *rrd);
-
-rrd_file_t* rrd_open(const char * const file_name, rrd_t *rrd, unsigned rdwr);
-int rrd_close(rrd_file_t* rrd_file);
-ssize_t rrd_read(rrd_file_t* rrd_file, void*buf, size_t count);
-ssize_t rrd_write(rrd_file_t* rrd_file, const void*buf, size_t count);
-void rrd_flush(rrd_file_t* rrd_file);
-off_t rrd_seek(rrd_file_t* rrd_file, off_t off, int whence);
-off_t rrd_tell(rrd_file_t* rrd_file);
-int readfile(const char *file, char **buffer, int skipfirst);
+    int       PngSize(
+    FILE *,
+    long *,
+    long *);
+
+    int       rrd_create_fn(
+    const char *file_name,
+    rrd_t *rrd);
+    int       rrd_fetch_fn(
+    const char *filename,
+    enum cf_en cf_idx,
+    time_t *start,
+    time_t *end,
+    unsigned long *step,
+    unsigned long *ds_cnt,
+    char ***ds_namv,
+    rrd_value_t ** data);
+
+    void      rrd_free(
+    rrd_t *rrd);
+    void      rrd_freemem(
+    void *mem);
+    void      rrd_init(
+    rrd_t *rrd);
+
+    rrd_file_t *rrd_open(
+    const char *const file_name,
+    rrd_t *rrd,
+    unsigned rdwr);
+    int       rrd_close(
+    rrd_file_t * rrd_file);
+    ssize_t   rrd_read(
+    rrd_file_t * rrd_file,
+    void *buf,
+    size_t count);
+    ssize_t   rrd_write(
+    rrd_file_t * rrd_file,
+    const void *buf,
+    size_t count);
+    void      rrd_flush(
+    rrd_file_t * rrd_file);
+    off_t     rrd_seek(
+    rrd_file_t * rrd_file,
+    off_t off,
+    int whence);
+    off_t     rrd_tell(
+    rrd_file_t * rrd_file);
+    int       readfile(
+    const char *file,
+    char **buffer,
+    int skipfirst);
 
 #define RRD_READONLY    0
 #define RRD_READWRITE   1
 #define RRD_CREAT       2
 
-enum cf_en cf_conv(const char *string);
-enum dst_en dst_conv(char *string);
-long ds_match(rrd_t *rrd,char *ds_nam);
-double rrd_diff(char *a, char *b);
+    enum cf_en cf_conv(
+    const char *string);
+    enum dst_en dst_conv(
+    char *string);
+    long      ds_match(
+    rrd_t *rrd,
+    char *ds_nam);
+    double    rrd_diff(
+    char *a,
+    char *b);
 
     /* rrd_strerror is thread safe, but still it uses a global buffer
        (but one per thread), thus subsequent calls within a single
        thread overwrite the same buffer */
-const char *rrd_strerror(int err);
+    const char *rrd_strerror(
+    int err);
 
 #endif
 
index 61dc6ad..df22968 100644 (file)
 #include "rrd_rpncalc.h"
 #include "rrd_hw.h"
 
-int set_hwarg(rrd_t *rrd,enum cf_en cf,enum rra_par_en rra_par,char *arg);
-int set_deltaarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg);
-int set_windowarg(rrd_t *rrd,enum rra_par_en,char *arg);
+int       set_hwarg(
+    rrd_t *rrd,
+    enum cf_en cf,
+    enum rra_par_en rra_par,
+    char *arg);
+int       set_deltaarg(
+    rrd_t *rrd,
+    enum rra_par_en rra_par,
+    char *arg);
+int       set_windowarg(
+    rrd_t *rrd,
+    enum rra_par_en,
+    char *arg);
 
-int
-rrd_tune(int argc, char **argv)    
-{   
-    rrd_t               rrd;
-    int                 matches;
-    int                 optcnt = 0;
-    long                ds;
-    char                ds_nam[DS_NAM_SIZE];
-    char                ds_new[DS_NAM_SIZE];
-    long                heartbeat;
-    double              min;
-    double              max;
-    char                dst[DST_SIZE];
-    rrd_file_t         *rrd_file;
-    optind = 0; opterr = 0;  /* initialize getopt */
+int rrd_tune(
+    int argc,
+    char **argv)
+{
+    rrd_t     rrd;
+    int       matches;
+    int       optcnt = 0;
+    long      ds;
+    char      ds_nam[DS_NAM_SIZE];
+    char      ds_new[DS_NAM_SIZE];
+    long      heartbeat;
+    double    min;
+    double    max;
+    char      dst[DST_SIZE];
+    rrd_file_t *rrd_file;
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
 
-    rrd_file = rrd_open(argv[1],&rrd,RRD_READWRITE);
+    rrd_file = rrd_open(argv[1], &rrd, RRD_READWRITE);
     if (rrd_file == NULL) {
         return -1;
     }
 
-    while (1){
-       static struct option long_options[] =
-       {
-           {"heartbeat",        required_argument, 0, 'h'},
-           {"minimum",          required_argument, 0, 'i'},
-           {"maximum",          required_argument, 0, 'a'},
-           {"data-source-type", required_argument, 0, 'd'},
-           {"data-source-rename", required_argument, 0, 'r'},
-           /* added parameter tuning options for aberrant behavior detection */
-               {"deltapos",required_argument,0,'p'},
-               {"deltaneg",required_argument,0,'n'},
-               {"window-length",required_argument,0,'w'},
-               {"failure-threshold",required_argument,0,'f'},
-           {"alpha",required_argument,0,'x'},
-           {"beta",required_argument,0,'y'},
-           {"gamma",required_argument,0,'z'},
-           {"gamma-deviation",required_argument,0,'v'},
-               {"aberrant-reset",required_argument,0,'b'},
-           {0,0,0,0}
-       };
-       int option_index = 0;
-       int opt;
-       opt = getopt_long(argc, argv, "h:i:a:d:r:p:n:w:f:x:y:z:v:b:", 
-                         long_options, &option_index);
-       if (opt == EOF)
-           break;
-       
-       optcnt++;
-       switch(opt) {       
-       case 'h':
-           if ((matches = sscanf(optarg, DS_NAM_FMT ":%ld",ds_nam,&heartbeat)) != 2){
-               rrd_set_error("invalid arguments for heartbeat");
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-               rrd_free(&rrd);
+    while (1) {
+        static struct option long_options[] = {
+            {"heartbeat", required_argument, 0, 'h'},
+            {"minimum", required_argument, 0, 'i'},
+            {"maximum", required_argument, 0, 'a'},
+            {"data-source-type", required_argument, 0, 'd'},
+            {"data-source-rename", required_argument, 0, 'r'},
+            /* added parameter tuning options for aberrant behavior detection */
+            {"deltapos", required_argument, 0, 'p'},
+            {"deltaneg", required_argument, 0, 'n'},
+            {"window-length", required_argument, 0, 'w'},
+            {"failure-threshold", required_argument, 0, 'f'},
+            {"alpha", required_argument, 0, 'x'},
+            {"beta", required_argument, 0, 'y'},
+            {"gamma", required_argument, 0, 'z'},
+            {"gamma-deviation", required_argument, 0, 'v'},
+            {"aberrant-reset", required_argument, 0, 'b'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "h:i:a:d:r:p:n:w:f:x:y:z:v:b:",
+                          long_options, &option_index);
+        if (opt == EOF)
+            break;
+
+        optcnt++;
+        switch (opt) {
+        case 'h':
+            if ((matches =
+                 sscanf(optarg, DS_NAM_FMT ":%ld", ds_nam,
+                        &heartbeat)) != 2) {
+                rrd_set_error("invalid arguments for heartbeat");
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                rrd_free(&rrd);
                 close(rrd_file->fd);
-               return -1;
-           }
-           rrd.ds_def[ds].par[DS_mrhb_cnt].u_cnt = heartbeat;
-           break;
+                return -1;
+            }
+            rrd.ds_def[ds].par[DS_mrhb_cnt].u_cnt = heartbeat;
+            break;
 
-       case 'i':
-           if ((matches = sscanf(optarg,DS_NAM_FMT ":%lf",ds_nam,&min)) <1){
-               rrd_set_error("invalid arguments for minimum ds value");
-               rrd_free(&rrd);
+        case 'i':
+            if ((matches =
+                 sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &min)) < 1) {
+                rrd_set_error("invalid arguments for minimum ds value");
+                rrd_free(&rrd);
                 close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-               rrd_free(&rrd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                rrd_free(&rrd);
                 close(rrd_file->fd);
-               return -1;
-           }
+                return -1;
+            }
+
+            if (matches == 1)
+                min = DNAN;
+            rrd.ds_def[ds].par[DS_min_val].u_val = min;
+            break;
 
-           if(matches == 1)
-               min= DNAN;
-           rrd.ds_def[ds].par[DS_min_val].u_val = min;
-           break;
+        case 'a':
+            if ((matches =
+                 sscanf(optarg, DS_NAM_FMT ":%lf", ds_nam, &max)) < 1) {
+                rrd_set_error("invalid arguments for maximum ds value");
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if (matches == 1)
+                max = DNAN;
+            rrd.ds_def[ds].par[DS_max_val].u_val = max;
+            break;
 
-       case 'a':
-           if ((matches = sscanf(optarg, DS_NAM_FMT ":%lf",ds_nam,&max)) <1){
-               rrd_set_error("invalid arguments for maximum ds value");
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if(matches == 1) 
-               max= DNAN; 
-           rrd.ds_def[ds].par[DS_max_val].u_val = max;
-           break;
+        case 'd':
+            if ((matches =
+                 sscanf(optarg, DS_NAM_FMT ":" DST_FMT, ds_nam, dst)) != 2) {
+                rrd_set_error("invalid arguments for data source type");
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((int) dst_conv(dst) == -1) {
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            strncpy(rrd.ds_def[ds].dst, dst, DST_SIZE - 1);
+            rrd.ds_def[ds].dst[DST_SIZE - 1] = '\0';
 
-       case 'd':
-           if ((matches = sscanf(optarg, DS_NAM_FMT ":" DST_FMT ,ds_nam,dst)) != 2){
-               rrd_set_error("invalid arguments for data source type");
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((int)dst_conv(dst) == -1){
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           strncpy(rrd.ds_def[ds].dst,dst,DST_SIZE-1);
-           rrd.ds_def[ds].dst[DST_SIZE-1]='\0';
+            rrd.pdp_prep[ds].last_ds[0] = 'U';
+            rrd.pdp_prep[ds].last_ds[1] = 'N';
+            rrd.pdp_prep[ds].last_ds[2] = 'K';
+            rrd.pdp_prep[ds].last_ds[3] = 'N';
+            rrd.pdp_prep[ds].last_ds[4] = '\0';
 
-           rrd.pdp_prep[ds].last_ds[0] = 'U';
-           rrd.pdp_prep[ds].last_ds[1] = 'N';
-           rrd.pdp_prep[ds].last_ds[2] = 'K';
-           rrd.pdp_prep[ds].last_ds[3] = 'N';
-           rrd.pdp_prep[ds].last_ds[4] = '\0';
-           
-           break;
-       case 'r':
-           if ((matches = 
-                sscanf(optarg,DS_NAM_FMT ":" DS_NAM_FMT , ds_nam,ds_new)) != 2){
-               rrd_set_error("invalid arguments for data source type");
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           strncpy(rrd.ds_def[ds].ds_nam,ds_new,DS_NAM_SIZE-1);
-           rrd.ds_def[ds].ds_nam[DS_NAM_SIZE-1]='\0';
-           break;
-    case 'p':
-               if (set_deltaarg(&rrd,RRA_delta_pos,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'n':
-               if (set_deltaarg(&rrd,RRA_delta_neg,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'f':
-               if (set_windowarg(&rrd,RRA_failure_threshold,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'w':
-               if (set_windowarg(&rrd,RRA_window_len,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'x':
-               if (set_hwarg(&rrd,CF_HWPREDICT,RRA_hw_alpha,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'y':
-               if (set_hwarg(&rrd,CF_HWPREDICT,RRA_hw_beta,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'z':
-               if (set_hwarg(&rrd,CF_SEASONAL,RRA_seasonal_gamma,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'v':
-               if (set_hwarg(&rrd,CF_DEVSEASONAL,RRA_seasonal_gamma,optarg)) {
-                  rrd_free(&rrd);
-                  return -1;
-               }
-               break;
-       case 'b':
-               if (sscanf(optarg,DS_NAM_FMT,ds_nam) != 1){
-               rrd_set_error("invalid argument for aberrant-reset");
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           if ((ds=ds_match(&rrd,ds_nam))==-1){
-           /* ds_match handles it own errors */        
-               rrd_free(&rrd);
-               close(rrd_file->fd);
-               return -1;
-           }
-           reset_aberrant_coefficients(&rrd,rrd_file,(unsigned long) ds);
-               if (rrd_test_error()) {
-                  rrd_free(&rrd);
-                  close(rrd_file->fd);
-                  return -1;
-               }
-               break;
-       case '?':
+            break;
+        case 'r':
+            if ((matches =
+                 sscanf(optarg, DS_NAM_FMT ":" DS_NAM_FMT, ds_nam,
+                        ds_new)) != 2) {
+                rrd_set_error("invalid arguments for data source type");
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            strncpy(rrd.ds_def[ds].ds_nam, ds_new, DS_NAM_SIZE - 1);
+            rrd.ds_def[ds].ds_nam[DS_NAM_SIZE - 1] = '\0';
+            break;
+        case 'p':
+            if (set_deltaarg(&rrd, RRA_delta_pos, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'n':
+            if (set_deltaarg(&rrd, RRA_delta_neg, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'f':
+            if (set_windowarg(&rrd, RRA_failure_threshold, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'w':
+            if (set_windowarg(&rrd, RRA_window_len, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'x':
+            if (set_hwarg(&rrd, CF_HWPREDICT, RRA_hw_alpha, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'y':
+            if (set_hwarg(&rrd, CF_HWPREDICT, RRA_hw_beta, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'z':
+            if (set_hwarg(&rrd, CF_SEASONAL, RRA_seasonal_gamma, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'v':
+            if (set_hwarg(&rrd, CF_DEVSEASONAL, RRA_seasonal_gamma, optarg)) {
+                rrd_free(&rrd);
+                return -1;
+            }
+            break;
+        case 'b':
+            if (sscanf(optarg, DS_NAM_FMT, ds_nam) != 1) {
+                rrd_set_error("invalid argument for aberrant-reset");
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            if ((ds = ds_match(&rrd, ds_nam)) == -1) {
+                /* ds_match handles it own errors */
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            reset_aberrant_coefficients(&rrd, rrd_file, (unsigned long) ds);
+            if (rrd_test_error()) {
+                rrd_free(&rrd);
+                close(rrd_file->fd);
+                return -1;
+            }
+            break;
+        case '?':
             if (optopt != 0)
                 rrd_set_error("unknown option '%c'", optopt);
             else
-                rrd_set_error("unknown option '%s'",argv[optind-1]);
-           rrd_free(&rrd);         
+                rrd_set_error("unknown option '%s'", argv[optind - 1]);
+            rrd_free(&rrd);
             close(rrd_file->fd);
             return -1;
         }
     }
-       if(optcnt>0){
-       
-       rrd_seek(rrd_file,0,SEEK_SET);
-       rrd_write(rrd_file,rrd.stat_head, sizeof(stat_head_t)*1);
-       rrd_write(rrd_file,rrd.ds_def,
-              sizeof(ds_def_t)* rrd.stat_head->ds_cnt);
-       /* need to write rra_defs for RRA parameter changes */
-       rrd_write(rrd_file,rrd.rra_def,
-               sizeof(rra_def_t)*rrd.stat_head->rra_cnt);
+    if (optcnt > 0) {
+
+        rrd_seek(rrd_file, 0, SEEK_SET);
+        rrd_write(rrd_file, rrd.stat_head, sizeof(stat_head_t) * 1);
+        rrd_write(rrd_file, rrd.ds_def,
+                  sizeof(ds_def_t) * rrd.stat_head->ds_cnt);
+        /* need to write rra_defs for RRA parameter changes */
+        rrd_write(rrd_file, rrd.rra_def,
+                  sizeof(rra_def_t) * rrd.stat_head->rra_cnt);
     } else {
-       int i;
-       for(i=0;i< (int)rrd.stat_head->ds_cnt;i++)
-               if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
-           printf("DS[%s] typ: %s\thbt: %ld\tmin: %1.4f\tmax: %1.4f\n",
-                  rrd.ds_def[i].ds_nam,
-                  rrd.ds_def[i].dst,
-                  rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt,
-                  rrd.ds_def[i].par[DS_min_val].u_val,
-                  rrd.ds_def[i].par[DS_max_val].u_val);
-               } else {
-               char *buffer = NULL;
-               rpn_compact2str((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]),rrd.ds_def,&buffer);
-               printf("DS[%s] typ: %s\tcdef: %s\n", rrd.ds_def[i].ds_nam,rrd.ds_def[i].dst,buffer);
-           free(buffer);
-               }
+        int       i;
+
+        for (i = 0; i < (int) rrd.stat_head->ds_cnt; i++)
+            if (dst_conv(rrd.ds_def[i].dst) != DST_CDEF) {
+                printf("DS[%s] typ: %s\thbt: %ld\tmin: %1.4f\tmax: %1.4f\n",
+                       rrd.ds_def[i].ds_nam,
+                       rrd.ds_def[i].dst,
+                       rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt,
+                       rrd.ds_def[i].par[DS_min_val].u_val,
+                       rrd.ds_def[i].par[DS_max_val].u_val);
+            } else {
+                char     *buffer = NULL;
+
+                rpn_compact2str((rpn_cdefds_t *) &
+                                (rrd.ds_def[i].par[DS_cdef]), rrd.ds_def,
+                                &buffer);
+                printf("DS[%s] typ: %s\tcdef: %s\n", rrd.ds_def[i].ds_nam,
+                       rrd.ds_def[i].dst, buffer);
+                free(buffer);
+            }
     }
     close(rrd_file->fd);
     rrd_free(&rrd);
     return 0;
 }
 
-int set_hwarg(rrd_t *rrd,enum cf_en cf,enum rra_par_en rra_par,char *arg)
+int set_hwarg(
+    rrd_t *rrd,
+    enum cf_en cf,
+    enum rra_par_en rra_par,
+    char *arg)
 {
-   double param;
-   unsigned long i;
-   signed short rra_idx = -1;
-   /* read the value */
-   param = atof(arg);
-   if (param <= 0.0 || param >= 1.0)
-   {
-         rrd_set_error("Holt-Winters parameter must be between 0 and 1");
-         return -1;
-   }
-   /* does the appropriate RRA exist?  */
-   for (i =  0; i < rrd -> stat_head -> rra_cnt; ++i)
-   {
-         if (cf_conv(rrd -> rra_def[i].cf_nam) == cf)
-         {
-                rra_idx = i;
-                break;
-         }
-   }
-   if (rra_idx == -1) 
-   {
-         rrd_set_error("Holt-Winters RRA does not exist in this RRD");
-         return -1;
-   }
-   
-   /* set the value */
-   rrd -> rra_def[rra_idx].par[rra_par].u_val = param;
-   return 0;
+    double    param;
+    unsigned long i;
+    signed short rra_idx = -1;
+
+    /* read the value */
+    param = atof(arg);
+    if (param <= 0.0 || param >= 1.0) {
+        rrd_set_error("Holt-Winters parameter must be between 0 and 1");
+        return -1;
+    }
+    /* does the appropriate RRA exist?  */
+    for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
+        if (cf_conv(rrd->rra_def[i].cf_nam) == cf) {
+            rra_idx = i;
+            break;
+        }
+    }
+    if (rra_idx == -1) {
+        rrd_set_error("Holt-Winters RRA does not exist in this RRD");
+        return -1;
+    }
+
+    /* set the value */
+    rrd->rra_def[rra_idx].par[rra_par].u_val = param;
+    return 0;
 }
 
-int set_deltaarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg)
+int set_deltaarg(
+    rrd_t *rrd,
+    enum rra_par_en rra_par,
+    char *arg)
 {
-   rrd_value_t param;
-   unsigned long i;
-   signed short rra_idx = -1;
+    rrd_value_t param;
+    unsigned long i;
+    signed short rra_idx = -1;
 
-   param = atof(arg);
-   if (param < 0.1)
-   {
-         rrd_set_error("Parameter specified is too small");
-         return -1;
-   }
-   /* does the appropriate RRA exist?  */
-   for (i = 0; i < rrd -> stat_head -> rra_cnt; ++i)
-   {
-         if (cf_conv(rrd -> rra_def[i].cf_nam) == CF_FAILURES) 
-         {
-                rra_idx = i;
-                break;
-         }
-   }
-   if (rra_idx == -1) 
-   {
-         rrd_set_error("Failures RRA does not exist in this RRD");
-         return -1;
-   }
+    param = atof(arg);
+    if (param < 0.1) {
+        rrd_set_error("Parameter specified is too small");
+        return -1;
+    }
+    /* does the appropriate RRA exist?  */
+    for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
+        if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
+            rra_idx = i;
+            break;
+        }
+    }
+    if (rra_idx == -1) {
+        rrd_set_error("Failures RRA does not exist in this RRD");
+        return -1;
+    }
 
-   /* set the value */
-   rrd -> rra_def[rra_idx].par[rra_par].u_val = param;
-   return 0;
+    /* set the value */
+    rrd->rra_def[rra_idx].par[rra_par].u_val = param;
+    return 0;
 }
 
-int set_windowarg(rrd_t *rrd,enum rra_par_en rra_par,char *arg)
+int set_windowarg(
+    rrd_t *rrd,
+    enum rra_par_en rra_par,
+    char *arg)
 {
-   unsigned long param;
-   unsigned long i, cdp_idx;
-   signed short rra_idx = -1;
-   /* read the value */
-   param = atoi(arg);
-   if (param < 1 || param > MAX_FAILURES_WINDOW_LEN)
-   {
-         rrd_set_error("Parameter must be between %d and %d",
-                1, MAX_FAILURES_WINDOW_LEN);
-         return -1;
-   }
-   /* does the appropriate RRA exist?  */
-   for (i = 0; i < rrd -> stat_head -> rra_cnt; ++i)
-   {
-         if (cf_conv(rrd -> rra_def[i].cf_nam) == CF_FAILURES) 
-         {
-                rra_idx = i;
-                break;
-         }
-   }
-   if (rra_idx == -1) 
-   {
-         rrd_set_error("Failures RRA does not exist in this RRD");
-         return -1;
-   }
-   
-   /* set the value */
-   rrd -> rra_def[rra_idx].par[rra_par].u_cnt = param;
+    unsigned long param;
+    unsigned long i, cdp_idx;
+    signed short rra_idx = -1;
 
-   /* erase existing violations */
-   for (i = 0; i < rrd -> stat_head -> ds_cnt; i++)
-   {
-         cdp_idx = rra_idx * (rrd -> stat_head -> ds_cnt) + i;
-         erase_violations(rrd,cdp_idx,rra_idx);
-   }
-   return 0;
+    /* read the value */
+    param = atoi(arg);
+    if (param < 1 || param > MAX_FAILURES_WINDOW_LEN) {
+        rrd_set_error("Parameter must be between %d and %d",
+                      1, MAX_FAILURES_WINDOW_LEN);
+        return -1;
+    }
+    /* does the appropriate RRA exist?  */
+    for (i = 0; i < rrd->stat_head->rra_cnt; ++i) {
+        if (cf_conv(rrd->rra_def[i].cf_nam) == CF_FAILURES) {
+            rra_idx = i;
+            break;
+        }
+    }
+    if (rra_idx == -1) {
+        rrd_set_error("Failures RRA does not exist in this RRD");
+        return -1;
+    }
+
+    /* set the value */
+    rrd->rra_def[rra_idx].par[rra_par].u_cnt = param;
+
+    /* erase existing violations */
+    for (i = 0; i < rrd->stat_head->ds_cnt; i++) {
+        cdp_idx = rra_idx * (rrd->stat_head->ds_cnt) + i;
+        erase_violations(rrd, cdp_idx, rra_idx);
+    }
+    return 0;
 }
index f1242f3..c1849f3 100644 (file)
@@ -14,9 +14,9 @@
 #endif
 
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
- #include <sys/locking.h>
- #include <sys/stat.h>
- #include <io.h>
+#include <sys/locking.h>
+#include <sys/stat.h>
+#include <io.h>
 #endif
 
 #include "rrd_hw.h"
 
 #ifndef __MINGW32__
 struct timeval {
-       time_t tv_sec; /* seconds */
-       long tv_usec;  /* microseconds */
+    time_t    tv_sec;   /* seconds */
+    long      tv_usec;  /* microseconds */
 };
 #endif
 
 struct __timezone {
-       int  tz_minuteswest; /* minutes W of Greenwich */
-       int  tz_dsttime;     /* type of dst correction */
+    int       tz_minuteswest;   /* minutes W of Greenwich */
+    int       tz_dsttime;   /* type of dst correction */
 };
 
-static int gettimeofday(struct timeval *t, struct __timezone *tz) {
+static int gettimeofday(
+    struct timeval *t,
+    struct __timezone *tz)
+{
 
-       struct _timeb current_time;
+    struct _timeb current_time;
 
-       _ftime(&current_time);
+    _ftime(&current_time);
 
-       t->tv_sec  = current_time.time;
-       t->tv_usec = current_time.millitm * 1000;
+    t->tv_sec = current_time.time;
+    t->tv_usec = current_time.millitm * 1000;
 
-       return 0;
+    return 0;
 }
 
 #endif
@@ -61,218 +64,254 @@ static int gettimeofday(struct timeval *t, struct __timezone *tz) {
  * normilize time as returned by gettimeofday. usec part must
  * be always >= 0
  */
-static void normalize_time(struct timeval *t)
+static void normalize_time(
+    struct timeval *t)
 {
-       if(t->tv_usec < 0) {
-               t->tv_sec--;
-               t->tv_usec += 1000000L;
-       }
+    if (t->tv_usec < 0) {
+        t->tv_sec--;
+        t->tv_usec += 1000000L;
+    }
 }
 
 /* Local prototypes */
-int LockRRD(int in_file);
+int       LockRRD(
+    int in_file);
+
 #ifdef HAVE_MMAP
-info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, 
-                                       unsigned long *rra_current,
-                                       unsigned short CDP_scratch_idx,
+info_t   *write_RRA_row(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long *rra_current,
+    unsigned short CDP_scratch_idx,
 #ifndef DEBUG
-int UNUSED(in_file),
+    int UNUSED(in_file),
 #else
-int in_file,
+    int in_file,
 #endif
-                                       info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file);
+    info_t *pcdp_summary,
+    time_t *rra_time,
+    void *rrd_mmaped_file);
 #else
-info_t *write_RRA_row (rrd_t *rrd, unsigned long rra_idx, 
-                                       unsigned long *rra_current,
-                                       unsigned short CDP_scratch_idx, int in_file,
-                                       info_t *pcdp_summary, time_t *rra_time);
+info_t   *write_RRA_row(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long *rra_current,
+    unsigned short CDP_scratch_idx,
+    int in_file,
+    info_t *pcdp_summary,
+    time_t *rra_time);
 #endif
-int rrd_update_r(const char *filename, const char *tmplt, int argc, const char **argv);
-int _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv, 
-                                       info_t*);
+int       rrd_update_r(
+    const char *filename,
+    const char *tmplt,
+    int argc,
+    const char **argv);
+int       _rrd_update(
+    const char *filename,
+    const char *tmplt,
+    int argc,
+    const char **argv,
+    info_t *);
 
 #define IFDNAN(X,Y) (isnan(X) ? (Y) : (X));
 
 
-info_t *rrd_update_v(int argc, char **argv)
+info_t   *rrd_update_v(
+    int argc,
+    char **argv)
 {
-    char             *tmplt = NULL;          
-       info_t *result = NULL;
-       infoval rc;
-      rc.u_int = -1;
-    optind = 0; opterr = 0;  /* initialize getopt */
+    char     *tmplt = NULL;
+    info_t   *result = NULL;
+    infoval   rc;
+
+    rc.u_int = -1;
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
     while (1) {
-               static struct option long_options[] =
-                       {
-                               {"template",      required_argument, 0, 't'},
-                               {0,0,0,0}
-                       };
-               int option_index = 0;
-               int opt;
-               opt = getopt_long(argc, argv, "t:", 
-                                                 long_options, &option_index);
-               
-               if (opt == EOF)
-                       break;
-               
-               switch(opt) {
-               case 't':
-                       tmplt = optarg;
-                       break;
-               
-               case '?':
-                       rrd_set_error("unknown option '%s'",argv[optind-1]);
-                       goto end_tag;
-               }
+        static struct option long_options[] = {
+            {"template", required_argument, 0, 't'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "t:", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 't':
+            tmplt = optarg;
+            break;
+
+        case '?':
+            rrd_set_error("unknown option '%s'", argv[optind - 1]);
+            goto end_tag;
+        }
     }
 
     /* need at least 2 arguments: filename, data. */
-    if (argc-optind < 2) {
-               rrd_set_error("Not enough arguments");
-               goto end_tag;
+    if (argc - optind < 2) {
+        rrd_set_error("Not enough arguments");
+        goto end_tag;
     }
     rc.u_int = 0;
-    result = info_push(NULL,sprintf_alloc("return_value"),RD_I_INT,rc);
-       rc.u_int = _rrd_update(argv[optind], tmplt,
-                     argc - optind - 1, (const char **)(argv + optind + 1), result);
+    result = info_push(NULL, sprintf_alloc("return_value"), RD_I_INT, rc);
+    rc.u_int = _rrd_update(argv[optind], tmplt,
+                           argc - optind - 1,
+                           (const char **) (argv + optind + 1), result);
     result->value.u_int = rc.u_int;
-end_tag:
+  end_tag:
     return result;
 }
 
-int
-rrd_update(int argc, char **argv)
+int rrd_update(
+    int argc,
+    char **argv)
 {
-    char             *tmplt = NULL;          
-    int rc;
-    optind = 0; opterr = 0;  /* initialize getopt */
+    char     *tmplt = NULL;
+    int       rc;
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
     while (1) {
-               static struct option long_options[] =
-                       {
-                               {"template",      required_argument, 0, 't'},
-                               {0,0,0,0}
-                       };
-               int option_index = 0;
-               int opt;
-               opt = getopt_long(argc, argv, "t:", 
-                                                 long_options, &option_index);
-               
-               if (opt == EOF)
-                       break;
-               
-               switch(opt) {
-               case 't':
-                       tmplt = optarg;
-                       break;
-               
-               case '?':
-                       rrd_set_error("unknown option '%s'",argv[optind-1]);
-                       return(-1);
-               }
+        static struct option long_options[] = {
+            {"template", required_argument, 0, 't'},
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "t:", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 't':
+            tmplt = optarg;
+            break;
+
+        case '?':
+            rrd_set_error("unknown option '%s'", argv[optind - 1]);
+            return (-1);
+        }
     }
 
     /* need at least 2 arguments: filename, data. */
-    if (argc-optind < 2) {
-               rrd_set_error("Not enough arguments");
+    if (argc - optind < 2) {
+        rrd_set_error("Not enough arguments");
 
-               return -1;
+        return -1;
     }
-       rc = rrd_update_r(argv[optind], tmplt,
-                     argc - optind - 1, (const char **)(argv + optind + 1));
+
+    rc = rrd_update_r(argv[optind], tmplt,
+                      argc - optind - 1, (const char **) (argv + optind + 1));
     return rc;
 }
 
-int
-rrd_update_r(const char *filename, const char *tmplt, int argc, const char **argv)
+int rrd_update_r(
+    const char *filename,
+    const char *tmplt,
+    int argc,
+    const char **argv)
 {
-   return _rrd_update(filename, tmplt, argc, argv, NULL);
+    return _rrd_update(filename, tmplt, argc, argv, NULL);
 }
 
-int
-_rrd_update(const char *filename, const char *tmplt, int argc, const char **argv, 
-   info_t *pcdp_summary)
+int _rrd_update(
+    const char *filename,
+    const char *tmplt,
+    int argc,
+    const char **argv,
+    info_t *pcdp_summary)
 {
 
-    int              arg_i = 2;
-    short            j;
-    unsigned long    i,ii,iii=1;
-
-    unsigned long    rra_begin;          /* byte pointer to the rra
-                                         * area in the rrd file.  this
-                                         * pointer never changes value */
-    unsigned long    rra_start;          /* byte pointer to the rra
-                                         * area in the rrd file.  this
-                                         * pointer changes as each rrd is
-                                         * processed. */
-    unsigned long    rra_current;        /* byte pointer to the current write
-                                         * spot in the rrd file. */
-    unsigned long    rra_pos_tmp;        /* temporary byte pointer. */
-    double           interval,
-                     pre_int,post_int;   /* interval between this and
-                                         * the last run */
-    unsigned long    proc_pdp_st;        /* which pdp_st was the last
-                                         * to be processed */
-    unsigned long    occu_pdp_st;        /* when was the pdp_st
-                                         * before the last update
-                                         * time */
-    unsigned long    proc_pdp_age;       /* how old was the data in
-                                         * the pdp prep area when it
-                                         * was last updated */
-    unsigned long    occu_pdp_age;       /* how long ago was the last
-                                         * pdp_step time */
-    rrd_value_t      *pdp_new;           /* prepare the incoming data
-                                         * to be added the the
-                                         * existing entry */
-    rrd_value_t      *pdp_temp;          /* prepare the pdp values 
-                                         * to be added the the
-                                         * cdp values */
-
-    long             *tmpl_idx;          /* index representing the settings
-                                           transported by the tmplt index */
-    unsigned long    tmpl_cnt = 2;       /* time and data */
-
-    rrd_t            rrd;
-    time_t           current_time = 0;
-    time_t           rra_time = 0;      /* time of update for a RRA */
-    unsigned long    current_time_usec=0;/* microseconds part of current time */
-    struct timeval   tmp_time;           /* used for time conversion */
-
-    char             **updvals;
-    int              schedule_smooth = 0;
-       rrd_value_t      *seasonal_coef = NULL, *last_seasonal_coef = NULL;
-                                        /* a vector of future Holt-Winters seasonal coefs */
-    unsigned long    elapsed_pdp_st;
-                                        /* number of elapsed PDP steps since last update */
-    unsigned long    *rra_step_cnt = NULL;
-                                        /* number of rows to be updated in an RRA for a data
-                                         * value. */
-    unsigned long    start_pdp_offset;
-                                        /* number of PDP steps since the last update that
-                                         * are assigned to the first CDP to be generated
-                                         * since the last update. */
-    unsigned short   scratch_idx;
-                                        /* index into the CDP scratch array */
-    enum cf_en       current_cf;
-                                        /* numeric id of the current consolidation function */
-    rpnstack_t       rpnstack; /* used for COMPUTE DS */
-    int                     version;  /* rrd version */
-    char             *endptr; /* used in the conversion */
-    rrd_file_t*      rrd_file;
+    int       arg_i = 2;
+    short     j;
+    unsigned long i, ii, iii = 1;
+
+    unsigned long rra_begin;    /* byte pointer to the rra
+                                 * area in the rrd file.  this
+                                 * pointer never changes value */
+    unsigned long rra_start;    /* byte pointer to the rra
+                                 * area in the rrd file.  this
+                                 * pointer changes as each rrd is
+                                 * processed. */
+    unsigned long rra_current;  /* byte pointer to the current write
+                                 * spot in the rrd file. */
+    unsigned long rra_pos_tmp;  /* temporary byte pointer. */
+    double    interval, pre_int, post_int;  /* interval between this and
+                                             * the last run */
+    unsigned long proc_pdp_st;  /* which pdp_st was the last
+                                 * to be processed */
+    unsigned long occu_pdp_st;  /* when was the pdp_st
+                                 * before the last update
+                                 * time */
+    unsigned long proc_pdp_age; /* how old was the data in
+                                 * the pdp prep area when it
+                                 * was last updated */
+    unsigned long occu_pdp_age; /* how long ago was the last
+                                 * pdp_step time */
+    rrd_value_t *pdp_new;   /* prepare the incoming data
+                             * to be added the the
+                             * existing entry */
+    rrd_value_t *pdp_temp;  /* prepare the pdp values 
+                             * to be added the the
+                             * cdp values */
+
+    long     *tmpl_idx; /* index representing the settings
+                           transported by the tmplt index */
+    unsigned long tmpl_cnt = 2; /* time and data */
+
+    rrd_t     rrd;
+    time_t    current_time = 0;
+    time_t    rra_time = 0; /* time of update for a RRA */
+    unsigned long current_time_usec = 0;    /* microseconds part of current time */
+    struct timeval tmp_time;    /* used for time conversion */
+
+    char    **updvals;
+    int       schedule_smooth = 0;
+    rrd_value_t *seasonal_coef = NULL, *last_seasonal_coef = NULL;
+
+    /* a vector of future Holt-Winters seasonal coefs */
+    unsigned long elapsed_pdp_st;
+
+    /* number of elapsed PDP steps since last update */
+    unsigned long *rra_step_cnt = NULL;
+
+    /* number of rows to be updated in an RRA for a data
+     * value. */
+    unsigned long start_pdp_offset;
+
+    /* number of PDP steps since the last update that
+     * are assigned to the first CDP to be generated
+     * since the last update. */
+    unsigned short scratch_idx;
+
+    /* index into the CDP scratch array */
+    enum cf_en current_cf;
+
+    /* numeric id of the current consolidation function */
+    rpnstack_t rpnstack;    /* used for COMPUTE DS */
+    int       version;  /* rrd version */
+    char     *endptr;   /* used in the conversion */
+    rrd_file_t *rrd_file;
 
     rpnstack_init(&rpnstack);
 
     /* need at least 1 arguments: data. */
     if (argc < 1) {
-       rrd_set_error("Not enough arguments");
-       return -1;
+        rrd_set_error("Not enough arguments");
+        return -1;
     }
 
-    rrd_file = rrd_open(filename,&rrd, RRD_READWRITE);
+    rrd_file = rrd_open(filename, &rrd, RRD_READWRITE);
     if (rrd_file == NULL) {
-       return -1;
+        return -1;
     }
 
     /* initialize time */
@@ -280,25 +319,24 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv
     gettimeofday(&tmp_time, 0);
     normalize_time(&tmp_time);
     current_time = tmp_time.tv_sec;
-    if(version >= 3) {
+    if (version >= 3) {
         current_time_usec = tmp_time.tv_usec;
-    }
-    else {
-       current_time_usec = 0;
+    } else {
+        current_time_usec = 0;
     }
 
     rra_current = rra_start = rra_begin = rrd_file->header_len;
     /* This is defined in the ANSI C standard, section 7.9.5.3:
 
-        When a file is opened with udpate mode ('+' as the second
-        or third character in the ... list of mode argument
-        variables), both input and output may be performed on the
-        associated stream.  However, ...  input may not be directly
-        followed by output without an intervening call to a file
-        positioning function, unless the input operation encounters
-        end-of-file. */
-#if 0//def HAVE_MMAP
-rrd_filesize = rrd_file->file_size;
+       When a file is opened with udpate mode ('+' as the second
+       or third character in the ... list of mode argument
+       variables), both input and output may be performed on the
+       associated stream.  However, ...  input may not be directly
+       followed by output without an intervening call to a file
+       positioning function, unless the input operation encounters
+       end-of-file. */
+#if 0                   //def HAVE_MMAP
+    rrd_filesize = rrd_file->file_size;
     fseek(rrd_file->fd, 0, SEEK_END);
     rrd_filesize = ftell(rrd_file->fd);
     fseek(rrd_file->fd, rra_current, SEEK_SET);
@@ -306,41 +344,42 @@ rrd_filesize = rrd_file->file_size;
 //    fseek(rrd_file->fd, 0, SEEK_CUR);
 #endif
 
-    
+
     /* get exclusive lock to whole file.
      * lock gets removed when we close the file.
      */
     if (LockRRD(rrd_file->fd) != 0) {
-      rrd_set_error("could not lock RRD");
-      rrd_free(&rrd);
-      close(rrd_file->fd);
-      return(-1);   
-    } 
-
-    if((updvals = malloc( sizeof(char*) * (rrd.stat_head->ds_cnt+1)))==NULL){
-       rrd_set_error("allocating updvals pointer array");
-       rrd_free(&rrd);
+        rrd_set_error("could not lock RRD");
+        rrd_free(&rrd);
+        close(rrd_file->fd);
+        return (-1);
+    }
+
+    if ((updvals =
+         malloc(sizeof(char *) * (rrd.stat_head->ds_cnt + 1))) == NULL) {
+        rrd_set_error("allocating updvals pointer array");
+        rrd_free(&rrd);
         close(rrd_file->fd);
-       return(-1);
+        return (-1);
     }
 
     if ((pdp_temp = malloc(sizeof(rrd_value_t)
-                          *rrd.stat_head->ds_cnt))==NULL){
-       rrd_set_error("allocating pdp_temp ...");
-       free(updvals);
-       rrd_free(&rrd);
+                           * rrd.stat_head->ds_cnt)) == NULL) {
+        rrd_set_error("allocating pdp_temp ...");
+        free(updvals);
+        rrd_free(&rrd);
         close(rrd_file->fd);
-       return(-1);
+        return (-1);
     }
 
     if ((tmpl_idx = malloc(sizeof(unsigned long)
-                          *(rrd.stat_head->ds_cnt+1)))==NULL){
-       rrd_set_error("allocating tmpl_idx ...");
-       free(pdp_temp);
-       free(updvals);
-       rrd_free(&rrd);
+                           * (rrd.stat_head->ds_cnt + 1))) == NULL) {
+        rrd_set_error("allocating tmpl_idx ...");
+        free(pdp_temp);
+        free(updvals);
+        rrd_free(&rrd);
         close(rrd_file->fd);
-       return(-1);
+        return (-1);
     }
     /* initialize tmplt redirector */
     /* default config example (assume DS 1 is a CDEF DS)
@@ -348,1055 +387,1180 @@ rrd_filesize = rrd_file->file_size;
        tmpl_idx[1] -> 1; (DS 0)
        tmpl_idx[2] -> 3; (DS 2)
        tmpl_idx[3] -> 4; (DS 3) */
-    tmpl_idx[0] = 0; /* time */
-    for (i = 1, ii = 1 ; i <= rrd.stat_head->ds_cnt ; i++) 
-       {
-          if (dst_conv(rrd.ds_def[i-1].dst) != DST_CDEF)
-             tmpl_idx[ii++]=i;
-       }
-    tmpl_cnt= ii;
+    tmpl_idx[0] = 0;    /* time */
+    for (i = 1, ii = 1; i <= rrd.stat_head->ds_cnt; i++) {
+        if (dst_conv(rrd.ds_def[i - 1].dst) != DST_CDEF)
+            tmpl_idx[ii++] = i;
+    }
+    tmpl_cnt = ii;
 
     if (tmplt) {
-       /* we should work on a writeable copy here */
-       char *dsname;
-       unsigned int tmpl_len;
-       char *tmplt_copy = strdup(tmplt);
-       dsname = tmplt_copy;
-       tmpl_cnt = 1; /* the first entry is the time */
-       tmpl_len = strlen(tmplt_copy);
-       for(i=0;i<=tmpl_len ;i++) {
-           if (tmplt_copy[i] == ':' || tmplt_copy[i] == '\0') {
-               tmplt_copy[i] = '\0';
-               if (tmpl_cnt>rrd.stat_head->ds_cnt){
-                   rrd_set_error("tmplt contains more DS definitions than RRD");
-                   free(updvals); free(pdp_temp);
-                   free(tmpl_idx); rrd_free(&rrd);
-                   close(rrd_file->fd); return(-1);
-               }
-               if ((tmpl_idx[tmpl_cnt++] = ds_match(&rrd,dsname)) == -1){
-                   rrd_set_error("unknown DS name '%s'",dsname);
-                   free(updvals); free(pdp_temp);
-                   free(tmplt_copy);
-                   free(tmpl_idx); rrd_free(&rrd);
-                   close(rrd_file->fd); return(-1);
-               } else {
-                 /* the first element is always the time */
-                 tmpl_idx[tmpl_cnt-1]++; 
-                 /* go to the next entry on the tmplt_copy */
-                 dsname = &tmplt_copy[i+1];
-                  /* fix the damage we did before */
-                  if (i<tmpl_len) {
-                     tmplt_copy[i]=':';
-                  } 
-
-               }
-           }       
-       }
-       free(tmplt_copy);
+        /* we should work on a writeable copy here */
+        char     *dsname;
+        unsigned int tmpl_len;
+        char     *tmplt_copy = strdup(tmplt);
+
+        dsname = tmplt_copy;
+        tmpl_cnt = 1;   /* the first entry is the time */
+        tmpl_len = strlen(tmplt_copy);
+        for (i = 0; i <= tmpl_len; i++) {
+            if (tmplt_copy[i] == ':' || tmplt_copy[i] == '\0') {
+                tmplt_copy[i] = '\0';
+                if (tmpl_cnt > rrd.stat_head->ds_cnt) {
+                    rrd_set_error
+                        ("tmplt contains more DS definitions than RRD");
+                    free(updvals);
+                    free(pdp_temp);
+                    free(tmpl_idx);
+                    rrd_free(&rrd);
+                    close(rrd_file->fd);
+                    return (-1);
+                }
+                if ((tmpl_idx[tmpl_cnt++] = ds_match(&rrd, dsname)) == -1) {
+                    rrd_set_error("unknown DS name '%s'", dsname);
+                    free(updvals);
+                    free(pdp_temp);
+                    free(tmplt_copy);
+                    free(tmpl_idx);
+                    rrd_free(&rrd);
+                    close(rrd_file->fd);
+                    return (-1);
+                } else {
+                    /* the first element is always the time */
+                    tmpl_idx[tmpl_cnt - 1]++;
+                    /* go to the next entry on the tmplt_copy */
+                    dsname = &tmplt_copy[i + 1];
+                    /* fix the damage we did before */
+                    if (i < tmpl_len) {
+                        tmplt_copy[i] = ':';
+                    }
+
+                }
+            }
+        }
+        free(tmplt_copy);
     }
     if ((pdp_new = malloc(sizeof(rrd_value_t)
-                         *rrd.stat_head->ds_cnt))==NULL){
-       rrd_set_error("allocating pdp_new ...");
-       free(updvals);
-       free(pdp_temp);
-       free(tmpl_idx);
-       rrd_free(&rrd);
+                          * rrd.stat_head->ds_cnt)) == NULL) {
+        rrd_set_error("allocating pdp_new ...");
+        free(updvals);
+        free(pdp_temp);
+        free(tmpl_idx);
+        rrd_free(&rrd);
         close(rrd_file->fd);
-       return(-1);
+        return (-1);
     }
-
-#if 0//def HAVE_MMAP
-    rrd_mmaped_file = mmap(0, 
-                       rrd_file->file_len, 
-                       PROT_READ | PROT_WRITE, 
-                       MAP_SHARED, 
-                       fileno(in_file), 
-                       0);
+#if 0                   //def HAVE_MMAP
+    rrd_mmaped_file = mmap(0,
+                           rrd_file->file_len,
+                           PROT_READ | PROT_WRITE,
+                           MAP_SHARED, fileno(in_file), 0);
     if (rrd_mmaped_file == MAP_FAILED) {
         rrd_set_error("error mmapping file %s", filename);
-       free(updvals);
-       free(pdp_temp);
-       free(tmpl_idx);
-       rrd_free(&rrd);
+        free(updvals);
+        free(pdp_temp);
+        free(tmpl_idx);
+        rrd_free(&rrd);
         close(rrd_file->fd);
-       return(-1);
+        return (-1);
     }
 #ifdef USE_MADVISE
     /* when we use mmaping we tell the kernel the mmap equivalent
        of POSIX_FADV_RANDOM */
-    madvise(rrd_mmaped_file,rrd_filesize,POSIX_MADV_RANDOM);
+    madvise(rrd_mmaped_file, rrd_filesize, POSIX_MADV_RANDOM);
 #endif
 #endif
     /* loop through the arguments. */
-    for(arg_i=0; arg_i<argc;arg_i++) {
-       char *stepper = strdup(argv[arg_i]);
-        char *step_start = stepper;
-       char *p;
-       char *parsetime_error = NULL;
-       enum {atstyle, normal} timesyntax;
-       struct rrd_time_value ds_tv;
-        if (stepper == NULL){
-                rrd_set_error("failed duplication argv entry");
-               free(step_start);
-                free(updvals);
-                free(pdp_temp);  
-                free(tmpl_idx);
-                rrd_free(&rrd);
+    for (arg_i = 0; arg_i < argc; arg_i++) {
+        char     *stepper = strdup(argv[arg_i]);
+        char     *step_start = stepper;
+        char     *p;
+        char     *parsetime_error = NULL;
+        enum { atstyle, normal } timesyntax;
+        struct rrd_time_value ds_tv;
+
+        if (stepper == NULL) {
+            rrd_set_error("failed duplication argv entry");
+            free(step_start);
+            free(updvals);
+            free(pdp_temp);
+            free(tmpl_idx);
+            rrd_free(&rrd);
 #ifdef HAVE_MMAP
-               rrd_close(rrd_file);
+            rrd_close(rrd_file);
 #endif
-                close(rrd_file->fd);
-                return(-1);
-         }
-       /* initialize all ds input to unknown except the first one
+            close(rrd_file->fd);
+            return (-1);
+        }
+        /* initialize all ds input to unknown except the first one
            which has always got to be set */
-       for(ii=1;ii<=rrd.stat_head->ds_cnt;ii++) updvals[ii] = "U";
-       updvals[0]=stepper;
-       /* separate all ds elements; first must be examined separately
-          due to alternate time syntax */
-       if ((p=strchr(stepper,'@'))!=NULL) {
-           timesyntax = atstyle;
-           *p = '\0';
-           stepper = p+1;
-       } else if ((p=strchr(stepper,':'))!=NULL) {
-           timesyntax = normal;
-           *p = '\0';
-           stepper = p+1;
-       } else {
-           rrd_set_error("expected timestamp not found in data source from %s",
-                         argv[arg_i]);
-           free(step_start);
-           break;
-       }
-       ii=1;
-       updvals[tmpl_idx[ii]] = stepper;
-       while (*stepper) {
-           if (*stepper == ':') {
-               *stepper = '\0';
-               ii++;
-               if (ii<tmpl_cnt){                   
-                   updvals[tmpl_idx[ii]] = stepper+1;
-               }
-           }
-           stepper++;
-       }
-
-       if (ii != tmpl_cnt-1) {
-           rrd_set_error("expected %lu data source readings (got %lu) from %s",
-                         tmpl_cnt-1, ii, argv[arg_i]);
-           free(step_start);
-           break;
-       }
-       
+        for (ii = 1; ii <= rrd.stat_head->ds_cnt; ii++)
+            updvals[ii] = "U";
+        updvals[0] = stepper;
+        /* separate all ds elements; first must be examined separately
+           due to alternate time syntax */
+        if ((p = strchr(stepper, '@')) != NULL) {
+            timesyntax = atstyle;
+            *p = '\0';
+            stepper = p + 1;
+        } else if ((p = strchr(stepper, ':')) != NULL) {
+            timesyntax = normal;
+            *p = '\0';
+            stepper = p + 1;
+        } else {
+            rrd_set_error
+                ("expected timestamp not found in data source from %s",
+                 argv[arg_i]);
+            free(step_start);
+            break;
+        }
+        ii = 1;
+        updvals[tmpl_idx[ii]] = stepper;
+        while (*stepper) {
+            if (*stepper == ':') {
+                *stepper = '\0';
+                ii++;
+                if (ii < tmpl_cnt) {
+                    updvals[tmpl_idx[ii]] = stepper + 1;
+                }
+            }
+            stepper++;
+        }
+
+        if (ii != tmpl_cnt - 1) {
+            rrd_set_error
+                ("expected %lu data source readings (got %lu) from %s",
+                 tmpl_cnt - 1, ii, argv[arg_i]);
+            free(step_start);
+            break;
+        }
+
         /* get the time from the reading ... handle N */
-       if (timesyntax == atstyle) {
+        if (timesyntax == atstyle) {
             if ((parsetime_error = parsetime(updvals[0], &ds_tv))) {
-                rrd_set_error("ds time: %s: %s", updvals[0], parsetime_error );
-               free(step_start);
-               break;
-           }
-           if (ds_tv.type == RELATIVE_TO_END_TIME ||
-               ds_tv.type == RELATIVE_TO_START_TIME) {
-               rrd_set_error("specifying time relative to the 'start' "
-                             "or 'end' makes no sense here: %s",
-                             updvals[0]);
-               free(step_start);
-               break;
-           }
-
-           current_time = mktime(&ds_tv.tm) + ds_tv.offset;
-           current_time_usec = 0; /* FIXME: how to handle usecs here ? */
-           
-       } else if (strcmp(updvals[0],"N")==0){
-           gettimeofday(&tmp_time, 0);
-           normalize_time(&tmp_time);
-           current_time = tmp_time.tv_sec;
-           current_time_usec = tmp_time.tv_usec;
-       } else {
-           double tmp;
-           tmp = strtod(updvals[0], 0);
-           current_time = floor(tmp);
-           current_time_usec = (long)((tmp-(double)current_time) * 1000000.0);
-       }
-       /* dont do any correction for old version RRDs */
-       if(version < 3) 
-           current_time_usec = 0;
-       
-       if(current_time < rrd.live_head->last_up || 
-         (current_time == rrd.live_head->last_up && 
-          (long)current_time_usec <= (long)rrd.live_head->last_up_usec)) {
-           rrd_set_error("illegal attempt to update using time %ld when "
-                         "last update time is %ld (minimum one second step)",
-                         current_time, rrd.live_head->last_up);
-           free(step_start);
-           break;
-       }
-       
-       
-       /* seek to the beginning of the rra's */
-       if (rra_current != rra_begin) {
+                rrd_set_error("ds time: %s: %s", updvals[0], parsetime_error);
+                free(step_start);
+                break;
+            }
+            if (ds_tv.type == RELATIVE_TO_END_TIME ||
+                ds_tv.type == RELATIVE_TO_START_TIME) {
+                rrd_set_error("specifying time relative to the 'start' "
+                              "or 'end' makes no sense here: %s", updvals[0]);
+                free(step_start);
+                break;
+            }
+
+            current_time = mktime(&ds_tv.tm) + ds_tv.offset;
+            current_time_usec = 0;  /* FIXME: how to handle usecs here ? */
+
+        } else if (strcmp(updvals[0], "N") == 0) {
+            gettimeofday(&tmp_time, 0);
+            normalize_time(&tmp_time);
+            current_time = tmp_time.tv_sec;
+            current_time_usec = tmp_time.tv_usec;
+        } else {
+            double    tmp;
+
+            tmp = strtod(updvals[0], 0);
+            current_time = floor(tmp);
+            current_time_usec =
+                (long) ((tmp - (double) current_time) * 1000000.0);
+        }
+        /* dont do any correction for old version RRDs */
+        if (version < 3)
+            current_time_usec = 0;
+
+        if (current_time < rrd.live_head->last_up ||
+            (current_time == rrd.live_head->last_up &&
+             (long) current_time_usec <=
+             (long) rrd.live_head->last_up_usec)) {
+            rrd_set_error("illegal attempt to update using time %ld when "
+                          "last update time is %ld (minimum one second step)",
+                          current_time, rrd.live_head->last_up);
+            free(step_start);
+            break;
+        }
+
+
+        /* seek to the beginning of the rra's */
+        if (rra_current != rra_begin) {
 #ifndef HAVE_MMAP
-           if(rrd_seek(rrd_file, rra_begin, SEEK_SET) != 0) {
-               rrd_set_error("seek error in rrd");
-               free(step_start);
-               break;
-           }
+            if (rrd_seek(rrd_file, rra_begin, SEEK_SET) != 0) {
+                rrd_set_error("seek error in rrd");
+                free(step_start);
+                break;
+            }
 #endif
-           rra_current = rra_begin;
-       }
-       rra_start = rra_begin;
-
-       /* when was the current pdp started */
-       proc_pdp_age = rrd.live_head->last_up % rrd.stat_head->pdp_step;
-       proc_pdp_st = rrd.live_head->last_up - proc_pdp_age;
-
-       /* when did the last pdp_st occur */
-       occu_pdp_age = current_time % rrd.stat_head->pdp_step;
-       occu_pdp_st = current_time - occu_pdp_age;
-
-       /* interval = current_time - rrd.live_head->last_up; */
-       interval    = (double)(current_time - rrd.live_head->last_up) 
-                   + (double)((long)current_time_usec - (long)rrd.live_head->last_up_usec)/1000000.0;
-
-       if (occu_pdp_st > proc_pdp_st){
-           /* OK we passed the pdp_st moment*/
-           pre_int =  (long)occu_pdp_st - rrd.live_head->last_up; /* how much of the input data
-                                                             * occurred before the latest
-                                                             * pdp_st moment*/
-           pre_int -= ((double)rrd.live_head->last_up_usec)/1000000.0; /* adjust usecs */
-           post_int = occu_pdp_age;                         /* how much after it */
-           post_int += ((double)current_time_usec)/1000000.0;  /* adjust usecs */
-       } else {
-           pre_int = interval;
-           post_int = 0;
-       }
+            rra_current = rra_begin;
+        }
+        rra_start = rra_begin;
+
+        /* when was the current pdp started */
+        proc_pdp_age = rrd.live_head->last_up % rrd.stat_head->pdp_step;
+        proc_pdp_st = rrd.live_head->last_up - proc_pdp_age;
+
+        /* when did the last pdp_st occur */
+        occu_pdp_age = current_time % rrd.stat_head->pdp_step;
+        occu_pdp_st = current_time - occu_pdp_age;
+
+        /* interval = current_time - rrd.live_head->last_up; */
+        interval = (double) (current_time - rrd.live_head->last_up)
+            + (double) ((long) current_time_usec -
+                        (long) rrd.live_head->last_up_usec) / 1000000.0;
+
+        if (occu_pdp_st > proc_pdp_st) {
+            /* OK we passed the pdp_st moment */
+            pre_int = (long) occu_pdp_st - rrd.live_head->last_up;  /* how much of the input data
+                                                                     * occurred before the latest
+                                                                     * pdp_st moment*/
+            pre_int -= ((double) rrd.live_head->last_up_usec) / 1000000.0;  /* adjust usecs */
+            post_int = occu_pdp_age;    /* how much after it */
+            post_int += ((double) current_time_usec) / 1000000.0;   /* adjust usecs */
+        } else {
+            pre_int = interval;
+            post_int = 0;
+        }
 
 #ifdef DEBUG
-       printf(
-              "proc_pdp_age %lu\t"
-              "proc_pdp_st %lu\t" 
-              "occu_pfp_age %lu\t" 
-              "occu_pdp_st %lu\t"
-              "int %lf\t"
-              "pre_int %lf\t"
-              "post_int %lf\n", proc_pdp_age, proc_pdp_st, 
-               occu_pdp_age, occu_pdp_st,
-              interval, pre_int, post_int);
+        printf("proc_pdp_age %lu\t"
+               "proc_pdp_st %lu\t"
+               "occu_pfp_age %lu\t"
+               "occu_pdp_st %lu\t"
+               "int %lf\t"
+               "pre_int %lf\t"
+               "post_int %lf\n", proc_pdp_age, proc_pdp_st,
+               occu_pdp_age, occu_pdp_st, interval, pre_int, post_int);
 #endif
-    
-       /* process the data sources and update the pdp_prep 
-        * area accordingly */
-       for(i=0;i<rrd.stat_head->ds_cnt;i++){
-           enum dst_en dst_idx;
-           dst_idx= dst_conv(rrd.ds_def[i].dst);
+
+        /* process the data sources and update the pdp_prep 
+         * area accordingly */
+        for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+            enum dst_en dst_idx;
+
+            dst_idx = dst_conv(rrd.ds_def[i].dst);
 
             /* make sure we do not build diffs with old last_ds values */
-           if(rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt < interval) {
-               strncpy(rrd.pdp_prep[i].last_ds,"U",LAST_DS_LEN-1);
-               rrd.pdp_prep[i].last_ds[LAST_DS_LEN-1]='\0';
-           }
+            if (rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt < interval) {
+                strncpy(rrd.pdp_prep[i].last_ds, "U", LAST_DS_LEN - 1);
+                rrd.pdp_prep[i].last_ds[LAST_DS_LEN - 1] = '\0';
+            }
 
-           /* NOTE: DST_CDEF should never enter this if block, because
+            /* NOTE: DST_CDEF should never enter this if block, because
              * updvals[i+1][0] is initialized to 'U'; unless the caller
-            * accidently specified a value for the DST_CDEF. To handle 
-             * this case, an extra check is required. */
-
-           if((updvals[i+1][0] != 'U') &&
-                  (dst_idx != DST_CDEF) &&
-              rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt >= interval) {
-              double rate = DNAN;
-              /* the data source type defines how to process the data */
-               /* pdp_new contains rate * time ... eg the bytes
-                * transferred during the interval. Doing it this way saves
-                * a lot of math operations */
-               
-
-               switch(dst_idx){
-               case DST_COUNTER:
-               case DST_DERIVE:
-                   if(rrd.pdp_prep[i].last_ds[0] != 'U'){
-                      for(ii=0;updvals[i+1][ii] != '\0';ii++){
-                            if((updvals[i+1][ii] < '0' || updvals[i+1][ii] > '9') && (ii != 0 && updvals[i+1][ii] != '-')){
-                                 rrd_set_error("not a simple integer: '%s'",updvals[i+1]);
-                                 break;
+             * accidently specified a value for the DST_CDEF. To handle 
+             * this case, an extra check is required. */
+
+            if ((updvals[i + 1][0] != 'U') &&
+                (dst_idx != DST_CDEF) &&
+                rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt >= interval) {
+                double    rate = DNAN;
+
+                /* the data source type defines how to process the data */
+                /* pdp_new contains rate * time ... eg the bytes
+                 * transferred during the interval. Doing it this way saves
+                 * a lot of math operations */
+
+
+                switch (dst_idx) {
+                case DST_COUNTER:
+                case DST_DERIVE:
+                    if (rrd.pdp_prep[i].last_ds[0] != 'U') {
+                        for (ii = 0; updvals[i + 1][ii] != '\0'; ii++) {
+                            if ((updvals[i + 1][ii] < '0'
+                                 || updvals[i + 1][ii] > '9') && (ii != 0
+                                                                  && updvals[i
+                                                                             +
+                                                                             1]
+                                                                  [ii] !=
+                                                                  '-')) {
+                                rrd_set_error("not a simple integer: '%s'",
+                                              updvals[i + 1]);
+                                break;
                             }
-                       }
-                       if (rrd_test_error()){
+                        }
+                        if (rrd_test_error()) {
                             break;
-                       }
-                      pdp_new[i]= rrd_diff(updvals[i+1],rrd.pdp_prep[i].last_ds);
-                      if(dst_idx == DST_COUNTER) {
-                         /* simple overflow catcher suggested by Andres Kroonmaa */
-                         /* this will fail terribly for non 32 or 64 bit counters ... */
-                         /* are there any others in SNMP land ? */
-                         if (pdp_new[i] < (double)0.0 ) 
-                           pdp_new[i] += (double)4294967296.0 ;  /* 2^32 */
-                         if (pdp_new[i] < (double)0.0 ) 
-                           pdp_new[i] += (double)18446744069414584320.0; /* 2^64-2^32 */;
-                      }
-                      rate = pdp_new[i] / interval;
-                   }
-                  else {
-                    pdp_new[i]= DNAN;          
-                  }
-                  break;
-               case DST_ABSOLUTE:
+                        }
+                        pdp_new[i] =
+                            rrd_diff(updvals[i + 1], rrd.pdp_prep[i].last_ds);
+                        if (dst_idx == DST_COUNTER) {
+                            /* simple overflow catcher suggested by Andres Kroonmaa */
+                            /* this will fail terribly for non 32 or 64 bit counters ... */
+                            /* are there any others in SNMP land ? */
+                            if (pdp_new[i] < (double) 0.0)
+                                pdp_new[i] += (double) 4294967296.0;    /* 2^32 */
+                            if (pdp_new[i] < (double) 0.0)
+                                pdp_new[i] += (double) 18446744069414584320.0;
+                            /* 2^64-2^32 */ ;
+                        }
+                        rate = pdp_new[i] / interval;
+                    } else {
+                        pdp_new[i] = DNAN;
+                    }
+                    break;
+                case DST_ABSOLUTE:
                     errno = 0;
-                    pdp_new[i] = strtod(updvals[i+1],&endptr);
-                    if (errno > 0){
-                        rrd_set_error("converting  '%s' to float: %s",updvals[i+1],rrd_strerror(errno));
+                    pdp_new[i] = strtod(updvals[i + 1], &endptr);
+                    if (errno > 0) {
+                        rrd_set_error("converting  '%s' to float: %s",
+                                      updvals[i + 1], rrd_strerror(errno));
                         break;
                     };
-                    if (endptr[0] != '\0'){
-                        rrd_set_error("conversion of '%s' to float not complete: tail '%s'",updvals[i+1],endptr);
+                    if (endptr[0] != '\0') {
+                        rrd_set_error
+                            ("conversion of '%s' to float not complete: tail '%s'",
+                             updvals[i + 1], endptr);
                         break;
                     }
-                   rate = pdp_new[i] / interval;                 
-                   break;
-               case DST_GAUGE:
+                    rate = pdp_new[i] / interval;
+                    break;
+                case DST_GAUGE:
                     errno = 0;
-                    pdp_new[i] = strtod(updvals[i+1],&endptr) * interval;
-                    if (errno > 0){
-                        rrd_set_error("converting  '%s' to float: %s",updvals[i+1],rrd_strerror(errno));
+                    pdp_new[i] = strtod(updvals[i + 1], &endptr) * interval;
+                    if (errno > 0) {
+                        rrd_set_error("converting  '%s' to float: %s",
+                                      updvals[i + 1], rrd_strerror(errno));
                         break;
                     };
-                    if (endptr[0] != '\0'){
-                        rrd_set_error("conversion of '%s' to float not complete: tail '%s'",updvals[i+1],endptr);
+                    if (endptr[0] != '\0') {
+                        rrd_set_error
+                            ("conversion of '%s' to float not complete: tail '%s'",
+                             updvals[i + 1], endptr);
                         break;
                     }
-                   rate = pdp_new[i] / interval;                  
-                   break;
-               default:
-                   rrd_set_error("rrd contains unknown DS type : '%s'",
-                                 rrd.ds_def[i].dst);
-                   break;
-               }
-               /* break out of this for loop if the error string is set */
-               if (rrd_test_error()){
-                   break;
-               }
-              /* make sure pdp_temp is neither too large or too small
-               * if any of these occur it becomes unknown ...
-               * sorry folks ... */
-              if ( ! isnan(rate) && 
-                   (( ! isnan(rrd.ds_def[i].par[DS_max_val].u_val) &&
-                        rate > rrd.ds_def[i].par[DS_max_val].u_val ) ||     
-                   ( ! isnan(rrd.ds_def[i].par[DS_min_val].u_val) &&
-                       rate < rrd.ds_def[i].par[DS_min_val].u_val ))){
-                 pdp_new[i] = DNAN;
-              }               
-           } else {
-               /* no news is news all the same */
-               pdp_new[i] = DNAN;
-           }
-
-           
-           /* make a copy of the command line argument for the next run */
+                    rate = pdp_new[i] / interval;
+                    break;
+                default:
+                    rrd_set_error("rrd contains unknown DS type : '%s'",
+                                  rrd.ds_def[i].dst);
+                    break;
+                }
+                /* break out of this for loop if the error string is set */
+                if (rrd_test_error()) {
+                    break;
+                }
+                /* make sure pdp_temp is neither too large or too small
+                 * if any of these occur it becomes unknown ...
+                 * sorry folks ... */
+                if (!isnan(rate) &&
+                    ((!isnan(rrd.ds_def[i].par[DS_max_val].u_val) &&
+                      rate > rrd.ds_def[i].par[DS_max_val].u_val) ||
+                     (!isnan(rrd.ds_def[i].par[DS_min_val].u_val) &&
+                      rate < rrd.ds_def[i].par[DS_min_val].u_val))) {
+                    pdp_new[i] = DNAN;
+                }
+            } else {
+                /* no news is news all the same */
+                pdp_new[i] = DNAN;
+            }
+
+
+            /* make a copy of the command line argument for the next run */
 #ifdef DEBUG
-           fprintf(stderr,
-                   "prep ds[%lu]\t"
-                   "last_arg '%s'\t"
-                   "this_arg '%s'\t"
-                   "pdp_new %10.2f\n",
-                   i,
-                   rrd.pdp_prep[i].last_ds,
-                   updvals[i+1], pdp_new[i]);
+            fprintf(stderr,
+                    "prep ds[%lu]\t"
+                    "last_arg '%s'\t"
+                    "this_arg '%s'\t"
+                    "pdp_new %10.2f\n",
+                    i, rrd.pdp_prep[i].last_ds, updvals[i + 1], pdp_new[i]);
 #endif
-           strncpy(rrd.pdp_prep[i].last_ds, updvals[i+1],LAST_DS_LEN-1);
-           rrd.pdp_prep[i].last_ds[LAST_DS_LEN-1]='\0';
-       }
-       /* break out of the argument parsing loop if the error_string is set */
-       if (rrd_test_error()){
-           free(step_start);
-           break;
-       }
-       /* has a pdp_st moment occurred since the last run ? */
-
-       if (proc_pdp_st == occu_pdp_st){
-           /* no we have not passed a pdp_st moment. therefore update is simple */
-
-           for(i=0;i<rrd.stat_head->ds_cnt;i++){
-               if(isnan(pdp_new[i])) {            
-                   /* this is not realy accurate if we use subsecond data arival time
-                      should have thought of it when going subsecond resolution ...
+            strncpy(rrd.pdp_prep[i].last_ds, updvals[i + 1], LAST_DS_LEN - 1);
+            rrd.pdp_prep[i].last_ds[LAST_DS_LEN - 1] = '\0';
+        }
+        /* break out of the argument parsing loop if the error_string is set */
+        if (rrd_test_error()) {
+            free(step_start);
+            break;
+        }
+        /* has a pdp_st moment occurred since the last run ? */
+
+        if (proc_pdp_st == occu_pdp_st) {
+            /* no we have not passed a pdp_st moment. therefore update is simple */
+
+            for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+                if (isnan(pdp_new[i])) {
+                    /* this is not realy accurate if we use subsecond data arival time
+                       should have thought of it when going subsecond resolution ...
                        sorry next format change we will have it! */
-                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt += floor(interval);          
-               } else {
-                    if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val= pdp_new[i];
-                    } else {
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i];
-                    }
-               }
+                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt +=
+                        floor(interval);
+                } else {
+                    if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)) {
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val = pdp_new[i];
+                    } else {
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val += pdp_new[i];
+                    }
+                }
 #ifdef DEBUG
-               fprintf(stderr,
-                       "NO PDP  ds[%lu]\t"
-                       "value %10.2f\t"
-                       "unkn_sec %5lu\n",
-                       i,
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val,
-                       rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+                fprintf(stderr,
+                        "NO PDP  ds[%lu]\t"
+                        "value %10.2f\t"
+                        "unkn_sec %5lu\n",
+                        i,
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val,
+                        rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
 #endif
-           }   
-       } else {
-           /* an pdp_st has occurred. */
-
-           /* in pdp_prep[].scratch[PDP_val].u_val we have collected rate*seconds which 
-            * occurred up to the last run.        
-           pdp_new[] contains rate*seconds from the latest run.
-           pdp_temp[] will contain the rate for cdp */
-
-           for(i=0;i<rrd.stat_head->ds_cnt;i++){
-               /* update pdp_prep to the current pdp_st. */
-                double pre_unknown = 0.0;              
-               if(isnan(pdp_new[i]))
+            }
+        } else {
+            /* an pdp_st has occurred. */
+
+            /* in pdp_prep[].scratch[PDP_val].u_val we have collected rate*seconds which 
+             * occurred up to the last run.        
+             pdp_new[] contains rate*seconds from the latest run.
+             pdp_temp[] will contain the rate for cdp */
+
+            for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
+                /* update pdp_prep to the current pdp_st. */
+                double    pre_unknown = 0.0;
+
+                if (isnan(pdp_new[i]))
                     /* a final bit of unkonwn to be added bevore calculation
-                    * we use a tempaorary variable for this so that we 
-                    * don't have to turn integer lines before using the value */                
-                   pre_unknown = pre_int;
-               else {
-                    if (isnan( rrd.pdp_prep[i].scratch[PDP_val].u_val )){
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val=         pdp_new[i]/interval*pre_int;
-                    } else {
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val+= pdp_new[i]/interval*pre_int;
-                    }
-                }
-               
-
-               /* if too much of the pdp_prep is unknown we dump it */
-               if ( 
-                   /* removed because this does not agree with the definition
-                      a heart beat can be unknown */
-                   /* (rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt 
-                    > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) || */
-                   /* if the interval is larger thatn mrhb we get NAN */
-                   (interval > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) ||
-                   (occu_pdp_st-proc_pdp_st <= 
-                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)) {
-                   pdp_temp[i] = DNAN;
-               } else {
-                   pdp_temp[i] = rrd.pdp_prep[i].scratch[PDP_val].u_val
-                       / ((double)(occu_pdp_st - proc_pdp_st
-                                    - rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)
-                            -pre_unknown);
-               }
-
-               /* process CDEF data sources; remember each CDEF DS can
-                * only reference other DS with a lower index number */
-           if (dst_conv(rrd.ds_def[i].dst) == DST_CDEF) {
-                  rpnp_t *rpnp;
-                  rpnp = rpn_expand((rpn_cdefds_t *) &(rrd.ds_def[i].par[DS_cdef]));
-                  /* substitue data values for OP_VARIABLE nodes */
-                  for (ii = 0; rpnp[ii].op != OP_END; ii++)
-                  {
-                         if (rpnp[ii].op == OP_VARIABLE) {
-                                rpnp[ii].op = OP_NUMBER;
-                                rpnp[ii].val =  pdp_temp[rpnp[ii].ptr];
-                         }
-                  }
-                  /* run the rpn calculator */
-                  if (rpn_calc(rpnp,&rpnstack,0,pdp_temp,i) == -1) {
-                         free(rpnp);
-                         break; /* exits the data sources pdp_temp loop */
-                  }
-               }
-        
-               /* make pdp_prep ready for the next run */
-               if(isnan(pdp_new[i])){
-                   /* this is not realy accurate if we use subsecond data arival time
-                      should have thought of it when going subsecond resolution ...
+                     * we use a tempaorary variable for this so that we 
+                     * don't have to turn integer lines before using the value */
+                    pre_unknown = pre_int;
+                else {
+                    if (isnan(rrd.pdp_prep[i].scratch[PDP_val].u_val)) {
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val =
+                            pdp_new[i] / interval * pre_int;
+                    } else {
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val +=
+                            pdp_new[i] / interval * pre_int;
+                    }
+                }
+
+
+                /* if too much of the pdp_prep is unknown we dump it */
+                if (
+                       /* removed because this does not agree with the definition
+                          a heart beat can be unknown */
+                       /* (rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt 
+                          > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) || */
+                       /* if the interval is larger thatn mrhb we get NAN */
+                       (interval > rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt) ||
+                       (occu_pdp_st - proc_pdp_st <=
+                        rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt)) {
+                    pdp_temp[i] = DNAN;
+                } else {
+                    pdp_temp[i] = rrd.pdp_prep[i].scratch[PDP_val].u_val
+                        / ((double) (occu_pdp_st - proc_pdp_st
+                                     -
+                                     rrd.pdp_prep[i].
+                                     scratch[PDP_unkn_sec_cnt].u_cnt)
+                           - pre_unknown);
+                }
+
+                /* process CDEF data sources; remember each CDEF DS can
+                 * only reference other DS with a lower index number */
+                if (dst_conv(rrd.ds_def[i].dst) == DST_CDEF) {
+                    rpnp_t   *rpnp;
+
+                    rpnp =
+                        rpn_expand((rpn_cdefds_t *) &
+                                   (rrd.ds_def[i].par[DS_cdef]));
+                    /* substitue data values for OP_VARIABLE nodes */
+                    for (ii = 0; rpnp[ii].op != OP_END; ii++) {
+                        if (rpnp[ii].op == OP_VARIABLE) {
+                            rpnp[ii].op = OP_NUMBER;
+                            rpnp[ii].val = pdp_temp[rpnp[ii].ptr];
+                        }
+                    }
+                    /* run the rpn calculator */
+                    if (rpn_calc(rpnp, &rpnstack, 0, pdp_temp, i) == -1) {
+                        free(rpnp);
+                        break;  /* exits the data sources pdp_temp loop */
+                    }
+                }
+
+                /* make pdp_prep ready for the next run */
+                if (isnan(pdp_new[i])) {
+                    /* this is not realy accurate if we use subsecond data arival time
+                       should have thought of it when going subsecond resolution ...
                        sorry next format change we will have it! */
-                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = floor(post_int);
-                   rrd.pdp_prep[i].scratch[PDP_val].u_val = DNAN;
-               } else {
-                   rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = 0;
-                   rrd.pdp_prep[i].scratch[PDP_val].u_val = 
-                       pdp_new[i]/interval*post_int;
-               }
+                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt =
+                        floor(post_int);
+                    rrd.pdp_prep[i].scratch[PDP_val].u_val = DNAN;
+                } else {
+                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt = 0;
+                    rrd.pdp_prep[i].scratch[PDP_val].u_val =
+                        pdp_new[i] / interval * post_int;
+                }
 
 #ifdef DEBUG
-               fprintf(stderr,
-                       "PDP UPD ds[%lu]\t"
-                       "pdp_temp %10.2f\t"
-                       "new_prep %10.2f\t"
-                       "new_unkn_sec %5lu\n",
-                       i, pdp_temp[i],
-                       rrd.pdp_prep[i].scratch[PDP_val].u_val,
-                       rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+                fprintf(stderr,
+                        "PDP UPD ds[%lu]\t"
+                        "pdp_temp %10.2f\t"
+                        "new_prep %10.2f\t"
+                        "new_unkn_sec %5lu\n",
+                        i, pdp_temp[i],
+                        rrd.pdp_prep[i].scratch[PDP_val].u_val,
+                        rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
 #endif
-           }
+            }
 
-               /* if there were errors during the last loop, bail out here */
-           if (rrd_test_error()){
-              free(step_start);
-              break;
-           }
+            /* if there were errors during the last loop, bail out here */
+            if (rrd_test_error()) {
+                free(step_start);
+                break;
+            }
 
-               /* compute the number of elapsed pdp_st moments */
-               elapsed_pdp_st = (occu_pdp_st - proc_pdp_st) / rrd.stat_head -> pdp_step;
+            /* compute the number of elapsed pdp_st moments */
+            elapsed_pdp_st =
+                (occu_pdp_st - proc_pdp_st) / rrd.stat_head->pdp_step;
 #ifdef DEBUG
-               fprintf(stderr,"elapsed PDP steps: %lu\n", elapsed_pdp_st);
+            fprintf(stderr, "elapsed PDP steps: %lu\n", elapsed_pdp_st);
 #endif
-               if (rra_step_cnt == NULL)
-               {
-                  rra_step_cnt = (unsigned long *) 
-                         malloc((rrd.stat_head->rra_cnt)* sizeof(unsigned long));
-               }
-
-           for(i = 0, rra_start = rra_begin;
-               i < rrd.stat_head->rra_cnt;
-           rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
-               i++)
-               {
-               current_cf = cf_conv(rrd.rra_def[i].cf_nam);
-               start_pdp_offset = rrd.rra_def[i].pdp_cnt -
-                  (proc_pdp_st / rrd.stat_head -> pdp_step) % rrd.rra_def[i].pdp_cnt;
-        if (start_pdp_offset <= elapsed_pdp_st) {
-           rra_step_cnt[i] = (elapsed_pdp_st - start_pdp_offset) / 
-                     rrd.rra_def[i].pdp_cnt + 1;
-           } else {
-                  rra_step_cnt[i] = 0;
-               }
-
-               if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL) 
-               {
-                  /* If this is a bulk update, we need to skip ahead in the seasonal
-                       * arrays so that they will be correct for the next observed value;
-                       * note that for the bulk update itself, no update will occur to
-                       * DEVSEASONAL or SEASONAL; futhermore, HWPREDICT and DEVPREDICT will
-                       * be set to DNAN. */
-           if (rra_step_cnt[i] > 2) 
-                  {
-                         /* skip update by resetting rra_step_cnt[i],
-                          * note that this is not data source specific; this is due
-                          * to the bulk update, not a DNAN value for the specific data
-                          * source. */
-                         rra_step_cnt[i] = 0;
-              lookup_seasonal(&rrd,i,rra_start,rrd_file,elapsed_pdp_st, 
-                            &last_seasonal_coef);
-                     lookup_seasonal(&rrd,i,rra_start,rrd_file,elapsed_pdp_st + 1,
-                            &seasonal_coef);
-                  }
-               
-                 /* periodically run a smoother for seasonal effects */
-                 /* Need to use first cdp parameter buffer to track
-                  * burnin (burnin requires a specific smoothing schedule).
-                  * The CDP_init_seasonal parameter is really an RRA level,
-                  * not a data source within RRA level parameter, but the rra_def
-                  * is read only for rrd_update (not flushed to disk). */
-                 iii = i*(rrd.stat_head -> ds_cnt);
-                 if (rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt 
-                         <= BURNIN_CYCLES)
-                 {
-                    if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st 
-                                > rrd.rra_def[i].row_cnt - 1) {
-                          /* mark off one of the burnin cycles */
-                          ++(rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt);
-                      schedule_smooth = 1;
-                        }  
-                 } else {
-                        /* someone has no doubt invented a trick to deal with this
-                         * wrap around, but at least this code is clear. */
-                        if (rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt >
-                            rrd.rra_ptr[i].cur_row)
-                        {
-                                /* here elapsed_pdp_st = rra_step_cnt[i] because of 1-1
-                                 * mapping between PDP and CDP */
-                                if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
-                                       >= rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
-                                {
+            if (rra_step_cnt == NULL) {
+                rra_step_cnt = (unsigned long *)
+                    malloc((rrd.stat_head->rra_cnt) * sizeof(unsigned long));
+            }
+
+            for (i = 0, rra_start = rra_begin;
+                 i < rrd.stat_head->rra_cnt;
+                 rra_start +=
+                 rrd.rra_def[i].row_cnt * rrd.stat_head->ds_cnt *
+                 sizeof(rrd_value_t), i++) {
+                current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+                start_pdp_offset = rrd.rra_def[i].pdp_cnt -
+                    (proc_pdp_st / rrd.stat_head->pdp_step) %
+                    rrd.rra_def[i].pdp_cnt;
+                if (start_pdp_offset <= elapsed_pdp_st) {
+                    rra_step_cnt[i] = (elapsed_pdp_st - start_pdp_offset) /
+                        rrd.rra_def[i].pdp_cnt + 1;
+                } else {
+                    rra_step_cnt[i] = 0;
+                }
+
+                if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL) {
+                    /* If this is a bulk update, we need to skip ahead in the seasonal
+                     * arrays so that they will be correct for the next observed value;
+                     * note that for the bulk update itself, no update will occur to
+                     * DEVSEASONAL or SEASONAL; futhermore, HWPREDICT and DEVPREDICT will
+                     * be set to DNAN. */
+                    if (rra_step_cnt[i] > 2) {
+                        /* skip update by resetting rra_step_cnt[i],
+                         * note that this is not data source specific; this is due
+                         * to the bulk update, not a DNAN value for the specific data
+                         * source. */
+                        rra_step_cnt[i] = 0;
+                        lookup_seasonal(&rrd, i, rra_start, rrd_file,
+                                        elapsed_pdp_st, &last_seasonal_coef);
+                        lookup_seasonal(&rrd, i, rra_start, rrd_file,
+                                        elapsed_pdp_st + 1, &seasonal_coef);
+                    }
+
+                    /* periodically run a smoother for seasonal effects */
+                    /* Need to use first cdp parameter buffer to track
+                     * burnin (burnin requires a specific smoothing schedule).
+                     * The CDP_init_seasonal parameter is really an RRA level,
+                     * not a data source within RRA level parameter, but the rra_def
+                     * is read only for rrd_update (not flushed to disk). */
+                    iii = i * (rrd.stat_head->ds_cnt);
+                    if (rrd.cdp_prep[iii].scratch[CDP_init_seasonal].u_cnt
+                        <= BURNIN_CYCLES) {
+                        if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
+                            > rrd.rra_def[i].row_cnt - 1) {
+                            /* mark off one of the burnin cycles */
+                            ++(rrd.cdp_prep[iii].scratch[CDP_init_seasonal].
+                               u_cnt);
+                            schedule_smooth = 1;
+                        }
+                    } else {
+                        /* someone has no doubt invented a trick to deal with this
+                         * wrap around, but at least this code is clear. */
+                        if (rrd.rra_def[i].par[RRA_seasonal_smooth_idx].
+                            u_cnt > rrd.rra_ptr[i].cur_row) {
+                            /* here elapsed_pdp_st = rra_step_cnt[i] because of 1-1
+                             * mapping between PDP and CDP */
+                            if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st
+                                >=
+                                rrd.rra_def[i].par[RRA_seasonal_smooth_idx].
+                                u_cnt) {
 #ifdef DEBUG
-                                       fprintf(stderr,
-                                       "schedule_smooth 1: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
-                    rrd.rra_ptr[i].cur_row, elapsed_pdp_st, 
-                                       rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+                                fprintf(stderr,
+                                        "schedule_smooth 1: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
+                                        rrd.rra_ptr[i].cur_row,
+                                        elapsed_pdp_st,
+                                        rrd.rra_def[i].
+                                        par[RRA_seasonal_smooth_idx].u_cnt);
 #endif
-                                       schedule_smooth = 1;
-                                }
-             } else {
-                                /* can't rely on negative numbers because we are working with
-                                 * unsigned values */
-                                /* Don't need modulus here. If we've wrapped more than once, only
-                                 * one smooth is executed at the end. */
-                                if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st >= rrd.rra_def[i].row_cnt
-                                       && rrd.rra_ptr[i].cur_row + elapsed_pdp_st - rrd.rra_def[i].row_cnt
-                                       >= rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt)
-                                {
+                                schedule_smooth = 1;
+                            }
+                        } else {
+                            /* can't rely on negative numbers because we are working with
+                             * unsigned values */
+                            /* Don't need modulus here. If we've wrapped more than once, only
+                             * one smooth is executed at the end. */
+                            if (rrd.rra_ptr[i].cur_row + elapsed_pdp_st >=
+                                rrd.rra_def[i].row_cnt
+                                && rrd.rra_ptr[i].cur_row + elapsed_pdp_st -
+                                rrd.rra_def[i].row_cnt >=
+                                rrd.rra_def[i].par[RRA_seasonal_smooth_idx].
+                                u_cnt) {
 #ifdef DEBUG
-                                       fprintf(stderr,
-                                       "schedule_smooth 2: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
-                    rrd.rra_ptr[i].cur_row, elapsed_pdp_st, 
-                                       rrd.rra_def[i].par[RRA_seasonal_smooth_idx].u_cnt);
+                                fprintf(stderr,
+                                        "schedule_smooth 2: cur_row %lu, elapsed_pdp_st %lu, smooth idx %lu\n",
+                                        rrd.rra_ptr[i].cur_row,
+                                        elapsed_pdp_st,
+                                        rrd.rra_def[i].
+                                        par[RRA_seasonal_smooth_idx].u_cnt);
 #endif
-                                       schedule_smooth = 1;
-                                }
-                        }
-                 }
-
-             rra_current = rrd_tell(rrd_file);
-               } /* if cf is DEVSEASONAL or SEASONAL */
-
-        if (rrd_test_error()) break;
-
-                   /* update CDP_PREP areas */
-                   /* loop over data soures within each RRA */
-                   for(ii = 0;
-                       ii < rrd.stat_head->ds_cnt;
-                       ii++)
-                       {
-                       
-                       /* iii indexes the CDP prep area for this data source within the RRA */
-                       iii=i*rrd.stat_head->ds_cnt+ii;
-
-                       if (rrd.rra_def[i].pdp_cnt > 1) {
-                         
-                          if (rra_step_cnt[i] > 0) {
-                          /* If we are in this block, as least 1 CDP value will be written to
-                               * disk, this is the CDP_primary_val entry. If more than 1 value needs
-                               * to be written, then the "fill in" value is the CDP_secondary_val
-                               * entry. */
-                                 if (isnan(pdp_temp[ii]))
-                  {
-                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt += start_pdp_offset;
-                                        rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = DNAN;
-                                 } else {
-                                        /* CDP_secondary value is the RRA "fill in" value for intermediary
-                                         * CDP data entries. No matter the CF, the value is the same because
-                                         * the average, max, min, and last of a list of identical values is
-                                         * the same, namely, the value itself. */
-                                        rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = pdp_temp[ii];
-                                 }
-                     
-                                 if (rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt
-                                     > rrd.rra_def[i].pdp_cnt*
-                                     rrd.rra_def[i].par[RRA_cdp_xff_val].u_val)
-                                 {
-                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = DNAN;
-                                        /* initialize carry over */
-                                        if (current_cf == CF_AVERAGE) {
-                                                  if (isnan(pdp_temp[ii])) { 
-                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = DNAN;
-                                                  } else {
-                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
-                                                                ((elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt);
-                                                  }
-                                        } else {
-                                               rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                        }
-                                 } else {
-                                        rrd_value_t cum_val, cur_val; 
-                                    switch (current_cf) {
-                                               case CF_AVERAGE:
-                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, 0.0);
-                                                 cur_val = IFDNAN(pdp_temp[ii],0.0);
-                          rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val =
-                                              (cum_val + cur_val * start_pdp_offset) /
-                                          (rrd.rra_def[i].pdp_cnt
-                                              -rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt);
-                                                  /* initialize carry over value */
-                                                  if (isnan(pdp_temp[ii])) { 
-                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = DNAN;
-                                                  } else {
-                                                         rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
-                                                                ((elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt);
-                                                  }
-                                                  break;
-                                               case CF_MAXIMUM:
-                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, -DINF);
-                                                 cur_val = IFDNAN(pdp_temp[ii],-DINF);
+                                schedule_smooth = 1;
+                            }
+                        }
+                    }
+
+                    rra_current = rrd_tell(rrd_file);
+                }
+                /* if cf is DEVSEASONAL or SEASONAL */
+                if (rrd_test_error())
+                    break;
+
+                /* update CDP_PREP areas */
+                /* loop over data soures within each RRA */
+                for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) {
+
+                    /* iii indexes the CDP prep area for this data source within the RRA */
+                    iii = i * rrd.stat_head->ds_cnt + ii;
+
+                    if (rrd.rra_def[i].pdp_cnt > 1) {
+
+                        if (rra_step_cnt[i] > 0) {
+                            /* If we are in this block, as least 1 CDP value will be written to
+                             * disk, this is the CDP_primary_val entry. If more than 1 value needs
+                             * to be written, then the "fill in" value is the CDP_secondary_val
+                             * entry. */
+                            if (isnan(pdp_temp[ii])) {
+                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].
+                                    u_cnt += start_pdp_offset;
+                                rrd.cdp_prep[iii].scratch[CDP_secondary_val].
+                                    u_val = DNAN;
+                            } else {
+                                /* CDP_secondary value is the RRA "fill in" value for intermediary
+                                 * CDP data entries. No matter the CF, the value is the same because
+                                 * the average, max, min, and last of a list of identical values is
+                                 * the same, namely, the value itself. */
+                                rrd.cdp_prep[iii].scratch[CDP_secondary_val].
+                                    u_val = pdp_temp[ii];
+                            }
+
+                            if (rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].
+                                u_cnt >
+                                rrd.rra_def[i].pdp_cnt *
+                                rrd.rra_def[i].par[RRA_cdp_xff_val].u_val) {
+                                rrd.cdp_prep[iii].scratch[CDP_primary_val].
+                                    u_val = DNAN;
+                                /* initialize carry over */
+                                if (current_cf == CF_AVERAGE) {
+                                    if (isnan(pdp_temp[ii])) {
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val = DNAN;
+                                    } else {
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val =
+                                            pdp_temp[ii] *
+                                            ((elapsed_pdp_st -
+                                              start_pdp_offset) %
+                                             rrd.rra_def[i].pdp_cnt);
+                                    }
+                                } else {
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                }
+                            } else {
+                                rrd_value_t cum_val, cur_val;
+
+                                switch (current_cf) {
+                                case CF_AVERAGE:
+                                    cum_val =
+                                        IFDNAN(rrd.cdp_prep[iii].
+                                               scratch[CDP_val].u_val, 0.0);
+                                    cur_val = IFDNAN(pdp_temp[ii], 0.0);
+                                    rrd.cdp_prep[iii].
+                                        scratch[CDP_primary_val].u_val =
+                                        (cum_val +
+                                         cur_val * start_pdp_offset) /
+                                        (rrd.rra_def[i].pdp_cnt -
+                                         rrd.cdp_prep[iii].
+                                         scratch[CDP_unkn_pdp_cnt].u_cnt);
+                                    /* initialize carry over value */
+                                    if (isnan(pdp_temp[ii])) {
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val = DNAN;
+                                    } else {
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val =
+                                            pdp_temp[ii] *
+                                            ((elapsed_pdp_st -
+                                              start_pdp_offset) %
+                                             rrd.rra_def[i].pdp_cnt);
+                                    }
+                                    break;
+                                case CF_MAXIMUM:
+                                    cum_val =
+                                        IFDNAN(rrd.cdp_prep[iii].
+                                               scratch[CDP_val].u_val, -DINF);
+                                    cur_val = IFDNAN(pdp_temp[ii], -DINF);
 #ifdef DEBUG
-                                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val) &&
-                                                         isnan(pdp_temp[ii])) {
-                                                    fprintf(stderr,
-                                                               "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
-                                                               i,ii);
-                                                        exit(-1);
-                                                 }
+                                    if (isnan
+                                        (rrd.cdp_prep[iii].scratch[CDP_val].
+                                         u_val) && isnan(pdp_temp[ii])) {
+                                        fprintf(stderr,
+                                                "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
+                                                i, ii);
+                                        exit(-1);
+                                    }
 #endif
-                                                 if (cur_val > cum_val)
-                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cur_val;
-                                                 else
-                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cum_val;
-                                                 /* initialize carry over value */
-                                                 rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                                 break;
-                                               case CF_MINIMUM:
-                                                 cum_val = IFDNAN(rrd.cdp_prep[iii].scratch[CDP_val].u_val, DINF);
-                                                 cur_val = IFDNAN(pdp_temp[ii],DINF);
+                                    if (cur_val > cum_val)
+                                        rrd.cdp_prep[iii].
+                                            scratch[CDP_primary_val].u_val =
+                                            cur_val;
+                                    else
+                                        rrd.cdp_prep[iii].
+                                            scratch[CDP_primary_val].u_val =
+                                            cum_val;
+                                    /* initialize carry over value */
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                    break;
+                                case CF_MINIMUM:
+                                    cum_val =
+                                        IFDNAN(rrd.cdp_prep[iii].
+                                               scratch[CDP_val].u_val, DINF);
+                                    cur_val = IFDNAN(pdp_temp[ii], DINF);
 #ifdef DEBUG
-                                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val) &&
-                                                         isnan(pdp_temp[ii])) {
-                                                    fprintf(stderr,
-                                                               "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
-                                                               i,ii);
-                                                        exit(-1);
-                                                 }
+                                    if (isnan
+                                        (rrd.cdp_prep[iii].scratch[CDP_val].
+                                         u_val) && isnan(pdp_temp[ii])) {
+                                        fprintf(stderr,
+                                                "RRA %lu, DS %lu, both CDP_val and pdp_temp are DNAN!",
+                                                i, ii);
+                                        exit(-1);
+                                    }
 #endif
-                                                 if (cur_val < cum_val)
-                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cur_val;
-                                                 else
-                                                        rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = cum_val;
-                                                 /* initialize carry over value */
-                                                 rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                                 break;
-                                               case CF_LAST:
-                                               default:
-                                                  rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = pdp_temp[ii];
-                                                  /* initialize carry over value */
-                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                               break;
-                                        }
-                                 } /* endif meets xff value requirement for a valid value */
-                                 /* initialize carry over CDP_unkn_pdp_cnt, this must after CDP_primary_val
-                                  * is set because CDP_unkn_pdp_cnt is required to compute that value. */
-                                 if (isnan(pdp_temp[ii]))
-                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt = 
-                                               (elapsed_pdp_st - start_pdp_offset) % rrd.rra_def[i].pdp_cnt;
-                                 else
-                                        rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt = 0;
-               } else  /* rra_step_cnt[i]  == 0 */
-                          {
+                                    if (cur_val < cum_val)
+                                        rrd.cdp_prep[iii].
+                                            scratch[CDP_primary_val].u_val =
+                                            cur_val;
+                                    else
+                                        rrd.cdp_prep[iii].
+                                            scratch[CDP_primary_val].u_val =
+                                            cum_val;
+                                    /* initialize carry over value */
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                    break;
+                                case CF_LAST:
+                                default:
+                                    rrd.cdp_prep[iii].
+                                        scratch[CDP_primary_val].u_val =
+                                        pdp_temp[ii];
+                                    /* initialize carry over value */
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                    break;
+                                }
+                            }   /* endif meets xff value requirement for a valid value */
+                            /* initialize carry over CDP_unkn_pdp_cnt, this must after CDP_primary_val
+                             * is set because CDP_unkn_pdp_cnt is required to compute that value. */
+                            if (isnan(pdp_temp[ii]))
+                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].
+                                    u_cnt =
+                                    (elapsed_pdp_st -
+                                     start_pdp_offset) %
+                                    rrd.rra_def[i].pdp_cnt;
+                            else
+                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].
+                                    u_cnt = 0;
+                        } else {    /* rra_step_cnt[i]  == 0 */
+
 #ifdef DEBUG
-                                 if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val)) {
-                                 fprintf(stderr,"schedule CDP_val update, RRA %lu DS %lu, DNAN\n",
-                                        i,ii);
-                                 } else {
-                                 fprintf(stderr,"schedule CDP_val update, RRA %lu DS %lu, %10.2f\n",
-                                        i,ii,rrd.cdp_prep[iii].scratch[CDP_val].u_val);
-                                 }
+                            if (isnan
+                                (rrd.cdp_prep[iii].scratch[CDP_val].u_val)) {
+                                fprintf(stderr,
+                                        "schedule CDP_val update, RRA %lu DS %lu, DNAN\n",
+                                        i, ii);
+                            } else {
+                                fprintf(stderr,
+                                        "schedule CDP_val update, RRA %lu DS %lu, %10.2f\n",
+                                        i, ii,
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                        u_val);
+                            }
 #endif
-                                 if (isnan(pdp_temp[ii])) {
-                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].u_cnt += elapsed_pdp_st;
-                                 } else if (isnan(rrd.cdp_prep[iii].scratch[CDP_val].u_val))
-                                 {
-                                        if (current_cf == CF_AVERAGE) {
-                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii] *
-                                                  elapsed_pdp_st;
-                                        } else {
-                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                        }
+                            if (isnan(pdp_temp[ii])) {
+                                rrd.cdp_prep[iii].scratch[CDP_unkn_pdp_cnt].
+                                    u_cnt += elapsed_pdp_st;
+                            } else
+                                if (isnan
+                                    (rrd.cdp_prep[iii].scratch[CDP_val].
+                                     u_val)) {
+                                if (current_cf == CF_AVERAGE) {
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii] * elapsed_pdp_st;
+                                } else {
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                }
 #ifdef DEBUG
-                                        fprintf(stderr,"Initialize CDP_val for RRA %lu DS %lu: %10.2f\n",
-                                           i,ii,rrd.cdp_prep[iii].scratch[CDP_val].u_val);
+                                fprintf(stderr,
+                                        "Initialize CDP_val for RRA %lu DS %lu: %10.2f\n",
+                                        i, ii,
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                        u_val);
 #endif
-                                 } else {
-                                        switch (current_cf) {
-                                        case CF_AVERAGE:
-                                           rrd.cdp_prep[iii].scratch[CDP_val].u_val += pdp_temp[ii] *
-                                                  elapsed_pdp_st;
-                                               break;
-                                        case CF_MINIMUM:
-                                               if (pdp_temp[ii] < rrd.cdp_prep[iii].scratch[CDP_val].u_val)
-                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                               break; 
-                                        case CF_MAXIMUM:
-                                               if (pdp_temp[ii] > rrd.cdp_prep[iii].scratch[CDP_val].u_val)
-                                                  rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                               break; 
-                                        case CF_LAST:
-                                        default:
-                                               rrd.cdp_prep[iii].scratch[CDP_val].u_val = pdp_temp[ii];
-                                               break;
-                                        }
-                                 }
-                          }
-                       } else { /* rrd.rra_def[i].pdp_cnt == 1 */
-                          if (elapsed_pdp_st > 2)
-                          {
-                                  switch (current_cf) {
-                                  case CF_AVERAGE:
-                                  default:
-                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val=pdp_temp[ii];
-                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val=pdp_temp[ii];
-                                         break;
-                   case CF_SEASONAL:
-                                  case CF_DEVSEASONAL:
-                                         /* need to update cached seasonal values, so they are consistent
-                                          * with the bulk update */
-                      /* WARNING: code relies on the fact that CDP_hw_last_seasonal and
-                                          * CDP_last_deviation are the same. */
-                      rrd.cdp_prep[iii].scratch[CDP_hw_last_seasonal].u_val =
-                                                last_seasonal_coef[ii];
-                                         rrd.cdp_prep[iii].scratch[CDP_hw_seasonal].u_val =
-                                                seasonal_coef[ii];
-                                         break;
-                   case CF_HWPREDICT:
-                                         /* need to update the null_count and last_null_count.
-                                          * even do this for non-DNAN pdp_temp because the
-                                          * algorithm is not learning from batch updates. */
-                                         rrd.cdp_prep[iii].scratch[CDP_null_count].u_cnt += 
-                                                elapsed_pdp_st;
-                                         rrd.cdp_prep[iii].scratch[CDP_last_null_count].u_cnt += 
-                                                elapsed_pdp_st - 1;
-                                         /* fall through */
-                                  case CF_DEVPREDICT:
-                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = DNAN;
-                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = DNAN;
-                                         break;
-                   case CF_FAILURES:
-                                         /* do not count missed bulk values as failures */
-                                 rrd.cdp_prep[iii].scratch[CDP_primary_val].u_val = 0;
-                                 rrd.cdp_prep[iii].scratch[CDP_secondary_val].u_val = 0;
-                                         /* need to reset violations buffer.
-                                          * could do this more carefully, but for now, just
-                                          * assume a bulk update wipes away all violations. */
-                      erase_violations(&rrd, iii, i);
-                                         break;
-                                  }
-                          } 
-                       } /* endif rrd.rra_def[i].pdp_cnt == 1 */
-
-                       if (rrd_test_error()) break;
-
-                       } /* endif data sources loop */
-        } /* end RRA Loop */
-
-               /* this loop is only entered if elapsed_pdp_st < 3 */
-               for (j = elapsed_pdp_st, scratch_idx = CDP_primary_val; 
-                        j > 0 && j < 3; j--, scratch_idx = CDP_secondary_val)
-               {
-              for(i = 0, rra_start = rra_begin;
-                  i < rrd.stat_head->rra_cnt;
-              rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
-                  i++)
-                  {
-                         if (rrd.rra_def[i].pdp_cnt > 1) continue;
-
-                 current_cf = cf_conv(rrd.rra_def[i].cf_nam);
-                         if (current_cf == CF_SEASONAL || current_cf == CF_DEVSEASONAL)
-                         {
-                        lookup_seasonal(&rrd,i,rra_start,rrd_file,
-                                   elapsed_pdp_st + (scratch_idx == CDP_primary_val ? 1 : 2),
-                               &seasonal_coef);
-                 rra_current = rrd_tell(rrd_file);
-                         }
-                         if (rrd_test_error()) break;
-                     /* loop over data soures within each RRA */
-                     for(ii = 0;
-                         ii < rrd.stat_head->ds_cnt;
-                         ii++)
-                         {
-                            update_aberrant_CF(&rrd,pdp_temp[ii],current_cf,
-                                       i*(rrd.stat_head->ds_cnt) + ii,i,ii,
-                                   scratch_idx, seasonal_coef);
-                         }
-           } /* end RRA Loop */
-                  if (rrd_test_error()) break;
-           } /* end elapsed_pdp_st loop */
-
-               if (rrd_test_error()) break;
-
-               /* Ready to write to disk */
-               /* Move sequentially through the file, writing one RRA at a time.
-                * Note this architecture divorces the computation of CDP with
-                * flushing updated RRA entries to disk. */
-           for(i = 0, rra_start = rra_begin;
-               i < rrd.stat_head->rra_cnt;
-           rra_start += rrd.rra_def[i].row_cnt * rrd.stat_head -> ds_cnt * sizeof(rrd_value_t),
-               i++) {
-               /* is th5Aere anything to write for this RRA? If not, continue. */
-        if (rra_step_cnt[i] == 0) continue;
-
-               /* write the first row */
+                            } else {
+                                switch (current_cf) {
+                                case CF_AVERAGE:
+                                    rrd.cdp_prep[iii].scratch[CDP_val].
+                                        u_val +=
+                                        pdp_temp[ii] * elapsed_pdp_st;
+                                    break;
+                                case CF_MINIMUM:
+                                    if (pdp_temp[ii] <
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                        u_val)
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val = pdp_temp[ii];
+                                    break;
+                                case CF_MAXIMUM:
+                                    if (pdp_temp[ii] >
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                        u_val)
+                                        rrd.cdp_prep[iii].scratch[CDP_val].
+                                            u_val = pdp_temp[ii];
+                                    break;
+                                case CF_LAST:
+                                default:
+                                    rrd.cdp_prep[iii].scratch[CDP_val].u_val =
+                                        pdp_temp[ii];
+                                    break;
+                                }
+                            }
+                        }
+                    } else {    /* rrd.rra_def[i].pdp_cnt == 1 */
+                        if (elapsed_pdp_st > 2) {
+                            switch (current_cf) {
+                            case CF_AVERAGE:
+                            default:
+                                rrd.cdp_prep[iii].scratch[CDP_primary_val].
+                                    u_val = pdp_temp[ii];
+                                rrd.cdp_prep[iii].scratch[CDP_secondary_val].
+                                    u_val = pdp_temp[ii];
+                                break;
+                            case CF_SEASONAL:
+                            case CF_DEVSEASONAL:
+                                /* need to update cached seasonal values, so they are consistent
+                                 * with the bulk update */
+                                /* WARNING: code relies on the fact that CDP_hw_last_seasonal and
+                                 * CDP_last_deviation are the same. */
+                                rrd.cdp_prep[iii].
+                                    scratch[CDP_hw_last_seasonal].u_val =
+                                    last_seasonal_coef[ii];
+                                rrd.cdp_prep[iii].scratch[CDP_hw_seasonal].
+                                    u_val = seasonal_coef[ii];
+                                break;
+                            case CF_HWPREDICT:
+                                /* need to update the null_count and last_null_count.
+                                 * even do this for non-DNAN pdp_temp because the
+                                 * algorithm is not learning from batch updates. */
+                                rrd.cdp_prep[iii].scratch[CDP_null_count].
+                                    u_cnt += elapsed_pdp_st;
+                                rrd.cdp_prep[iii].
+                                    scratch[CDP_last_null_count].u_cnt +=
+                                    elapsed_pdp_st - 1;
+                                /* fall through */
+                            case CF_DEVPREDICT:
+                                rrd.cdp_prep[iii].scratch[CDP_primary_val].
+                                    u_val = DNAN;
+                                rrd.cdp_prep[iii].scratch[CDP_secondary_val].
+                                    u_val = DNAN;
+                                break;
+                            case CF_FAILURES:
+                                /* do not count missed bulk values as failures */
+                                rrd.cdp_prep[iii].scratch[CDP_primary_val].
+                                    u_val = 0;
+                                rrd.cdp_prep[iii].scratch[CDP_secondary_val].
+                                    u_val = 0;
+                                /* need to reset violations buffer.
+                                 * could do this more carefully, but for now, just
+                                 * assume a bulk update wipes away all violations. */
+                                erase_violations(&rrd, iii, i);
+                                break;
+                            }
+                        }
+                    }   /* endif rrd.rra_def[i].pdp_cnt == 1 */
+
+                    if (rrd_test_error())
+                        break;
+
+                }       /* endif data sources loop */
+            }           /* end RRA Loop */
+
+            /* this loop is only entered if elapsed_pdp_st < 3 */
+            for (j = elapsed_pdp_st, scratch_idx = CDP_primary_val;
+                 j > 0 && j < 3; j--, scratch_idx = CDP_secondary_val) {
+                for (i = 0, rra_start = rra_begin;
+                     i < rrd.stat_head->rra_cnt;
+                     rra_start +=
+                     rrd.rra_def[i].row_cnt * rrd.stat_head->ds_cnt *
+                     sizeof(rrd_value_t), i++) {
+                    if (rrd.rra_def[i].pdp_cnt > 1)
+                        continue;
+
+                    current_cf = cf_conv(rrd.rra_def[i].cf_nam);
+                    if (current_cf == CF_SEASONAL
+                        || current_cf == CF_DEVSEASONAL) {
+                        lookup_seasonal(&rrd, i, rra_start, rrd_file,
+                                        elapsed_pdp_st + (scratch_idx ==
+                                                          CDP_primary_val ? 1
+                                                          : 2),
+                                        &seasonal_coef);
+                        rra_current = rrd_tell(rrd_file);
+                    }
+                    if (rrd_test_error())
+                        break;
+                    /* loop over data soures within each RRA */
+                    for (ii = 0; ii < rrd.stat_head->ds_cnt; ii++) {
+                        update_aberrant_CF(&rrd, pdp_temp[ii], current_cf,
+                                           i * (rrd.stat_head->ds_cnt) + ii,
+                                           i, ii, scratch_idx, seasonal_coef);
+                    }
+                }       /* end RRA Loop */
+                if (rrd_test_error())
+                    break;
+            }           /* end elapsed_pdp_st loop */
+
+            if (rrd_test_error())
+                break;
+
+            /* Ready to write to disk */
+            /* Move sequentially through the file, writing one RRA at a time.
+             * Note this architecture divorces the computation of CDP with
+             * flushing updated RRA entries to disk. */
+            for (i = 0, rra_start = rra_begin;
+                 i < rrd.stat_head->rra_cnt;
+                 rra_start +=
+                 rrd.rra_def[i].row_cnt * rrd.stat_head->ds_cnt *
+                 sizeof(rrd_value_t), i++) {
+                /* is th5Aere anything to write for this RRA? If not, continue. */
+                if (rra_step_cnt[i] == 0)
+                    continue;
+
+                /* write the first row */
 #ifdef DEBUG
-        fprintf(stderr,"  -- RRA Preseek %ld\n",rrd_file->pos);
+                fprintf(stderr, "  -- RRA Preseek %ld\n", rrd_file->pos);
 #endif
-           rrd.rra_ptr[i].cur_row++;
-           if (rrd.rra_ptr[i].cur_row >= rrd.rra_def[i].row_cnt)
-                  rrd.rra_ptr[i].cur_row = 0; /* wrap around */
-               /* positition on the first row */
-               rra_pos_tmp = rra_start +
-                  (rrd.stat_head->ds_cnt)*(rrd.rra_ptr[i].cur_row)*sizeof(rrd_value_t);
-               if(rra_pos_tmp != rra_current) {
+                rrd.rra_ptr[i].cur_row++;
+                if (rrd.rra_ptr[i].cur_row >= rrd.rra_def[i].row_cnt)
+                    rrd.rra_ptr[i].cur_row = 0; /* wrap around */
+                /* positition on the first row */
+                rra_pos_tmp = rra_start +
+                    (rrd.stat_head->ds_cnt) * (rrd.rra_ptr[i].cur_row) *
+                    sizeof(rrd_value_t);
+                if (rra_pos_tmp != rra_current) {
 #ifndef HAVE_MMAP
-                  if(rrd_seek(rrd_file, rra_pos_tmp, SEEK_SET) != 0){
-                     rrd_set_error("seek error in rrd");
-                     break;
-                  }
+                    if (rrd_seek(rrd_file, rra_pos_tmp, SEEK_SET) != 0) {
+                        rrd_set_error("seek error in rrd");
+                        break;
+                    }
 #endif
-                  rra_current = rra_pos_tmp;
-               }
-
+                    rra_current = rra_pos_tmp;
+                }
 #ifdef DEBUG
-           fprintf(stderr,"  -- RRA Postseek %ld\n",rrd_file->pos);
+                fprintf(stderr, "  -- RRA Postseek %ld\n", rrd_file->pos);
 #endif
-               scratch_idx = CDP_primary_val;
-               if (pcdp_summary != NULL)
-               {
-                  rra_time = (current_time - current_time 
-                  % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step))
-                  - ((rra_step_cnt[i]-1)*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
-               }
+                scratch_idx = CDP_primary_val;
+                if (pcdp_summary != NULL) {
+                    rra_time = (current_time - current_time
+                                % (rrd.rra_def[i].pdp_cnt *
+                                   rrd.stat_head->pdp_step))
+                        -
+                        ((rra_step_cnt[i] -
+                          1) * rrd.rra_def[i].pdp_cnt *
+                         rrd.stat_head->pdp_step);
+                }
 #ifdef HAVE_MMAP
-               pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file->fd, 
-                  pcdp_summary, &rra_time, rrd_file->file_start);
+                pcdp_summary =
+                    write_RRA_row(&rrd, i, &rra_current, scratch_idx,
+                                  rrd_file->fd, pcdp_summary, &rra_time,
+                                  rrd_file->file_start);
 #else
-               pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file->fd, 
-                  pcdp_summary, &rra_time);
+                pcdp_summary =
+                    write_RRA_row(&rrd, i, &rra_current, scratch_idx,
+                                  rrd_file->fd, pcdp_summary, &rra_time);
 #endif
-               if (rrd_test_error()) break;
-
-               /* write other rows of the bulk update, if any */
-               scratch_idx = CDP_secondary_val;
-               for ( ; rra_step_cnt[i] > 1; rra_step_cnt[i]--)
-               {
-                  if (++rrd.rra_ptr[i].cur_row == rrd.rra_def[i].row_cnt)
-                  {
+                if (rrd_test_error())
+                    break;
+
+                /* write other rows of the bulk update, if any */
+                scratch_idx = CDP_secondary_val;
+                for (; rra_step_cnt[i] > 1; rra_step_cnt[i]--) {
+                    if (++rrd.rra_ptr[i].cur_row == rrd.rra_def[i].row_cnt) {
 #ifdef DEBUG
-              fprintf(stderr,"Wraparound for RRA %s, %lu updates left\n",
-                         rrd.rra_def[i].cf_nam, rra_step_cnt[i] - 1);
+                        fprintf(stderr,
+                                "Wraparound for RRA %s, %lu updates left\n",
+                                rrd.rra_def[i].cf_nam, rra_step_cnt[i] - 1);
 #endif
-                         /* wrap */
-                         rrd.rra_ptr[i].cur_row = 0;
-                         /* seek back to beginning of current rra */
-                     if (rrd_seek(rrd_file, rra_start, SEEK_SET) != 0)
-                         {
-                        rrd_set_error("seek error in rrd");
-                        break;
-                         }
+                        /* wrap */
+                        rrd.rra_ptr[i].cur_row = 0;
+                        /* seek back to beginning of current rra */
+                        if (rrd_seek(rrd_file, rra_start, SEEK_SET) != 0) {
+                            rrd_set_error("seek error in rrd");
+                            break;
+                        }
 #ifdef DEBUG
-                 fprintf(stderr,"  -- Wraparound Postseek %ld\n",rrd_file->pos);
+                        fprintf(stderr, "  -- Wraparound Postseek %ld\n",
+                                rrd_file->pos);
 #endif
-                         rra_current = rra_start;
-                  }
-                  if (pcdp_summary != NULL)
-                  {
-                     rra_time = (current_time - current_time 
-                     % (rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step))
-                     - ((rra_step_cnt[i]-2)*rrd.rra_def[i].pdp_cnt*rrd.stat_head->pdp_step);
-                  }
+                        rra_current = rra_start;
+                    }
+                    if (pcdp_summary != NULL) {
+                        rra_time = (current_time - current_time
+                                    % (rrd.rra_def[i].pdp_cnt *
+                                       rrd.stat_head->pdp_step))
+                            -
+                            ((rra_step_cnt[i] -
+                              2) * rrd.rra_def[i].pdp_cnt *
+                             rrd.stat_head->pdp_step);
+                    }
 #ifdef HAVE_MMAP
-                  pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file->fd,
-                     pcdp_summary, &rra_time, rrd_file->file_start);
+                    pcdp_summary =
+                        write_RRA_row(&rrd, i, &rra_current, scratch_idx,
+                                      rrd_file->fd, pcdp_summary, &rra_time,
+                                      rrd_file->file_start);
 #else
-                  pcdp_summary = write_RRA_row(&rrd, i, &rra_current, scratch_idx, rrd_file->fd,
-                     pcdp_summary, &rra_time);
+                    pcdp_summary =
+                        write_RRA_row(&rrd, i, &rra_current, scratch_idx,
+                                      rrd_file->fd, pcdp_summary, &rra_time);
 #endif
-               }
-               
-               if (rrd_test_error())
-                 break;
-               } /* RRA LOOP */
-
-           /* break out of the argument parsing loop if error_string is set */
-           if (rrd_test_error()){
-                  free(step_start);
-                  break;
-           } 
-           
-       } /* endif a pdp_st has occurred */ 
-       rrd.live_head->last_up = current_time;
-       rrd.live_head->last_up_usec = current_time_usec; 
-       free(step_start);
-    } /* function argument loop */
-
-    if (seasonal_coef != NULL) free(seasonal_coef);
-    if (last_seasonal_coef != NULL) free(last_seasonal_coef);
-       if (rra_step_cnt != NULL) free(rra_step_cnt);
+                }
+
+                if (rrd_test_error())
+                    break;
+            }           /* RRA LOOP */
+
+            /* break out of the argument parsing loop if error_string is set */
+            if (rrd_test_error()) {
+                free(step_start);
+                break;
+            }
+
+        }               /* endif a pdp_st has occurred */
+        rrd.live_head->last_up = current_time;
+        rrd.live_head->last_up_usec = current_time_usec;
+        free(step_start);
+    }                   /* function argument loop */
+
+    if (seasonal_coef != NULL)
+        free(seasonal_coef);
+    if (last_seasonal_coef != NULL)
+        free(last_seasonal_coef);
+    if (rra_step_cnt != NULL)
+        free(rra_step_cnt);
     rpnstack_free(&rpnstack);
 
 #ifdef HAVE_MMAP
     if (munmap(rrd_file->file_start, rrd_file->file_len) == -1) {
-            rrd_set_error("error writing(unmapping) file: %s", filename);
+        rrd_set_error("error writing(unmapping) file: %s", filename);
     }
-#endif    
+#endif
     /* if we got here and if there is an error and if the file has not been
      * written to, then close things up and return. */
     if (rrd_test_error()) {
-       free(updvals);
-       free(tmpl_idx);
-       rrd_free(&rrd);
-       free(pdp_temp);
-       free(pdp_new);
-       close(rrd_file->fd);
-       return(-1);
+        free(updvals);
+        free(tmpl_idx);
+        rrd_free(&rrd);
+        free(pdp_temp);
+        free(pdp_new);
+        close(rrd_file->fd);
+        return (-1);
     }
 
     /* aargh ... that was tough ... so many loops ... anyway, its done.
      * we just need to write back the live header portion now*/
 
     if (rrd_seek(rrd_file, (sizeof(stat_head_t)
-                        + sizeof(ds_def_t)*rrd.stat_head->ds_cnt 
-                        + sizeof(rra_def_t)*rrd.stat_head->rra_cnt),
-             SEEK_SET) != 0) {
-       rrd_set_error("seek rrd for live header writeback");
-       free(updvals);
-       free(tmpl_idx);
-       rrd_free(&rrd);
-       free(pdp_temp);
-       free(pdp_new);
-       close(rrd_file->fd);
-       return(-1);
+                            + sizeof(ds_def_t) * rrd.stat_head->ds_cnt
+                            + sizeof(rra_def_t) * rrd.stat_head->rra_cnt),
+                 SEEK_SET) != 0) {
+        rrd_set_error("seek rrd for live header writeback");
+        free(updvals);
+        free(tmpl_idx);
+        rrd_free(&rrd);
+        free(pdp_temp);
+        free(pdp_new);
+        close(rrd_file->fd);
+        return (-1);
     }
 
-    if(version >= 3) {
-           if(rrd_write(rrd_file, rrd.live_head,
-                      sizeof(live_head_t)*1) != sizeof(live_head_t)*1){
-               rrd_set_error("rrd_write live_head to rrd");
-               free(updvals);
-               rrd_free(&rrd);
-               free(tmpl_idx);
-               free(pdp_temp);
-               free(pdp_new);
-               close(rrd_file->fd);
-               return(-1);
-           }
-    }
-    else {
-           if(rrd_write(rrd_file, &rrd.live_head->last_up,
-                      sizeof(time_t)*1) != sizeof(time_t)*1){
-               rrd_set_error("rrd_write live_head to rrd");
-               free(updvals);
-               rrd_free(&rrd);
-               free(tmpl_idx);
-               free(pdp_temp);
-               free(pdp_new);
-               close(rrd_file->fd);
-               return(-1);
-           }
+    if (version >= 3) {
+        if (rrd_write(rrd_file, rrd.live_head,
+                      sizeof(live_head_t) * 1) != sizeof(live_head_t) * 1) {
+            rrd_set_error("rrd_write live_head to rrd");
+            free(updvals);
+            rrd_free(&rrd);
+            free(tmpl_idx);
+            free(pdp_temp);
+            free(pdp_new);
+            close(rrd_file->fd);
+            return (-1);
+        }
+    } else {
+        if (rrd_write(rrd_file, &rrd.live_head->last_up,
+                      sizeof(time_t) * 1) != sizeof(time_t) * 1) {
+            rrd_set_error("rrd_write live_head to rrd");
+            free(updvals);
+            rrd_free(&rrd);
+            free(tmpl_idx);
+            free(pdp_temp);
+            free(pdp_new);
+            close(rrd_file->fd);
+            return (-1);
+        }
     }
-           
-
-    if(rrd_write(rrd_file, rrd.pdp_prep,
-              sizeof(pdp_prep_t)*rrd.stat_head->ds_cnt)
-           != (ssize_t)(sizeof(pdp_prep_t)*rrd.stat_head->ds_cnt)){
-       rrd_set_error("rrd_write pdp_prep to rrd");
-       free(updvals);
-       rrd_free(&rrd);
-       free(tmpl_idx);
-       free(pdp_temp);
-       free(pdp_new);
-       close(rrd_file->fd);
-       return(-1);
+
+
+    if (rrd_write(rrd_file, rrd.pdp_prep,
+                  sizeof(pdp_prep_t) * rrd.stat_head->ds_cnt)
+        != (ssize_t) (sizeof(pdp_prep_t) * rrd.stat_head->ds_cnt)) {
+        rrd_set_error("rrd_write pdp_prep to rrd");
+        free(updvals);
+        rrd_free(&rrd);
+        free(tmpl_idx);
+        free(pdp_temp);
+        free(pdp_new);
+        close(rrd_file->fd);
+        return (-1);
     }
 
-    if(rrd_write(rrd_file, rrd.cdp_prep,
-              sizeof(cdp_prep_t)*rrd.stat_head->rra_cnt *rrd.stat_head->ds_cnt)
-       != (ssize_t)(sizeof(cdp_prep_t)*rrd.stat_head->rra_cnt *rrd.stat_head->ds_cnt)){
-
-       rrd_set_error("rrd_write cdp_prep to rrd");
-       free(updvals);
-       free(tmpl_idx);
-       rrd_free(&rrd);
-       free(pdp_temp);
-       free(pdp_new);
-       close(rrd_file->fd);
-       return(-1);
+    if (rrd_write(rrd_file, rrd.cdp_prep,
+                  sizeof(cdp_prep_t) * rrd.stat_head->rra_cnt *
+                  rrd.stat_head->ds_cnt)
+        != (ssize_t) (sizeof(cdp_prep_t) * rrd.stat_head->rra_cnt *
+                      rrd.stat_head->ds_cnt)) {
+
+        rrd_set_error("rrd_write cdp_prep to rrd");
+        free(updvals);
+        free(tmpl_idx);
+        rrd_free(&rrd);
+        free(pdp_temp);
+        free(pdp_new);
+        close(rrd_file->fd);
+        return (-1);
     }
 
-    if(rrd_write(rrd_file, rrd.rra_ptr,
-              sizeof(rra_ptr_t)* rrd.stat_head->rra_cnt)
-           != (ssize_t)(sizeof(rra_ptr_t)*rrd.stat_head->rra_cnt)){
-       rrd_set_error("rrd_write rra_ptr to rrd");
-       free(updvals);
-       free(tmpl_idx);
-       rrd_free(&rrd);
-       free(pdp_temp);
-       free(pdp_new);
-       close(rrd_file->fd);
-       return(-1);
+    if (rrd_write(rrd_file, rrd.rra_ptr,
+                  sizeof(rra_ptr_t) * rrd.stat_head->rra_cnt)
+        != (ssize_t) (sizeof(rra_ptr_t) * rrd.stat_head->rra_cnt)) {
+        rrd_set_error("rrd_write rra_ptr to rrd");
+        free(updvals);
+        free(tmpl_idx);
+        rrd_free(&rrd);
+        free(pdp_temp);
+        free(pdp_new);
+        close(rrd_file->fd);
+        return (-1);
     }
-    
 #ifdef HAVE_POSIX_FADVISExxx
 
     /* with update we have write ops, so they will probably not be done by now, this means
@@ -1405,59 +1569,59 @@ rrd_filesize = rrd_file->file_size;
        update cycle. Calling fdsync to force things is much too hard here. */
 
     if (0 != posix_fadvise(rrd_file->fd, rra_begin, 0, POSIX_FADV_DONTNEED)) {
-         rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));
-         close(rrd_file->fd);
-         return(-1);
-    } 
+        rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s", filename,
+                      rrd_strerror(errno));
+        close(rrd_file->fd);
+        return (-1);
+    }
 #endif
-    /*XXX: ? */rrd_flush(rrd_file);
+    /*XXX: ? */ rrd_flush(rrd_file);
 
     /* calling the smoothing code here guarantees at most
-        * one smoothing operation per rrd_update call. Unfortunately,
-        * it is possible with bulk updates, or a long-delayed update
-        * for smoothing to occur off-schedule. This really isn't
-        * critical except during the burning cycles. */
-       if (schedule_smooth)
-       {
-//       in_file = fopen(filename,"rb+");
-          
-
-         rra_start = rra_begin;
-         for (i = 0; i < rrd.stat_head -> rra_cnt; ++i)
-         {
-           if (cf_conv(rrd.rra_def[i].cf_nam) == CF_DEVSEASONAL ||
-               cf_conv(rrd.rra_def[i].cf_nam) == CF_SEASONAL)
-           {
+     * one smoothing operation per rrd_update call. Unfortunately,
+     * it is possible with bulk updates, or a long-delayed update
+     * for smoothing to occur off-schedule. This really isn't
+     * critical except during the burning cycles. */
+    if (schedule_smooth) {
+//    in_file = fopen(filename,"rb+");
+
+
+        rra_start = rra_begin;
+        for (i = 0; i < rrd.stat_head->rra_cnt; ++i) {
+            if (cf_conv(rrd.rra_def[i].cf_nam) == CF_DEVSEASONAL ||
+                cf_conv(rrd.rra_def[i].cf_nam) == CF_SEASONAL) {
 #ifdef DEBUG
-             fprintf(stderr,"Running smoother for rra %ld\n",i);
+                fprintf(stderr, "Running smoother for rra %ld\n", i);
 #endif
-             apply_smoother(&rrd,i,rra_start,rrd_file);
-             if (rrd_test_error())
-               break;
-           }
-           rra_start += rrd.rra_def[i].row_cnt
-             *rrd.stat_head->ds_cnt*sizeof(rrd_value_t);
-         }
+                apply_smoother(&rrd, i, rra_start, rrd_file);
+                if (rrd_test_error())
+                    break;
+            }
+            rra_start += rrd.rra_def[i].row_cnt
+                * rrd.stat_head->ds_cnt * sizeof(rrd_value_t);
+        }
 #ifdef HAVE_POSIX_FADVISExxx
-          /* same procedure as above ... */
-          if (0 != posix_fadvise(rrd_file->fd, rra_begin, 0, POSIX_FADV_DONTNEED)) {
-             rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s",filename, rrd_strerror(errno));
-             close(rrd_file->fd);
-             return(-1);
-          } 
+        /* same procedure as above ... */
+        if (0 !=
+            posix_fadvise(rrd_file->fd, rra_begin, 0, POSIX_FADV_DONTNEED)) {
+            rrd_set_error("setting POSIX_FADV_DONTNEED on '%s': %s", filename,
+                          rrd_strerror(errno));
+            close(rrd_file->fd);
+            return (-1);
+        }
 #endif
-         close(rrd_file->fd);
-       }
+        close(rrd_file->fd);
+    }
 
     /* OK now close the files and free the memory */
-    if(close(rrd_file->fd) != 0){
-       rrd_set_error("closing rrd");
-       free(updvals);
-       free(tmpl_idx);
-       rrd_free(&rrd);
-       free(pdp_temp);
-       free(pdp_new);
-       return(-1);
+    if (close(rrd_file->fd) != 0) {
+        rrd_set_error("closing rrd");
+        free(updvals);
+        free(tmpl_idx);
+        rrd_free(&rrd);
+        free(pdp_temp);
+        free(pdp_new);
+        return (-1);
     }
 
     rrd_free(&rrd);
@@ -1465,7 +1629,7 @@ rrd_filesize = rrd_file->file_size;
     free(tmpl_idx);
     free(pdp_new);
     free(pdp_temp);
-    return(0);
+    return (0);
 }
 
 /*
@@ -1474,87 +1638,117 @@ rrd_filesize = rrd_file->file_size;
  *
  * returns 0 on success
  */
-int
-LockRRD(int in_file)
+int LockRRD(
+    int in_file)
 {
-    int        rcstat;
+    int       rcstat;
 
-       {
+    {
 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
-    struct _stat st;
+        struct _stat st;
 
-    if ( _fstat( in_file, &st ) == 0 ) {
-           rcstat = _locking ( in_file, _LK_NBLCK, st.st_size );
-    } else {
-           rcstat = -1;
-    }
+        if (_fstat(in_file, &st) == 0) {
+            rcstat = _locking(in_file, _LK_NBLCK, st.st_size);
+        } else {
+            rcstat = -1;
+        }
 #else
-    struct flock       lock;
-    lock.l_type = F_WRLCK;    /* exclusive write lock */
-    lock.l_len = 0;          /* whole file */
-    lock.l_start = 0;        /* start of file */
-    lock.l_whence = SEEK_SET;   /* end of file */
+        struct flock lock;
+
+        lock.l_type = F_WRLCK;  /* exclusive write lock */
+        lock.l_len = 0; /* whole file */
+        lock.l_start = 0;   /* start of file */
+        lock.l_whence = SEEK_SET;   /* end of file */
 
-    rcstat = fcntl(in_file, F_SETLK, &lock);
+        rcstat = fcntl(in_file, F_SETLK, &lock);
 #endif
-       }
+    }
 
-    return(rcstat);
+    return (rcstat);
 }
 
 
 #ifdef HAVE_MMAP
 info_t
-*write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current,
-              unsigned short CDP_scratch_idx, 
+
+
+
+
+
+
+
+
+         *write_RRA_row(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long *rra_current,
+    unsigned short CDP_scratch_idx,
 #ifndef DEBUG
-int UNUSED(in_file),
+    int UNUSED(in_file),
 #else
-int in_file,
+    int in_file,
 #endif
-                  info_t *pcdp_summary, time_t *rra_time, void *rrd_mmaped_file)
+    info_t *pcdp_summary,
+    time_t *rra_time,
+    void *rrd_mmaped_file)
 #else
 info_t
-*write_RRA_row (rrd_t *rrd, unsigned long rra_idx, unsigned long *rra_current,
-              unsigned short CDP_scratch_idx, int in_file,
-                  info_t *pcdp_summary, time_t *rra_time)
+
+
+
+
+
+
+
+
+         *write_RRA_row(
+    rrd_t *rrd,
+    unsigned long rra_idx,
+    unsigned long *rra_current,
+    unsigned short CDP_scratch_idx,
+    int in_file,
+    info_t *pcdp_summary,
+    time_t *rra_time)
 #endif
 {
-   unsigned long ds_idx, cdp_idx;
-   infoval iv;
-  
-   for (ds_idx = 0; ds_idx < rrd -> stat_head -> ds_cnt; ds_idx++)
-   {
-      /* compute the cdp index */
-      cdp_idx =rra_idx * (rrd -> stat_head->ds_cnt) + ds_idx;
+    unsigned long ds_idx, cdp_idx;
+    infoval   iv;
+
+    for (ds_idx = 0; ds_idx < rrd->stat_head->ds_cnt; ds_idx++) {
+        /* compute the cdp index */
+        cdp_idx = rra_idx * (rrd->stat_head->ds_cnt) + ds_idx;
 #ifdef DEBUG
-         fprintf(stderr,"  -- RRA WRITE VALUE %e, at %ld CF:%s\n",
-            rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val,rrd_file->pos,
-            rrd -> rra_def[rra_idx].cf_nam);
-#endif 
-      if (pcdp_summary != NULL)
-         {
-            iv.u_val = rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val;
-            /* append info to the return hash */
-                pcdp_summary = info_push(pcdp_summary,
-                sprintf_alloc("[%d]RRA[%s][%lu]DS[%s]",
-                *rra_time, rrd->rra_def[rra_idx].cf_nam, 
-                rrd->rra_def[rra_idx].pdp_cnt, rrd->ds_def[ds_idx].ds_nam),
-         RD_I_VAL, iv);
-         }
+        fprintf(stderr, "  -- RRA WRITE VALUE %e, at %ld CF:%s\n",
+                rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val,
+                rrd_file->pos, rrd->rra_def[rra_idx].cf_nam);
+#endif
+        if (pcdp_summary != NULL) {
+            iv.u_val = rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val;
+            /* append info to the return hash */
+            pcdp_summary = info_push(pcdp_summary,
+                                     sprintf_alloc("[%d]RRA[%s][%lu]DS[%s]",
+                                                   *rra_time,
+                                                   rrd->rra_def[rra_idx].
+                                                   cf_nam,
+                                                   rrd->rra_def[rra_idx].
+                                                   pdp_cnt,
+                                                   rrd->ds_def[ds_idx].
+                                                   ds_nam), RD_I_VAL, iv);
+        }
 #ifdef HAVE_MMAP
-         memcpy((char *)rrd_mmaped_file + *rra_current,
-                         &(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
-                         sizeof(rrd_value_t));
+        memcpy((char *) rrd_mmaped_file + *rra_current,
+               &(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
+               sizeof(rrd_value_t));
 #else
-         if(rrd_write(rrd_file,&(rrd -> cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
-                sizeof(rrd_value_t)*1) != sizeof(rrd_value_t)*1)
-         { 
-            rrd_set_error("writing rrd");
-            return 0;
-         }
+        if (rrd_write
+            (rrd_file,
+             &(rrd->cdp_prep[cdp_idx].scratch[CDP_scratch_idx].u_val),
+             sizeof(rrd_value_t) * 1) != sizeof(rrd_value_t) * 1) {
+            rrd_set_error("writing rrd");
+            return 0;
+        }
 #endif
-         *rra_current += sizeof(rrd_value_t);
-       }
-       return (pcdp_summary);
+        *rra_current += sizeof(rrd_value_t);
+    }
+    return (pcdp_summary);
 }
index 7d13aeb..336d1a3 100644 (file)
@@ -8,16 +8,14 @@
 
 #include "rrd_tool.h"
 
-double
-rrd_version(void)
+double rrd_version(
+    void)
 {
-  return NUMVERS;
+    return NUMVERS;
 }
 
-char *
-rrd_strversion(void)
+char     *rrd_strversion(
+    void)
 {
-  return PACKAGE_VERSION;
+    return PACKAGE_VERSION;
 }
-
-
index ef964a0..10c020f 100644 (file)
 #endif
 
 
-int rrd_xport(int, char **, int *,
-             time_t *, time_t *,
-             unsigned long *, unsigned long *,
-             char ***, rrd_value_t **);
-
-int rrd_xport_fn(image_desc_t *,
-                time_t *, time_t *,
-                unsigned long *, unsigned long *,
-                char ***, rrd_value_t **);
-
-
-
-
-int 
-rrd_xport(int argc, char **argv, int UNUSED(*xsize),
-         time_t         *start,
-         time_t         *end,        /* which time frame do you want ?
-                                      * will be changed to represent reality */
-         unsigned long  *step,       /* which stepsize do you want? 
-                                      * will be changed to represent reality */
-         unsigned long  *col_cnt,    /* number of data columns in the result */
-         char           ***legend_v, /* legend entries */
-         rrd_value_t    **data)      /* two dimensional array containing the data */
-
-{
-
-    image_desc_t   im;
-    time_t        start_tmp=0,end_tmp=0;
+int       rrd_xport(
+    int,
+    char **,
+    int *,
+    time_t *,
+    time_t *,
+    unsigned long *,
+    unsigned long *,
+    char ***,
+    rrd_value_t **);
+
+int       rrd_xport_fn(
+    image_desc_t *,
+    time_t *,
+    time_t *,
+    unsigned long *,
+    unsigned long *,
+    char ***,
+    rrd_value_t **);
+
+
+
+
+int rrd_xport(
+    int argc,
+    char **argv,
+    int UNUSED(*xsize),
+    time_t *start,
+    time_t *end,        /* which time frame do you want ?
+                         * will be changed to represent reality */
+    unsigned long *step,    /* which stepsize do you want? 
+                             * will be changed to represent reality */
+    unsigned long *col_cnt, /* number of data columns in the result */
+    char ***legend_v,   /* legend entries */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
+
+    image_desc_t im;
+    time_t    start_tmp = 0, end_tmp = 0;
     struct rrd_time_value start_tv, end_tv;
-    char           *parsetime_error = NULL;
-    optind = 0; opterr = 0;  /* initialize getopt */
+    char     *parsetime_error = NULL;
+
+    optind = 0;
+    opterr = 0;         /* initialize getopt */
 
     rrd_graph_init(&im);
 
     parsetime("end-24h", &start_tv);
     parsetime("now", &end_tv);
 
-    while (1){
-       static struct option long_options[] =
-       {
-           {"start",      required_argument, 0,  's'},
-           {"end",        required_argument, 0,  'e'},
-           {"maxrows",    required_argument, 0,  'm'},
-           {"step",       required_argument, 0,   261},
-           {"enumds",     no_argument,       0,   262}, /* these are handled in the frontend ... */
-           {0,0,0,0}
-       };
-       int option_index = 0;
-       int opt;
-       
-       opt = getopt_long(argc, argv, "s:e:m:",
-                         long_options, &option_index);
-
-       if (opt == EOF)
-           break;
-       
-       switch(opt) {
-       case 261:
-           im.step =  atoi(optarg);
-           break;
-       case 262:
-           break;
-       case 's':
-           if ((parsetime_error = parsetime(optarg, &start_tv))) {
-               rrd_set_error( "start time: %s", parsetime_error );
-               return -1;
-           }
-           break;
-       case 'e':
-           if ((parsetime_error = parsetime(optarg, &end_tv))) {
-               rrd_set_error( "end time: %s", parsetime_error );
-               return -1;
-           }
-           break;
-       case 'm':
-           im.xsize = atol(optarg);
-           if (im.xsize < 10) {
-               rrd_set_error("maxrows below 10 rows");
-               return -1;
-           }
-           break;
-       case '?':
-            rrd_set_error("unknown option '%s'",argv[optind-1]);
+    while (1) {
+        static struct option long_options[] = {
+            {"start", required_argument, 0, 's'},
+            {"end", required_argument, 0, 'e'},
+            {"maxrows", required_argument, 0, 'm'},
+            {"step", required_argument, 0, 261},
+            {"enumds", no_argument, 0, 262},    /* these are handled in the frontend ... */
+            {0, 0, 0, 0}
+        };
+        int       option_index = 0;
+        int       opt;
+
+        opt = getopt_long(argc, argv, "s:e:m:", long_options, &option_index);
+
+        if (opt == EOF)
+            break;
+
+        switch (opt) {
+        case 261:
+            im.step = atoi(optarg);
+            break;
+        case 262:
+            break;
+        case 's':
+            if ((parsetime_error = parsetime(optarg, &start_tv))) {
+                rrd_set_error("start time: %s", parsetime_error);
+                return -1;
+            }
+            break;
+        case 'e':
+            if ((parsetime_error = parsetime(optarg, &end_tv))) {
+                rrd_set_error("end time: %s", parsetime_error);
+                return -1;
+            }
+            break;
+        case 'm':
+            im.xsize = atol(optarg);
+            if (im.xsize < 10) {
+                rrd_set_error("maxrows below 10 rows");
+                return -1;
+            }
+            break;
+        case '?':
+            rrd_set_error("unknown option '%s'", argv[optind - 1]);
             return -1;
-       }
+        }
     }
 
-    if (proc_start_end(&start_tv,&end_tv,&start_tmp,&end_tmp) == -1){
-       return -1;
-    }  
-    
-    if (start_tmp < 3600*24*365*10){
-       rrd_set_error("the first entry to fetch should be after 1980 (%ld)",start_tmp);
-       return -1;
+    if (proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) {
+        return -1;
     }
-    
+
+    if (start_tmp < 3600 * 24 * 365 * 10) {
+        rrd_set_error("the first entry to fetch should be after 1980 (%ld)",
+                      start_tmp);
+        return -1;
+    }
+
     if (end_tmp < start_tmp) {
-       rrd_set_error("start (%ld) should be less than end (%ld)", 
-              start_tmp, end_tmp);
-       return -1;
+        rrd_set_error("start (%ld) should be less than end (%ld)",
+                      start_tmp, end_tmp);
+        return -1;
     }
-    
+
     im.start = start_tmp;
     im.end = end_tmp;
-    im.step = max((long)im.step, (im.end-im.start)/im.xsize);
-    
-    rrd_graph_script(argc,argv,&im,0);
+    im.step = max((long) im.step, (im.end - im.start) / im.xsize);
+
+    rrd_graph_script(argc, argv, &im, 0);
     if (rrd_test_error()) {
-       im_free(&im);
-       return -1;
+        im_free(&im);
+        return -1;
     }
 
-    if (im.gdes_c == 0){
-       rrd_set_error("can't make a graph without contents");
-       im_free(&im);
-       return(-1); 
+    if (im.gdes_c == 0) {
+        rrd_set_error("can't make a graph without contents");
+        im_free(&im);
+        return (-1);
     }
-    
-    if (rrd_xport_fn(&im, start, end, step, col_cnt, legend_v, data) == -1){
-       im_free(&im);
-       return -1;
+
+    if (rrd_xport_fn(&im, start, end, step, col_cnt, legend_v, data) == -1) {
+        im_free(&im);
+        return -1;
     }
 
     im_free(&im);
@@ -146,98 +158,98 @@ rrd_xport(int argc, char **argv, int UNUSED(*xsize),
 
 
 
-int
-rrd_xport_fn(image_desc_t *im,
-            time_t         *start,
-            time_t         *end,        /* which time frame do you want ?
-                                         * will be changed to represent reality */
-            unsigned long  *step,       /* which stepsize do you want? 
-                                         * will be changed to represent reality */
-            unsigned long  *col_cnt,    /* number of data columns in the result */
-            char           ***legend_v, /* legend entries */
-            rrd_value_t    **data)      /* two dimensional array containing the data */
-{
+int rrd_xport_fn(
+    image_desc_t * im,
+    time_t *start,
+    time_t *end,        /* which time frame do you want ?
+                         * will be changed to represent reality */
+    unsigned long *step,    /* which stepsize do you want? 
+                             * will be changed to represent reality */
+    unsigned long *col_cnt, /* number of data columns in the result */
+    char ***legend_v,   /* legend entries */
+    rrd_value_t ** data)
+{                       /* two dimensional array containing the data */
 
-    int            i = 0, j = 0;
-    unsigned long  *ds_cnt;    /* number of data sources in file */
-    unsigned long  col, dst_row, row_cnt;
-    rrd_value_t    *srcptr, *dstptr;
+    int       i = 0, j = 0;
+    unsigned long *ds_cnt;  /* number of data sources in file */
+    unsigned long col, dst_row, row_cnt;
+    rrd_value_t *srcptr, *dstptr;
 
     unsigned long nof_xports = 0;
     unsigned long xport_counter = 0;
     unsigned long *ref_list;
     rrd_value_t **srcptr_list;
-    char **legend_list;
-    int ii = 0;
+    char    **legend_list;
+    int       ii = 0;
 
-    time_t start_tmp = 0;
-    time_t end_tmp = 0;
+    time_t    start_tmp = 0;
+    time_t    end_tmp = 0;
     unsigned long step_tmp = 1;
 
     /* pull the data from the rrd files ... */
-    if(data_fetch(im)==-1)
-       return -1;
+    if (data_fetch(im) == -1)
+        return -1;
 
     /* evaluate CDEF  operations ... */
-    if(data_calc(im)==-1)
-       return -1;
+    if (data_calc(im) == -1)
+        return -1;
 
     /* how many xports? */
-    for(i = 0; i < im->gdes_c; i++) {  
-       switch(im->gdes[i].gf) {
-       case GF_XPORT:
-         nof_xports++;
-         break;
-       default:
-         break;
-       }
+    for (i = 0; i < im->gdes_c; i++) {
+        switch (im->gdes[i].gf) {
+        case GF_XPORT:
+            nof_xports++;
+            break;
+        default:
+            break;
+        }
     }
 
-    if(nof_xports == 0) {
-      rrd_set_error("no XPORT found, nothing to do");
-      return -1;
+    if (nof_xports == 0) {
+        rrd_set_error("no XPORT found, nothing to do");
+        return -1;
     }
 
     /* a list of referenced gdes */
     ref_list = malloc(sizeof(int) * nof_xports);
-    if(ref_list == NULL)
-      return -1;
+    if (ref_list == NULL)
+        return -1;
 
     /* a list to save pointers into each gdes data */
     srcptr_list = malloc(sizeof(srcptr) * nof_xports);
-    if(srcptr_list == NULL) {
-      free(ref_list);
-      return -1;
+    if (srcptr_list == NULL) {
+        free(ref_list);
+        return -1;
     }
 
     /* a list to save pointers to the column's legend entry */
     /* this is a return value! */
     legend_list = malloc(sizeof(char *) * nof_xports);
-    if(legend_list == NULL) {
-      free(srcptr_list);
-      free(ref_list);
-      return -1;
+    if (legend_list == NULL) {
+        free(srcptr_list);
+        free(ref_list);
+        return -1;
     }
 
     /* find referenced gdes and save their index and */
     /* a pointer into their data */
-    for(i = 0; i < im->gdes_c; i++) {  
-       switch(im->gdes[i].gf) {
-       case GF_XPORT:
-         ii = im->gdes[i].vidx;
-         if(xport_counter > nof_xports) {
-           rrd_set_error( "too many xports: should not happen. Hmmm");
-           free(srcptr_list);
-           free(ref_list);
-           free(legend_list);
-           return -1;
-         } 
-         srcptr_list[xport_counter] = im->gdes[ii].data;
-         ref_list[xport_counter++] = i;
-         break;
-       default:
-         break;
-       }
+    for (i = 0; i < im->gdes_c; i++) {
+        switch (im->gdes[i].gf) {
+        case GF_XPORT:
+            ii = im->gdes[i].vidx;
+            if (xport_counter > nof_xports) {
+                rrd_set_error("too many xports: should not happen. Hmmm");
+                free(srcptr_list);
+                free(ref_list);
+                free(legend_list);
+                return -1;
+            }
+            srcptr_list[xport_counter] = im->gdes[ii].data;
+            ref_list[xport_counter++] = i;
+            break;
+        default:
+            break;
+        }
     }
 
     start_tmp = im->gdes[0].start;
@@ -250,69 +262,75 @@ rrd_xport_fn(image_desc_t *im,
     *end = end_tmp;
     *step = step_tmp;
 
-    row_cnt = ((*end)-(*start))/(*step);
+    row_cnt = ((*end) - (*start)) / (*step);
 
     /* room for rearranged data */
     /* this is a return value! */
-    if (((*data) = malloc((*col_cnt) * row_cnt * sizeof(rrd_value_t)))==NULL){
+    if (((*data) =
+         malloc((*col_cnt) * row_cnt * sizeof(rrd_value_t))) == NULL) {
         free(srcptr_list);
         free(ref_list);
-       free(legend_list);
-       rrd_set_error("malloc xport data area");
-       return(-1);
+        free(legend_list);
+        rrd_set_error("malloc xport data area");
+        return (-1);
     }
     dstptr = (*data);
 
     j = 0;
-    for(i = 0; i < im->gdes_c; i++) {  
-       switch(im->gdes[i].gf) {
-       case GF_XPORT:
-         /* reserve room for one legend entry */
-         /* is FMT_LEG_LEN + 5 the correct size? */
-         if ((legend_list[j] = malloc(sizeof(char) * (FMT_LEG_LEN+5)))==NULL) {
-           free(srcptr_list);
-           free(ref_list);
-           free(*data);  *data = NULL;
-           while (--j > -1) free(legend_list[j]);
-           free(legend_list);
-           rrd_set_error("malloc xport legend entry");
-           return(-1);
-         }
-
-         if (im->gdes[i].legend)
-           /* omit bounds check, should have the same size */
-           strcpy (legend_list[j++], im->gdes[i].legend);
-         else
-           legend_list[j++][0] = '\0';
-
-         break;
-       default:
-         break;
-       }
+    for (i = 0; i < im->gdes_c; i++) {
+        switch (im->gdes[i].gf) {
+        case GF_XPORT:
+            /* reserve room for one legend entry */
+            /* is FMT_LEG_LEN + 5 the correct size? */
+            if ((legend_list[j] =
+                 malloc(sizeof(char) * (FMT_LEG_LEN + 5))) == NULL) {
+                free(srcptr_list);
+                free(ref_list);
+                free(*data);
+                *data = NULL;
+                while (--j > -1)
+                    free(legend_list[j]);
+                free(legend_list);
+                rrd_set_error("malloc xport legend entry");
+                return (-1);
+            }
+
+            if (im->gdes[i].legend)
+                /* omit bounds check, should have the same size */
+                strcpy(legend_list[j++], im->gdes[i].legend);
+            else
+                legend_list[j++][0] = '\0';
+
+            break;
+        default:
+            break;
+        }
     }
 
     /* fill data structure */
-    for(dst_row = 0; (int)dst_row < (int)row_cnt; dst_row++) {
-      for(i = 0; i < (int)nof_xports; i++) {
-        j = ref_list[i];
-       ii = im->gdes[j].vidx;
-       ds_cnt = &im->gdes[ii].ds_cnt;
-
-       srcptr = srcptr_list[i];
-       for(col = 0; col < (*ds_cnt); col++) {
-         rrd_value_t newval = DNAN;
-         newval = srcptr[col];
-
-         if (im->gdes[ii].ds_namv && im->gdes[ii].ds_nam) {
-           if(strcmp(im->gdes[ii].ds_namv[col],im->gdes[ii].ds_nam) == 0)
-             (*dstptr++) = newval;
-         } else {
-           (*dstptr++) = newval;
-         }
-
-       }
-       srcptr_list[i] += (*ds_cnt);
-      }
+    for (dst_row = 0; (int) dst_row < (int) row_cnt; dst_row++) {
+        for (i = 0; i < (int) nof_xports; i++) {
+            j = ref_list[i];
+            ii = im->gdes[j].vidx;
+            ds_cnt = &im->gdes[ii].ds_cnt;
+
+            srcptr = srcptr_list[i];
+            for (col = 0; col < (*ds_cnt); col++) {
+                rrd_value_t newval = DNAN;
+
+                newval = srcptr[col];
+
+                if (im->gdes[ii].ds_namv && im->gdes[ii].ds_nam) {
+                    if (strcmp(im->gdes[ii].ds_namv[col], im->gdes[ii].ds_nam)
+                        == 0)
+                        (*dstptr++) = newval;
+                } else {
+                    (*dstptr++) = newval;
+                }
+
+            }
+            srcptr_list[i] += (*ds_cnt);
+        }
     }
 
     *legend_v = legend_list;
index f8dd93e..bce09be 100644 (file)
@@ -4,7 +4,7 @@
  * rrd_xport.h  contains XML related constants
  ****************************************************************************/
 #ifdef  __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 #ifndef _RRD_XPORT_H
index 257f2c7..d51dc9a 100644 (file)
 
 #include "rrd.h"
 
-int 
-main(int argc, char **argv){
-        rrd_update(argc,argv);
-        if (rrd_test_error()) {
-                printf("RRDtool " PACKAGE_VERSION "  Copyright by Tobi Oetiker, 1997-2007\n\n"
-                        "Usage: rrdupdate filename\n"
-                        "\t\t\t[--template|-t ds-name:ds-name:...]\n"
-                        "\t\t\ttime|N:value[:value...]\n\n"
-                        "\t\t\tat-time@value[:value...]\n\n"
-                        "\t\t\t[ time:value[:value...] ..]\n\n");
-                                   
-                printf("ERROR: %s\n",rrd_get_error());
-                rrd_clear_error();                                                            
-                return 1;
-        }
-        return 0;
+int main(
+    int argc,
+    char **argv)
+{
+    rrd_update(argc, argv);
+    if (rrd_test_error()) {
+        printf("RRDtool " PACKAGE_VERSION
+               "  Copyright by Tobi Oetiker, 1997-2007\n\n"
+               "Usage: rrdupdate filename\n"
+               "\t\t\t[--template|-t ds-name:ds-name:...]\n"
+               "\t\t\ttime|N:value[:value...]\n\n"
+               "\t\t\tat-time@value[:value...]\n\n"
+               "\t\t\t[ time:value[:value...] ..]\n\n");
+
+        printf("ERROR: %s\n", rrd_get_error());
+        rrd_clear_error();
+        return 1;
+    }
+    return 0;
 }
index c57a726..3928a6f 100644 (file)
@@ -19,7 +19,7 @@
 
 /* Define your own defaults in config.h if necessary */
 #if defined(TZNAME_STD) && defined(TZNAME_DST)
-char *tzname_[2] = {TZNAME_STD, TZNAME_DST};
+char     *tzname_[2] = { TZNAME_STD, TZNAME_DST };
 #else
 #define tzname_ tzname
 #endif
@@ -45,7 +45,10 @@ static char *month[] = {
 
 static char buf[26];
 
-static void strfmt(char *str, const char *fmt, ...);
+static void strfmt(
+    char *str,
+    const char *fmt,
+    ...);
 
 /**
  *
@@ -114,163 +117,161 @@ static void strfmt(char *str, const char *fmt, ...);
  *
 **/
 
-size_t strftime_(char *s, size_t maxs, const char *f, const struct tm *t)
+size_t strftime_(
+    char *s,
+    size_t maxs,
+    const char *f,
+    const struct tm *t)
 {
-      int w,d;
-      char *p, *q, *r;
-
-      p = s;
-      q = s + maxs - 1;
-      while ((*f != '\0'))
-      {
-            if (*f++ == '%')
-            {
-                  r = buf;
-                  switch (*f++)
-                  {
-                  case '%' :
-                        r = "%";
-                        break;
-
-                  case 'a' :
-                        r = aday[t->tm_wday];
-                        break;
-
-                  case 'A' :
-                        r = day[t->tm_wday];
-                        break;
-
-                  case 'b' :
-                        r = amonth[t->tm_mon];
-                        break;
-
-                  case 'B' :
-                        r = month[t->tm_mon];
-                        break;
-
-                  case 'c' :
-                        strfmt(r, "%0 %0 %2 %2:%2:%2 %4",
-                              aday[t->tm_wday], amonth[t->tm_mon],
-                              t->tm_mday,t->tm_hour, t->tm_min,
-                              t->tm_sec, t->tm_year+1900);
-                        break;
-
-                  case 'd' :
-                        strfmt(r,"%2",t->tm_mday);
-                        break;
-
-                  case 'H' :
-                        strfmt(r,"%2",t->tm_hour);
-                        break;
-
-                  case 'I' :
-                        strfmt(r,"%2",(t->tm_hour%12)?t->tm_hour%12:12);
-                        break;
-
-                  case 'j' :
-                        strfmt(r,"%3",t->tm_yday+1);
-                        break;
-
-                  case 'm' :
-                        strfmt(r,"%2",t->tm_mon+1);
-                        break;
-
-                  case 'M' :
-                        strfmt(r,"%2",t->tm_min);
-                        break;
-
-                  case 'p' :
-                        r = (t->tm_hour>11)?"PM":"AM";
-                        break;
-
-                  case 'S' :
-                        strfmt(r,"%2",t->tm_sec);
-                        break;
-
-                  case 'U' :
-                        w = t->tm_yday/7;
-                        if (t->tm_yday%7 > t->tm_wday)
-                              w++;
-                        strfmt(r, "%2", w);
-                        break;
-
-                  case 'W' :
-                        w = t->tm_yday/7;
-                        if (t->tm_yday%7 > (t->tm_wday+6)%7)
-                              w++;
-                        strfmt(r, "%2", w);
-                        break;
-
-                  case 'V':
-
-                        /* ISO 8601 Week Of Year:
-                           If the week (Monday - Sunday) containing January 1 has four or more
-                           days in the new year, then it is week 1; otherwise it is week 53 of
-                           the previous year and the next week is week one. */
-
-                       w  =  (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) / 7;
-                        d  =  (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) % 7;
-
-                        if (d >= 4) { w++; } else if (w == 0) { w = 53; }
-                        strfmt(r, "%2", w);
-                        break;
-
-                  case 'w' :
-                        strfmt(r,"%1",t->tm_wday);
-                        break;
-
-                  case 'x' :
-                        strfmt(r, "%3s %3s %2 %4", aday[t->tm_wday],
-                              amonth[t->tm_mon], t->tm_mday, t->tm_year+1900);
-                        break;
-
-                  case 'X' :
-                        strfmt(r, "%2:%2:%2", t->tm_hour,
-                              t->tm_min, t->tm_sec);
-                        break;
-
-                  case 'y' :
-                        strfmt(r,"%2",t->tm_year%100);
-                        break;
-
-                  case 'Y' :
-                        strfmt(r,"%4",t->tm_year+1900);
-                        break;
-
-                  case 'Z' :
-                        r = (t->tm_isdst && tzname_[1][0]) ?
-                              tzname_[1] : tzname_[0];
-                        break;
-
-                  default:
-                        buf[0] = '%';     /* reconstruct the format */
-                        buf[1] = f[-1];
-                        buf[2] = '\0';
-                        if (buf[1] == 0)
-                              f--;        /* back up if at end of string */
-                  }
-                  while (*r)
-                  {
-                        if (p == q)
-                        {
-                              *q = '\0';
-                              return 0;
-                        }
-                        *p++ = *r++;
-                  }
+    int       w, d;
+    char     *p, *q, *r;
+
+    p = s;
+    q = s + maxs - 1;
+    while ((*f != '\0')) {
+        if (*f++ == '%') {
+            r = buf;
+            switch (*f++) {
+            case '%':
+                r = "%";
+                break;
+
+            case 'a':
+                r = aday[t->tm_wday];
+                break;
+
+            case 'A':
+                r = day[t->tm_wday];
+                break;
+
+            case 'b':
+                r = amonth[t->tm_mon];
+                break;
+
+            case 'B':
+                r = month[t->tm_mon];
+                break;
+
+            case 'c':
+                strfmt(r, "%0 %0 %2 %2:%2:%2 %4",
+                       aday[t->tm_wday], amonth[t->tm_mon],
+                       t->tm_mday, t->tm_hour, t->tm_min,
+                       t->tm_sec, t->tm_year + 1900);
+                break;
+
+            case 'd':
+                strfmt(r, "%2", t->tm_mday);
+                break;
+
+            case 'H':
+                strfmt(r, "%2", t->tm_hour);
+                break;
+
+            case 'I':
+                strfmt(r, "%2", (t->tm_hour % 12) ? t->tm_hour % 12 : 12);
+                break;
+
+            case 'j':
+                strfmt(r, "%3", t->tm_yday + 1);
+                break;
+
+            case 'm':
+                strfmt(r, "%2", t->tm_mon + 1);
+                break;
+
+            case 'M':
+                strfmt(r, "%2", t->tm_min);
+                break;
+
+            case 'p':
+                r = (t->tm_hour > 11) ? "PM" : "AM";
+                break;
+
+            case 'S':
+                strfmt(r, "%2", t->tm_sec);
+                break;
+
+            case 'U':
+                w = t->tm_yday / 7;
+                if (t->tm_yday % 7 > t->tm_wday)
+                    w++;
+                strfmt(r, "%2", w);
+                break;
+
+            case 'W':
+                w = t->tm_yday / 7;
+                if (t->tm_yday % 7 > (t->tm_wday + 6) % 7)
+                    w++;
+                strfmt(r, "%2", w);
+                break;
+
+            case 'V':
+
+                /* ISO 8601 Week Of Year:
+                   If the week (Monday - Sunday) containing January 1 has four or more
+                   days in the new year, then it is week 1; otherwise it is week 53 of
+                   the previous year and the next week is week one. */
+
+                w = (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) / 7;
+                d = (t->tm_yday + 7 - (t->tm_wday ? t->tm_wday - 1 : 6)) % 7;
+
+                if (d >= 4) {
+                    w++;
+                } else if (w == 0) {
+                    w = 53;
+                }
+                strfmt(r, "%2", w);
+                break;
+
+            case 'w':
+                strfmt(r, "%1", t->tm_wday);
+                break;
+
+            case 'x':
+                strfmt(r, "%3s %3s %2 %4", aday[t->tm_wday],
+                       amonth[t->tm_mon], t->tm_mday, t->tm_year + 1900);
+                break;
+
+            case 'X':
+                strfmt(r, "%2:%2:%2", t->tm_hour, t->tm_min, t->tm_sec);
+                break;
+
+            case 'y':
+                strfmt(r, "%2", t->tm_year % 100);
+                break;
+
+            case 'Y':
+                strfmt(r, "%4", t->tm_year + 1900);
+                break;
+
+            case 'Z':
+                r = (t->tm_isdst && tzname_[1][0]) ? tzname_[1] : tzname_[0];
+                break;
+
+            default:
+                buf[0] = '%';   /* reconstruct the format */
+                buf[1] = f[-1];
+                buf[2] = '\0';
+                if (buf[1] == 0)
+                    f--;    /* back up if at end of string */
             }
-            else
-            {
-                  if (p == q)
-                  {
-                        *q = '\0';
-                        return 0;
-                  }
-                  *p++ = f[-1];
+            while (*r) {
+                if (p == q) {
+                    *q = '\0';
+                    return 0;
+                }
+                *p++ = *r++;
             }
-      }
-      *p = '\0';
-      return p - s;
+        } else {
+            if (p == q) {
+                *q = '\0';
+                return 0;
+            }
+            *p++ = f[-1];
+        }
+    }
+    *p = '\0';
+    return p - s;
 }
 
 /*
@@ -298,38 +299,38 @@ static int powers[5] = { 1, 10, 100, 1000, 10000 };
  *
 **/
 
-static void strfmt(char *str, const char *fmt, ...)
+static void strfmt(
+    char *str,
+    const char *fmt,
+    ...)
 {
-      int ival, ilen;
-      char *sval;
-      va_list vp;
-
-      va_start(vp, fmt);
-      while (*fmt)
-      {
-            if (*fmt++ == '%')
-            {
-                  ilen = *fmt++ - '0';
-                  if (ilen == 0)                /* zero means string arg */
-                  {
-                        sval = va_arg(vp, char*);
-                        while (*sval)
-                              *str++ = *sval++;
-                  }
-                  else                          /* always leading zeros */
-                  {
-                        ival = va_arg(vp, int);
-                        while (ilen)
-                        {
-                              ival %= powers[ilen--];
-                              *str++ = (char)('0' + ival / powers[ilen]);
-                        }
-                  }
+    int       ival, ilen;
+    char     *sval;
+    va_list   vp;
+
+    va_start(vp, fmt);
+    while (*fmt) {
+        if (*fmt++ == '%') {
+            ilen = *fmt++ - '0';
+            if (ilen == 0) {    /* zero means string arg */
+                sval = va_arg(vp, char *);
+
+                while (*sval)
+                    *str++ = *sval++;
+            } else {    /* always leading zeros */
+
+                ival = va_arg(vp, int);
+
+                while (ilen) {
+                    ival %= powers[ilen--];
+                    *str++ = (char) ('0' + ival / powers[ilen]);
+                }
             }
-            else  *str++ = fmt[-1];
-      }
-      *str = '\0';
-      va_end(vp);
+        } else
+            *str++ = fmt[-1];
+    }
+    *str = '\0';
+    va_end(vp);
 }
 
 #ifdef TEST
@@ -337,20 +338,22 @@ static void strfmt(char *str, const char *fmt, ...)
 #include <stdio.h>      /* for printf */
 #include <time.h>       /* for strftime */
 
-char test[80];
+char      test[80];
 
-int main(int argc, char *argv[])
+int main(
+    int argc,
+    char *argv[])
 {
-      int len;
-      char *fmt;
-      time_t now;
+    int       len;
+    char     *fmt;
+    time_t    now;
 
-      time(&now);
+    time(&now);
 
-      fmt = (argc == 1) ? "%I:%M %p\n%c\n" : argv[1];
-      len = strftime_(test,sizeof test, fmt, localtime(&now));
-      printf("%d: %s\n", len, test);
-      return !len;
+    fmt = (argc == 1) ? "%I:%M %p\n%c\n" : argv[1];
+    len = strftime_(test, sizeof test, fmt, localtime(&now));
+    printf("%d: %s\n", len, test);
+    return !len;
 }
 
-#endif /* TEST */
+#endif                          /* TEST */
index c9d45e3..485dbdd 100644 (file)
 #include <stddef.h>     /* for size_t */
 #include <time.h>       /* for struct tm */
 
-size_t strftime_(char *s, size_t maxs, const char *f, const struct tm *t);
+size_t    strftime_(
+    char *s,
+    size_t maxs,
+    const char *f,
+    const struct tm *t);
 
 #if defined(TZNAME_STD) && defined(TZNAME_DST)
-extern char * tzname_[2];
+extern char *tzname_[2];
 #endif
 
-#endif /* STRFTIME__H */
+#endif                          /* STRFTIME__H */
index 32f5337..5f55701 100644 (file)
@@ -1,27 +1,39 @@
 // compatibility routines, non reentrant ....
 
-#include <string.h> 
+#include <string.h>
 #include <time.h>
 
-struct tm* localtime_r(const time_t* t, struct tm* r) {
-  struct tm * temp;
-  temp = localtime(t);
-  memcpy(r,temp,sizeof(struct tm));
-  return(r);
+struct tm *localtime_r(
+    const time_t *t,
+    struct tm *r)
+{
+    struct tm *temp;
+
+    temp = localtime(t);
+    memcpy(r, temp, sizeof(struct tm));
+    return (r);
 }
 
-struct tm* gmtime_r(const time_t* t, struct tm* r) {
-  struct tm * temp;
-  temp = gmtime(t);
-  memcpy(r,temp,sizeof(struct tm));
-  return r;
+struct tm *gmtime_r(
+    const time_t *t,
+    struct tm *r)
+{
+    struct tm *temp;
+
+    temp = gmtime(t);
+    memcpy(r, temp, sizeof(struct tm));
+    return r;
 }
 
-char* ctime_r (const time_t* t, char* buf) {
-  char * temp;
-  temp = asctime(localtime(t));
-  strcpy(buf,temp);
-  return(buf);
+char     *ctime_r(
+    const time_t *t,
+    char *buf)
+{
+    char     *temp;
+
+    temp = asctime(localtime(t));
+    strcpy(buf, temp);
+    return (buf);
 }
 
 /*
@@ -36,32 +48,35 @@ char* ctime_r (const time_t* t, char* buf) {
 */
 
 
-char * strtok_r (char *s, const char *delim, char **save_ptr) {
-  char *token;
+char     *strtok_r(
+    char *s,
+    const char *delim,
+    char **save_ptr)
+{
+    char     *token;
 
-  if (s == NULL)  s = *save_ptr;
+    if (s == NULL)
+        s = *save_ptr;
 
-  /* Scan leading delimiters.  */
-  s += strspn(s, delim);
-  if (*s == '\0')
-    {
-      *save_ptr = s;
-      return NULL;
+    /* Scan leading delimiters.  */
+    s += strspn(s, delim);
+    if (*s == '\0') {
+        *save_ptr = s;
+        return NULL;
     }
 
-  /* Find the end of the token.  */
-  token = s;
-  s = strpbrk (token, delim);
-  if (s == NULL) {
-    /* This token finishes the string.  */
-         *save_ptr = token;
-         while (**save_ptr != '\0') (*save_ptr)++;
-  }  else
-    {
-      /* Terminate the token and make *SAVE_PTR point past it.  */
-      *s = '\0';
-      *save_ptr = s + 1;
+    /* Find the end of the token.  */
+    token = s;
+    s = strpbrk(token, delim);
+    if (s == NULL) {
+        /* This token finishes the string.  */
+        *save_ptr = token;
+        while (**save_ptr != '\0')
+            (*save_ptr)++;
+    } else {
+        /* Terminate the token and make *SAVE_PTR point past it.  */
+        *s = '\0';
+        *save_ptr = s + 1;
     }
-  return token;
+    return token;
 }
-