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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [features/] [feature_to_c.sh] - Diff between revs 834 and 842

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

Rev 834 Rev 842
#!/bin/sh
#!/bin/sh
 
 
# Convert text files to compilable C arrays.
# Convert text files to compilable C arrays.
#
#
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#
#
# This file is part of GDB.
# This file is part of GDB.
#
#
# This program is free software; you can redistribute it and/or modify
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# (at your option) any later version.
#
#
# This program is distributed in the hope that it will be useful,
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
output=$1
output=$1
shift
shift
 
 
if test -z "$output" || test -z "$1"; then
if test -z "$output" || test -z "$1"; then
  echo "Usage: $0 OUTPUTFILE INPUTFILE..."
  echo "Usage: $0 OUTPUTFILE INPUTFILE..."
  exit 1
  exit 1
fi
fi
 
 
if test -e "$output"; then
if test -e "$output"; then
  echo "Output file \"$output\" already exists; refusing to overwrite."
  echo "Output file \"$output\" already exists; refusing to overwrite."
  exit 1
  exit 1
fi
fi
 
 
for input; do
for input; do
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
 
 
  ${AWK:-awk} 'BEGIN { n = 0
  ${AWK:-awk} 'BEGIN { n = 0
      print "static const char '$arrayname'[] = {"
      print "static const char '$arrayname'[] = {"
      for (i = 0; i < 255; i++)
      for (i = 0; i < 255; i++)
        _ord_[sprintf("%c", i)] = i
        _ord_[sprintf("%c", i)] = i
    } {
    } {
      split($0, line, "");
      split($0, line, "");
      printf "  "
      printf "  "
      for (i = 1; i <= length($0); i++) {
      for (i = 1; i <= length($0); i++) {
        c = line[i]
        c = line[i]
        if (c == "'\''") {
        if (c == "'\''") {
          printf "'\''\\'\'''\'', "
          printf "'\''\\'\'''\'', "
        } else if (c == "\\") {
        } else if (c == "\\") {
          printf "'\''\\\\'\'', "
          printf "'\''\\\\'\'', "
        } else if (_ord_[c] >= 32 && _ord_[c] < 127) {
        } else if (_ord_[c] >= 32 && _ord_[c] < 127) {
          printf "'\''%s'\'', ", c
          printf "'\''%s'\'', ", c
        } else {
        } else {
          printf "'\''\\%03o'\'', ", _ord_[c]
          printf "'\''\\%03o'\'', ", _ord_[c]
        }
        }
        if (i % 10 == 0)
        if (i % 10 == 0)
          printf "\n   "
          printf "\n   "
      }
      }
      printf "'\''\\n'\'', \n"
      printf "'\''\\n'\'', \n"
    } END {
    } END {
      print "  0 };"
      print "  0 };"
    }' < $input >> $output
    }' < $input >> $output
done
done
 
 
echo >> $output
echo >> $output
echo "const char *const xml_builtin[][2] = {" >> $output
echo "const char *const xml_builtin[][2] = {" >> $output
 
 
for input; do
for input; do
  basename=`echo $input | sed 's,.*/,,'`
  basename=`echo $input | sed 's,.*/,,'`
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
  arrayname=xml_feature_`echo $input | sed 's,.*/,,; s/[-.]/_/g'`
  echo "  { \"$basename\", $arrayname }," >> $output
  echo "  { \"$basename\", $arrayname }," >> $output
done
done
 
 
echo "  { 0, 0 }" >> $output
echo "  { 0, 0 }" >> $output
echo "};" >> $output
echo "};" >> $output
 
 

powered by: WebSVN 2.1.0

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