]> mj.ucw.cz Git - libucw.git/blob - images/sig-dump.c
Daemon: Bug fixes and signal defaults
[libucw.git] / images / sig-dump.c
1 /*
2  *      Image Library -- Dumping of image signatures
3  *
4  *      (c) 2006 Pavel Charvat <pchar@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #include <ucw/lib.h>
11 #include <images/images.h>
12 #include <images/signature.h>
13 #include <stdio.h>
14
15 byte *
16 image_vector_dump(byte *buf, struct image_vector *vec)
17 {
18   byte *p = buf;
19   *p++ = '(';
20   for (uns i = 0; i < IMAGE_VEC_F; i++)
21     {
22       if (i)
23         *p++ = ' ';
24       p += sprintf(p, "%u", vec->f[i]);
25     }
26   *p++ = ')';
27   *p = 0;
28   return buf;
29 }
30
31 byte *
32 image_region_dump(byte *buf, struct image_region *reg)
33 {
34   byte *p = buf;
35   p += sprintf(p, "(txt=");
36   for (uns i = 0; i < IMAGE_REG_F; i++)
37     {
38       if (i)
39         *p++ = ' ';
40       p += sprintf(p, "%u", reg->f[i]);
41     }
42   p += sprintf(p, " shp=");
43   for (uns i = 0; i < IMAGE_REG_H; i++)
44     {
45       if (i)
46         *p++ = ' ';
47       p += sprintf(p, "%u", reg->h[i]);
48     }
49   p += sprintf(p, " wa=%u wb=%u)", reg->wa, reg->wb);
50   *p = 0;
51   return buf;
52 }