OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [tags/] [VER_5_3/] [gdb-5.3/] [sim/] [common/] [gentvals.sh] - Diff between revs 1182 and 1765

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 1182 Rev 1765
#!/bin/sh
#!/bin/sh
# Usage: gentvals.sh target type dir files pattern cpp
# Usage: gentvals.sh target type dir files pattern cpp
 
 
target=$1
target=$1
type=$2
type=$2
dir=$3
dir=$3
# FIXME: Would be nice to process #include's in these files.
# FIXME: Would be nice to process #include's in these files.
files=$4
files=$4
pattern=$5
pattern=$5
cpp=$6
cpp=$6
 
 
# FIXME: need trap to remove tmp files.
# FIXME: need trap to remove tmp files.
 
 
rm -f tmpvals.list tmpvals.uniq
rm -f tmpvals.list tmpvals.uniq
for f in $files
for f in $files
do
do
        if test -f $dir/$f ; then
        if test -f $dir/$f ; then
                grep "#define[  ]$pattern" $dir/$f | sed -e "s/^.*#define[      ]\($pattern\)[  ]*\([^  ][^     ]*\).*$/\1/" >> tmpvals.list
                grep "#define[  ]$pattern" $dir/$f | sed -e "s/^.*#define[      ]\($pattern\)[  ]*\([^  ][^     ]*\).*$/\1/" >> tmpvals.list
        fi
        fi
done
done
 
 
sort <tmpvals.list | uniq >tmpvals.uniq
sort <tmpvals.list | uniq >tmpvals.uniq
 
 
rm -f tmpvals.h
rm -f tmpvals.h
for f in $files
for f in $files
do
do
        if test -f $dir/$f ; then
        if test -f $dir/$f ; then
                echo "#include <$f>" >>tmpvals.h
                echo "#include <$f>" >>tmpvals.h
        fi
        fi
done
done
 
 
cat tmpvals.uniq |
cat tmpvals.uniq |
while read sym
while read sym
do
do
        echo "#ifdef $sym" >>tmpvals.h
        echo "#ifdef $sym" >>tmpvals.h
        echo 'DEFVAL { "'$sym'", '$sym ' },' >>tmpvals.h
        echo 'DEFVAL { "'$sym'", '$sym ' },' >>tmpvals.h
        echo "#endif" >>tmpvals.h
        echo "#endif" >>tmpvals.h
done
done
 
 
if test -z "$target"
if test -z "$target"
then
then
        echo "#ifdef ${type}_defs"
        echo "#ifdef ${type}_defs"
else
else
        echo "#ifdef NL_TARGET_$target"
        echo "#ifdef NL_TARGET_$target"
        echo "#ifdef ${type}_defs"
        echo "#ifdef ${type}_defs"
fi
fi
 
 
for f in $files
for f in $files
do
do
        if test -f $dir/$f ; then
        if test -f $dir/$f ; then
                echo "/* from $f */"
                echo "/* from $f */"
        fi
        fi
done
done
 
 
if test -z "$target"
if test -z "$target"
then
then
        echo "/* begin $type target macros */"
        echo "/* begin $type target macros */"
else
else
        echo "/* begin $target $type target macros */"
        echo "/* begin $target $type target macros */"
fi
fi
 
 
$cpp -I$dir tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/  / /'
$cpp -I$dir tmpvals.h | grep DEFVAL | sed -e 's/DEFVAL//' -e 's/  / /'
 
 
if test -z "$target"
if test -z "$target"
then
then
        echo "/* end $type target macros */"
        echo "/* end $type target macros */"
        echo "#endif"
        echo "#endif"
else
else
        echo "/* end $target $type target macros */"
        echo "/* end $target $type target macros */"
        echo "#endif"
        echo "#endif"
        echo "#endif"
        echo "#endif"
fi
fi
 
 
rm -f tmpvals.list tmpvals.uniq tmpvals.h
rm -f tmpvals.list tmpvals.uniq tmpvals.h
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.