view release on metacpan or search on metacpan
SV *coords
UV m
PREINIT:
EXTRACT(self);
double buf[KD_MAX_DIMS];
PPCODE:
kd_read_point(aTHX_ h, coords, buf, "knn");
REEXTRACT(self); /* kd_read_point ran arbitrary Perl */
{
KdRes *res = NULL;
uint64_t got = 0, i;
SV *lo
SV *hi
PREINIT:
EXTRACT(self);
double blo[KD_MAX_DIMS], bhi[KD_MAX_DIMS];
PPCODE:
kd_read_point(aTHX_ h, lo, blo, "range");
REEXTRACT(self); /* kd_read_point ran arbitrary Perl */
kd_read_point(aTHX_ h, hi, bhi, "range");
REEXTRACT(self); /* kd_read_point ran arbitrary Perl */
{
SV *coords
double r
PREINIT:
EXTRACT(self);
double buf[KD_MAX_DIMS];
PPCODE:
if (r < 0) croak("Data::KDTree::Shared->radius: radius must be >= 0");
kd_read_point(aTHX_ h, coords, buf, "radius");
REEXTRACT(self); /* kd_read_point ran arbitrary Perl */
{
KdRes *res = NULL;
view all matches for this distribution
view release on metacpan or search on metacpan
LetterTree.xs view on Meta::CPAN
Node * tree
char * word
PREINIT:
SV** data;
int i = 0;
PPCODE:
data = get_data(tree, word);
if (data)
while (data[i])
XPUSHs((SV*) data[i++]);
view all matches for this distribution
view release on metacpan or search on metacpan
Locations.xs view on Meta::CPAN
void
_mortalize_(ref)
SV * ref
PPCODE:
{
GV *obj;
if ( DATA_LOCATIONS_OBJECT(ref,obj) )
{
Locations.xs view on Meta::CPAN
}
void
Version(...)
PPCODE:
{
if ((items >= 0) && (items <= 1))
{
EXTEND(sp,1);
PUSHs(sv_2mortal(newSVpv((char *)"5.5",0)));
view all matches for this distribution
view release on metacpan or search on metacpan
read_entry(self, offset, ...)
SV *self
UV offset
PREINIT:
EXTRACT_LOG(self);
PPCODE:
const uint8_t *out_data;
uint32_t out_len;
int out_utf8 = 0;
uint64_t next_off;
/* Optional third arg: abandon_wait_us (default LOG_ABANDON_WAIT_US).
view all matches for this distribution
view release on metacpan or search on metacpan
void
registers(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
uint64_t k = h->hdr->k;
uint64_t kmax = mnh_reg_max(h); /* Layer B: never read past the real mapping */
if (k > kmax) k = kmax;
uint64_t *snap = NULL;
view all matches for this distribution
view release on metacpan or search on metacpan
void
shape(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
uint64_t snap[NDA_MAX_DIMS]; uint32_t ndim, d;
/* Snapshot ndim+shape under the read lock: reshape mutates them under
* the write lock, so an unlocked read could tear (a new ndim with a
* stale shape[]). Copy out, unlock, then build the SVs. */
void
strides(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
uint64_t snap[NDA_MAX_DIMS]; uint32_t ndim, d;
/* Snapshot ndim+strides under the read lock (see shape): reshape mutates
* them under the write lock; an unlocked read could tear. */
nda_rwlock_rdlock(h);
view all matches for this distribution
view release on metacpan or search on metacpan
passwdqc.xs view on Meta::CPAN
void
_test_params (packed_params)
const char * packed_params
PREINIT:
const passwdqc_params_qc_t * params;
PPCODE:
params = (passwdqc_params_qc_t *)packed_params;
EXTEND(SP, 10);
PUSHs(sv_2mortal(newSViv(params->min[0])));
PUSHs(sv_2mortal(newSViv(params->min[1])));
PUSHs(sv_2mortal(newSViv(params->min[2])));
view all matches for this distribution
view release on metacpan or search on metacpan
MODULE = Data::Peek PACKAGE = Data::Peek
void
DPeek (...)
PROTOTYPE: ;$
PPCODE:
I32 gimme = GIMME_V;
SV *sv = items ? ST (0) : DEFSV;
if (items == 0) EXTEND (SP, 1);
ST (0) = _DPeek (aTHX_ items, sv);
if (gimme == G_VOID) warn ("%s\n", SvPVX (ST (0)));
/* XS DPeek */
void
DDisplay (...)
PROTOTYPE: ;$
PPCODE:
I32 gimme = GIMME_V;
SV *sv = items ? ST (0) : DEFSV;
SV *dsp = newSVpv ("", 0);
if (SvPOK (sv) || SvPOKp (sv))
pv_pretty (dsp, SvPVX (sv), SvCUR (sv), 0,
SV *pv
SV *iv
SV *nv
PROTOTYPE: $$$
PPCODE:
SV *tv = newSVpvs ("");
SvUPGRADE (tv, SVt_PVNV);
if (SvPOK (pv) || SvPOKp (pv)) {
sv_setpvn (tv, SvPVX (pv), SvCUR (pv));
void
DDual (sv, ...)
SV *sv
PROTOTYPE: $;$
PPCODE:
I32 gimme = GIMME_V;
if (items > 1 && SvGMAGICAL (sv) && SvTRUE (ST (1)))
mg_get (sv);
DGrow (sv, size)
SV *sv
IV size
PROTOTYPE: $$
PPCODE:
if (SvROK (sv))
sv = SvRV (sv);
if (!SvPOK (sv))
sv_setpvn (sv, "", 0);
SvGROW (sv, size);
void
DDump_XS (sv)
SV *sv
PROTOTYPE: $
PPCODE:
SV *dd = _DDump (aTHX_ sv);
if (dd) {
ST (0) = dd;
XSRETURN (1);
DDump_IO (io, sv, level)
PerlIO *io
SV *sv
IV level
PPCODE:
do_sv_dump (0, io, sv, 1, level, 1, 0);
XSRETURN (1);
/* XS DDump */
view all matches for this distribution
view release on metacpan or search on metacpan
SV *self
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
int64_t value;
PPCODE:
for (UV i = 0; i < count; i++) {
int r = pubsub_int_poll(sub, &value);
if (r != 1) break;
mXPUSHi((IV)value);
}
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
int64_t value;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
while (max_count-- > 0 && pubsub_int_poll(sub, &value))
mXPUSHi((IV)value);
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
double timeout = -1;
int64_t value;
PPCODE:
if (count == 0) XSRETURN(0);
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
if (!pubsub_int_poll_wait(sub, &value, timeout)) XSRETURN(0);
mXPUSHi((IV)value);
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
int64_t value;
uint32_t max_count;
PPCODE:
pubsub_sub_eventfd_consume(sub);
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int::Sub", self);
while (max_count-- > 0 && pubsub_int_poll(sub, &value))
mXPUSHi((IV)value);
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
const char *str;
uint32_t len;
bool utf8;
PPCODE:
for (UV i = 0; i < count; i++) {
int r = pubsub_str_poll(sub, &str, &len, &utf8);
if (r != 1) break;
SV *sv = newSVpvn(str, len);
if (utf8) SvUTF8_on(sv);
EXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
const char *str;
uint32_t len;
bool utf8;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
while (max_count-- > 0 && pubsub_str_poll(sub, &str, &len, &utf8) == 1) {
SV *sv = newSVpvn(str, len);
if (utf8) SvUTF8_on(sv);
EXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
double timeout = -1;
const char *str;
uint32_t len;
bool utf8;
PPCODE:
if (count == 0) XSRETURN(0);
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
if (pubsub_str_poll_wait(sub, &str, &len, &utf8, timeout) != 1) XSRETURN(0);
{
EXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
const char *str;
uint32_t len;
bool utf8;
uint32_t max_count;
PPCODE:
pubsub_sub_eventfd_consume(sub);
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Str::Sub", self);
while (max_count-- > 0 && pubsub_str_poll(sub, &str, &len, &utf8) == 1) {
SV *sv = newSVpvn(str, len);
SV *self
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
int32_t value;
PPCODE:
for (UV i = 0; i < count; i++) {
int r = pubsub_int32_poll(sub, &value);
if (r != 1) break;
mXPUSHi((IV)value);
}
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
int32_t value;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
while (max_count-- > 0 && pubsub_int32_poll(sub, &value))
mXPUSHi((IV)value);
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
double timeout = -1;
int32_t value;
PPCODE:
if (count == 0) XSRETURN(0);
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
if (!pubsub_int32_poll_wait(sub, &value, timeout)) XSRETURN(0);
mXPUSHi((IV)value);
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
int32_t value;
uint32_t max_count;
PPCODE:
pubsub_sub_eventfd_consume(sub);
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int32::Sub", self);
while (max_count-- > 0 && pubsub_int32_poll(sub, &value))
mXPUSHi((IV)value);
SV *self
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
int16_t value;
PPCODE:
for (UV i = 0; i < count; i++) {
int r = pubsub_int16_poll(sub, &value);
if (r != 1) break;
mXPUSHi((IV)value);
}
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
int16_t value;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
while (max_count-- > 0 && pubsub_int16_poll(sub, &value))
mXPUSHi((IV)value);
UV count
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
double timeout = -1;
int16_t value;
PPCODE:
if (count == 0) XSRETURN(0);
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
if (!pubsub_int16_poll_wait(sub, &value, timeout)) XSRETURN(0);
mXPUSHi((IV)value);
SV *self
PREINIT:
EXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
int16_t value;
uint32_t max_count;
PPCODE:
pubsub_sub_eventfd_consume(sub);
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_SUB("Data::PubSub::Shared::Int16::Sub", self);
while (max_count-- > 0 && pubsub_int16_poll(sub, &value))
mXPUSHi((IV)value);
view all matches for this distribution
view release on metacpan or search on metacpan
SV *self
UV count
PREINIT:
EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
int64_t value;
PPCODE:
for (UV i = 0; i < count; i++) {
if (!queue_int_try_pop(h, &value)) break;
mXPUSHi((IV)value);
}
SV *self
PREINIT:
EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
int64_t value;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
REEXTRACT_HANDLE("Data::Queue::Shared::Int", self);
while (max_count-- > 0 && queue_int_try_pop(h, &value))
mXPUSHi((IV)value);
UV count
PREINIT:
EXTRACT_HANDLE("Data::Queue::Shared::Int", self);
double timeout = -1;
int64_t value;
PPCODE:
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_HANDLE("Data::Queue::Shared::Int", self);
/* Block until at least 1 */
if (!queue_int_pop_wait(h, &value, timeout)) XSRETURN(0);
mXPUSHi((IV)value);
PREINIT:
EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
const char *str;
uint32_t len;
bool utf8;
PPCODE:
/* Hoist Perl SV construction out of the process-shared mutex:
* newSVpvn can longjmp on OOM and deadlock peers on the futex. */
struct { char *buf; uint32_t len; bool utf8; } *items_buf = NULL;
UV n = 0;
int last_r = 0;
EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
const char *str;
uint32_t len;
bool utf8;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
/* Hoist SV construction out of the mutex (see pop_multi). */
struct drain_item { char *buf; uint32_t len; bool utf8; struct drain_item *next; } *drained_head = NULL, *drained_tail = NULL;
UV drained_n = 0;
int last_r = 0;
EXTRACT_HANDLE("Data::Queue::Shared::Str", self);
double timeout = -1;
const char *str;
uint32_t len;
bool utf8;
PPCODE:
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_HANDLE("Data::Queue::Shared::Str", self);
/* Block until at least 1 */
{
int r = queue_str_pop_wait(h, &str, &len, &utf8, timeout);
view all matches for this distribution
view release on metacpan or search on metacpan
EXTRACT_HANDLE("Data::ReqRep::Shared", self);
const char *str;
uint32_t len;
uint64_t id;
bool utf8;
PPCODE:
int r = reqrep_try_recv(h, &str, &len, &utf8, &id);
if (r == -1) croak("Data::ReqRep::Shared: out of memory");
if (r == 1) {
SV *sv = newSVpvn(str, len);
if (utf8) SvUTF8_on(sv);
double timeout = -1;
const char *str;
uint32_t len;
uint64_t id;
bool utf8;
PPCODE:
if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1));
REEXTRACT_HANDLE("Data::ReqRep::Shared", self);
int r = reqrep_recv_wait(h, &str, &len, &utf8, &id, timeout);
if (r == -1) croak("Data::ReqRep::Shared: out of memory");
if (r == 1) {
EXTRACT_HANDLE("Data::ReqRep::Shared", self);
const char *str;
uint32_t len;
uint64_t id;
bool utf8;
PPCODE:
/* Hoist Perl SV construction out of process-shared futex mutex. */
struct { char *buf; uint32_t len; uint64_t id; bool utf8; } *items_buf = NULL;
UV n = 0;
int last_r = 0;
int oom = 0;
double timeout = -1;
const char *str;
uint32_t len;
uint64_t id;
bool utf8;
PPCODE:
if (items > 2 && (SvGETMAGIC(ST(2)), SvOK(ST(2)))) timeout = SvNV(ST(2));
REEXTRACT_HANDLE("Data::ReqRep::Shared", self);
/* Block until at least 1 */
int r = reqrep_recv_wait(h, &str, &len, &utf8, &id, timeout);
if (r == -1) croak("Data::ReqRep::Shared: out of memory");
const char *str;
uint32_t len;
uint64_t id;
bool utf8;
uint32_t max_count;
PPCODE:
max_count = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? (uint32_t)SvUV(ST(1)) : UINT32_MAX;
/* Hoist SV construction out of the mutex (see recv_multi). */
struct drain_item { char *buf; uint32_t len; uint64_t id; bool utf8; struct drain_item *next; } *drained_head = NULL, *drained_tail = NULL;
UV drained_n = 0;
int last_r = 0;
SV *self
PREINIT:
EXTRACT_HANDLE("Data::ReqRep::Shared::Int", self);
int64_t value;
uint64_t id;
PPCODE:
if (reqrep_int_try_recv(h, &value, &id)) {
mXPUSHi((IV)value);
mXPUSHu((UV)id);
}
PREINIT:
EXTRACT_HANDLE("Data::ReqRep::Shared::Int", self);
double timeout = -1;
int64_t value;
uint64_t id;
PPCODE:
if (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) timeout = SvNV(ST(1));
REEXTRACT_HANDLE("Data::ReqRep::Shared::Int", self);
if (reqrep_int_recv_wait(h, &value, &id, timeout)) {
mXPUSHi((IV)value);
mXPUSHu((UV)id);
view all matches for this distribution
view release on metacpan or search on metacpan
void
sample(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
uint64_t k = h->k, isz = h->stride, cnt, i; /* cached geometry: alloc + copy agree */
uint8_t *buf;
/* worst-case snapshot buffer (k slots) allocated BEFORE the lock */
Newx(buf, (size_t)(k * isz), uint8_t); SAVEFREEPV(buf);
view all matches for this distribution
view release on metacpan or search on metacpan
void
pop_min(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
int64_t m; double s; int ok;
ss_rwlock_wrlock(h);
ok = ss_pop_locked(h, 0, &m, &s);
if (ok) __atomic_fetch_add(&h->hdr->stat_ops, 1, __ATOMIC_RELAXED);
void
pop_max(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
int64_t m; double s; int ok;
ss_rwlock_wrlock(h);
ok = ss_pop_locked(h, 1, &m, &s);
if (ok) __atomic_fetch_add(&h->hdr->stat_ops, 1, __ATOMIC_RELAXED);
SV *self
IV start
IV stop
PREINIT:
EXTRACT(self);
PPCODE:
int ws = 0;
ss_parse_range_opts(aTHX_ &ST(0), 3, items, &ws, NULL, NULL);
REEXTRACT(self);
ss_rwlock_rdlock(h);
{
SV *self
IV start
IV stop
PREINIT:
EXTRACT(self);
PPCODE:
int ws = 0;
ss_parse_range_opts(aTHX_ &ST(0), 3, items, &ws, NULL, NULL);
REEXTRACT(self);
ss_rwlock_rdlock(h);
{
SV *self
NV min
NV max
PREINIT:
EXTRACT(self);
PPCODE:
int ws = 0; IV limit = -1, offset = 0;
ss_parse_range_opts(aTHX_ &ST(0), 3, items, &ws, &limit, &offset);
REEXTRACT(self);
ss_rwlock_rdlock(h);
{
SV *self
NV max
NV min
PREINIT:
EXTRACT(self);
PPCODE:
int ws = 0; IV limit = -1, offset = 0;
ss_parse_range_opts(aTHX_ &ST(0), 3, items, &ws, &limit, &offset);
REEXTRACT(self);
ss_rwlock_rdlock(h);
{
void
peek_min(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
ss_rwlock_rdlock(h);
if (h->hdr->root != SS_NONE && ss_node_ok(h, h->hdr->leftmost)) {
SsNode *nd = &h->nodes[h->hdr->leftmost];
IV m = (IV)nd->members[0]; NV s = nd->scores[0];
ss_rwlock_rdunlock(h);
void
peek_max(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
ss_rwlock_rdlock(h);
if (h->hdr->root != SS_NONE && ss_node_ok(h, h->hdr->rightmost)) {
SsNode *nd = &h->nodes[h->hdr->rightmost];
IV m = (IV)nd->members[nd->num - 1]; NV s = nd->scores[nd->num - 1];
ss_rwlock_rdunlock(h);
view all matches for this distribution
view release on metacpan or search on metacpan
void
world(self)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
if (h->wrap) {
int dims = (h->hdr->world[2] > 0.0) ? 3 : 2;
EXTEND(SP, dims);
for (int i = 0; i < dims; i++) PUSHs(sv_2mortal(newSVnv(h->hdr->world[i])));
}
insert_many(self, rows)
SV *self
SV *rows
PREINIT:
EXTRACT(self);
PPCODE:
SvGETMAGIC(rows);
if (!SvROK(rows) || SvTYPE(SvRV(rows)) != SVt_PVAV)
croak("insert_many: expected an arrayref of [x,y,value] or [x,y,value,radius]");
{
AV *av = (AV *)SvRV(rows);
SV *self
UV handle
PREINIT:
EXTRACT(self);
double px, py, pz;
PPCODE:
sph_rwlock_rdlock(h);
REQUIRE_LIVE_RD(h, sph_idx(handle));
px = h->entries[sph_idx(handle)].pos[0];
py = h->entries[sph_idx(handle)].pos[1];
pz = h->entries[sph_idx(handle)].pos[2];
SV *self
NV x
NV y
PREINIT:
EXTRACT(self);
PPCODE:
if (items != 3 && items != 4) croak("query_cell: (x,y) or (x,y,z)");
int dims = (items == 4) ? 3 : 2;
double p[3] = { x, y, dims==3 ? (double)SvNV(ST(3)) : 0 };
REEXTRACT(self);
EMIT_QUERY(sph_query_cell(h, p, dims, &col));
void
query_aabb(self, ...)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
double lo[3], hi[3]; int dims;
if (items == 5) { dims = 2;
lo[0]=SvNV(ST(1)); lo[1]=SvNV(ST(2)); hi[0]=SvNV(ST(3)); hi[1]=SvNV(ST(4)); lo[2]=hi[2]=0;
} else if (items == 7) { dims = 3;
lo[0]=SvNV(ST(1)); lo[1]=SvNV(ST(2)); lo[2]=SvNV(ST(3));
void
query_radius(self, ...)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
double c[3] = {0,0,0}, r; int dims;
if (items == 4) { dims = 2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); r=SvNV(ST(3)); }
else if (items == 5) { dims = 3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); r=SvNV(ST(4)); }
else croak("query_radius: (x,y,r) or (x,y,z,r)");
if (r < 0 || !isfinite(r)) croak("query_radius: r must be a finite number >= 0");
SV *self
UV handle
PREINIT:
EXTRACT(self);
double p[3], lat, lon, alt;
PPCODE:
if (!(h->hdr->sphere_radius > 0.0)) croak("position_geo: map was not created with sphere => R");
sph_rwlock_rdlock(h);
REQUIRE_LIVE_RD(h, sph_idx(handle));
p[0] = h->entries[sph_idx(handle)].pos[0];
p[1] = h->entries[sph_idx(handle)].pos[1];
NV alt
NV dist
PREINIT:
EXTRACT(self);
double c[3];
PPCODE:
if (!(h->hdr->sphere_radius > 0.0)) croak("query_geo_radius: map was not created with sphere => R");
if (dist < 0 || !isfinite(dist)) croak("query_geo_radius: dist must be a finite number >= 0");
sph_geo_to_xyz(h->hdr->sphere_radius, lat, lon, alt, c);
EMIT_QUERY(sph_query_radius(h, c, (double)dist, 3, &col));
SV *self
UV cell
PREINIT:
EXTRACT(self);
double d[3];
PPCODE:
(void)h;
if (!sph_cube_valid((uint64_t)cell)) croak("cube_center: not a valid cube cell id");
sph_cube_center((uint64_t)cell, d);
EXTEND(SP, 3);
PUSHs(sv_2mortal(newSVnv(d[0])));
SV *self
UV cell
PREINIT:
EXTRACT(self);
double d[3], lat, lon, alt;
PPCODE:
(void)h;
if (!sph_cube_valid((uint64_t)cell)) croak("cube_center_geo: not a valid cube cell id");
sph_cube_center((uint64_t)cell, d);
sph_geo_of_xyz(1.0, d, &lat, &lon, &alt);
EXTEND(SP, 2);
SV *self
UV cell
PREINIT:
EXTRACT(self);
uint64_t kids[4];
PPCODE:
(void)h;
if (!sph_cube_valid((uint64_t)cell)) croak("cube_children: not a valid cube cell id");
if (sph_cube_children((uint64_t)cell, kids)) {
EXTEND(SP, 4);
for (int k = 0; k < 4; k++) PUSHs(sv_2mortal(newSVuv((UV)kids[k])));
SV *self
UV cell
PREINIT:
EXTRACT(self);
uint64_t nb[4];
PPCODE:
(void)h;
if (!sph_cube_valid((uint64_t)cell)) croak("cube_neighbors: not a valid cube cell id");
sph_cube_neighbors((uint64_t)cell, nb);
EXTEND(SP, 4);
for (int k = 0; k < 4; k++) PUSHs(sv_2mortal(newSVuv((UV)nb[k])));
void query_knn(self, ...)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
double c[3] = {0,0,0}; uint32_t k; int dims; IV kiv;
if (items == 4) { dims = 2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); kiv=SvIV(ST(3)); }
else if (items == 5) { dims = 3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); kiv=SvIV(ST(4)); }
else croak("query_knn: (x,y,k) or (x,y,z,k)");
if (kiv < 1) croak("query_knn: k must be >= 1"); /* SvIV so a negative k is caught (SvUV would wrap it to a huge k) */
void each_in_radius(self, ...)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
/* items: self,x,y,r,cb (5)=2D ; self,x,y,z,r,cb (6)=3D. cb is last. */
double c[3] = {0,0,0}, r; int dims; SV *cb;
if (items == 5) { dims=2; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); r=SvNV(ST(3)); cb=ST(4); }
else if (items == 6) { dims=3; c[0]=SvNV(ST(1)); c[1]=SvNV(ST(2)); c[2]=SvNV(ST(3)); r=SvNV(ST(4)); cb=ST(5); }
else croak("each_in_radius: (x,y,r,cb) or (x,y,z,r,cb)");
SV *self
NV max_r
SV *cb
PREINIT:
EXTRACT(self);
PPCODE:
SvGETMAGIC(cb); /* a tied/overloaded scalar may FETCH to a coderef */
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_pair_within: last arg must be a coderef");
if (max_r < 0 || !isfinite(max_r)) croak("each_pair_within: max_r must be a finite number >= 0");
REEXTRACT(self);
EMIT_PAIRS(sph_pairs(h, (double)max_r, sph_pair_to_collect, &col));
each_colliding_pair(self, cb)
SV *self
SV *cb
PREINIT:
EXTRACT(self);
PPCODE:
SvGETMAGIC(cb); /* a tied/overloaded scalar may FETCH to a coderef */
if (!SvROK(cb) || SvTYPE(SvRV(cb)) != SVt_PVCV) croak("each_colliding_pair: arg must be a coderef");
REEXTRACT(self);
EMIT_PAIRS(sph_pairs(h, -1.0, sph_pair_to_collect, &col));
view all matches for this distribution
view release on metacpan or search on metacpan
deref(...)
PREINIT:
I32 i, n = 0;
I32 sref;
SV *sv;
PPCODE:
sref = (GIMME == G_SCALAR) && (PL_op->op_flags & OPf_REF);
for (i = 0; i < items; i++) {
if (!SvROK(ST(i))) {
STRLEN z;
if (SvOK(ST(i)))
view all matches for this distribution
view release on metacpan or search on metacpan
advance(self, ticks = 1)
SV *self
IV ticks
PREINIT:
EXTRACT(self);
PPCODE:
{
REEXTRACT(self); /* `ticks = 1` is converted after PREINIT, so its magic already ran */
uint64_t *out = NULL, fired = 0, i, cap = h->capacity;
/* signed: reject a negative tick count (would UV-wrap to ~2^64 and spin the
* per-tick loop under the write lock, wedging every sharer) */
view all matches for this distribution
view release on metacpan or search on metacpan
void
top(self, ...)
SV *self
PREINIT:
EXTRACT(self);
PPCODE:
{
UV k = (items > 1 && (SvGETMAGIC(ST(1)), SvOK(ST(1)))) ? SvUV(ST(1)) : 0; /* optional; undef/omitted = 0 = all */
TkEnt *ents = NULL;
char *keys = NULL;
REEXTRACT(self);
view all matches for this distribution
view release on metacpan or search on metacpan
SV *uu2_sv;
PROTOTYPE: $$
PREINIT:
uuid_t uu1;
uuid_t uu2;
PPCODE:
if ( sv_to_uuid(uu1_sv, uu1) && sv_to_uuid(uu2_sv, uu2) )
if ( uuid_compare(uu1, uu2) == 0 )
XSRETURN_YES;
else
XSRETURN_NO;
SV *uu2_sv;
PROTOTYPE: $$
PREINIT:
uuid_t uu1;
uuid_t uu2;
PPCODE:
if ( sv_to_uuid(uu1_sv, uu1) && sv_to_uuid(uu2_sv, uu2) )
XSRETURN_IV(uuid_compare(uu1, uu2));
else
XSRETURN_UNDEF;
view all matches for this distribution
view release on metacpan or search on metacpan
perl_uuid_time_t timestamp;
unsigned16 clockseq;
perl_uuid_t uuid;
FILE *fd;
mode_t mask;
PPCODE:
clockseq = self->state.cs;
get_current_time(×tamp);
if ( self->state.ts == I64(0) ||
memcmp(&(self->nodeid), &(self->state.node), sizeof(uuid_node_t)))
clockseq = true_random();
PREINIT:
SV *ctx;
unsigned char hash[16];
perl_uuid_t net_nsid;
perl_uuid_t uuid;
PPCODE:
net_nsid = *nsid;
net_nsid.time_low = htonl(net_nsid.time_low);
net_nsid.time_mid = htons(net_nsid.time_mid);
net_nsid.time_hi_and_version = htons(net_nsid.time_hi_and_version);
uuid_context_t *self;
perl_uuid_t *uuid;
ALIAS:
Data::UUID::to_hexstring = F_HEX
Data::UUID::to_b64string = F_B64
PPCODE:
ST(0) = make_ret(*uuid, ix ? ix : F_STR);
XSRETURN(1);
void
from_string(self,str)
perl_uuid_t uuid;
char *from, *to;
int c;
unsigned int i;
unsigned char buf[4];
PPCODE:
switch(ix) {
case F_BIN:
case F_STR:
case F_HEX:
from = str;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Data/Util.xs view on Meta::CPAN
get_code_info(code)
CV* code
PREINIT:
GV* gv;
HV* stash;
PPCODE:
if( (gv = CvGV(code)) && isGV_with_GP(gv)
&& (stash = (GvSTASH(gv))) && HvNAME_get(stash) ){
if(GIMME_V == G_ARRAY){
EXTEND(SP, 2);
lib/Data/Util.xs view on Meta::CPAN
*/
MAGIC* mg;
AV* modifiers; /* (before, around, after, original, current) */
SV* property;
const char* property_pv;
PPCODE:
mg = mg_find_by_vtbl((SV*)code, &modified_vtbl);
if(items == 1){ /* check only */
ST(0) = boolSV(mg);
XSRETURN(1);
view all matches for this distribution
view release on metacpan or search on metacpan
void
DateCalc_Days_in_Year(year,month)
Z_int year
Z_int month
PPCODE:
{
if (year > 0)
{
if ((month >= 1) and (month <= 12))
{
void
DateCalc_Days_in_Month(year,month)
Z_int year
Z_int month
PPCODE:
{
if (year > 0)
{
if ((month >= 1) and (month <= 12))
{
void
DateCalc_Week_of_Year(year,month,day)
Z_int year
Z_int month
Z_int day
PPCODE:
{
Z_int week;
if (DateCalc_week_of_year(&week,&year,month,day))
{
void
DateCalc_Monday_of_Week(week,year)
Z_int week
Z_int year
PPCODE:
{
Z_int month;
Z_int day;
if (year > 0)
DateCalc_Nth_Weekday_of_Month_Year(year,month,dow,n)
Z_int year
Z_int month
Z_int dow
Z_int n
PPCODE:
{
Z_int day;
if (year > 0)
{
void
DateCalc_Standard_to_Business(year,month,day)
Z_int year
Z_int month
Z_int day
PPCODE:
{
Z_int week;
Z_int dow;
if (DateCalc_standard_to_business(&year,&week,&dow,month,day))
void
DateCalc_Business_to_Standard(year,week,dow)
Z_int year
Z_int week
Z_int dow
PPCODE:
{
Z_int month;
Z_int day;
if (DateCalc_business_to_standard(&year,&month,&day,week,dow))
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_long Dd;
Z_int Dh;
Z_int Dm;
Z_int Ds;
Z_int month1
Z_int day1
Z_int year2
Z_int month2
Z_int day2
PPCODE:
{
if (DateCalc_delta_ymd(&year1,&month1,&day1, year2,month2,day2))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year1)));
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_int D_y;
Z_int D_m;
Z_int D_d;
Z_int Dh;
Z_int month1
Z_int day1
Z_int year2
Z_int month2
Z_int day2
PPCODE:
{
if (DateCalc_norm_delta_ymd(&year1,&month1,&day1, year2,month2,day2))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year1)));
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_int D_y;
Z_int D_m;
Z_int D_d;
Z_int Dhh;
DateCalc_Normalize_DHMS(Dd,Dh,Dm,Ds)
Z_long Dd
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
DateCalc_Normalize_DHMS(&Dd,&Dh,&Dm,&Ds);
EXTEND(sp,4);
PUSHs(sv_2mortal(newSViv((IV)Dd)));
PUSHs(sv_2mortal(newSViv((IV)Dh)));
DateCalc_Add_Delta_Days(year,month,day, Dd)
Z_int year
Z_int month
Z_int day
Z_long Dd
PPCODE:
{
if (DateCalc_add_delta_days(&year,&month,&day, Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
Z_int sec
Z_long Dd
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
Z_int year
Z_int month
Z_int day
Z_long Dy
Z_long Dm
PPCODE:
{
if (DateCalc_add_delta_ym(&year,&month,&day, Dy,Dm))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
Z_int month
Z_int day
Z_long Dy
Z_long Dm
Z_long Dd
PPCODE:
{
if (DateCalc_add_delta_ymd(&year,&month,&day, Dy,Dm,Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
Z_long D_m
Z_long D_d
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
Z_int month
Z_int day
Z_long Dy
Z_long Dm
Z_long Dd
PPCODE:
{
if (DateCalc_add_norm_delta_ymd(&year,&month,&day, Dy,Dm,Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
Z_long D_m
Z_long D_d
Z_long Dhh
Z_long Dmm
Z_long Dss
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
}
void
DateCalc_System_Clock(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
}
void
DateCalc_Today(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
}
void
DateCalc_Now(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
}
void
DateCalc_Today_and_Now(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
}
void
DateCalc_This_Year(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
}
void
DateCalc_Gmtime(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
}
void
DateCalc_Localtime(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
Z_int month
Z_int day
Z_int hour
Z_int min
Z_int sec
PPCODE:
{
time_t seconds;
if (DateCalc_mktime(&seconds, year,month,day, hour,min,sec, -1,-1,-1))
{
}
void
DateCalc_Timezone(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_when;
#endif
time_t when;
Z_int month
Z_int day
Z_int hour
Z_int min
Z_int sec
PPCODE:
{
time_t seconds;
if (DateCalc_date2time(&seconds, year,month,day, hour,min,sec))
{
}
void
DateCalc_Time_to_Date(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
void
DateCalc_Easter_Sunday(year)
Z_int year
PPCODE:
{
Z_int month;
Z_int day;
if ((year > 0) and DateCalc_easter_sunday(&year,&month,&day))
}
void
DateCalc_Decode_Month(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
}
void
DateCalc_Decode_Day_of_Week(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
RETVAL
void
DateCalc_Decode_Date_EU(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
Z_int year;
}
void
DateCalc_Decode_Date_US(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
Z_int year;
void
DateCalc_Uncompress(date)
Z_int date
PPCODE:
{
Z_int century;
Z_int year;
Z_int month;
Z_int day;
Z_int date
void
DateCalc_Compressed_to_Text(...)
PPCODE:
{
charptr string;
Z_int date;
Z_int lang;
}
void
DateCalc_Date_to_Text(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
Z_int day;
}
void
DateCalc_Date_to_Text_Long(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
Z_int day;
void
DateCalc_English_Ordinal(number)
Z_int number
PPCODE:
{
blockdef(string,64);
DateCalc_English_Ordinal(string,number);
EXTEND(sp,1);
}
void
DateCalc_Calendar(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
boolean orthodox;
}
void
DateCalc_Month_to_Text(...)
PPCODE:
{
Z_int month;
Z_int lang = 0;
if ((items == 1) or (items == 2))
}
void
DateCalc_Day_of_Week_to_Text(...)
PPCODE:
{
Z_int dow;
Z_int lang = 0;
if ((items == 1) or (items == 2))
}
void
DateCalc_Day_of_Week_Abbreviation(...)
PPCODE:
{
blockdef(buffer,4);
Z_int dow;
Z_int lang = 0;
void
DateCalc_Language_to_Text(lang)
Z_int lang
PPCODE:
{
if ((lang >= 1) and (lang <= DateCalc_LANGUAGES))
{
EXTEND(sp,1);
PUSHs(sv_2mortal(newSVpv((char *)DateCalc_Language_to_Text_[lang],0)));
void
DateCalc_ISO_LC(scalar)
SV * scalar
PPCODE:
{
charptr string;
charptr buffer;
N_int length;
N_int index;
void
DateCalc_ISO_UC(scalar)
SV * scalar
PPCODE:
{
charptr string;
charptr buffer;
N_int length;
N_int index;
}
void
DateCalc_Version()
PPCODE:
{
charptr string;
string = DateCalc_Version();
if (string != NULL)
view all matches for this distribution
view release on metacpan or search on metacpan
void
expand_recurrence(rule, start=0, count=INT_MAX)
const char * rule
int start
int count
PPCODE:
struct icalrecurrencetype recur, err;
icalrecur_iterator *ritr;
struct icaltimetype icstart, next;
icalrecurrencetype_clear(&err);
view all matches for this distribution
view release on metacpan or search on metacpan
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Days_in_Year(year,month)
Z_int year
Z_int month
PPCODE:
{
if (year > 0)
{
if ((month >= 1) and (month <= 12))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Days_in_Month(year,month)
Z_int year
Z_int month
PPCODE:
{
if (year > 0)
{
if ((month >= 1) and (month <= 12))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Week_of_Year(year,month,day)
Z_int year
Z_int month
Z_int day
PPCODE:
{
Z_int week;
if (DateCalc_week_of_year(&week,&year,month,day))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Monday_of_Week(week,year)
Z_int week
Z_int year
PPCODE:
{
Z_int month;
Z_int day;
if (year > 0)
src/C_XS/Pcalc.xs view on Meta::CPAN
DateCalc_Nth_Weekday_of_Month_Year(year,month,dow,n)
Z_int year
Z_int month
Z_int dow
Z_int n
PPCODE:
{
Z_int day;
if (year > 0)
{
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Standard_to_Business(year,month,day)
Z_int year
Z_int month
Z_int day
PPCODE:
{
Z_int week;
Z_int dow;
if (DateCalc_standard_to_business(&year,&week,&dow,month,day))
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Business_to_Standard(year,week,dow)
Z_int year
Z_int week
Z_int dow
PPCODE:
{
Z_int month;
Z_int day;
if (DateCalc_business_to_standard(&year,&month,&day,week,dow))
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_long Dd;
Z_int Dh;
Z_int Dm;
Z_int Ds;
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month1
Z_int day1
Z_int year2
Z_int month2
Z_int day2
PPCODE:
{
if (DateCalc_delta_ymd(&year1,&month1,&day1, year2,month2,day2))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year1)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_int D_y;
Z_int D_m;
Z_int D_d;
Z_int Dh;
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month1
Z_int day1
Z_int year2
Z_int month2
Z_int day2
PPCODE:
{
if (DateCalc_norm_delta_ymd(&year1,&month1,&day1, year2,month2,day2))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year1)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month2
Z_int day2
Z_int hour2
Z_int min2
Z_int sec2
PPCODE:
{
Z_int D_y;
Z_int D_m;
Z_int D_d;
Z_int Dhh;
src/C_XS/Pcalc.xs view on Meta::CPAN
DateCalc_Normalize_DHMS(Dd,Dh,Dm,Ds)
Z_long Dd
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
DateCalc_Normalize_DHMS(&Dd,&Dh,&Dm,&Ds);
EXTEND(sp,4);
PUSHs(sv_2mortal(newSViv((IV)Dd)));
PUSHs(sv_2mortal(newSViv((IV)Dh)));
src/C_XS/Pcalc.xs view on Meta::CPAN
DateCalc_Add_Delta_Days(year,month,day, Dd)
Z_int year
Z_int month
Z_int day
Z_long Dd
PPCODE:
{
if (DateCalc_add_delta_days(&year,&month,&day, Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int sec
Z_long Dd
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int year
Z_int month
Z_int day
Z_long Dy
Z_long Dm
PPCODE:
{
if (DateCalc_add_delta_ym(&year,&month,&day, Dy,Dm))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month
Z_int day
Z_long Dy
Z_long Dm
Z_long Dd
PPCODE:
{
if (DateCalc_add_delta_ymd(&year,&month,&day, Dy,Dm,Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_long D_m
Z_long D_d
Z_long Dh
Z_long Dm
Z_long Ds
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month
Z_int day
Z_long Dy
Z_long Dm
Z_long Dd
PPCODE:
{
if (DateCalc_add_norm_delta_ymd(&year,&month,&day, Dy,Dm,Dd))
{
EXTEND(sp,3);
PUSHs(sv_2mortal(newSViv((IV)year)));
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_long D_m
Z_long D_d
Z_long Dhh
Z_long Dmm
Z_long Dss
PPCODE:
{
if (DateCalc_check_date(year,month,day))
{
if (DateCalc_check_time(hour,min,sec))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_System_Clock(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Today(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Now(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Today_and_Now(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_This_Year(...)
PPCODE:
{
Z_int year;
Z_int month;
Z_int day;
Z_int hour;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Gmtime(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Localtime(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month
Z_int day
Z_int hour
Z_int min
Z_int sec
PPCODE:
{
time_t seconds;
if (DateCalc_mktime(&seconds, year,month,day, hour,min,sec, -1,-1,-1))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Timezone(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_when;
#endif
time_t when;
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int month
Z_int day
Z_int hour
Z_int min
Z_int sec
PPCODE:
{
time_t seconds;
if (DateCalc_date2time(&seconds, year,month,day, hour,min,sec))
{
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Time_to_Date(...)
PPCODE:
{
#ifdef MACOS_TRADITIONAL
double f_seconds;
#endif
time_t seconds;
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Easter_Sunday(year)
Z_int year
PPCODE:
{
Z_int month;
Z_int day;
if ((year > 0) and DateCalc_easter_sunday(&year,&month,&day))
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Decode_Month(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Decode_Day_of_Week(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
src/C_XS/Pcalc.xs view on Meta::CPAN
RETVAL
void
DateCalc_Decode_Date_EU(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
Z_int year;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Decode_Date_US(...)
PPCODE:
{
charptr string;
N_int length;
Z_int lang;
Z_int year;
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Uncompress(date)
Z_int date
PPCODE:
{
Z_int century;
Z_int year;
Z_int month;
Z_int day;
src/C_XS/Pcalc.xs view on Meta::CPAN
Z_int date
void
DateCalc_Compressed_to_Text(...)
PPCODE:
{
charptr string;
Z_int date;
Z_int lang;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Date_to_Text(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
Z_int day;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Date_to_Text_Long(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
Z_int day;
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_English_Ordinal(number)
Z_int number
PPCODE:
{
blockdef(string,64);
DateCalc_English_Ordinal(string,number);
EXTEND(sp,1);
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Calendar(...)
PPCODE:
{
charptr string;
Z_int year;
Z_int month;
boolean orthodox;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Month_to_Text(...)
PPCODE:
{
Z_int month;
Z_int lang = 0;
if ((items == 1) or (items == 2))
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Day_of_Week_to_Text(...)
PPCODE:
{
Z_int dow;
Z_int lang = 0;
if ((items == 1) or (items == 2))
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Day_of_Week_Abbreviation(...)
PPCODE:
{
blockdef(buffer,4);
Z_int dow;
Z_int lang = 0;
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_Language_to_Text(lang)
Z_int lang
PPCODE:
{
if ((lang >= 1) and (lang <= DateCalc_LANGUAGES))
{
EXTEND(sp,1);
PUSHs(sv_2mortal(newSVpv((char *)DateCalc_Language_to_Text_[lang],0)));
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_ISO_LC(scalar)
SV * scalar
PPCODE:
{
charptr string;
charptr buffer;
N_int length;
N_int index;
src/C_XS/Pcalc.xs view on Meta::CPAN
void
DateCalc_ISO_UC(scalar)
SV * scalar
PPCODE:
{
charptr string;
charptr buffer;
N_int length;
N_int index;
src/C_XS/Pcalc.xs view on Meta::CPAN
}
void
DateCalc_Version()
PPCODE:
{
charptr string;
string = DateCalc_Version();
if (string != NULL)
view all matches for this distribution
view release on metacpan or search on metacpan
RETVAL
void
days_to_ymd(days)
IV days
PPCODE:
{
IV ymd[3];
days_to_ymd (days, ymd);
EXTEND (sp, 3);
PUSHs (sv_2mortal (newSViv (ymd[0])));
RETVAL
void
as_ymd(date)
SV* date
PPCODE:
{
IV ymd[3];
if (! SvROK (date))
XSRETURN_EMPTY;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/DateTime/Astro.xs view on Meta::CPAN
DT_Astro_gregorian_components_from_rd(rd)
long rd;
PREINIT:
long y;
int m, d;
PPCODE:
EXTEND(SP, 3);
gregorian_components_from_rd(rd, &y, &m, &d);
mPUSHi(y);
mPUSHi(m);
lib/DateTime/Astro.xs view on Meta::CPAN
DT_Astro_ymd_seconds_from_moment(moment)
SV_TO_MPFR moment;
PREINIT:
long y;
int m, d, s;
PPCODE:
ymd_seconds_from_moment( &moment, &y, &m, &d, &s );
mpfr_clear(moment);
EXTEND(SP, 4);
mPUSHi(y);
view all matches for this distribution
view release on metacpan or search on metacpan
DateTime-Lite.xs view on Meta::CPAN
IV quarter;
IV yadj = 0;
IV dow, doy, doq;
IV rd_days;
PPCODE:
rd_days = d;
d += MARCH_1;
if( d <= 0 )
DateTime-Lite.xs view on Meta::CPAN
IV d;
PREINIT:
IV adj;
PPCODE:
if( m <= 2 )
{
adj = (14 - m) / 12;
y -= adj;
m += 12 * adj;
DateTime-Lite.xs view on Meta::CPAN
IV secs_modifier;
PREINIT:
IV h, m, s;
PPCODE:
secs -= secs_modifier;
h = secs / 3600;
secs -= h * 3600;
DateTime-Lite.xs view on Meta::CPAN
_time_as_seconds(self, h, m, s)
IV h;
IV m;
IV s;
PPCODE:
EXTEND(SP, 1);
mPUSHi(h * 3600 + m * 60 + s);
# Leap year / leap second helpers
void
_is_leap_year(self, y)
IV y;
PPCODE:
EXTEND(SP, 1);
mPUSHi(_real_is_leap_year(y));
void
_day_length(self, utc_rd)
IV utc_rd;
PPCODE:
IV day_length;
SET_DAY_LENGTH(utc_rd, day_length);
EXTEND(SP, 1);
mPUSHi(day_length);
void
_day_has_leap_second(self, utc_rd)
IV utc_rd;
PPCODE:
IV day_length;
SET_DAY_LENGTH(utc_rd, day_length);
EXTEND(SP, 1);
mPUSHi(day_length > SECONDS_PER_DAY ? 1 : 0);
void
_accumulated_leap_seconds(self, utc_rd)
IV utc_rd;
PPCODE:
IV leap_seconds;
SET_LEAP_SECONDS(utc_rd, leap_seconds);
EXTEND(SP, 1);
mPUSHi(leap_seconds);
DateTime-Lite.xs view on Meta::CPAN
void
_normalize_tai_seconds(self, days, secs)
SV* days;
SV* secs;
PPCODE:
if( dtl_isfinite(SvNV(days)) && dtl_isfinite(SvNV(secs)) )
{
IV d = SvIV(days);
IV s = SvIV(secs);
IV adj;
DateTime-Lite.xs view on Meta::CPAN
void
_normalize_leap_seconds(self, days, secs)
SV* days;
SV* secs;
PPCODE:
if( dtl_isfinite(SvNV(days)) && dtl_isfinite(SvNV(secs)) )
{
IV d = SvIV(days);
IV s = SvIV(secs);
IV day_length;
DateTime-Lite.xs view on Meta::CPAN
IV epoch;
PREINIT:
IV d, s;
PPCODE:
d = epoch / SECONDS_PER_DAY;
s = epoch - d * SECONDS_PER_DAY;
if( s < 0 )
{
DateTime-Lite.xs view on Meta::CPAN
void
_normalize_nanoseconds(self, secs, nanosecs)
SV* secs;
SV* nanosecs;
PPCODE:
{
IV s = SvIV(secs);
IV ns = SvIV(nanosecs);
IV overflow;
view all matches for this distribution
view release on metacpan or search on metacpan
DateTime.xs view on Meta::CPAN
IV quarter;
IV yadj = 0;
IV dow, doy, doq;
IV rd_days;
PPCODE:
rd_days = d;
d += MARCH_1;
if (d <= 0) {
DateTime.xs view on Meta::CPAN
IV d;
PREINIT:
IV adj;
PPCODE:
if (m <= 2) {
adj = (14 - m) / 12;
y -= adj;
m += 12 * adj;
} else if (m > 14) {
DateTime.xs view on Meta::CPAN
IV secs_modifier;
PREINIT:
IV h, m, s;
PPCODE:
secs -= secs_modifier;
h = secs / 3600;
secs -= h * 3600;
DateTime.xs view on Meta::CPAN
void
_normalize_tai_seconds(self, days, secs)
SV* days;
SV* secs;
PPCODE:
if (dt_isfinite(SvNV(days)) && dt_isfinite(SvNV(secs))) {
IV d = SvIV(days);
IV s = SvIV(secs);
IV adj;
DateTime.xs view on Meta::CPAN
void
_normalize_leap_seconds(self, days, secs)
SV* days;
SV* secs;
PPCODE:
if (dt_isfinite(SvNV(days)) && dt_isfinite(SvNV(secs))) {
IV d = SvIV(days);
IV s = SvIV(secs);
IV day_length;
DateTime.xs view on Meta::CPAN
_time_as_seconds(self, h, m, s)
IV h;
IV m;
IV s;
PPCODE:
EXTEND(SP, 1);
mPUSHi(h * 3600 + m * 60 + s);
void
_is_leap_year(self, y)
IV y;
PPCODE:
EXTEND(SP, 1);
mPUSHi(_real_is_leap_year(y));
void
_day_length(self, utc_rd)
IV utc_rd;
PPCODE:
IV day_length;
SET_DAY_LENGTH(utc_rd, day_length);
EXTEND(SP, 1);
mPUSHi(day_length);
void
_day_has_leap_second(self, utc_rd)
IV utc_rd;
PPCODE:
IV day_length;
SET_DAY_LENGTH(utc_rd, day_length);
EXTEND(SP, 1);
mPUSHi(day_length > 86400 ? 1 : 0);
void
_accumulated_leap_seconds(self, utc_rd)
IV utc_rd;
PPCODE:
IV leap_seconds;
SET_LEAP_SECONDS(utc_rd, leap_seconds);
EXTEND(SP, 1);
mPUSHi(leap_seconds);
view all matches for this distribution
view release on metacpan or search on metacpan
# custom GetDODA returns values as list type
#
void
MyGetDODA(datano)
COUNT datano
PPCODE:
DATOBJ doda[100];
int i=0;
i=GetDODA(datano,sizeof(DATOBJ)*100,doda,SCHEMA_DODA);
if (i)
for(i=0; i<100 ; i++)
view all matches for this distribution
view release on metacpan or search on metacpan
_str2list = 1
GTM::gvn2list = 2
GTM::_str2list = 3
GtmEnvPtr::gvn2list = 4
GtmEnvPtr::_str2list = 5
PPCODE:
{
cppack *start = NULL, *next; SV *ret; unsigned s , x; char *glvn;
s = (ix < 4) ? 0 : 1; if(items < s) XSRETURN_UNDEF;
start = unpackgvn( SvPV(ST(s),x) ); while(start) {
ret = sv_newmortal(); sv_setpv(ret, start->loc); XPUSHs(ret);
GTM::list2gvn = 2
GTM::_list2str = 3
GtmEnvPtr::list2gvn = 4
GtmEnvPtr::_list2str = 5
GtmEnvPtr::node = 6
PPCODE:
{
strpack *args;
GtmEnv *pfx = (ix<4) ? NULL : (GtmEnv *)SvIV((SV*)SvRV(ST(0)));
unsigned i,s = (ix<4) ? 0 : 1, n; SV *ret;
gtm_string_t value, glvn;
} else PUSHs(&PL_sv_undef);
}
void
END()
PPCODE:
{
if( _GTMinvoc ) {
gtm_exit();
#ifdef _GT_NEED_TERMFIX
tcsetattr(STDIN_FILENO,0,_GTMterm); free(_GTMterm);
MODULE = Db::GTM PACKAGE = GtmEnvPtr
void
DESTROY(gt_env)
GtmEnv *gt_env
PPCODE:
{
gtenv_clear(gt_env);
}
void
ALIAS:
retrieve = 1
FETCH = 2
EXISTS = 3
exists = 4
PPCODE:
{
strpack *args; unsigned i;
unsigned long exst=0,n; gtm_string_t value,glvn;
SV *ret=sv_newmortal(); EXTEND(SP, 1);
set(gt_env,...)
GtmEnv *gt_env
ALIAS:
store = 1
STORE = 2
PPCODE:
{
strpack *args; unsigned i,n; gtm_string_t glvn;
if(items>2) {
args = (strpack *)calloc(items-2,sizeof(strpack));
FIRSTKEY = 4
haschildren = 5
last = 6
revorder = 7
prev = 8
PPCODE:
{
strpack *args,*x; unsigned i, aq=0,n; int dir=(ix>5)?-1:1; SV *ret;
char *addquot=""; gtm_string_t value, glvn;
if( GIMME_V==G_VOID ) XSRETURN_UNDEF;
ALIAS:
DELETE = 1
CLEAR = 2
ks = 3
kv = 4
PPCODE:
{
strpack *args; unsigned i,n; gtm_string_t glvn;
if(items>1) {
args = (strpack *)calloc(items-1,sizeof(strpack));
}
void
query(gt_env,...)
GtmEnv *gt_env
PPCODE:
{
SV *ret; char **brk;
strpack *args; cppack *start=NULL,*next; gtm_string_t value, glvn;
unsigned i,z,n;
}
void
children(gt_env,...)
GtmEnv *gt_env
PPCODE:
{
char *end="\")\x00\x00",*loc; unsigned count=0,n,kids=0,base;
strpack *args; gtm_string_t value,glvn,buf;
if( GIMME_V==G_VOID ) XSRETURN_UNDEF;
GTM::clobber = 6
GTMDB::clobber = 10
overwrite = 3
GTM::overwrite = 7
GTMDB::overwrite = 11
PPCODE:
{
strpack *args; unsigned i,mid=0,ov=(ix & 2)?1:0,ob=(ix<4)?1:0,s=1,d=1;
GtmEnv *gt_env = (ob) ? (GtmEnv *)SvIV((SV*)SvRV(ST(0))) : NULL;
gtm_string_t src, dst; unsigned fs, fd; strpack value; SV *ret;
txnstart(gt_env)
GtmEnv *gt_env
ALIAS:
txnabort = 1
txncommit = 2
PPCODE:
{
EXTEND(SP,1); switch(ix) {
case 0: gt_env->flags |= IN_TXN; break;
case 1: if(inTxn(gt_env)) {
gt_env->last_err = gtm_ci("tabort",gt_env->gtmEnvId);
}
void
lock(gt_env,...)
GtmEnv *gt_env
PPCODE:
{
strpack *args; unsigned i,n; gtm_string_t glvn;
gtm_long_t value, timeout = 0;
if(items>1) {
}
void
unlock(gt_env,...)
GtmEnv *gt_env
PPCODE:
{
strpack *args; unsigned i,n; gtm_string_t glvn;
if(items>1) {
args = (strpack *)calloc(items-1,sizeof(strpack));
}
void
getid(gt_env)
GtmEnv *gt_env
PPCODE:
{
XPUSHs(newSViv(gt_env->gtmEnvId));
}
void
getprefix(gt_env)
GtmEnv *gt_env
PPCODE:
{
strpack *x; unsigned i; EXTEND(SP,gt_env->pfx_elem);
if(gt_env->prefix) for(i=0;i<(gt_env->pfx_elem);i++) {
x=>_env->prefix[i]; PUSHs(newSVpvn(x->address, x->length));
}
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