apply FSL(Flora Software License)
[apps/home/memo.git] / scripts / float.sh
1 #!/bin/bash
2 dest="../include/memo_edc_float.h"
3 scale=5
4
5 rm -f $dest
6 cat ./copyright > $dest
7 echo "#ifndef __MEMO_EDC_FLOAT_H__
8 #define __MEMO_EDC_FLOAT_H__
9
10 /* Don't modify this file manually, generate it by float.sh located in scripts directory!!! */
11 " >> $dest
12
13 files=$(ls ../edc/ | grep "in$")
14 for i in $files ; do
15     rpath=$(realpath ../edc/$i)
16     echo "Handling $rpath ..."
17     while l=$(line) ; do
18         n=$(echo $l | awk '{print $1}')
19         f=$(echo $l | sed -r "s/^\w+\s+/scale=$scale;/" | bc | sed -r "s/^\./0./")
20         echo "#define $n $f" >>  $dest
21     done < $rpath
22 done
23
24 echo "
25 #endif /* __MEMO_EDC_FLOAT_H__ */
26 " >> $dest
27
28 chmod -w $dest