From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.devel Subject: Re: snarfer guard macro name decision: SCM_MAGIC_SNARFER Date: Wed, 13 Mar 2002 14:58:06 -0800 Sender: guile-devel-admin@gnu.org Message-ID: References: <877kognusb.fsf@zagadka.ping.de> <87henkgmbi.fsf@raven.i.defaultvalue.org> Reply-To: ttn@glug.org NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1016060642 10649 127.0.0.1 (13 Mar 2002 23:04:02 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 13 Mar 2002 23:04:02 +0000 (UTC) Cc: mvo@zagadka.ping.de, guile-devel@gnu.org Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16lHms-0002lf-00 for ; Thu, 14 Mar 2002 00:04:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16lHmJ-0007Zz-00; Wed, 13 Mar 2002 18:03:27 -0500 Original-Received: from ca-crlsbd-u3-c5c-122.crlsca.adelphia.net ([68.64.59.122] helo=giblet) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16lHjz-0007W9-00 for ; Wed, 13 Mar 2002 18:01:03 -0500 Original-Received: from ttn by giblet with local (Exim 3.33 #1 (Debian)) id 16lHh8-000693-00; Wed, 13 Mar 2002 14:58:06 -0800 Original-To: rlb@defaultvalue.org In-Reply-To: <87henkgmbi.fsf@raven.i.defaultvalue.org> (message from Rob Browning on Wed, 13 Mar 2002 16:00:33 -0600) Errors-To: guile-devel-admin@gnu.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.0.5 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Developers list for Guile, the GNU extensibility library List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.devel:29 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:29 From: Rob Browning 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 _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel