Billy et. al. -
>From the perlxs manpage:
The function name and the return type must be placed on
separate lines and should be flush left-adjusted.
So it is interpreting warn("1") as the return type of a new function, and
then looking to the next line for a function name. It barfs because the
function name ("if (rname)") is not flush with the left column.
In short: all the code within a single XSUB needs to be indented.
: : : J. David Lowe :: [EMAIL PROTECTED] :: http://pootpoot.com : : :
: "When you are a Bear of Very Little Brain, and you Think of :
: Things, you sometimes find that a Thing which seemed very :
: Thingish inside you is quite different when it gets out into :
: the open and has other people looking at it." :
: - Pooh, in /House at Pooh Corner/ by A.A. Milne :
:: fingerprint: 79 1D 66 9F 35 A1 2D ED 81 98 26 E1 F8 D5 3F 29 ::
On Thu, 1 Feb 2001, Billy Patton wrote:
> Using perl5.005 on solaris7 SUN
> Can someone please explain why this fails with the following error :
> Error: Cannot parse function definition from ' if (rname)' in Laff.xs,
> line 2609
>
> CODE:
> {
> prel_p p;
> AV *idav;
> int i,nids=0,rel=0,ids[4096];
>
> warn("1");
> if (rname)
> rel = (!strcmp(rname,"EQUIPOT")) ? lEQUIPOT
> : (!strcmp(rname,"EQUIV")) ? lEQUIV
> : (!strcmp(rname,"UNDEF")) ? lUNDEF
> : 0;
>
> but this works : the warn is now indented :
>
> CODE:
> {
> prel_p p;
> AV *idav;
> int i,nids=0,rel=0,ids[4096];
>
> warn("1");
> if (rname)
> rel = (!strcmp(rname,"EQUIPOT")) ? lEQUIPOT
> : (!strcmp(rname,"EQUIV")) ? lEQUIV
> : (!strcmp(rname,"UNDEF")) ? lUNDEF
> : 0;
>
> --
> =========+=========+=========+=========+=========+=========+=========+
> ___ _ ____ ___ __ __
> / _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
> / _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
> /____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
> /___/
> Texas Instruments ASIC Circuit Design Methology Group
> Dallas, Texas
> 214-480-4455
> [EMAIL PROTECTED]
> =========+=========+=========+=========+=========+=========+=========+
>