FreeCalypso > hg > freecalypso-tools
comparison librftab/smallconv.c @ 720:b73c21a2148f
reorg: smallconv.c moved from ffstools/cal2text to librftab
This module contains write_afcdac_ascii() and write_stdmap_ascii()
functions; the plan is to make them available to other programs,
particularly the upcoming addition of RF table dump to tiffs.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 25 Aug 2020 06:28:44 +0000 |
parents | ffstools/cal2text/smallconv.c@d41edd329670 |
children |
comparison
equal
deleted
inserted
replaced
719:f33d050eac6e | 720:b73c21a2148f |
---|---|
1 /* | |
2 * /gsm/rf/afcdac and /gsm/rf/stdmap each store a single 16-bit value, | |
3 * and are not tables in the rftw/rftr sense, hence the code in rftablewr.c | |
4 * does not handle these two. However, in fc-cal2text we would like to | |
5 * handle their conversion from binary to ASCII the same way as the bigger | |
6 * tables, hence the two functions in this module. | |
7 */ | |
8 | |
9 #include <sys/types.h> | |
10 #include <stdio.h> | |
11 #include <stdint.h> | |
12 #include <endian.h> | |
13 | |
14 void | |
15 write_afcdac_ascii(bin, outf) | |
16 uint16_t *bin; | |
17 FILE *outf; | |
18 { | |
19 int i; | |
20 | |
21 i = le16toh(*bin); | |
22 if (i >= 32768) | |
23 i -= 65536; | |
24 fprintf(outf, "%d\n", i); | |
25 } | |
26 | |
27 void | |
28 write_stdmap_ascii(bin, outf) | |
29 uint16_t *bin; | |
30 FILE *outf; | |
31 { | |
32 int i; | |
33 | |
34 i = le16toh(*bin); | |
35 fprintf(outf, "0x%04X\n", i); | |
36 } |