[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: New way to do XS constants
On Fri, Jan 07, 2000 at 11:56:13AM -0600, Tye McQueen wrote:
> Excerpts from the mail message of Graham Barr:
> ) #ifdef B110
> ) newCONSTSUB(stash,"B110", newSViv(B110));
> ) #else
> ) av_push(export_fail, newSVpv("B110",4));
> ) #endif
> )
> ) So that the import of B110 will fail if it does not exist.
> )
> ) But all of this requires entering long-hand. I think the original
> ) question was to get xsubpp to help out a bit, which I think would
> ) be a good idea.
>
> Okay, so I should modify constants_pm_c.PLX to add code to the
> C<XS(boot_Module__Name)> routine in the generated Name.c?
> Perhaps just a C<#include "constants.h"> with F<constants.h>
> generated by a modified constants_pm_c.PLX [otherwise the
> B<make> dependencies would be too tricky]?
That is what I do in IO-Tty
> I forgot to mention that constants_pm_c.PLX doesn't yet support
> C<#ifdef>ing the constant definitions, but that such support is
> planned. But you need the ability to specify constants that are
> C<enum>s [for example] and so should not be C<#ifdef>ed or where
> the C<#ifdef> [or some other type of C<#if>] uses something other
> than the constant's name.
Yes you need to know when the constant is not a define
> I planned to have a switch for the common cases [no C<#ifdef>s or
> all C<#ifdef>s using the constants' names] and let F<Makefile.PL>
> provide a C<sub MY::const_ifdef> for the tricky cases that mix the
> two or need other C<#if> constructs.
I am not sure what you are saying here
> It'd probably also be a good idea to make this code generation
> easy to do outside of B<make> so rather than writing a C<sub
> MY::const_ifdef> for the tricky case you could decide to just
> generate the code and edit it and then have the F<constants.h>
> distributed with the module [and not regenerated by B<make>].
Sure.
> But I still like a simple F<constants.pm> because these
> alternatives quickly become so opaque, especially with so many
> binary distributions floating around that don't include source
> code.
You lost me again. A binary dist is broken if the constants for the
machine are not the same as the build machine. What's constants.pm for ?
Graham.
- References to:
-
Graham Barr <gbarr@pobox.com>
Tye McQueen <tye@metronet.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]