On 17/03/03 13:20 -0800, Brian Ingerson wrote:
> I am running into some problems though. Like line numbers. It would be
> really handy if they matched my Perl module source file. 

I hereby give myself the "Slow Thinker" award. There is really no reason
to invent some crazy line number hack for Inline. You can just put in a 

    #line 55 "Foo.pm"

line in your C portion and it just works. Of course you'll need to
adjust the number if the code above it shifts, but it's a very easy way
to resolve this deficiency. Why did I never think of this? Are there
others out there who have done this??

Here is an example from a program I'm working on:

    package YAML::Loader::Syck;
    $VERSION = '0.01';
    use strict;

    use Inline C => DATA =>
               LIBS => '-lsyck',
               TYPEMAPS => 'typemap',
               NAME => 'YAML::Loader::Syck',
               VERSION => '0.01';

    __DATA__
    __C__
    #line 13 "Syck.pm"
    #include <syck.h>
    ...

and here is the output:

    /usr/lang/perl/5.8.0/bin/perl
    /usr/lang/perl/5.8.0/lib/5.8.0/ExtUtils/xsubpp  -typemap
    /usr/lang/perl/5.8.0/lib/5.8.0/ExtUtils/typemap -typemap
    /home/ingy/dev/cpan/YAML-Syck/typemap -typemap
    /home/ingy/dev/cpan/YAML-Syck/typemap   Syck.xs > Syck.xsc && mv
    Syck.xsc Syck.c
    cc -c  -I/home/ingy/dev/cpan/YAML-Syck -fno-strict-aliasing
    -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O3
    -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fpic
    "-I/usr/lang/perl/5.8.0/lib/5.8.0/i686-linux/CORE"   Syck.c
    Syck.pm:14: parse error before `...'

Cheers, Brian

Reply via email to