#!/usr/bin/bash

#a=`locale | grep LANG=`;a=${a#*=};a=${a%_*}
#if [ "${a}" = "ro" ]; then this was in locale, now x86_64-w64-mingw32-objdump do like ~90% in locale, but not this anymore
#	b=`x86_64-w64-mingw32-objdump -p actionswf.dll | grep "\[Ordinal\/Nume Pointer\] Tabel" -n`
#fi
#if [ -z "${b}" ]; then
b=`x86_64-w64-mingw32-objdump -p actionswf.dll | grep "\[Ordinal\/Name Pointer\] Table" -n` || exit 1
#fi

echo "LIBRARY actionswf.dll" > $1
echo "EXPORTS" >> $1
b=${b%%:*}
b=`echo $b+2 | bc`
n=`x86_64-w64-mingw32-objdump -p actionswf.dll | tail -n +$b | sed '/./d;=;q'`
c=`x86_64-w64-mingw32-objdump -p actionswf.dll | tail -n +$b | head -$n`

for (( ; ; ))
do
	c=${c#*]}
	c=${c#*]}
	d=${c%%[*}
	d=`echo $d | cut -d' ' -f2`
	if [ "$e" = $d ]
	then
		break
	fi
	e=$d
	echo $d >> $1
done
