B-C

 view release on metacpan or  search on metacpan

ByteLoader/ByteLoader.xs  view on Meta::CPAN

    data.next_out = 0;
    data.datasv = FILTER_DATA(idx);
    /* [perl #86186] Using tell(DATA) within __DATA__ file buffer is broken on Win32:
       Source filters were changed with 5.14 to read DATA in textmode, so \r\n are
       changed to \n on Windows only in our binary data.
     */
#if (PERL_VERSION < 17) && (PERL_VERSION > 7)
    PerlIO_binmode(aTHX_ PL_RSFP, IoTYPE_RDONLY, O_BINARY, 0);
#endif
    data.idx = idx;

    bstate.bs_fdata = &data;
    bstate.bs_obj_list = Null(void**);
    bstate.bs_obj_list_fill = -1;
    bstate.u.bs_sv = Nullsv;
    bstate.bs_iv_overflows = 0;

/* KLUDGE */
    /*  byterun loads incrementally from DATA, jitrun might require the whole
	buffer at once. best via mmap */
    if (byterun(aTHX_ &bstate)
        && (len = SvCUR(data.datasv) - (STRLEN)data.next_out))
    {
	PerlIO_seek(PL_RSFP, -len, SEEK_CUR);
	PL_RSFP = NULL;
    }
    filter_del(byteloader_filter);

    if (PL_in_eval) {
        OP *o;

        PL_eval_start = PL_main_start;

        o = newSVOP(OP_CONST, 0, newSViv(1));
        PL_eval_root = newLISTOP(OP_LINESEQ, 0, PL_main_root, o);
        PL_main_root->op_next = o;
        PL_eval_root = newUNOP(OP_LEAVEEVAL, 0, PL_eval_root);
        o->op_next = PL_eval_root;

        PL_main_root = saveroot;
        PL_main_start = savestart;
    }
    /* Proof for [cperl #75] that newPROG() overwrites our main_start */
#if PERL_VERSION > 21 && defined(DEBUGGING)
    if (DEBUG_t_TEST_ && DEBUG_v_TEST_) {
      op_dump(PL_main_start);
      op_dump(PL_main_start->op_next);
    }
#endif
    return 0;
}

MODULE = ByteLoader		PACKAGE = ByteLoader

PROTOTYPES:	ENABLE

void
import(...)
  PREINIT:
    SV *sv = newSVpvn ("", 0);
  PPCODE:
    if (!sv)
      croak ("Could not allocate ByteLoader buffers");
    filter_add(byteloader_filter, sv);

void
unimport(...)
  PPCODE:
    filter_del(byteloader_filter);


# Local variables:
#   c-indent-level: 4
# End:
# vim: expandtab shiftwidth=4:



( run in 0.311 second using v1.01-cache-2.11-cpan-71847e10f99 )