view release on metacpan or search on metacpan
# damn, POSIX doesn't include S_ISLNK!
void
S_ISDIR(mode)
int mode
PPCODE:
RETURN_BOOL (S_ISDIR (mode));
void
S_ISREG(mode)
int mode
PPCODE:
RETURN_BOOL (S_ISREG (mode));
void
S_ISLNK(mode)
int mode
PPCODE:
RETURN_BOOL (S_ISLNK (mode));
void
S_IFMT()
PPCODE:
XSRETURN_IV (S_IFMT);
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Inline/C.pm view on Meta::CPAN
if ($o->{CONFIG}{_TESTING}) {
$XS .= <<END;
PREINIT:
PerlIO* stream;
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
$function($arg_name_list);
stream = PerlIO_open(\"$dir/void_test\", \"a\");
if (stream == NULL) warn(\"%s\\n\", \"Unable to open $dir/void_test for appending\");
if (PL_markstack_ptr != temp) {
inc/Inline/C.pm view on Meta::CPAN
}
else {
$XS .= <<END;
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
$function($arg_name_list);
if (PL_markstack_ptr != temp) {
/* truly void, because dXSARGS not invoked */
PL_markstack_ptr = temp;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Devel/PatchPerl/Plugin/Asan.pm view on Meta::CPAN
+KEY(hek)
+ B::HEK hek
+ ALIAS:
+ LEN = 1
+ FLAGS = 2
+ PPCODE:
+ SV *pv;
+ switch (ix) {
+ case 0:
+ pv = newSVpvn(HEK_KEY(hek), HEK_LEN(hek));
+ if (HEK_UTF8(hek)) SvUTF8_on(pv);
view all matches for this distribution
view release on metacpan or search on metacpan
ByteBoozer.xs view on Meta::CPAN
# my $data = bb_data($file);
void
bb_data(file)
File *file
PPCODE:
# Push string (PV) with data on the stack and mortalize it:
SV *fileData = sv_2mortal(newSVpv((const char *)file->data, file->size));
XPUSHs(fileData);
# my $size = bb_size($file);
void
bb_size(file)
File *file
PPCODE:
# Push unsigned integer (UV) with size on the stack and mortalize it:
SV *fileSize = sv_2mortal(newSVuv(file->size));
XPUSHs(fileSize);
# bb_free($source, $target);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Extract/Libarchive.xs view on Meta::CPAN
}
MODULE = Archive::Extract::Libarchive PACKAGE = Archive::Extract::Libarchive
void _extract(const char * filename, const char * path)
PPCODE:
struct archive *a;
struct archive *ext;
struct archive_entry *entry;
SV *path_sv;
int r;
view all matches for this distribution
view release on metacpan or search on metacpan
Libarchive.xs view on Meta::CPAN
}
MODULE = Archive::Peek::Libarchive PACKAGE = Archive::Peek::Libarchive
void _files(const char * filename)
PPCODE:
struct archive *a;
struct archive_entry *entry;
int r;
a = _open_file(filename);
Libarchive.xs view on Meta::CPAN
}
}
_close_file(a);
void _file(const char * archivename, const char * filename)
PPCODE:
struct archive *a;
struct archive_entry *entry;
int r;
const void *buffer;
size_t size;
view all matches for this distribution
view release on metacpan or search on metacpan
xs/Entry.xs view on Meta::CPAN
void
is_data_encrypted (self)
Entry self
PPCODE:
#if ARCHIVE_VERSION_NUMBER >= 3002000
if (archive_entry_is_data_encrypted (self->e))
XSRETURN_YES;
#else
croak ("this feature requires libarchive 3.2+");
xs/Entry.xs view on Meta::CPAN
void
is_metadata_encrypted (self)
Entry self
PPCODE:
#if ARCHIVE_VERSION_NUMBER >= 3002000
if (archive_entry_is_metadata_encrypted (self->e))
XSRETURN_YES;
#else
croak ("this feature requires libarchive 3.2+");
xs/Entry.xs view on Meta::CPAN
void
is_encrypted (self)
Entry self
PPCODE:
#if ARCHIVE_VERSION_NUMBER >= 3002000
if (archive_entry_is_encrypted (self->e))
XSRETURN_YES;
#else
croak ("this feature requires libarchive 3.2+");
xs/Entry.xs view on Meta::CPAN
void
ctime_is_set (self)
Entry self
PPCODE:
if (archive_entry_ctime_is_set (self->e))
XSRETURN_YES;
XSRETURN_NO;
void
mtime_is_set (self)
Entry self
PPCODE:
if (archive_entry_mtime_is_set (self->e))
XSRETURN_YES;
XSRETURN_NO;
void
size_is_set (self)
Entry self
PPCODE:
if (archive_entry_size_is_set (self->e))
XSRETURN_YES;
XSRETURN_NO;
view all matches for this distribution
view release on metacpan or search on metacpan
void
new(class, self)
char *class
SV *self
PPCODE:
Arcus_API *arcus = NULL;
if (SvROK(self) && SvTYPE(SvRV(self)) == SVt_PVHV) {
EXTEND(SP, 1);
Newx(arcus, 1, Arcus_API);
arcus->global = memcached_create(NULL);
append_multi = ARCUS_APPEND
prepend_multi = ARCUS_PREPEND
PREINIT:
size_t finished = 0;
size_t arg = 1;
PPCODE:
memcached_return_t ret;
memcached_storage_request_st req[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
memcached_return_t results[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
int req_index[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
SV **result_buf;
cas_multi(arcus, ...)
Arcus_API *arcus
PREINIT:
size_t finished = 0;
size_t arg = 1;
PPCODE:
memcached_return_t ret;
memcached_storage_request_st req[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
memcached_return_t results[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
int req_index[MAX_KEYS_FOR_MULTI_STORE_OPERATION];
SV **result_buf;
Arcus_API *arcus
SV *key
ALIAS:
get = ARCUS_GET
gets = ARCUS_GETS
PPCODE:
memcached_return_t ret;
size_t key_length = 0;
char *key_ptr = NULL;
size_t value_length;
char *value;
view all matches for this distribution
view release on metacpan or search on metacpan
Override.xs view on Meta::CPAN
SV *sv
PROTOTYPE: \[@%]
PREINIT:
int i;
AV *av;
PPCODE:
if (!SvROK(sv))
croak("Argument to Array::Each::Override::array_each must be a reference");
sv = SvRV(sv);
if (SvTYPE(sv) == SVt_PVHV) {
HV *hv = (HV *) sv;
Override.xs view on Meta::CPAN
SV *sv
PROTOTYPE: \[@%]
PREINIT:
int i;
AV *av;
PPCODE:
if (!SvROK(sv))
croak("Argument to Array::Each::Override::array_keys must be a reference");
sv = SvRV(sv);
if (SvTYPE(sv) == SVt_PVHV) {
HV *hv = (HV *) sv;
Override.xs view on Meta::CPAN
SV *sv
PROTOTYPE: \[@%]
PREINIT:
int i;
AV *av;
PPCODE:
if (!SvROK(sv))
croak("Argument to Array::Each::Override::array_values must be a reference");
sv = SvRV(sv);
if (SvTYPE(sv) == SVt_PVHV) {
HV *const hv = (HV *) sv;
view all matches for this distribution
view release on metacpan or search on metacpan
SV *sv
int howmany
PREINIT:
int i, j, len;
AV *av;
PPCODE:
if (howmany == 0)
XSRETURN_EMPTY;
if (howmany < 0)
croak("Second argument must be a positive integer");
if (!SvROK(sv))
void
reset(sv,...)
SV *sv
PROTOTYPE: \@;$
PPCODE:
if (!SvROK(sv))
croak("Argument to Array::Slice::reset must be a reference");
sv = SvRV(sv);
if (SvTYPE(sv) != SVt_PVAV)
croak("Argument to Array::Slice::reset must be an array reference");
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Array/Splice.xs view on Meta::CPAN
I32 diff;
SV **tmparyval = 0;
MAGIC *mg;
register SV **src;
register SV **dst;
PPCODE:
if ( !SvROK(array) || SvTYPE(SvRV(array)) != SVt_PVAV ) {
croak("first argument to Array::Splice::_splice() not an array");
}
ary = (AV*) SvRV(array);
view all matches for this distribution
view release on metacpan or search on metacpan
* CFITSIO.xs: Added fits_get_img_equivtype, fits_get_eqcoltype
2003-06-04 Diab Jerius <djerius@cfa.harvard.edu>
* CFITSIO.xs: open_file() wasn't handling the possible magic
of status correctly (it's in a PPCODE block which doesn't
automatically do that for you).
2003-01-06 Diab Jerius <djerius@cfa.harvard.edu>
* CFITSIO.xs: forgot to initialize status to 0 in DESTROY.
view all matches for this distribution
view release on metacpan or search on metacpan
buildtools/makeNovaClass.pl view on Meta::CPAN
void
set_$field( self, val )
$name* self
$type val
PPCODE:
self->$field = val;
HERE
}
else {
my $field_class = $structs_hash->{$type}{package};
buildtools/makeNovaClass.pl view on Meta::CPAN
void
set_$field( self, val )
$name* self
$type* val
PPCODE:
Copy(val, &(self->$field), 1, $type);
HERE
}
}
return join("\n\n", @code)."\n";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/PAL.xs view on Meta::CPAN
double dm
double eq
PREINIT:
double rc;
double dc;
PPCODE:
palAddet(rm, dm, eq, &rc, &dc);
XPUSHs(sv_2mortal(newSVnv(rc)));
XPUSHs(sv_2mortal(newSVnv(dc)));
double
lib/Astro/PAL.xs view on Meta::CPAN
double eld;
double eldd;
double pa;
double pad;
double padd;
PPCODE:
palAltaz(ha, dec, phi, &az, &azd, &azdd, &el, &eld, &eldd, &pa, &pad, &padd);
XPUSHs(sv_2mortal(newSVnv(az)));
XPUSHs(sv_2mortal(newSVnv(azd)));
XPUSHs(sv_2mortal(newSVnv(azdd)));
XPUSHs(sv_2mortal(newSVnv(el)));
lib/Astro/PAL.xs view on Meta::CPAN
double date
double eq
PREINIT:
double rm;
double dm;
PPCODE:
palAmp(ra, da, date, eq, &rm, &dm);
XPUSHs(sv_2mortal(newSVnv(rm)));
XPUSHs(sv_2mortal(newSVnv(dm)));
lib/Astro/PAL.xs view on Meta::CPAN
double da
double * amprms
PREINIT:
double rm;
double dm;
PPCODE:
palAmpqk(ra, da, amprms, &rm, &dm);
XPUSHs(sv_2mortal(newSVnv(rm)));
XPUSHs(sv_2mortal(newSVnv(dm)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double aob;
double zob;
double hob;
double dob;
double rob;
PPCODE:
palAop(rap,dap,date,dut,elongm,phim,hm,xp,yp,tdk,pmb,rh,wl,tlr,&aob,&zob,&hob,&dob,&rob);
XPUSHs(sv_2mortal(newSVnv(aob)));
XPUSHs(sv_2mortal(newSVnv(zob)));
XPUSHs(sv_2mortal(newSVnv(hob)));
XPUSHs(sv_2mortal(newSVnv(dob)));
lib/Astro/PAL.xs view on Meta::CPAN
double wl
double tlr
PREINIT:
double aoprms[14];
int i;
PPCODE:
palAoppa(date,dut,elongm,phim,hm,xp,yp,tdk,pmb,rh,wl,tlr,aoprms);
RETVEC( aoprms, 14, nv );
# Documented to update element 13 of AOPRMS by using
# the information in element 12. To make things easy in the XS
lib/Astro/PAL.xs view on Meta::CPAN
double date
double elem12
PREINIT:
double aoprms[14];
int i;
PPCODE:
aoprms[12] = elem12;
palAoppat(date, aoprms);
XPUSHs(sv_2mortal(newSVnv(aoprms[13])));
void
lib/Astro/PAL.xs view on Meta::CPAN
double aob;
double zob;
double hob;
double dob;
double rob;
PPCODE:
palAopqk(rap, dap, aoprms, &aob,&zob,&hob,&dob,&rob);
XPUSHs(sv_2mortal(newSVnv(aob)));
XPUSHs(sv_2mortal(newSVnv(zob)));
XPUSHs(sv_2mortal(newSVnv(hob)));
XPUSHs(sv_2mortal(newSVnv(dob)));
lib/Astro/PAL.xs view on Meta::CPAN
double b1
double wl2
PREINIT:
double a2;
double b2;
PPCODE:
palAtmdsp(tdk, pmb, rh, wl1, a1, b1, wl2, &a2, &b2);
XPUSHs(sv_2mortal(newSVnv(a2)));
XPUSHs(sv_2mortal(newSVnv(b2)));
void
lib/Astro/PAL.xs view on Meta::CPAN
int im
int id
PREINIT:
double djm;
int j;
PPCODE:
palCaldj(iy, im, id, &djm, &j);
XPUSHs(sv_2mortal(newSVnv(djm)));
XPUSHs(sv_2mortal(newSViv(j)));
void
lib/Astro/PAL.xs view on Meta::CPAN
int im
int id
PREINIT:
double djm;
int status;
PPCODE:
palCldj(iy, im, id, &djm, &status);
XPUSHs(sv_2mortal(newSVnv(djm)));
XPUSHs(sv_2mortal(newSViv(status)));
void
lib/Astro/PAL.xs view on Meta::CPAN
int iamin
double asec
PREINIT:
double rad;
int j;
PPCODE:
palDaf2r(ideg, iamin, asec, &rad, &j);
XPUSHs(sv_2mortal(newSVnv(rad)));
XPUSHs(sv_2mortal(newSViv(j)));
# Note that nstrt is given but also returned
lib/Astro/PAL.xs view on Meta::CPAN
char * string
int nstrt
PREINIT:
double dreslt;
int jf;
PPCODE:
palDafin(string, &nstrt, &dreslt, &jf);
XPUSHs(sv_2mortal(newSViv(nstrt)));
XPUSHs(sv_2mortal(newSVnv(dreslt)));
XPUSHs(sv_2mortal(newSViv(jf)));
lib/Astro/PAL.xs view on Meta::CPAN
palDav2m(axvec)
double * axvec
PREINIT:
int i,j;
double rmat[3][3];
PPCODE:
palDav2m(axvec, rmat);
RETMATRIX(rmat);
double
palDbear(a1, b1, a2, b2)
lib/Astro/PAL.xs view on Meta::CPAN
palDcc2s(v)
double * v
PREINIT:
double a;
double b;
PPCODE:
palDcc2s(v, &a, &b);
XPUSHs(sv_2mortal(newSVnv(a)));
XPUSHs(sv_2mortal(newSVnv(b)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double yz;
double xs;
double ys;
double perp;
double orient;
PPCODE:
palDcmpf(coeffs, &xz, &yz, &xs, &ys, &perp, &orient);
XPUSHs(sv_2mortal(newSVnv(xz)));
XPUSHs(sv_2mortal(newSVnv(yz)));
XPUSHs(sv_2mortal(newSVnv(xs)));
XPUSHs(sv_2mortal(newSVnv(ys)));
lib/Astro/PAL.xs view on Meta::CPAN
palDcs2c(a, b)
double a
double b
PREINIT:
double v[3];
PPCODE:
palDcs2c(a, b, v);
RETVEC( v, 3, nv );
# Converts decimal day to hours minutes and seconds
lib/Astro/PAL.xs view on Meta::CPAN
int ndp
double days
PREINIT:
char sign;
int ihmsf[4];
PPCODE:
palDd2tf(ndp, days, &sign, ihmsf);
XPUSHs(sv_2mortal(newSVpvn(&sign, 1)));
RETVEC( ihmsf, 4, iv );
# Equatorial to horizontal
lib/Astro/PAL.xs view on Meta::CPAN
double dec
double phi
PREINIT:
double az;
double el;
PPCODE:
palDe2h(ha, dec, phi, &az, &el);
XPUSHs(sv_2mortal(newSVnv(az)));
XPUSHs(sv_2mortal(newSVnv(el)));
# Returns 9 elements directly on stack
lib/Astro/PAL.xs view on Meta::CPAN
double phi
double theta
double psi
PREINIT:
double rmat[3][3];
PPCODE:
palDeuler(order, phi, theta, psi, rmat);
RETMATRIX(rmat);
# Note that nstrt is given and then returned on the stack
lib/Astro/PAL.xs view on Meta::CPAN
char * string
int nstrt
PREINIT:
double dreslt;
int jflag;
PPCODE:
palDfltin(string, &nstrt, &dreslt, &jflag);
XPUSHs(sv_2mortal(newSViv(nstrt)));
XPUSHs(sv_2mortal(newSVnv(dreslt)));
XPUSHs(sv_2mortal(newSViv(jflag)));
lib/Astro/PAL.xs view on Meta::CPAN
double el
double phi
PREINIT:
double ha;
double dec;
PPCODE:
palDh2e(az, el, phi, &ha, &dec);
XPUSHs(sv_2mortal(newSVnv(ha)));
XPUSHs(sv_2mortal(newSVnv(dec)));
# Returned 3-vector on stack
lib/Astro/PAL.xs view on Meta::CPAN
double * va
PREINIT:
double vb[3];
double rmat[3][3];
int i;
PPCODE:
VECTOMAT( dm, rmat );
palDimxv(rmat, va, vb);
RETVEC( vb, 3, nv );
# Note that we return j on the stack first
lib/Astro/PAL.xs view on Meta::CPAN
int ndp
double djm
PREINIT:
int iymdf[4];
int j;
PPCODE:
palDjcal(ndp, djm, iymdf, &j);
XPUSHs(sv_2mortal(newSViv(j)));
RETVEC(iymdf, 4, iv);
# MJD to UT
lib/Astro/PAL.xs view on Meta::CPAN
int iy;
int im;
int id;
double fd;
int j;
PPCODE:
palDjcl(mjd, &iy, &im, &id, &fd, &j);
XPUSHs(sv_2mortal(newSViv(iy)));
XPUSHs(sv_2mortal(newSViv(im)));
XPUSHs(sv_2mortal(newSViv(id)));
XPUSHs(sv_2mortal(newSVnv(fd)));
lib/Astro/PAL.xs view on Meta::CPAN
palDm2av(rmatv)
double * rmatv
PREINIT:
double rmat[3][3];
double axvec[3];
PPCODE:
VECTOMAT( rmatv, rmat );
palDm2av( rmat, axvec);
RETVEC( axvec, 3, nv );
lib/Astro/PAL.xs view on Meta::CPAN
void
palDmoon(date)
double date
PREINIT:
double pv[6];
PPCODE:
palDmoon(date, pv);
RETVEC( pv, 6, nv );
#### FLAG : Matrix manipulation should be using PDLs
lib/Astro/PAL.xs view on Meta::CPAN
double * b
PREINIT:
double amat[3][3];
double bmat[3][3];
double cmat[3][3];
PPCODE:
VECTOMAT( a, amat );
VECTOMAT( b, bmat );
palDmxm(amat,bmat,cmat);
RETMATRIX(cmat);
lib/Astro/PAL.xs view on Meta::CPAN
double * dm
double * va
PREINIT:
double dmat[3][3];
double vb[3];
PPCODE:
VECTOMAT( dm, dmat );
palDmxv(dmat, va, vb);
RETVEC( vb, 3, nv );
double
lib/Astro/PAL.xs view on Meta::CPAN
int ndp
double angle
PREINIT:
char sign;
int idmsf[4];
PPCODE:
palDr2af(ndp, angle, &sign, idmsf);
XPUSHs(sv_2mortal(newSVpvn(&sign, 1)));
RETVEC( idmsf, 4, iv );
# Converts radians to HMS
lib/Astro/PAL.xs view on Meta::CPAN
int ndp
double angle
PREINIT:
char sign;
int ihmsf[4];
PPCODE:
palDr2tf(ndp, angle, &sign, ihmsf);
XPUSHs(sv_2mortal(newSVpvn(&sign, 1)));
RETVEC( ihmsf, 4, iv );
double
lib/Astro/PAL.xs view on Meta::CPAN
double decz
PREINIT:
double xi;
double eta;
int j;
PPCODE:
palDs2tp(ra, dec, raz, decz, &xi, &eta, &j);
XPUSHs(sv_2mortal(newSVnv(xi)));
XPUSHs(sv_2mortal(newSVnv(eta)));
XPUSHs(sv_2mortal(newSViv(j)));
lib/Astro/PAL.xs view on Meta::CPAN
int imin
double sec
PREINIT:
double days;
int j;
PPCODE:
palDtf2d(ihour, imin, sec, &days, &j);
XPUSHs(sv_2mortal(newSVnv(days)));
XPUSHs(sv_2mortal(newSViv(j)));
# Converts HMS to radians
lib/Astro/PAL.xs view on Meta::CPAN
int imin
double sec
PREINIT:
double rad;
int j;
PPCODE:
palDtf2r(ihour, imin, sec, &rad, &j);
XPUSHs(sv_2mortal(newSVnv(rad)));
XPUSHs(sv_2mortal(newSViv(j)));
lib/Astro/PAL.xs view on Meta::CPAN
double raz
double decz
PREINIT:
double ra;
double dec;
PPCODE:
palDtp2s(xi, eta, raz, decz, &ra, &dec);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(dec)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double raz1;
double decz1;
double raz2;
double decz2;
int n;
PPCODE:
palDtps2c(xi, eta, ra, dec, &raz1, &decz1, &raz2, &decz2, &n);
XPUSHs(sv_2mortal(newSVnv(raz1)));
XPUSHs(sv_2mortal(newSVnv(decz1)));
XPUSHs(sv_2mortal(newSVnv(raz2)));
XPUSHs(sv_2mortal(newSVnv(decz2)));
lib/Astro/PAL.xs view on Meta::CPAN
palDvn(v)
double * v
PREINIT:
double uv[3];
double vm;
PPCODE:
palDvn(v, uv, &vm);
XPUSHs(sv_2mortal(newSVnv(vm)));
RETVEC(uv, 3, nv );
void
palDvxv(va, vb)
double * va
double * vb
PREINIT:
double vc[3];
PPCODE:
palDvxv(va,vb,vc);
RETVEC(vc, 3, nv );
void
palEcmat(date)
double date
PREINIT:
double rmat[3][3];
PPCODE:
palEcmat(date, rmat);
RETMATRIX(rmat);
void
palEcleq(dl, db, date)
lib/Astro/PAL.xs view on Meta::CPAN
double db
double date
PREINIT:
double dr;
double dd;
PPCODE:
palEcleq(dl, db, date, &dr, &dd);
XPUSHs(sv_2mortal(newSVnv(dr)));
XPUSHs(sv_2mortal(newSVnv(dd)));
# TODO: palEl2ue goes here
lib/Astro/PAL.xs view on Meta::CPAN
double vb[3];
AV * pph;
AV * pvh;
AV * ppb;
AV * pvb;
PPCODE:
palEpv( date, ph, vh, pb, vb );
pph = newAV();
unpack1D( newRV_noinc((SV*)pph), ph, 'd', 3 );
XPUSHs( newRV_noinc((SV*)pph));
lib/Astro/PAL.xs view on Meta::CPAN
double dd
double date
PREINIT:
double dl;
double db;
PPCODE:
palEqecl(dr, dd, date, &dl, &db);
XPUSHs(sv_2mortal(newSVnv(dl)));
XPUSHs(sv_2mortal(newSVnv(db)));
# Equation of the equinoxes
lib/Astro/PAL.xs view on Meta::CPAN
double dr
double dd
PREINIT:
double dl;
double db;
PPCODE:
palEqgal(dr, dd, &dl, &db);
XPUSHs(sv_2mortal(newSVnv(dl)));
XPUSHs(sv_2mortal(newSVnv(db)));
void
palEtrms(ep)
double ep
PREINIT:
double ev[3];
PPCODE:
palEtrms(ep, ev);
RETVEC(ev, 3, nv );
void
palEvp(date, deqx)
lib/Astro/PAL.xs view on Meta::CPAN
double dph[3];
AV * pdvb;
AV * pdpb;
AV * pdvh;
AV * pdph;
PPCODE:
palEvp(date, deqx, dvb, dpb, dvh, dph);
pdvb = newAV();
unpack1D( newRV_noinc((SV*)pdvb), dvb, 'd', 3 );
XPUSHs( newRV_noinc((SV*)pdvb));
lib/Astro/PAL.xs view on Meta::CPAN
double d1950
double bepoch
PREINIT:
double r2000;
double d2000;
PPCODE:
palFk45z(r1950, d1950, bepoch, &r2000, &d2000);
XPUSHs(sv_2mortal(newSVnv(r2000)));
XPUSHs(sv_2mortal(newSVnv(d2000)));
lib/Astro/PAL.xs view on Meta::CPAN
double d1950;
double dr1950;
double dd1950;
double p1950;
double v1950;
PPCODE:
palFk524(r2000,d2000,dr2000,dd2000,p2000,v2000,
&r1950,&d1950,&dr1950,&dd1950,&p1950,&v1950);
XPUSHs(sv_2mortal(newSVnv(r1950)));
XPUSHs(sv_2mortal(newSVnv(d1950)));
XPUSHs(sv_2mortal(newSVnv(dr1950)));
lib/Astro/PAL.xs view on Meta::CPAN
PREINIT:
double r1950;
double d1950;
double dr1950;
double dd1950;
PPCODE:
palFk54z(r2000, d2000, bepoch, &r1950, &d1950, &dr1950, &dd1950);
XPUSHs(sv_2mortal(newSVnv(r1950)));
XPUSHs(sv_2mortal(newSVnv(d1950)));
XPUSHs(sv_2mortal(newSVnv(dr1950)));
XPUSHs(sv_2mortal(newSVnv(dd1950)));
lib/Astro/PAL.xs view on Meta::CPAN
PREINIT:
int np;
double coeffs[6];
int j;
AV * pcoeffs;
PPCODE:
np = (av_len(xye) + 1) / 2;
double mxye[np][2];
double mxym[np][2];
ARRAYTOMAT(xye, mxye, np, 2);
ARRAYTOMAT(xym, mxym, np, 2);
lib/Astro/PAL.xs view on Meta::CPAN
double dl
double db
PREINIT:
double dr;
double dd;
PPCODE:
palGaleq(dl, db, &dr, &dd);
XPUSHs(sv_2mortal(newSVnv(dr)));
XPUSHs(sv_2mortal(newSVnv(dd)));
lib/Astro/PAL.xs view on Meta::CPAN
double dl
double db
PREINIT:
double dsl;
double dsb;
PPCODE:
palGalsup(dl, db, &dsl, &dsb);
XPUSHs(sv_2mortal(newSVnv(dsl)));
XPUSHs(sv_2mortal(newSVnv(dsb)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double dl
double db
PREINIT:
double dr;
double dd;
PPCODE:
palGe50(dl, db, &dr, &dd);
XPUSHs(sv_2mortal(newSVnv(dr)));
XPUSHs(sv_2mortal(newSVnv(dd)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double p
double h
PREINIT:
double r;
double z;
PPCODE:
palGeoc(p, h, &r, &z);
XPUSHs(sv_2mortal(newSVnv(r)));
XPUSHs(sv_2mortal(newSVnv(z)));
# UT to GMST
lib/Astro/PAL.xs view on Meta::CPAN
PREINIT:
double r5;
double d5;
double dr5;
double dd5;
PPCODE:
palHfk5z(rh,dh,epoch,&r5,&d5,&dr5,&dd5);
XPUSHs(sv_2mortal(newSVnv(r5)));
XPUSHs(sv_2mortal(newSVnv(d5)));
XPUSHs(sv_2mortal(newSVnv(dr5)));
XPUSHs(sv_2mortal(newSVnv(dd5)));
lib/Astro/PAL.xs view on Meta::CPAN
char * string
int nstrt
PREINIT:
long ireslt;
int jflag;
PPCODE:
palIntin(string, &nstrt, &ireslt, &jflag);
XPUSHs(sv_2mortal(newSViv(nstrt)));
XPUSHs(sv_2mortal(newSViv(ireslt)));
XPUSHs(sv_2mortal(newSViv(jflag)));
lib/Astro/PAL.xs view on Meta::CPAN
double * fwds
PREINIT:
double bkwds[6];
int j;
AV * pbkwds;
PPCODE:
palInvf(fwds, bkwds, &j);
pbkwds = newAV();
unpack1D(newRV_noinc((SV*)pbkwds), bkwds, 'd', 6);
XPUSHs(sv_2mortal(newSViv(j)));
XPUSHs(newRV_noinc((SV*)pbkwds));
lib/Astro/PAL.xs view on Meta::CPAN
double eq
double date
PREINIT:
double ra;
double da;
PPCODE:
palMap(rm, dm, pr, pd, px, rv, eq, date, &ra, &da);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(da)));
lib/Astro/PAL.xs view on Meta::CPAN
palMappa(eq, date)
double eq
double date
PREINIT:
double amprms[21];
PPCODE:
palMappa(eq, date, amprms);
RETVEC( amprms, 21, nv );
void
palMapqk(rm, dm, pr, pd, px, rv, amprms)
lib/Astro/PAL.xs view on Meta::CPAN
double rv
double * amprms
PREINIT:
double ra;
double da;
PPCODE:
palMapqk(rm, dm, pr, pd, px, rv, amprms, &ra, &da);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(da)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double dm
double * amprms
PREINIT:
double ra;
double da;
PPCODE:
palMapqkz(rm, dm, amprms, &ra, &da);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(da)));
void
palNut(date)
double date
PREINIT:
double rmatn[3][3];
PPCODE:
palNut(date, rmatn);
RETMATRIX(rmatn);
void
palNutc(date)
double date
PREINIT:
double dpsi;
double deps;
double eps0;
PPCODE:
palNutc(date, &dpsi, &deps, &eps0);
XPUSHs(sv_2mortal(newSVnv(dpsi)));
XPUSHs(sv_2mortal(newSVnv(deps)));
XPUSHs(sv_2mortal(newSVnv(eps0)));
lib/Astro/PAL.xs view on Meta::CPAN
double wl
double tlr
PREINIT:
double rap;
double dap;
PPCODE:
palOap(type, ob1, ob2, date, dut, elongm, phim, hm, xp, yp, tdk, pmb, rh, wl, tlr, &rap, &dap);
XPUSHs(sv_2mortal(newSVnv(rap)));
XPUSHs(sv_2mortal(newSVnv(dap)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double ob2
double * aoprms
PREINIT:
double rap;
double dap;
PPCODE:
palOapqk(type, ob1, ob2, aoprms, &rap, &dap);
XPUSHs(sv_2mortal(newSVnv(rap)));
XPUSHs(sv_2mortal(newSVnv(dap)));
# Note that we have a perl layer on top to handle
lib/Astro/PAL.xs view on Meta::CPAN
char name[41];
double w;
double p;
double h;
int j;
PPCODE:
if (n<0) n = 0; /* palObs uses a size_t */
j = palObs(n, c, ident, sizeof(ident), name, sizeof(name),
&w, &p, &h);
if (j == 0) {
XPUSHs(sv_2mortal(newSVpvn(ident, strlen(ident))));
lib/Astro/PAL.xs view on Meta::CPAN
void
palPcd(disco, x, y)
double disco
double x
double y
PPCODE:
palPcd(disco, &x, &y);
XPUSHs(sv_2mortal(newSVnv(x)));
XPUSHs(sv_2mortal(newSVnv(y)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double perih1;
double aorq1;
double e1;
double am1;
int jstat;
PPCODE:
jstat = 0;
palPertel(jform,date0,date1,epoch0,orbi0,anode0,perih0,aorq0,e0,am0,
&epoch1,&orbi1,&anode1,&perih1,&aorq1,&e1,&am1,&jstat);
XPUSHs(sv_2mortal(newSVnv(epoch1)));
XPUSHs(sv_2mortal(newSVnv(orbi1)));
lib/Astro/PAL.xs view on Meta::CPAN
palPertue(date, u)
double date
double * u
PREINIT:
int jstat;
PPCODE:
jstat = 0;
palPertue(date,u,&jstat);
XPUSHs(sv_2mortal(newSViv(jstat)));
RETVEC( u, 13, nv );
lib/Astro/PAL.xs view on Meta::CPAN
double aorl
double dm
PREINIT:
double pv[6];
int jstat;
PPCODE:
palPlanel(date, jform, epoch, orbinc, anode, perih, aorq, e, aorl, dm, pv, &jstat);
XPUSHs(sv_2mortal(newSViv(jstat)));
RETVEC( pv, 6, nv );
void
lib/Astro/PAL.xs view on Meta::CPAN
double date
int np
PREINIT:
double pv[6];
int jstat;
PPCODE:
palPlanet(date, np, pv, &jstat);
XPUSHs(sv_2mortal(newSViv(jstat)));
RETVEC( pv, 6, nv );
void
lib/Astro/PAL.xs view on Meta::CPAN
PREINIT:
double ra;
double dec;
double r;
int jstat;
PPCODE:
palPlante(date, elong, phi, jform, epoch, orbinc, anode, perih, aorq,e, aorl, dm, &ra, &dec, &r, &jstat);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(dec)));
XPUSHs(sv_2mortal(newSVnv(r)));
XPUSHs(sv_2mortal(newSViv(jstat)));
lib/Astro/PAL.xs view on Meta::CPAN
double ep0
double ep1
PREINIT:
double r1;
double d1;
PPCODE:
palPm(r0,d0,pr,pd,px,rv,ep0,ep1,&r1,&d1);
XPUSHs(sv_2mortal(newSVnv(r1)));
XPUSHs(sv_2mortal(newSVnv(d1)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double yp
PREINIT:
double elong;
double phi;
double daz;
PPCODE:
palPolmo(elongm, phim, xp, yp, &elong, &phi, &daz);
XPUSHs(sv_2mortal(newSVnv(elong)));
XPUSHs(sv_2mortal(newSVnv(phi)));
XPUSHs(sv_2mortal(newSVnv(daz)));
lib/Astro/PAL.xs view on Meta::CPAN
palPrebn(bep0, bep1)
double bep0
double bep1
PREINIT:
double rmatp[3][3];
PPCODE:
palPrebn(bep0, bep1, rmatp);
RETMATRIX(rmatp);
void
palPrec(ep0, ep1)
double ep0
double ep1
PREINIT:
double rmatp[3][3];
PPCODE:
palPrec(ep0, ep1, rmatp);
RETMATRIX(rmatp);
# Precession
lib/Astro/PAL.xs view on Meta::CPAN
char *system
double ep0
double ep1
double ra
double dc
PPCODE:
palPreces(system, ep0, ep1, &ra, &dc);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(dc)));
void
palPrenut(epoch, date, rmatpn)
double epoch
double date
PREINIT:
double rmatpn[3][3];
PPCODE:
palPrenut(epoch, date, rmatpn);
RETMATRIX(rmatpn);
void
palPvobs(p, h, stl)
double p
double h
double stl
PREINIT:
double pv[6];
PPCODE:
palPvobs(p, h, stl, pv);
RETVEC(pv, 6, nv);
void
palPxy(xye, xym, coeffs)
lib/Astro/PAL.xs view on Meta::CPAN
int np;
double xrms;
double yrms;
double rrms;
AV * pxyp;
PPCODE:
np = (av_len(xye) + 1) / 2;
double mxye[np][2];
double mxym[np][2];
double xyp[np][2];
ARRAYTOMAT(xye, mxye, np, 2);
lib/Astro/PAL.xs view on Meta::CPAN
double phi
PREINIT:
double ra;
double dec;
double diam;
PPCODE:
palRdplan(date, np, elong, phi, &ra, &dec, &diam);
XPUSHs(sv_2mortal(newSVnv(ra)));
XPUSHs(sv_2mortal(newSVnv(dec)));
XPUSHs(sv_2mortal(newSVnv(diam)));
lib/Astro/PAL.xs view on Meta::CPAN
double tlr
double eps
PREINIT:
double refa;
double refb;
PPCODE:
palRefco(hm, tdk, pmb, rh, wl, phi, tlr, eps, &refa, &refb);
XPUSHs(sv_2mortal(newSVnv(refa)));
XPUSHs(sv_2mortal(newSVnv(refb)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double rh
double wl
PREINIT:
double refa;
double refb;
PPCODE:
palRefcoq(tdk, pmb, rh, wl, &refa, &refb);
XPUSHs(sv_2mortal(newSVnv(refa)));
XPUSHs(sv_2mortal(newSVnv(refb)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double phi
double tlr
double eps
PREINIT:
double ref;
PPCODE:
palRefro(zobs, hm, tdk, pmb, rh, wl, phi, tlr, eps, &ref);
XPUSHs(sv_2mortal(newSVnv(ref)));
void
palRefv(vu, refa, refb)
double * vu
double refa
double refb
PREINIT:
double vr[3];
PPCODE:
palRefv(vu, refa, refb, vr);
RETVEC( vr, 3, nv );
void
lib/Astro/PAL.xs view on Meta::CPAN
double zu
double refa
double refb
PREINIT:
double zr;
PPCODE:
palRefz(zu, refa, refb, &zr);
XPUSHs(sv_2mortal(newSVnv(zr)));
double
palRverot(phi, ra, da, st)
lib/Astro/PAL.xs view on Meta::CPAN
double dc
double eq
PREINIT:
double rm;
double dm;
PPCODE:
palSubet(rc, dc, eq, &rm, &dm);
XPUSHs(sv_2mortal(newSVnv(rm)));
XPUSHs(sv_2mortal(newSVnv(dm)));
void
lib/Astro/PAL.xs view on Meta::CPAN
double dsl
double dsb
PREINIT:
double dl;
double db;
PPCODE:
palSupgal(dsl, dsb, &dl, &db);
XPUSHs(sv_2mortal(newSVnv(dl)));
XPUSHs(sv_2mortal(newSVnv(db)));
# TODO: palUe2el
lib/Astro/PAL.xs view on Meta::CPAN
void
palUnpcd(disco, x, y)
double disco
double x
double y
PPCODE:
palUnpcd(disco, &x, &y);
XPUSHs(sv_2mortal(newSVnv(x)));
XPUSHs(sv_2mortal(newSVnv(y)));
void palXy2xy(x1, y1, coeffs)
lib/Astro/PAL.xs view on Meta::CPAN
double y1
double * coeffs
PREINIT:
double x2;
double y2;
PPCODE:
palXy2xy(x1, y1, coeffs, &x2, &y2);
XPUSHs(sv_2mortal(newSVnv(x2)));
XPUSHs(sv_2mortal(newSVnv(y2)));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Astro/SLA.xs view on Meta::CPAN
# Since "c" can be both input and output depending on the value
# of n the XS routine is explicit and will write the output to
# outc regardless of inc. We do this to allow slaObs to be called
# with constants that can not handle always being modified in the
# simple XS {could use PPCODE but the multivar approach is easier
# since there are many return values that would need to be specified.)
void
_slaObs(n, inc, outc, name, w, p, h)
int n
view all matches for this distribution
view release on metacpan or search on metacpan
AstroCatalog::colNames()
PREINIT:
int i;
int len;
char ** names;
PPCODE:
names = THIS->colNames();
for (i = 0; i < THIS->numCols(); i++) {
len = strlen( *names );
XPUSHs(sv_2mortal(newSVpv( *names++, len)));
}
# ID is tricky since when it is used as an accessor
# it returns a char and when it is used to set the ID
# it returns an int
# Can either break the interface and have setid, getid
# or we have to use PPCODE to handle with the return value
# Essentially means we are doing everything by hand
void
AstroQuery::id( ... )
PREINIT:
int retint;
const char * retchar;
const char * inchar;
PPCODE:
if (items == 2) {
/* Setting the attribute */
inchar = (const char *)SvPV(ST(1),PL_na);
retint = THIS->id( inchar );
PUSHs(sv_2mortal( newSViv( retint )));
int retint;
WorldOrImageCoords retwc;
const WorldOrImageCoords * inwc;
const WorldOrImageCoords * inwc2;
SV * retsv;
PPCODE:
if (items >= 2) {
/* Setting the attribute - unfortunately it has to be an object */
inwc = SvToWorldOrImageCoords( ST(1) );
if (items == 2) {
QueryResult::colNames()
PREINIT:
int i;
int len;
char ** names;
PPCODE:
names = THIS->colNames();
for (i = 0; i < THIS->numCols(); i++) {
len = strlen( *names );
XPUSHs(sv_2mortal(newSVpv( *names++, len)));
}
view all matches for this distribution
view release on metacpan or search on metacpan
Interrupt.pm view on Meta::CPAN
The C<c_func> simply returns the address of a static function and arranges
for the object pointed to by C<$self> to be passed to it, as an integer:
void
_c_func (SV *loop)
PPCODE:
EXTEND (SP, 2);
PUSHs (sv_2mortal (newSViv (PTR2IV (c_func))));
PUSHs (sv_2mortal (newSViv (SvRV (loop))));
This would be the callback (since it runs in a normal Perl context, it is
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Async/Trampoline.xs++ view on Meta::CPAN
void
Async::run_until_completion()
INIT:
CXX_TRY
PPCODE:
{
Async_run_until_completion(THIS);
Async& result = THIS->ptr_follow();
lib/Async/Trampoline.xs++ view on Meta::CPAN
{
ASYNC_LOG_DEBUG("returning to Perl: " ASYNC_FORMAT "\n",
ASYNC_FORMAT_ARGS(&result));
DestructibleTuple& values = result.as_value;
XSprePUSH; // to fix weird XS+PPCODE argument handling
EXTEND(SP, static_cast<ssize_t>(values.size));
for (auto value : values)
{
ASYNC_LOG_DEBUG(" - " DESTRUCTIBLE_FORMAT "\n",
DESTRUCTIBLE_FORMAT_ARGS_BORROWED(values.vtable, value));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attribute/Storage.xs view on Meta::CPAN
INIT:
SV *subject;
SV *hash = NULL;
MAGIC *magic;
PPCODE:
if(!SvROK(rv))
croak("Cannot fetch attributes hash of a non-reference value");
subject = SvRV(rv);
if(SvTYPE(subject) >= SVt_PVMG)
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
SV * out
SV * in
SV * result
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
CROSSFADE_ease_in_out_quad(crossfade, out, in, result);
if (PL_markstack_ptr != temp) {
/* truly void, because dXSARGS not invoked */
PL_markstack_ptr = temp;
view all matches for this distribution
view release on metacpan or search on metacpan
#############################################
################ Constructor ################
void
new (...)
PPCODE:
{
HV* construct = newHV();
HV* thistash = newHV();
SV* buff = newSViv(4096); /* read/write buffer size */
#################################################################
############## Methods for opening / closing device #############
void
init (...)
PPCODE:
{
SV* format;
HV* caller = (HV*)SvRV(ST(0));
char* dev;
char* key;
XSRETURN_YES;
}
void
open (...)
PPCODE:
{
/* open without sending any ioctl messages */
HV* caller = (HV*)SvRV(ST(0));
SV* flag;
int fd;
XSRETURN_YES;
}
void
close (...)
PPCODE:
{
/* fetch file descriptor and close... nothing fancy */
int fd = SvIV(*hv_fetch((HV*)SvRV(ST(0)), "file_indicator", 14, 0));
if (close(fd) < 0)
#################################################################
####################### I/O control methods #####################
void
channels (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int chan, arg;
chan = arg = SvIV(ST(1));
XPUSHs(newSViv(arg));
}
void
getfmts (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int mask;
XPUSHs(newSViv(mask));
}
void
post (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
if (ioctl(fd, SNDCTL_DSP_POST, 0) == -1) {
XSRETURN_YES;
}
void
reset (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
if (ioctl(fd, SNDCTL_DSP_RESET, 0) == -1) {
XSRETURN_YES;
}
void
setduplex (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
if (ioctl(fd, SNDCTL_DSP_SETDUPLEX) == -1) {
XSRETURN_YES;
}
void
setfmt (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
/* SV* format = ST(1); */
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int fmt, arg;
XPUSHs(newSViv(arg));
}
void
speed (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int rate, arg;
rate = arg = SvIV(ST(1));
XPUSHs(newSViv(arg));
}
void
sync (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
if (ioctl(fd, SNDCTL_DSP_SYNC, 0) == -1) {
#################################################################
##################### Direct device I/O #########################
void
dread (...)
PPCODE:
{
/* read data and return it */
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
free(buf);
}
void
dwrite (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int status;
#################################################################
##################### "data-in-memory" methods ##################
void
audiofile (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
char audio_buff[AUDIO_FILE_BUFFER_SIZE];
char* audio_file;
int audio_fd;
XSRETURN_YES;
}
void
clear (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
hv_store(caller, "data", 4, newSVpv("",0), 0);
hv_store(caller, "mark", 4, newSViv(0), 0);
}
void
data (...)
PPCODE:
{
XPUSHs(*hv_fetch((HV*)SvRV(ST(0)), "data", 4, 0));
}
void
datacat (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int len = SvCUR(ST(1));
sv_catpvn(*hv_fetch(caller, "data", 4, 0), SvPVX(ST(1)), len);
XPUSHs(sv_2mortal(newSViv(SvCUR(*hv_fetch(caller, "data", 4, 0)))));
}
void
datalen (...)
PPCODE:
{
XPUSHs(sv_2mortal(newSViv(SvCUR(*hv_fetch((HV*)SvRV(ST(0)), "data", 4, 0)))));
}
void
read (...)
PPCODE:
{
/* read one buffer length of data */
HV* caller = (HV*)SvRV(ST(0));
int count = SvIV(*hv_fetch(caller, "buffer", 6, 0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
XSRETURN_YES;
}
void
setmark (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
hv_store(caller, "mark", 4, ST(1), 0);
XPUSHs(*hv_fetch(caller, "mark", 4, 0));
}
void
write (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int count = SvIV(*hv_fetch(caller, "buffer", 6, 0));
int dlength = SvCUR(*hv_fetch(caller, "data", 4, 0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
####################################################################
######################### misc. methods ############################
void
errstr (...)
PPCODE:
{
XPUSHs(*hv_fetch((HV*)SvRV(ST(0)), "errstr", 6, 0));
}
####################################################################
################## Deprecated methods from v.0.01 ##################
void
getformat (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
SV* format = ST(1);
int arg = _audioformat(format);
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
XSRETURN_NO;
}
void
queryformat (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
int fd = SvIV(*hv_fetch(caller, "file_indicator", 14, 0));
int status = ioctl(fd, SNDCTL_DSP_SETFMT, AFMT_QUERY);
XPUSHs(newSViv(status));
}
void
setbuffer (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
hv_store(caller, "buffer", 6, ST(1), 0);
XPUSHs(*hv_fetch(caller, "buffer", 6, 0));
}
void
setchannels (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
hv_store(caller, "channels", 8, ST(1), 0);
XPUSHs(*hv_fetch(caller, "channels", 8, 0));
}
void
setdevice (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
hv_store(caller, "device", 6, ST(1), 0);
XPUSHs(*hv_fetch(caller, "device", 6, 0));
}
void
setformat (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
XPUSHs(*hv_fetch(caller, "format", 6, 0));
}
void
setrate (...)
PPCODE:
{
HV* caller = (HV*)SvRV(ST(0));
if (items >= 2) {
SvREFCNT_inc(ST(1));
hv_store(caller, "rate", 4, ST(1), 0);
view all matches for this distribution
view release on metacpan or search on metacpan
const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
/* Change this to constant(aTHX_ s, len, &iv, &nv);
if you need to return both NVs and IVs */
type = constant(aTHX_ s, len, &iv);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
view all matches for this distribution
view release on metacpan or search on metacpan
LibSampleRate.xs view on Meta::CPAN
PREINIT:
SRC_DATA data;
AV* data_out;
float *in, *out;
int i, error;
PPCODE:
data.input_frames = (av_len(data_in) + 1) / channels;
data.output_frames = data.input_frames * src_ratio + 10;
Newx(in, data.input_frames * channels, float);
Newx(out, data.output_frames * channels, float);
for(i = 0 ; i <= av_len(data_in) ; i++)
LibSampleRate.xs view on Meta::CPAN
PREINIT:
SRC_DATA data;
AV* data_out;
float *in, *out;
int i, error;
PPCODE:
data.input_frames = av_len(data_in) + 1;
data.output_frames = data.input_frames * src_ratio + 10;
Newx(in, data.input_frames, float);
Newx(out, data.output_frames, float);
for(i = 0 ; i <= av_len(data_in) ; i++)
view all matches for this distribution
view release on metacpan or search on metacpan
fallback/const-xs.inc view on Meta::CPAN
/* NV nv; Uncomment this if you need to return NVs */
/* const char *pv; Uncomment this if you need to return PVs */
INPUT:
SV * sv;
const char * s = SvPV(sv, len);
PPCODE:
type = constant(aTHX_ s, len);
/* Return 1 or 2 items. First is error message, or undef if no error.
Second, if present, is found value */
switch (type) {
case PERL_constant_NOTFOUND:
view all matches for this distribution
view release on metacpan or search on metacpan
struct mad_stream *stream;
struct mad_frame *frame;
struct mad_header *header;
int err = 0;
unsigned long tagsize;
PPCODE:
stream = THIS->stream;
frame = THIS->frame;
header = &frame->header;
decode_loop:
if (mad_header_decode(header, stream) == -1) {
header(THIS, datasize = 0)
Audio_MPEG_Output THIS
unsigned int datasize
PREINIT:
struct audio_params *params;
PPCODE:
params = THIS->params;
switch (params->type) {
case AUDIO_MPEG_OUTPUT_TYPE_SND:
{
unsigned char header[24];
struct audio_stats *stats;
struct audio_dither_err *dither_err;
unsigned int len;
unsigned char data[MAX_NSAMPLES * sizeof(double) * 2];
mad_fixed_t mono[MAX_NSAMPLES];
PPCODE:
params = THIS->params;
stats = THIS->stats;
dither_err = THIS->dither_err;
if (!pcm->length) {
warn("pcm sample length cannot be 0");
PREINIT:
unsigned char *pcm;
STRLEN pcm_len;
unsigned int encode_len;
unsigned char out[LAME_MAXMP3BUFFER / sizeof(short) * sizeof(float)];
PPCODE:
pcm = SvPV(pcm_sv, pcm_len);
if (!pcm_len) {
warn("pcm sample length cannot be 0");
XSRETURN_UNDEF;
}
PREINIT:
unsigned char *pcm;
STRLEN pcm_len;
unsigned int encode_len;
unsigned char out[LAME_MAXMP3BUFFER];
PPCODE:
pcm = SvPV(pcm_sv, pcm_len);
if (!pcm_len) {
warn("pcm sample length cannot be 0");
XSRETURN_UNDEF;
}
encode_flush(THIS)
Audio_MPEG_Encode THIS
PREINIT:
unsigned int encode_len;
unsigned char out[LAME_MAXMP3BUFFER];
PPCODE:
encode_len = lame_encode_flush(THIS->flags, out, LAME_MAXMP3BUFFER);
XPUSHs(sv_2mortal(newSVpvn(out, encode_len)));
#
# Write the Xing VBR header to an MP3 file. NOTE: file *must* be opened
view all matches for this distribution
view release on metacpan or search on metacpan
void
samples(THIS)
Audio_Mad_Synth THIS
PREINIT:
struct mad_pcm *pcm;
PPCODE:
pcm = &THIS->pcm;
if (!(pcm->length > 0)) {
XSRETURN_UNDEF;
}
SV *right
PREINIT:
unsigned int length, old_length, bufsize;
mad_fixed_t *resampled, *data;
double fscale;
PPCODE:
if (!SvPOK(left)) {
XSRETURN_UNDEF;
}
/* this scale value, and the following calculation
SV *rightsv
PREINIT:
STRLEN old_length, length;
mad_fixed_t *left, *right = NULL;
unsigned char *cooked;
PPCODE:
if (THIS->pcmfunc == NULL) {
XSRETURN_UNDEF;
}
if (!SvPOK(leftsv)) {
view all matches for this distribution
view release on metacpan or search on metacpan
Opusfile.xs view on Meta::CPAN
Audio::Opusfile of;
int bufsize;
PREINIT:
opus_int16* buf;
int li, ret, chans, i;
PPCODE:
Newx(buf, bufsize, opus_int16);
ret = op_read(of, buf, bufsize, &li);
if(ret < 0)
croak("op_read returned error %d\n", ret);
chans = op_channel_count(of, li);
Opusfile.xs view on Meta::CPAN
Audio::Opusfile of;
int bufsize;
PREINIT:
float* buf;
int li, ret, chans, i;
PPCODE:
Newx(buf, bufsize, float);
ret = op_read_float(of, buf, bufsize, &li);
if(ret < 0)
croak("op_read_float returned error %d\n", ret);
chans = op_channel_count(of, li);
Opusfile.xs view on Meta::CPAN
Audio::Opusfile of;
int bufsize;
PREINIT:
opus_int16* buf;
int ret, i;
PPCODE:
Newx(buf, bufsize, opus_int16);
ret = op_read_stereo(of, buf, bufsize);
if(ret < 0)
croak("op_read_stereo returned error %d\n", ret);
EXTEND(SP, 2 * ret);
Opusfile.xs view on Meta::CPAN
Audio::Opusfile of;
int bufsize;
PREINIT:
float* buf;
int ret, i;
PPCODE:
Newx(buf, bufsize, float);
ret = op_read_float_stereo(of, buf, bufsize);
if(ret < 0)
croak("op_read_float_stereo returned error %d\n", ret);
EXTEND(SP, 2 * ret);
view all matches for this distribution
view release on metacpan or search on metacpan
Header/Header.xs view on Meta::CPAN
PROTOTYPE: $
PREINIT:
SF_INFO *info;
HV *hash;
SV *head;
PPCODE:
{
if (! (sv_isobject(self) && sv_derived_from(self, CLASSNAME)))
XSRETURN_UNDEF;
if (SvTYPE(hash = (HV *)SvRV(self)) != SVt_PVHV)
view all matches for this distribution
view release on metacpan or search on metacpan
Data/Data.xs view on Meta::CPAN
float amp
void
DESTROY(au)
Audio * au
PPCODE:
{
if (au->comment)
SvREFCNT_dec(au->comment);
if (au->data)
SvREFCNT_dec(au->data);
Data/Data.xs view on Meta::CPAN
}
void
Audio_data(au,...)
Audio * au
PPCODE:
{
int gimme = GIMME_V;
if (items > 1)
{
int i;
Data/Data.xs view on Meta::CPAN
void
Audio_dB(au,start = 0, count = (GIMME == G_ARRAY) ? Audio_samples(au)-start : 1)
Audio * au
int start
int count
PPCODE:
{
int n = Audio_samples(au);
float *p = AUDIO_DATA(au)+start*AUDIO_WORDS(au);
/* Min noticable value in 16bit is 1/(2**15) - call that 100dB */
float min = 1.0/(1 << 15);
Data/Data.xs view on Meta::CPAN
void
Audio_amplitude(au,start = 0, count = (GIMME == G_ARRAY) ? Audio_samples(au)-start : 1)
Audio * au
int start
int count
PPCODE:
{
int n = Audio_samples(au);
float *p = AUDIO_DATA(au)+start*AUDIO_WORDS(au);
if (start+count > n)
count = n - start;
Data/Data.xs view on Meta::CPAN
void
Audio_phase(au,start = 0, count = (GIMME == G_ARRAY) ? Audio_samples(au)-start : 1)
Audio * au
int start
int count
PPCODE:
{
int n = Audio_samples(au);
float *p = AUDIO_DATA(au)+start*AUDIO_WORDS(au);
if (start+count > n)
count = n - start;
Data/Data.xs view on Meta::CPAN
MODULE = Audio::Data PACKAGE = Audio::Filter::AllPole PREFIX = AllPole_
void
AllPole_process(au,...)
Audio * au
PPCODE:
{
XSRETURN(Audio_filter_process(aTHX_ au,&Audio_AllPole,items,&ST(0)));
}
MODULE = Audio::Data PACKAGE = Audio::Filter::FIR PREFIX = FIR_
void
FIR_process(au,...)
Audio * au
PPCODE:
{
XSRETURN(Audio_filter_process(aTHX_ au,&Audio_FIR,items,&ST(0)));
}
view all matches for this distribution