/[guile]/guile/guile-core/libguile/guile-snarf.in
ViewVC logotype

Diff of /guile/guile-core/libguile/guile-snarf.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by mvo, Thu Mar 14 22:21:53 2002 UTC revision 1.17 by ttn, Fri Mar 15 14:00:02 2002 UTC
# Line 20  Line 20 
20    
21  # Commentary:  # Commentary:
22    
23  # Usage: guile-snarf [--compat=1.4] [-o OUTFILE] INFILE [CPP-OPTIONS ...]  # Usage: guile-snarf [-d | -D] [-o OUTFILE] INFILE [CPP-OPTIONS ...]
24  #  #
25  # Process INFILE using the C pre-processor and some other programs.  # Process INFILE using the C pre-processor and some other programs.
26  # Write output to a file, named OUTFILE if specified, or STEM.x if  # Write output to a file, named OUTFILE if specified, or STEM.x if
# Line 32  Line 32 
32  # If there are errors during processing, delete OUTFILE and exit with  # If there are errors during processing, delete OUTFILE and exit with
33  # non-zero status.  # non-zero status.
34  #  #
35  # Optional arg "--compat=1.4" means emulate guile-1.4 guile-snarf.  # Optional arg "-d" means grep INFILE for deprecated macros and
36  # This option is easily misunderstood -- see Guile reference manual.  # issue a warning if any are found.  Alternatively, "-D" means
37    # do the same thing but signal error and exit w/ non-zero status.
38  #  #
39  # If env var CPP is set, use its value instead of the C pre-processor  # If env var CPP is set, use its value instead of the C pre-processor
40  # determined at Guile configure-time: "@CPP@".  # determined at Guile configure-time: "@CPP@".
41    
42  # Code:  # Code:
43    
44    ## config
45    
46    deprecated_list="
47     SCM_CONST_LONG
48     SCM_VCELL
49     SCM_VCELL_INIT
50     SCM_GLOBAL_VCELL
51     SCM_GLOBAL_VCELL_INIT
52    "
53    
54  ## funcs  ## funcs
55    
56  modern_snarf ()                         # writes stdout  modern_snarf ()                         # writes stdout
# Line 48  ${cpp} -DSCM_MAGIC_SNARF_INITS "$@" > ${ Line 59  ${cpp} -DSCM_MAGIC_SNARF_INITS "$@" > ${
59  grep "^ *\^ *\^" ${temp} | sed -e "s/^ *\^ *\^//" -e "s/\^\ *:\ *\^.*/;/"  grep "^ *\^ *\^" ${temp} | sed -e "s/^ *\^ *\^//" -e "s/\^\ *:\ *\^.*/;/"
60  }  }
61    
62  compat_mode_clean_xxx ()                # modifies $1  grep_deprecated ()                      # $1 is the filename
63  {  {
64  filename=$1  regexp="(^greetings!spooks!hows!life)"
65  cp $filename ${temp}  for dep in `echo $deprecated_list` ; do
66  sed -e 's/SCM_CONST_LONG/SCM_GLOBAL_VCELL_INIT/g' \      regexp="(^${dep}[^_A-Z])|${regexp}"
67      -e 's/SCM_GLOBAL_VCELL_INIT/SCM_GLOBAL_VARIABLE_INIT/g' \  done
68      -e 's/SCM_GLOBAL_VCELL/SCM_GLOBAL_VARIABLE/g' \  echo $regexp
69      -e 's/SCM_VCELL_INIT/SCM_VARIABLE_INIT/g' \  egrep -n ${regexp} $1 /dev/null > ${temp}
70      -e 's/SCM_VCELL/SCM_VARIABLE/g' \  if [ -s ${temp} ] ; then
71      < ${temp} \      if $grep_dep_exit_p ; then hey=ERROR ; else hey=WARNING ; fi
72      > $filename      echo $0: $hey: deprecated macros found:
73        sed -e 's/.clean.c:/:/g' ${temp}
74        $grep_dep_exit_p && exit 1
75    fi
76  }  }
77    
78  ## main  ## main
# Line 69  if [ x"$1" = x--help ] ; then Line 83  if [ x"$1" = x--help ] ; then
83          | sed -e 1,2d -e 's/^. *//g'          | sed -e 1,2d -e 's/^. *//g'
84      exit 0      exit 0
85  fi  fi
86  if [ x"$1" = x--compat=1.4 ]  case x"$1" in x-d) grep_dep_p=true ; grep_dep_exit_p=false ; shift ;;
87      then compat_mode_p=true ; shift                x-D) grep_dep_p=true ; grep_dep_exit_p=true  ; shift ;;
88      else compat_mode_p=false                *)   grep_dep_p=false                                ;;
89  fi  esac
90  if [ x"$1" = x-o ]  if [ x"$1" = x-o ]
91      then outfile=$2 ; shift ; shift ; infile=$1 ; shift      then outfile=$2 ; shift ; shift ; infile=$1 ; shift
92      else infile=$1 ; shift ; outfile=`basename $infile .c`.x      else infile=$1 ; shift ; outfile=`basename $infile .c`.x
# Line 94  trap "rm -f $temp $clean_infile" 0 1 2 1 Line 108  trap "rm -f $temp $clean_infile" 0 1 2 1
108    
109  # clean input file  # clean input file
110  grep -v "$self_blind_regexp" $infile > $clean_infile  grep -v "$self_blind_regexp" $infile > $clean_infile
111  $compat_mode_p && compat_mode_clean_xxx $clean_infile  
112    # grep deprecated
113    $grep_dep_p && grep_deprecated $clean_infile
114    
115  # do the snarfing -- output something extra for needy cpp programs (AIX)  # do the snarfing -- output something extra for needy cpp programs (AIX)
116  { echo "/* source: $infile */" ;  { echo "/* source: $infile */" ;

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26