changeset 351:97c699f40ab3

libtwamr: generate namespace.h from namespace.list
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 05 May 2024 20:34:55 +0000
parents 9b05bbc23b8a
children 99661127ca53
files libtwamr/Makefile libtwamr/namespace.awk libtwamr/namespace.h libtwamr/namespace.list
diffstat 4 files changed, 164 insertions(+), 151 deletions(-) [+]
line wrap: on
line diff
--- a/libtwamr/Makefile	Tue Apr 23 05:34:54 2024 +0000
+++ b/libtwamr/Makefile	Sun May 05 20:34:55 2024 +0000
@@ -8,12 +8,16 @@
 	gmed_n.o graytab.o inv_sqrt.o log2.o lsp_lsf.o oper_32b.o pow2.o \
 	prmno.o q_plsf3_tab.o q_plsf5_tab.o reorder.o s10_8pf.o set_sign.o \
 	sqrt_l.o tls_flags.o window.o
+HDRS=	namespace.h
 LIB=	libtwamr.a
 
 INSTALL_PREFIX=	/usr/local
 
 all:	${LIB}
 
+namespace.h:	namespace.awk namespace.list
+	awk -f namespace.awk namespace.list > $@
+
 ${OBJS}:	${HDRS}
 
 ${LIB}:	${OBJS}
@@ -27,4 +31,4 @@
 #	install -c -m 444 ${LIB} ${INSTALL_PREFIX}/lib
 
 clean:
