# HG changeset patch # User Mychaela Falconia # Date 1598336924 0 # Node ID b73c21a2148f67e324eff46b4710f8253a6431c2 # Parent f33d050eac6ecb282206ce8bd573fa8d58e9ed51 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. diff -r f33d050eac6e -r b73c21a2148f ffstools/cal2text/Makefile --- a/ffstools/cal2text/Makefile Sun Aug 23 15:42:45 2020 +0000 +++ b/ffstools/cal2text/Makefile Tue Aug 25 06:28:44 2020 +0000 @@ -1,7 +1,7 @@ CC= gcc CFLAGS= -O2 PROG= fc-cal2text -OBJS= dircheck.o main.o mkdir.o smallconv.o +OBJS= dircheck.o main.o mkdir.o LIBS= ../../librftab/librftab.a INSTALL_PREFIX= /opt/freecalypso diff -r f33d050eac6e -r b73c21a2148f ffstools/cal2text/smallconv.c --- a/ffstools/cal2text/smallconv.c Sun Aug 23 15:42:45 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* - * /gsm/rf/afcdac and /gsm/rf/stdmap each store a single 16-bit value, - * and are not tables in the rftw/rftr sense, hence the code in rftablewr.c - * does not handle these two. However, in fc-cal2text we would like to - * handle their conversion from binary to ASCII the same way as the bigger - * tables, hence the two functions in this module. - */ - -#include -#include -#include -#include - -void -write_afcdac_ascii(bin, outf) - uint16_t *bin; - FILE *outf; -{ - int i; - - i = le16toh(*bin); - if (i >= 32768) - i -= 65536; - fprintf(outf, "%d\n", i); -} - -void -write_stdmap_ascii(bin, outf) - uint16_t *bin; - FILE *outf; -{ - int i; - - i = le16toh(*bin); - fprintf(outf, "0x%04X\n", i); -} diff -r f33d050eac6e -r b73c21a2148f librftab/Makefile --- a/librftab/Makefile Sun Aug 23 15:42:45 2020 +0000 +++ b/librftab/Makefile Tue Aug 25 06:28:44 2020 +0000 @@ -1,6 +1,6 @@ CC= gcc CFLAGS= -O2 -OBJS= readfir.o readtxramp.o rftablerd.o rftablewr.o +OBJS= readfir.o readtxramp.o rftablerd.o rftablewr.o smallconv.o LIB= librftab.a all: ${LIB} diff -r f33d050eac6e -r b73c21a2148f librftab/smallconv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/librftab/smallconv.c Tue Aug 25 06:28:44 2020 +0000 @@ -0,0 +1,36 @@ +/* + * /gsm/rf/afcdac and /gsm/rf/stdmap each store a single 16-bit value, + * and are not tables in the rftw/rftr sense, hence the code in rftablewr.c + * does not handle these two. However, in fc-cal2text we would like to + * handle their conversion from binary to ASCII the same way as the bigger + * tables, hence the two functions in this module. + */ + +#include +#include +#include +#include + +void +write_afcdac_ascii(bin, outf) + uint16_t *bin; + FILE *outf; +{ + int i; + + i = le16toh(*bin); + if (i >= 32768) + i -= 65536; + fprintf(outf, "%d\n", i); +} + +void +write_stdmap_ascii(bin, outf) + uint16_t *bin; + FILE *outf; +{ + int i; + + i = le16toh(*bin); + fprintf(outf, "0x%04X\n", i); +}