[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER
From: |
Thien-Thi Nguyen |
Subject: |
Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER |
Date: |
Wed, 13 Mar 2002 14:58:06 -0800 |
From: Rob Browning <address@hidden>
Date: Wed, 13 Mar 2002 16:00:33 -0600
Is there any easy way I can get back the 1.5 functionality of a few
months ago (i.e. is your stuff in a good enough state to check in for
even light use, or is there perhaps some temporary hack I can use for
right now?)
I ask because I'm suddenly in a situation where need to use 1.5 with
gnome-guile again, and I'd prefer to use the current source rather
than checking out an older 1.5 -- I'm not positive, but I think
gnome-guile worked with 1.5 as of a month or two ago...
see below for guile-snarf.in snapshot. feedback welcome!
to play, modify Makefile.am to look like:
snarfcppopts = $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
.c.x:
./guile-snarf --compat=1.4 $< $(snarfcppopts)
(this is what i've done locally, except w/o the "--compat=1.4" for HEAD
and branch_release-1-6. WARNING: the old_school_snarf is incomplete.)
thi
____________________________________
#!/bin/sh
# Extract the initialization actions for builtin things.
#
# Copyright (C) 1996, 97, 98, 99, 2000, 2001, 2002 Free Software Foundation,
Inc.
#
# 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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this software; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307 USA
# Commentary:
# Usage: guile-snarf [--compat=1.4] [-o OUTFILE] INFILE [CPP-OPTIONS ...]
#
# Process INFILE using the C pre-processor and some other programs.
# Write output to a file, named OUTFILE if specified, or STEM.x if
# INFILE looks like STEM.c and no OUTFILE is specified. Ignore
# lines from the input matching grep(1) regular expression:
#
# ^#include ".*OUTFILE"
#
# If there are errors during processing, delete OUTFILE and exit with
# non-zero status.
#
# Optional arg "--compat=1.4" means emulate guile-1.4 guile-snarf.
# This option is not fully tested -- see Guile reference manual.
#
# If env var CPP is set, use its value instead of the C pre-processor
# determined at Guile configure-time: "@CPP@".
# Code:
[ x$DEBUG = x1 ] && set -x
old_school_snarf ()
{
$cpp -DSCM_MAGIC_SNARFER "$@" > ${temp} && cpp_status=true
grep "^ *SCM__I" ${temp} | sed -e "s/^ *SCM__I//" -e 's/SCM__D.*$//g'
# TODO TODO TODO: here we need to handle changes like:
# scm_make_gsubr -> scm_c_define_gsubr
# (probably sed is ok)
}
modern_snarf ()
{
$cpp -DSCM_MAGIC_SNARF_INITS "$@" > ${temp} && cpp_status=true
grep "^ *\^ *\^" ${temp} | sed -e "s/^ *\^ *\^//"
}
## main
# process command line
if [ x"$1" = x--help ] ; then
@AWK@ '/^#.Commentary:/,/^#.Code:/' $0 | grep -v Code: \
| sed -e 1,2d -e 's/^. *//g'
exit 0
fi
if [ x"$1" = x--compat=1.4 ]
then snarf=old_school_snarf ; shift
else snarf=modern_snarf
fi
if [ x"$1" = x-o ]
then outfile=$2 ; shift ; shift ; infile=$1 ; shift
else infile=$1 ; shift ; outfile=`basename $infile .c`.x
fi
[ x"$infile" = x ] && { echo $0: No input file ; exit 1 ; }
[ ! -f "$infile" ] && { echo $0: No such file: $infile ; exit 1 ; }
# set vars and handler -- handle CPP override
cpp_status=false
temp="/tmp/snarf.$$"
if [ x"$CPP" = x ] ; then cpp="@CPP@" ; else cpp="$CPP" ; fi
self_blind_regexp='^#include ".*'`basename $outfile`'"'
clean_infile=clean-`basename $infile`
trap "rm -f $temp $clean_infile" 0 1 2 15
# do the snarfing -- output something extra for needy cpp programs (AIX)
{ echo "/* source: $infile */" ;
echo "/* cpp-options: $@ */" ;
grep -v "$self_blind_regexp" $infile > $clean_infile ;
$snarf "$@" $clean_infile ;
} > $outfile
# zonk outfile if errors occurred
if $cpp_status ; then
exit 0
else
rm -f $outfile
exit 1
fi
# guile-snarf ends here
- snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Marius Vollmer, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Rob Browning, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER,
Thien-Thi Nguyen <=
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/13
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Rob Browning, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Marius Vollmer, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Marius Vollmer, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/15
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Marius Vollmer, 2002/03/15
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Thien-Thi Nguyen, 2002/03/14
- Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER, Rob Browning, 2002/03/14