-	rm -f *.[oa] errs
+	rm -f *.[oa] namespace.h errs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtwamr/namespace.awk	Sun May 05 20:34:55 2024 +0000
@@ -0,0 +1,18 @@
+# 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 ""
+}
+
+NF == 1 && $1 !~ /^#/ {
+	printf "#define	%s	amr__%s\n", $1, $1
+}
+
+END {
+	print ""
+	print "#endif"
+}
--- a/libtwamr/namespace.h	Tue Apr 23 05:34:54 2024 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * The code from ETSI consists of many separate modules and lots of little
- * functions; if we were to keep all those global function names untreated,
- * our library would cause horrible namespace pollution for any application
- * linking with it.  Our current solution: we include this header in all
- * internal modules, transforming the names of all internal functions
- * with intermodule linkage.
- */
-
-#ifndef	namespace_h
-#define	namespace_h
-
-#define	Overflow	AMR__Overflow
-#define	Carry		AMR__Carry
-
-#define	add		AMR__add
-#define	sub		AMR__sub
-#define	abs_s		AMR__abs_s
-#define	shl		AMR__shl
-#define	shr		AMR__shr
-#define	mult		AMR__mult
-#define	L_mult		AMR__L_mult
-#define	negate		AMR__negate
-#define	extract_h	AMR__extract_h
-#define	extract_l	AMR__extract_l
-#define	round		AMR__round
-#define	L_mac		AMR__L_mac
-#define	L_msu		AMR__L_msu
-#define	L_macNs		AMR__L_macNs
-#define	L_msuNs		AMR__L_msuNs
-#define	L_add		AMR__L_add
-#define	L_sub		AMR__L_sub
-#define	L_add_c		AMR__L_add_c
-#define	L_sub_c		AMR__L_sub_c
-#define	L_negate	AMR__L_negate
-#define	mult_r		AMR__mult_r
-#define	L_shl		AMR__L_shl
-#define	L_shr		AMR__L_shr
-#define	shr_r		AMR__shr_r
-#define	mac_r		AMR__mac_r
-#define	msu_r		AMR__msu_r
-#define	L_deposit_h	AMR__L_deposit_h
-#define	L_deposit_l	AMR__L_deposit_l
-#define	L_shr_r		AMR__L_shr_r
-#define	L_abs		AMR__L_abs
-#define	L_sat		AMR__L_sat
-#define	norm_m		AMR__norm_s
-#define	div_s		AMR__div_s
-#define	norm_l		AMR__norm_l
-
-#define	L_Extract	AMR__L_Extract
-#define	L_Comp		AMR__L_Comp
-#define	Mpy_32		AMR__Mpy_32
-#define	Mpy_32_16	AMR__Mpy_32_16
-#define	Div_32		AMR__Div_32
-
-#define	Inv_sqrt	AMR__Inv_sqrt
-#define	Log2		AMR__Log2
-#define	Log2_norm 	AMR__Log2_norm
-#define	Pow2		AMR__Pow2
-
-#define	A_Refl		AMR__A_Refl
-#define	Autocorr	AMR__Autocorr
-#define	Az_lsp		AMR__Az_lsp
-#define	Bgn_scd		AMR__Bgn_scd
-#define	Bgn_scd_reset	AMR__Bgn_scd_reset
-#define	Convolve 	AMR__Convolve
-#define	D_plsf_reset	AMR__D_plsf_reset
-#define	D_plsf_5	AMR__D_plsf_5
-#define	D_plsf_3	AMR__D_plsf_3
-#define	Init_D_plsf_3	AMR__Init_D_plsf_3
-#define	Lsf_lsp		AMR__Lsf_lsp
-#define	Lsp_lsf		AMR__Lsp_lsf
-#define	Reorder_lsf	AMR__Reorder_lsf
-
-#define	agc		AMR__agc
-#define	agc2		AMR__agc2
-#define	agc_reset	AMR__agc_reset
-#define	pseudonoise	AMR__pseudonoise
-#define	build_CN_code	AMR__build_CN_code
-#define	build_CN_param	AMR__build_CN_param
-#define	gmed_n		AMR__gmed_n
-#define	sqrt_l_exp	AMR__sqrt_l_exp
-#define	set_sign	AMR__set_sign
-#define	set_sign12k2	AMR__set_sign12k2
-#define	cor_h		AMR__cor_h
-#define	cor_h_x		AMR__cor_h_x
-#define	cor_h_x2	AMR__cor_h_x2
-#define	comp_corr 	AMR__comp_corr
-#define	cbsearch	AMR__cbsearch
-#define	d_gain_code	AMR__d_gain_code
-#define	d_gain_pitch	AMR__d_gain_pitch
-
-#define	Bits2prm	AMR__Bits2prm
-#define	Prm2bits	AMR__Prm2bits
-
-#define	bitno		AMR__bitno
-#define	prmno		AMR__prmno
-#define	prmnofs		AMR__prmnofs
-#define	gray		AMR__gray
-#define	dgray		AMR__dgray
-#define	window_200_40	AMR__window_200_40
-#define	window_160_80	AMR__window_160_80
-#define	window_232_8	AMR__window_232_8
-#define	qua_gain_pitch	AMR__qua_gain_pitch
-#define	qua_gain_code	AMR__qua_gain_code
-
-#define	mean_lsf	AMR__mean_lsf
-#define	mean_lsf3	AMR__mean_lsf3
-#define	dico1_lsf	AMR__dico1_lsf
-#define	dico2_lsf	AMR__dico2_lsf
-#define	dico3_lsf	AMR__dico3_lsf
-#define	dico4_lsf	AMR__dico4_lsf
-#define	dico5_lsf	AMR__dico5_lsf
-#define	dico1_lsf3	AMR__dico1_lsf3
-#define	dico2_lsf3	AMR__dico2_lsf3
-#define	dico3_lsf3	AMR__dico3_lsf3
-#define	mr515_3_lsf	AMR__mr515_3_lsf
-#define	mr795_1_lsf	AMR__mr795_1_lsf
-#define	past_rq_init	AMR__past_rq_init
-#define	pred_fact	AMR__pred_fact
-
-#define	Cb_gain_average		AMR__Cb_gain_average
-#define	Cb_gain_average_reset	AMR__Cb_gain_average_reset
-
-#define	calc_unfilt_energies	AMR__calc_unfilt_energies
-#define	calc_filt_energies	AMR__calc_filt_energies
-#define	calc_target_energy	AMR__calc_target_energy
-#define	code_2i40_9bits		AMR__code_2i40_9bits
-#define	code_2i40_11bits	AMR__code_2i40_11bits
-#define	code_3i40_14bits	AMR__code_3i40_14bits
-#define	code_4i40_17bits	AMR__code_4i40_17bits
-#define	code_8i40_31bits	AMR__code_8i10_31bits
-#define	code_10i40_35bits	AMR__code_10i40_35bits
-#define	search_10and8i40	AMR__search_10and8i40
-
-#define	decode_2i40_9bits	AMR__decode_2i40_9bits
-#define	decode_2i40_11bits	AMR__decode_2i40_11bits
-#define	decode_3i40_14bits	AMR__decode_3i40_14bits
-#define	decode_4i40_17bits	AMR__decode_4i40_17bits
-#define	dec_8i40_31bits		AMR__dec_8i40_31bits
-#define	dec_10i40_35bits	AMR__dec_10i40_35bits
-
-#define	gc_pred			AMR__gc_pred
-#define	gc_pred_copy		AMR__gc_pred_copy
-#define	gc_pred_reset		AMR__gc_pred_reset
-#define	gc_pred_update		AMR__gc_pred_update
-#define	gc_pred_average_limited	AMR__gc_pred_average_limited
-
-#endif	/* include guard */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtwamr/namespace.list	Sun May 05 20:34:55 2024 +0000
@@ -0,0 +1,141 @@
+# This file is the source input for automatic generation of namespace.h
+# for libtwamr.  Each non-empty, non-comment line names one function or
+# data object with intermodule linkage whose name needs to be transformed
+# in order to avoid namespace pollution for users of our library.
+
+Overflow
+Carry
+
+add
+sub
+abs_s
+shl
+shr
+mult
+L_mult
+negate
+extract_h
+extract_l
+round
+L_mac
+L_msu
+L_macNs
+L_msuNs
+L_add
+L_sub
+L_add_c
+L_sub_c
+L_negate
+mult_r
+L_shl
+L_shr
+shr_r
+mac_r
+msu_r
+L_deposit_h
+L_deposit_l
+L_shr_r
+L_abs
+L_sat
+norm_m
+div_s
+norm_l
+
+L_Extract
+L_Comp
+Mpy_32
+Mpy_32_16
+Div_32
+
+Inv_sqrt
+Log2
+Log2_norm
+Pow2
+
+A_Refl
+Autocorr
+Az_lsp
+Bgn_scd
+Bgn_scd_reset
+Convolve
+D_plsf_reset
+D_plsf_5
+D_plsf_3
+Init_D_plsf_3
+Lsf_lsp
+Lsp_lsf
+Reorder_lsf
+
+agc
+agc2
+agc_reset
+pseudonoise
+build_CN_code
+build_CN_param
+gmed_n
+sqrt_l_exp
+set_sign
+set_sign12k2
+cor_h
+cor_h_x
+cor_h_x2
+comp_corr
+cbsearch
+d_gain_code
+d_gain_pitch
+
+Bits2prm
+Prm2bits
+
+bitno
+prmno
+prmnofs
+gray
+dgray
+window_200_40
+window_160_80
+window_232_8
+qua_gain_pitch
+qua_gain_code
+
+mean_lsf
+mean_lsf3
+dico1_lsf
+dico2_lsf
+dico3_lsf
+dico4_lsf
+dico5_lsf
+dico1_lsf3
+dico2_lsf3
+dico3_lsf3
+mr515_3_lsf
+mr795_1_lsf
+past_rq_init
+pred_fact
+
+Cb_gain_average
+Cb_gain_average_reset
+
+calc_unfilt_energies
+calc_filt_energies
+calc_target_energy
+code_2i40_9bits
+code_2i40_11bits
+code_3i40_14bits
+code_4i40_17bits
+code_8i40_31bits
+code_10i40_35bits
+search_10and8i40
+
+decode_2i40_9bits
+decode_2i40_11bits
+decode_3i40_14bits
+decode_4i40_17bits
+dec_8i40_31bits
+dec_10i40_35bits
+
+gc_pred
+gc_pred_copy
+gc_pred_reset
+gc_pred_update
+gc_pred_average_limited