scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

mktbl (512B)


      1 #!/bin/sh
      2 
      3 
      4 unset LC_ALL
      5 LC_COLLATE=C
      6 set -e
      7 
      8 for i
      9 do
     10 	case $i in
     11 	-c)
     12 		cpu=$2
     13 		shift 2
     14 		;;
     15 	-f)
     16 		family=$2
     17 		shift 2
     18 		;;
     19 	-*)
     20 		echo mktbl: incorrect parameter:$i >&2
     21 		exit 1
     22 		;;
     23 	esac
     24 done
     25 
     26 echo cpu=${cpu:=z80} family=${family:=x80}
     27 
     28 rm -f  $$.c target/$family/${cpu}tbl.c
     29 trap "rm -f $$.c" 0 2 3
     30 
     31 awk '!/^$/ {print $1,NR,$2,$3,$4,$5,$6}' target/$family/ops.dat |
     32 sort -k1 -k2n |
     33 LC_ALL=C awk -v cpu=`echo $cpu | tr a-z A-Z` -v family=$family -f mktbl.awk  > $$.c &&
     34 mv $$.c target/$family/${cpu}tbl.c