ByteLoader.xs revision 7c478bd95313f5f23a4c958a745db2134aa03244
#define PERL_NO_GET_CONTEXT
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "byterun.h"
/* Something arbitary for a buffer size */
#define BYTELOADER_BUFFER 8096
int
{
dTHX;
int result;
/* Run out of buffered data, so attempt to read some more */
/* Filter returned error, or we got EOF and no data, then return EOF.
Not sure if filter is allowed to return EOF and add data simultaneously
Think not, but will bullet proof against it. */
return EOF;
/* Else there must be at least one byte present, which is good enough */
}
}
int
{
dTHX;
char *start;
int result;
/* Shuffle data to start of buffer */
if (len) {
} else {
}
/* Attempt to read more data. */
do {
/* Loop while not (EOF || error) and short reads */
/* If not enough data read, truncate copy */
}
if (wanted > 0) {
}
return (int) wanted;
}
static I32
{
struct byteloader_state bstate;
struct byteloader_fdata data;
bstate.bs_iv_overflows = 0;
if (PL_in_eval) {
OP *o;
PL_main_root->op_next = o;
o->op_next = PL_eval_root;
}
return 0;
}
void
import(...)
if (!sv)
croak ("Could not allocate ByteLoader buffers");
void
unimport(...)