changeset 502:b0333fa167c3

libgsmhr1: compile mathhalf.c
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 19 Jun 2024 01:06:28 +0000
parents 597b39aef484
children 3654df24451f
files .hgignore libgsmhr1/Makefile libgsmhr1/mathhalf.c libgsmhr1/namespace.awk libgsmhr1/namespace.list
diffstat 5 files changed, 43 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Jun 19 00:54:44 2024 +0000
+++ b/.hgignore	Wed Jun 19 01:06:28 2024 +0000
@@ -72,6 +72,7 @@
 ^frtest/gsmfr-encode-r$
 ^frtest/gsmfr-preproc$
 
+^libgsmhr1/namespace\.h$
 ^libtwamr/namespace\.h$
 
 ^miscutil/amrts-pcm8-compact$
--- a/libgsmhr1/Makefile	Wed Jun 19 00:54:44 2024 +0000
+++ b/libgsmhr1/Makefile	Wed Jun 19 01:06:28 2024 +0000
@@ -1,12 +1,15 @@
-OBJS=	dhf_params.o pack_frame.o rtp_in.o sid_detect.o sid_reset.o \
+OBJS=	dhf_params.o mathhalf.o pack_frame.o rtp_in.o sid_detect.o sid_reset.o \
 	twts002_in.o twts002_out.o unpack_frame.o
-HDRS=	tw_gsmhr.h
+HDRS=	mathhalf.h namespace.h tw_gsmhr.h typedefs.h
 LIB=	libgsmhr1.a
 
 include ../config.defs
 
 all:	${LIB}
 
+namespace.h:	namespace.awk namespace.list
+	awk -f namespace.awk namespace.list > $@
+
 ${OBJS}:	${HDRS}
 
 ${LIB}:	${OBJS}
@@ -20,4 +23,4 @@
 #	install -c -m 444 ${LIB} ${DESTDIR}${libdir}
 
 clean:
-	rm -f *.[oa] errs
+	rm -f *.[oa] namespace.h errs
--- a/libgsmhr1/mathhalf.c	Wed Jun 19 00:54:44 2024 +0000
+++ b/libgsmhr1/mathhalf.c	Wed Jun 19 01:06:28 2024 +0000
@@ -52,6 +52,7 @@
 */
 
 #include "typedefs.h"
+#include "namespace.h"
 #include "mathhalf.h"
 
 /***************************************************************************
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/namespace.awk	Wed Jun 19 01:06:28 2024 +0000
@@ -0,0 +1,22 @@
+# This awk script generates namespace.h from namespace.list
+
+BEGIN {
+	print "/* Auto-generated; do not edit! */"
+	print ""
+	print "#ifndef	namespace_h"
+	print "#define	namespace_h"
+	print ""
+}
+
+{
+	for (i = 1; i <= NF; i++) {
+		if ($i ~ /^#/)
+			break;
+		printf "#define	%s	gsmhr__%s\n", $i, $i;
+	}
+}
+
+END {
+	print ""
+	print "#endif"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/namespace.list	Wed Jun 19 01:06:28 2024 +0000
@@ -0,0 +1,13 @@
+# This file is the source input for automatic generation of namespace.h
+# for libgsmhr1.  Each word in every non-empty, non-comment line lists a
+# function or a data object with intermodule linkage whose name needs to be
+# transformed in order to avoid namespace pollution for users of our library.
+
+add sub L_add L_sub
+mult L_mult mult_r
+shr shl L_shr L_shl shift_r L_shift_r
+abs_s L_abs
+L_mac mac_r L_msu msu_r
+negate L_negate
+L_deposit_l L_deposit_h extract_l extract_h
+round norm_l norm_s divide_s