#!/bin/sh -
# scwm-doc-snarf
# Copyright (C) 1999, 2000 Ken Pizzini and Greg J. Badros
# Handle snarfs with embedded %/%/ separating the arglist of procedures
# from the rest.
# See scwm-snarf.h for what expands SCWM_PROC macros to what we process here.
# We need to do a couple of regexp search and replaces:
# s/SCM //g
# s/,[ \t]*//g
# s/"(/"'(/g  # add the Scheme quote to the list -- tricky shell quoting below
# AND we need these to only happen *after* the %/%/ marker on the input lines
# so we use two sed's to do it.
test -n "${CPP+set}" || CPP="@CPP@"
${CPP} -DSCM_MAGIC_SNARFER "$@" | tee | @PERL@ -e 'BEGIN {undef $/; $_ = <>} while (m/SCM__D\b\s*(\S+)\s+(".*?")\s+(\d+)\s+(\d+)\s+(\d+)\s*\bSCM__S\b\s*(.*?) \bSCM__E\b/gs) { print "$1, $2, $3, $4, $5, $6\n\n"; }'
