コード例 #1
0
ファイル: eca.c プロジェクト: alexbyk/perl-evo
static ECAslot *eca_init(char *name, ECAtype type, SV *value, SV *check,
                         bool is_ro, SV *inject) {
  dTHX;

  ECAslot *slot = calloc(1, sizeof(ECAslot));
  if (!slot) croak("Can't allocate memory");

  switch (type) {

  case ECA_RELAXED:
    break;
  case ECA_LAZY: // no need to store undef
    if (SvTRUE(value)) slot->value = newSVsv(value);
    break;
  case ECA_DEFAULT:
  case ECA_DEFAULT_CODE:
  case ECA_REQUIRED:
    slot->value = newSVsv(value);
    break;
  default:
    croak("Bad type: %d", type);
    break;
  }

  if (SvTRUE(check)) slot->check = newSVsv(check);
  if (SvTRUE(inject)) slot->inject = newSVsv(inject);
  slot->is_ro = is_ro;
  slot->type = type;
  slot->key = newSVpv_share(name, 0);
  return slot;
}
コード例 #2
0
ファイル: xsutils.c プロジェクト: bulk88/cperl
void
Perl_boot_core_xsutils(pTHX)
{
    SV* xsfile = newSVpv_share(__FILE__, 0);

    /* static internal builtins */
    boot_strict(aTHX_ xsfile);
    boot_attributes(aTHX_ xsfile);

#if 0
    boot_Carp(aTHX_ xsfile);

    /* static_xs: not with miniperl */
    newXS("Exporter::boot_Exporter",	boot_Exporter,	file);
    newXS("XSLoader::boot_XSLoader",	boot_XSLoader,	file);
    boot_Exporter(aTHX_ xsfile);
    boot_XSLoader(aTHX_ xsfile);

    /* shared xs: if as generated external modules only, without .pm */
    newXS("warnings::bootstrap",	XS_warnings_bootstrap,	file);
    newXS("Config::bootstrap",		XS_Config_bootstrap,	file);
    newXS("unicode::bootstrap",		XS_unicode_bootstrap,	file);
    xs_incset(aTHX_ STR_WITH_LEN("warnings.pm"),   xsfile);
    xs_incset(aTHX_ STR_WITH_LEN("Config.pm"),     xsfile);
    xs_incset(aTHX_ STR_WITH_LEN("utf8_heavy.pl"), xsfile);
#endif

#ifdef USE_CPERL
    boot_coretypes(aTHX_ xsfile);
    boot_core_cperl(aTHX);
#endif
}
コード例 #3
0
ファイル: eca.c プロジェクト: alexbyk/perl-evo
static ECAslot *eca_dup(const ECAslot *src) {
  dTHX;
  ECAslot *dup = calloc(1, sizeof(*src));
  if (!dup) croak("can't locate memory");

  dup->key = newSVpv_share(SvPV_nolen(src->key), 0);
  if (src->value) dup->value = newSVsv(src->value);
  if (src->check) dup->check = newSVsv(src->check);
  if (src->inject) dup->inject = newSVsv(src->inject);
  return dup;
}