new_table is now in /util/data, not /etc.

This commit is contained in:
dtrg 2007-02-25 12:49:04 +00:00
parent 903796a817
commit 0f16e7540d
2 changed files with 82 additions and 3 deletions

75
util/data/new_table Executable file
View file

@ -0,0 +1,75 @@
#!/bin/sh
em_table=$1
h=${2-.}
d=${3-.}
set `grep fpseu $em_table`
p=$2
set `grep fmnem $em_table`
m=$2
ed - $em_table <<'A' > X
1,/^$/g/ /s// /gp
A
ed - $em_table <<'A' | awk '{$2=$2+'$p'; print}' > Y
1,/^$/d
1,/^$/g/ /s// /gp
A
ed - $em_table <<'A' | awk '{print $0,'$m'+i++}' > Z
1,/^$/d
1,/^$/d
1,/^$/g/ /s// /gp
A
i=`wc -l <Y`
echo 'lpseu' `expr $i + $p - 1` >>X
i=`wc -l <Z`
echo 'lmnem' `expr $i + $m - 1` >>X
ed - X <<'A' > $h/em_spec.h
g/^/s//#define sp_/p
A
ed - Y <<'A' > $h/em_pseu.h
g/ \(.*\) .*/s// \1/
g/\(.*\) \(.*\)/s//#define ps_\1 \2/p
A
ed - Z <<'A' > $h/em_mnem.h
g/ .* /s// /
g/\(.*\) \(.*\)/s//#define op_\1 \2/p
A
(
echo 'char em_pseu[][4] = {'
ed - Y <<'A'
g/\(...\).*/s// "\1",/p
A
echo '};'
) > $d/em_pseu.c
(
echo 'char em_mnem[][4] = {'
ed - Z <<'A'
g/\(...\).*/s// "\1",/p
A
echo '};'
) > $d/em_mnem.c
(
echo '#include <em_flag.h>
char em_flag[] = {'
ed - Z <<'A' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
g/^... /s///
g/ .*/s///
g/\(.\)\(.\)/s//PAR_\1 | FLO_\2/
g/-/s//NO/g
g/.*/s// &,/p
A
echo '};'
) > $d/em_flag.c
rm X Y Z

View file

@ -14,7 +14,7 @@ local datafiles = simple {
},
command = {
"cd %ROOTDIR%etc && ./new_table %out[1]:dirname% %out[1]:dirname%"
"%in[1]% %in[2]% %out[1]:dirname% %out[1]:dirname%"
},
install = {
@ -23,7 +23,8 @@ local datafiles = simple {
pm.install("%U%/em_mnem.h", "%HEADERDIR%em_mnem.h")
},
file "%ROOTDIR%etc/new_table",
file (d.."new_table"),
file ("%ROOTDIR%h/em_table"),
}
local cfile_with_headers = cfile {
@ -48,6 +49,9 @@ lib_em_data = file "%LIBDIR%libem_data.a"
-- Revision history
-- $Log$
-- Revision 1.1 2006-07-20 23:24:28 dtrg
-- Revision 1.2 2007-02-25 12:49:04 dtrg
-- new_table is now in /util/data, not /etc.
--
-- Revision 1.1 2006/07/20 23:24:28 dtrg
-- First version in CVS.
--