view release on metacpan or search on metacpan
lib/POD2/RU/perlguts.pod view on Meta::CPAN
the RETVAL and OUTPUT directives. However, there are some cases where the
argument stack is not already long enough to handle all the return values.
An example is the POSIX tzname() call, which takes no arguments, but returns
two, the local time zone's standard and summer time abbreviations.
To handle this situation, the PPCODE directive is used and the stack is
extended using the macro:
EXTEND(SP, num);
where C<SP> is the macro that represents the local copy of the stack pointer,
view all matches for this distribution
view release on metacpan or search on metacpan
NomadJukebox/Device.xs view on Meta::CPAN
MODULE = POE::Component::NomadJukebox::Device PACKAGE = POE::Component::NomadJukebox::Device
AV*
Discover ()
PPCODE:
HV* devlist;
SV* devid;
// SV* type;
int n, i;
NomadJukebox/Device.xs view on Meta::CPAN
void
TrackList ( device, extended )
SV * device
int extended
PPCODE:
njb_t* njb;
int n, count=0;
songid_t* songtag;
if (SvROK( device )) {
NomadJukebox/Device.xs view on Meta::CPAN
XSRETURN(count);
void
PlayList ( device )
SV * device
PPCODE:
njb_t* njb;
// njbid_t njbid;
int n, count=0;
playlist_t* pl;
NomadJukebox/Device.xs view on Meta::CPAN
XSRETURN(count);
void
FileList ( device )
SV * device
PPCODE:
njb_t* njb;
int n, count=0;
datafile_t* datatag;
if (SvROK( device )) {
NomadJukebox/Device.xs view on Meta::CPAN
SV * device
AV*
DiskUsage ( device )
SV* device
PPCODE:
njb_t* njb;
HV* info;
u_int64_t total=0, free=0;
if (SvROK( device )) {
view all matches for this distribution
view release on metacpan or search on metacpan
POE::XS::Queue::Array pq
PREINIT:
pq_priority_t priority;
pq_id_t id;
SV *payload;
PPCODE:
if (pq_dequeue_next(pq, &priority, &id, &payload)) {
EXTEND(SP, 3);
PUSHs(sv_2mortal(newSVnv(priority)));
PUSHs(sv_2mortal(newSViv(id)));
PUSHs(sv_2mortal(payload));
POE::XS::Queue::Array pq
int id
SV *filter
PREINIT:
pq_entry removed;
PPCODE:
if (pq_remove_item(pq, id, filter, &removed)) {
EXTEND(SP, 3);
PUSHs(sv_2mortal(newSVnv(removed.priority)));
PUSHs(sv_2mortal(newSViv(removed.id)));
PUSHs(sv_2mortal(removed.payload));
PREINIT:
int max_count;
pq_entry *removed_entries = NULL;
int removed_count;
int i;
PPCODE:
if (items > 2)
max_count = SvIV(ST(2));
else
max_count = pq_get_item_count(pq);
removed_count = pq_remove_items(pq, filter, max_count,
int id
SV *filter
double delta
PREINIT:
pq_priority_t new_priority;
PPCODE:
if (pq_adjust_priority(pq, id, filter, delta, &new_priority)) {
EXTEND(SP, 1);
PUSHs(sv_2mortal(newSVnv(new_priority)));
}
pq_set_priority(pq, id, filter, new_priority)
POE::XS::Queue::Array pq
int id
SV *filter
double new_priority
PPCODE:
if (pq_set_priority(pq, id, filter, new_priority)) {
EXTEND(SP, 1);
PUSHs(sv_2mortal(newSVnv(new_priority)));
}
SV *filter
PREINIT:
pq_entry *ret_items;
int count, i;
int max_count;
PPCODE:
if (items == 3)
max_count = SvIV(ST(2));
else
max_count = pq_get_item_count(pq);
count = pq_peek_items(pq, filter, max_count, &ret_items);
view all matches for this distribution
view release on metacpan or search on metacpan
int resource;
PROTOTYPE: $
PREINIT:
struct rlimit64 rlim;
int result;
PPCODE:
/* on linux, rlim64_t is a __UQUAD_TYPE */
result = getrlimit64(resource, &rlim);
XPUSHs(sv_2mortal(newSVuv(rlim.rlim_cur)));
XPUSHs(sv_2mortal(newSVuv(rlim.rlim_max)));
XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes);
int resource;
PROTOTYPE: $
PREINIT:
struct rlimit rlim;
int result;
PPCODE:
/* on linux, rlim64_t is a __ULONGWORD_TYPE */
result = getrlimit(resource, &rlim);
XPUSHs(sv_2mortal(newSVuv(rlim.rlim_cur)));
XPUSHs(sv_2mortal(newSVuv(rlim.rlim_max)));
XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes);
void
_getrlimit(resource)
int resource;
PROTOTYPE: $
PPCODE:
XPUSHs(&PL_sv_undef);
XPUSHs(&PL_sv_undef);
XPUSHs(&PL_sv_no);
SV *
int rc;
HE * entry;
I32 len;
int j;
int nfd;
PPCODE:
#ifdef HAS_POLL
nfd = hv_iterinit(handles);
Newx(fds, nfd, struct pollfd);
for(j=0; j < nfd; j++)
{ /* Get hash key into 'C' space */
setuid(uid)
uid_t uid
PROTOTYPE: $
INIT:
int result;
PPCODE:
#ifdef HAS_SETUID
result = setuid(uid);
#ifdef CACHE_UID
PL_uid = getuid();
PL_euid = geteuid();
uid_t
getuid()
PROTOTYPE:
INIT:
int result;
PPCODE:
#ifdef HAS_SETUID
result = getuid();
#else
errno = ENOSYS;
result = -1;
setgid(gid)
gid_t gid
PROTOTYPE: $
INIT:
int result;
PPCODE:
#ifdef HAS_SETUID
result = setgid(gid);
#else
errno = ENOSYS;
result = -1;
gid_t
getgid()
PROTOTYPE:
INIT:
int result;
PPCODE:
#ifdef HAS_SETUID
result = getgid();
#ifdef CACHE_UID
PL_gid = getgid();
PL_egid = getegid();
seteuid(euid)
uid_t euid
PROTOTYPE: $
INIT:
int result;
PPCODE:
#ifdef HAS_SETEUID
result = seteuid(euid);
#ifdef CACHE_UID
PL_euid = geteuid();
#endif
uid_t
geteuid()
PROTOTYPE:
INIT:
int result;
PPCODE:
#ifdef HAS_SETEUID
result = geteuid();
#ifdef CACHE_UID
PL_egid = getegid();
#endif
setegid(egid)
gid_t egid
PROTOTYPE: $
INIT:
int result;
PPCODE:
#ifdef HAS_SETEUID
result = setegid(egid);
#else
errno = ENOSYS;
result = -1;
gid_t
getegid()
PROTOTYPE:
INIT:
int result;
PPCODE:
#ifdef HAS_SETEUID
result = getegid();
#else
errno = ENOSYS;
result = -1;
uid_t ruid
uid_t euid
PROTOTYPE: $$
INIT:
int result;
PPCODE:
#ifdef HAS_SETREUID
result = setreuid(ruid, euid);
#ifdef CACHE_UID
PL_uid = getuid();
PL_euid = geteuid();
gid_t rgid
gid_t egid
PROTOTYPE: $$
INIT:
int result;
PPCODE:
#ifdef HAS_SETREGID
result = setregid(rgid, egid);
#ifdef CACHE_UID
PL_gid = getgid();
PL_egid = getegid();
uid_t euid
uid_t suid
PROTOTYPE: $$$
INIT:
int result;
PPCODE:
#ifdef HAS_SETRESUID
result = setresuid(ruid, euid, suid);
#ifdef CACHE_UID
PL_uid = getuid();
PL_euid = geteuid();
INIT:
uid_t ruid;
uid_t euid;
uid_t suid;
int result;
PPCODE:
#ifdef HAS_SETRESUID
result = getresuid(&ruid, &euid, &suid);
if(result==0) {
XPUSHs(sv_2mortal(newSVuv(ruid)));
XPUSHs(sv_2mortal(newSVuv(euid)));
gid_t egid
gid_t sgid
PROTOTYPE: $$$
INIT:
int result;
PPCODE:
#ifdef HAS_SETRESGID
result = setresgid(rgid, egid, sgid);
#ifdef CACHE_UID
PL_gid = getgid();
PL_egid = getegid();
INIT:
gid_t rgid;
gid_t egid;
gid_t sgid;
int result;
PPCODE:
#ifdef HAS_SETRESUID
result = getresgid(&rgid, &egid, &sgid);
if(result==0) {
XPUSHs(sv_2mortal(newSVuv(rgid)));
XPUSHs(sv_2mortal(newSVuv(egid)));
getgroups()
PROTOTYPE:
INIT:
gid_t grouplist[_NGROUPS];
int nr_groups;
PPCODE:
#ifdef HAS_GETGROUPS
nr_groups = getgroups(_NGROUPS, grouplist);
if(nr_groups >= 0) {
int nr;
for(nr = 0; nr < nr_groups; nr++)
const char *format
PREINIT:
#ifdef I_TIME
struct tm t = { -1,-1,-1,-1,-1,-1,-1,-1 };
#endif
PPCODE:
#ifdef HAS_STRPTIME
strptime(input, format, &t);
if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec);
if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min);
if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour);
PREINIT:
#ifdef I_TIME
struct tm t;
time_t ts;
#endif
PPCODE:
#ifdef HAS_MKTIME
t.tm_sec = sec;
t.tm_min = min;
t.tm_hour = hour;
t.tm_mday = mday;
int fd
pid_t pid
int type
PROTOTYPE: $$$$
INIT:
PPCODE:
#ifdef HAS_FCNTL_OWN_EX
{ struct f_owner_ex ex;
ex.type = type;
ex.pid = pid;
view all matches for this distribution
view release on metacpan or search on metacpan
INCLUDE: const-xs.inc
#ifdef PSX2008_HAS_ABORT
void
abort();
PPCODE:
/* Using PPCODE instead of an empty body avoids the (unnecessary)
* XSRETURN_EMPTY epilog and saves quite a few bytes. */
abort();
#endif
#ifdef PSX2008_HAS_SYNC
void
sync();
PPCODE:
sync();
#endif
#ifdef PSX2008_HAS_A64L
void
clock_getcpuclockid(pid_t pid=0);
INIT:
int rv;
clockid_t clock_id;
PPCODE:
rv = clock_getcpuclockid(pid, &clock_id);
if (LIKELY(rv == 0))
PUSH_INT_OR_PV(clock_id);
else {
SETERRNO(rv, rv);
ALIAS:
clock_gettime = 1
INIT:
int rv;
struct timespec res;
PPCODE:
{
rv = (ix == 0)
? clock_getres(clock_id, &res)
: clock_gettime(clock_id, &res);
if (rv == 0)
PROTOTYPE: $$@
INIT:
int rv;
struct timespec request;
struct timespec remain = {0};
PPCODE:
{
SvGETMAGIC(sec);
if (items == 3 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV_nomg(request, sec);
else
void
clock_settime(clockid_t clock_id, SV *sec, long nsec=0);
PROTOTYPE: $@
INIT:
struct timespec tp;
PPCODE:
{
SvGETMAGIC(sec);
if (items == 2 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV_nomg(tp, sec);
else
nanosleep(SV *sec, long nsec=0);
PROTOTYPE: @
INIT:
struct timespec request;
struct timespec remain = {0};
PPCODE:
{
SvGETMAGIC(sec);
if (items == 1 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV_nomg(request, sec);
else
#ifdef PSX2008_HAS_FNMATCH
void
fnmatch(const char *pattern, const char *string, int flags);
INIT:
int rv;
PPCODE:
rv = fnmatch(pattern, string, flags);
if (LIKELY(rv == 0 || rv == FNM_NOMATCH))
mPUSHs(newSViv(rv));
else
PUSHs(&PL_sv_undef);
#ifdef PSX2008_HAS_GETDATE
void
getdate(const char *string);
INIT:
struct tm *tm = getdate(string);
PPCODE:
if (tm) {
EXTEND(SP, 9);
mPUSHs(newSViv(tm->tm_sec));
mPUSHs(newSViv(tm->tm_min));
mPUSHs(newSViv(tm->tm_hour));
struct tm tm;
char *remainder;
Size_t i, tm_count;
AV *tm_av = NULL;
U8 gimme;
PPCODE:
{
if (items > 2) {
if (items > TM_COUNT_MAX + 2) {
DumpDarkSuckerjerk:
croak("%s::strptime: Too many arguments", PACKNAME);
#elif defined(MAXHOSTNAMELEN) && MAXHOSTNAMELEN > 256
char name[MAXHOSTNAMELEN];
#else
char name[256];
#endif
PPCODE:
if (LIKELY(gethostname(name, sizeof(name)) == 0))
mPUSHp(name, _strnlen(name, sizeof(name)));
else
PUSHs(&PL_sv_undef);
#ifdef PSX2008_HAS_GETITIMER
void
getitimer(int which);
INIT:
struct itimerval value;
PPCODE:
if (getitimer(which, &value) == 0) {
EXTEND(SP, 2); /* Stack already has room for 2 items. */
mPUSHs(newSViv(value.it_interval.tv_sec));
mPUSHs(newSViv(value.it_interval.tv_usec));
mPUSHs(newSViv(value.it_value.tv_sec));
time_t val_sec, long val_usec);
PROTOTYPE: $@
INIT:
struct itimerval value = { {int_sec, int_usec}, {val_sec, val_usec} };
struct itimerval ovalue;
PPCODE:
if (setitimer(which, &value, &ovalue) == 0) {
/* We already know the stack is long enough. */
mPUSHs(newSViv(ovalue.it_interval.tv_sec));
mPUSHs(newSViv(ovalue.it_interval.tv_usec));
mPUSHs(newSViv(ovalue.it_value.tv_sec));
#ifdef PSX2008_HAS_NICE
void
nice(int incr);
INIT:
SETERRNO(0, 0);
PPCODE:
{
int rv = nice(incr);
if (rv != -1 || errno == 0)
mPUSHs(newSViv(rv));
else
#ifdef PSX2008_HAS_GETPRIORITY
void
getpriority(int which=PRIO_PROCESS, id_t who=0);
INIT:
SETERRNO(0, 0);
PPCODE:
{
int rv = getpriority(which, who);
if (rv != -1 || errno == 0)
mPUSHs(newSViv(rv));
else
}
#ifdef PSX2008_HAS_ENDUTXENT
void
endutxent();
PPCODE:
endutxent();
#endif
#ifdef PSX2008_HAS_GETUTXENT
void
getutxent();
PPCODE:
{
struct utmpx *utxent = getutxent();
RETURN_UTXENT;
}
getutxid(short ut_type, SV *ut_id=NULL);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {.ut_type=ut_type};
const Size_t ut_id_size = sizeof(utxent_req.ut_id);
PPCODE:
{
if (ut_id) {
STRLEN pvlen;
const char *pv = SvPV_const(ut_id, pvlen);
const STRLEN ut_id_len = ut_id_size < pvlen ? ut_id_size : pvlen;
getutxline(SV *ut_line);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {0};
const Size_t ut_line_size = sizeof(utxent_req.ut_line);
PPCODE:
{
STRLEN pvlen;
const char *pv = SvPV_const(ut_line, pvlen);
const STRLEN ut_line_len = ut_line_size < pvlen ? ut_line_size : pvlen;
Copy(pv, utxent_req.ut_line, ut_line_len, char);
#endif
#ifdef PSX2008_HAS_SETUTXENT
void
setutxent();
PPCODE:
setutxent();
#endif
#ifdef PSX2008_HAS_DRAND48
void
erand48(unsigned short X0, unsigned short X1, unsigned short X2);
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
double result = erand48(xsubi);
PPCODE:
/* We already know the stack is long enough. */
mPUSHs(newSVnv((NV)result));
mPUSHs(newSVuv(xsubi[0]));
mPUSHs(newSVuv(xsubi[1]));
mPUSHs(newSVuv(xsubi[2]));
ALIAS:
nrand48 = 1
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
long result = (ix == 0) ? jrand48(xsubi) : nrand48(xsubi);
PPCODE:
/* We already know the stack is long enough. */
mPUSHs(newSViv((IV)result));
mPUSHs(newSVuv(xsubi[0]));
mPUSHs(newSVuv(xsubi[1]));
mPUSHs(newSVuv(xsubi[2]));
void
seed48(unsigned short seed1, unsigned short seed2, unsigned short seed3);
INIT:
unsigned short seed16v[3] = { seed1, seed2, seed3 };
unsigned short *old = seed48(seed16v);
PPCODE:
/* We already know the stack is long enough. */
mPUSHs(newSVuv(old[0]));
mPUSHs(newSVuv(old[1]));
mPUSHs(newSVuv(old[2]));
#endif
#ifdef PSX2008_HAS_SRAND48
void
srand48(long seedval);
PPCODE:
srand48(seedval);
#endif
#ifdef PSX2008_HAS_RANDOM
#endif
#ifdef PSX2008_HAS_SRANDOM
void
srandom(unsigned seed);
PPCODE:
srandom(seed);
#endif
# else
# define _PSX_GETENTROPY_SVLEN_ROUNDUP(l) (l)
# endif
void
getentropy(IV length);
PPCODE:
{
if (UNLIKELY(length < 0 || length > GETENTROPY_MAX)) {
SETERRNO(EINVAL, LIB_INVARG); /* Thus quoth POSIX. */
MakeUndefGreatAgain:
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_GETRESGID
void
getresgid();
PPCODE:
{
gid_t rid, eid, sid;
int rv = getresgid(&rid, &eid, &sid);
if (LIKELY(rv == 0)) {
EXTEND(SP, 2); /* Stack already has room for 1 item. */
#endif
#ifdef PSX2008_HAS_GETRESUID
void
getresuid();
PPCODE:
{
uid_t rid, eid, sid;
int rv = getresuid(&rid, &eid, &sid);
if (LIKELY(rv == 0)) {
EXTEND(SP, 2); /* Stack already has room for 1 item. */
#endif
#ifdef PSX2008_HAS_SIGPAUSE
void
sigpause(int sig);
PPCODE:
(void)sigpause(sig);
PUSHs(&PL_sv_undef);
#endif
#endif
#ifdef PSX2008_HAS_PAUSE
void
pause();
PPCODE:
(void)pause();
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_PSIGNAL
void
psignal(int sig, const char *msg);
PPCODE:
psignal(sig, msg);
#endif
#ifdef PSX2008_HAS_STRSIGNAL
void
timer_gettime(timer_t timerid);
PREINIT:
struct itimerspec curr_value;
int rv;
PPCODE:
{
rv = timer_gettime(timerid, &curr_value);
if (rv == 0) {
EXTEND(SP, 2);
mPUSHs(newSViv(curr_value.it_interval.tv_sec));
time_t initial_sec=-1, long initial_nsec=-1);
PROTOTYPE: $$@
PREINIT:
struct itimerspec new_value, old_value;
int rv;
PPCODE:
{
new_value.it_interval.tv_sec = interval_sec;
new_value.it_interval.tv_nsec = interval_nsec;
if (initial_sec < 0 || initial_nsec < 0)
new_value.it_value = new_value.it_interval;
#ifdef PSX2008_HAS_CONFSTR
void
confstr(int name);
INIT:
SETERRNO(0, 0);
PPCODE:
{
Size_t len = confstr(name, NULL, 0);
if (!len && errno)
PUSHs(&PL_sv_undef);
else {
#endif
#ifdef PSX2008_HAS_PATHCONF
void
pathconf(SV *what, int name);
PPCODE:
{
long rv = -1;
SvGETMAGIC(what);
SETERRNO(0, 0); /* SvGETMAGIC() might have set errno. */
if (UNLIKELY(!SvOK(what)))
#endif
#ifdef PSX2008_HAS_SYSCONF
void
sysconf(int name);
PPCODE:
{
long rv;
SETERRNO(0, 0);
rv = sysconf(name);
if (rv < 0 && errno != 0)
void
stat(SV *what);
INIT:
int rv = -1;
struct stat buf;
PPCODE:
SvGETMAGIC(what);
if (!SvOK(what))
SETERRNO(ENOENT, RMS_FNF);
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
void
lstat(const char *path);
INIT:
int rv;
struct stat buf;
PPCODE:
rv = lstat(path, &buf);
RETURN_STAT_BUF(rv, buf);
#endif
void
statvfs(SV *what);
INIT:
int rv = -1;
struct statvfs buf;
PPCODE:
SvGETMAGIC(what);
if (!SvOK(what))
SETERRNO(ENOENT, RMS_FNF);
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
#endif
#ifdef PSX2008_HAS_MKDTEMP
void
mkdtemp(SV *template_sv);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template_sv, len);
/* Copy the original template to avoid overwriting it. */
SV *tmpsv = newSVpvn_flags(ctmp, len, SVs_TEMP);
#endif
#ifdef PSX2008_HAS_MKSTEMP
void
mkstemp(SV *template_sv);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template_sv, len);
/* Copy the original template to avoid overwriting it. */
SV *tmpsv = newSVpvn_flags(ctmp, len, SVs_TEMP);
#endif
#ifdef PSX2008_HAS_MKOSTEMP
void
mkostemp(SV *template_sv, int flags);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template_sv, len);
/* Copy the original template to avoid overwriting it. */
SV *tmpsv = newSVpvn_flags(ctmp, len, SVs_TEMP);
#endif
#if defined(PSX2008_HAS_FDOPEN)
void
fdopen(IV fd, const char *mode);
PPCODE:
{
SV *rv = NULL;
if (UNLIKELY(fd < 0 || fd > PERL_INT_MAX))
SETERRNO(EBADF, RMS_IFI);
else if (UNLIKELY(!mode || !*mode))
#endif
#if defined(PSX2008_HAS_FDOPENDIR)
void
fdopendir(IV fd);
PPCODE:
{
SV *rv = NULL;
if (UNLIKELY(fd < 0 || fd > PERL_INT_MAX))
SETERRNO(EBADF, RMS_IFI);
else
void
fstatat(psx_fd_t dirfd, const char *path, int flags=0);
INIT:
int rv;
struct stat buf;
PPCODE:
rv = fstatat(dirfd, path, &buf, flags);
RETURN_STAT_BUF(rv, buf);
#endif
#endif
#ifdef PSX2008_HAS_OPENAT
void
openat(SV *dirfdsv, const char *path, int flags=O_RDONLY, mode_t mode=0666);
PPCODE:
{
SV *rv = _openat50c(aTHX_ dirfdsv, path, flags, mode, NULL);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_OPENAT2
void
openat2(SV *dirfdsv, const char *path, HV *how);
PPCODE:
{
SV *rv = _openat50c(aTHX_ dirfdsv, path, 0, 0, how);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_READLINK
void
readlink(const char *path);
PPCODE:
{
SV *rv = _readlink50c(aTHX_ path, NULL);
PUSHs(rv ? rv : &PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_READLINKAT
void
readlinkat(psx_fd_t dirfd, const char *path);
PPCODE:
{
SV *rv = _readlink50c(aTHX_ path, &dirfd);
PUSHs(rv ? rv : &PL_sv_undef);
}
read(psx_fd_t fd, SV *buf, SV *count);
PREINIT:
SSize_t rv;
Size_t nbytes;
char *cbuf;
PPCODE:
{
if (UNLIKELY(SvIsNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::read: Negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
nbytes = SvSTRLEN(count);
#endif
#ifdef PSX2008_HAS_WRITE
void
write(psx_fd_t fd, SV *buf, SV *count=NULL);
PPCODE:
{
if (UNLIKELY(SvIsNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::write: Negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
else {
#ifdef PSX2008_HAS_READV
void
readv(psx_fd_t fd, SV *buffers, AV *sizes);
PROTOTYPE: $\[@$]$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, NULL, NULL);
if (UNLIKELY(rv < 0))
PUSHs(&PL_sv_undef);
else
#ifdef PSX2008_HAS_PREADV
void
preadv(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=NULL);
PROTOTYPE: $\[@$]$;$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, NULL);
if (UNLIKELY(rv < 0))
PUSHs(&PL_sv_undef);
else
#ifdef PSX2008_HAS_PREADV2
void
preadv2(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=NULL, SV *flags=NULL);
PROTOTYPE: $\[@$]$;$$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, flags);
if (UNLIKELY(rv < 0))
PUSHs(&PL_sv_undef);
else
#endif
#ifdef PSX2008_HAS_WRITEV
void
writev(psx_fd_t fd, AV *buffers);
PPCODE:
{
struct iovec *iov;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
SSize_t rv = LIKELY(iovcnt >= 0) ? writev(fd, iov, iovcnt) : -1;
if (UNLIKELY(rv < 0))
#endif
#ifdef PSX2008_HAS_PWRITEV
void
pwritev(psx_fd_t fd, AV *buffers, SV *offset=NULL);
PPCODE:
{
struct iovec *iov;
Off_t offs = SvIsUNDEF_onpurpose(offset) ? 0 : SvOFFt(offset);
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
SSize_t rv = LIKELY(iovcnt >= 0) ? pwritev(fd, iov, iovcnt, offs) : -1;
#endif
#ifdef PSX2008_HAS_PWRITEV2
void
pwritev2(psx_fd_t fd, AV *buffers, SV *offset=NULL, SV *flags=NULL);
PPCODE:
{
struct iovec *iov;
Off_t offs = SvIsUNDEF_onpurpose(offset) ? 0 : SvOFFt(offset);
int i_flags = SvIsUNDEF_onpurpose(flags) ? 0 : (int)SvIV(flags);
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
PREINIT:
char *cbuf;
Off_t f_offset;
Size_t b_offset, nbytes;
SSize_t rv;
PPCODE:
{
if (UNLIKELY(SvIsNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::pread: Negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
SV *count=NULL, SV *offset=NULL, SV *buf_offset=NULL);
PREINIT:
Off_t f_offset;
Size_t b_offset;
SSize_t rv;
PPCODE:
{
STRLEN svpv_len;
const char *cbuf = SvPV_const(buf, svpv_len);
STRLEN nbytes = svpv_len;
#endif
#ifdef PSX2008_HAS_POSIX_FADVISE
void
posix_fadvise(psx_fd_t fd, Off_t offset, Off_t len, int advice);
PPCODE:
{
int rv = posix_fadvise(fd, offset, len, advice);
if (LIKELY(rv == 0))
mPUSHp("0 but true", 10);
else {
#endif
#ifdef PSX2008_HAS_POSIX_FALLOCATE
void
posix_fallocate(psx_fd_t fd, Off_t offset, Off_t len);
PPCODE:
{
int rv = posix_fallocate(fd, offset, len);
if (LIKELY(rv == 0))
mPUSHp("0 but true", 10);
else {
#endif
#ifdef PSX2008_HAS_POSIX_OPENPT
void
posix_openpt(int flags=O_RDWR);
PPCODE:
{
const char *raw = _flags2raw(flags);
int fd = posix_openpt(flags);
SV *rv = LIKELY(fd >= 0) ? _psx_fd_to_handle(aTHX_ fd, raw) : NULL;
PUSHs(rv ? rv : &PL_sv_undef);
#endif
#ifdef PSX2008_HAS_PTSNAME
void
ptsname(psx_fd_t fd);
PPCODE:
{
# ifdef PSX2008_HAS_PTSNAME_R
char name[MAXPATHLEN];
int rv = ptsname_r(fd, name, sizeof(name));
if (LIKELY(rv == 0))
#endif
#ifdef PSX2008_HAS_TTYNAME
void
ttyname(psx_fd_t fd);
PPCODE:
{
# ifdef PSX2008_HAS_TTYNAME_R
char name[MAXPATHLEN];
int rv = ttyname_r(fd, name, sizeof(name));
if (LIKELY(rv == 0))
#if !defined(PSX2008_HAS_REMOVE) || (defined(_WIN32) && !defined(__CYGWIN__))
# if defined(PSX2008_HAS_UNLINK) && defined(PSX2008_HAS_RMDIR)
void
remove(const char *path);
PPCODE:
if (unlink(path) == 0 || (UNLINK_ISDIR_ERRNO && rmdir(path) == 0))
mPUSHp("0 but true", 10);
else
PUSHs(&PL_sv_undef);
#endif
#ifdef PSX2008_HAS_UNLINKAT
void
removeat(psx_fd_t dirfd, const char *path);
PPCODE:
if (unlinkat(dirfd, path, 0) == 0
|| (UNLINK_ISDIR_ERRNO && unlinkat(dirfd, path, AT_REMOVEDIR) == 0))
mPUSHp("0 but true", 10);
else
PUSHs(&PL_sv_undef);
#ifdef PSX2008_HAS_EXECVEAT
void
execveat(psx_fd_t dirfd, const char *path, \
AV *args, SV *env=NULL, int flags=0);
PPCODE:
{
_execve50c(aTHX_ dirfd, path, args, env, flags);
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_FEXECVE
void
fexecve(psx_fd_t fd, AV *args, SV *env=NULL);
PPCODE:
{
_execve50c(aTHX_ fd, NULL, args, env, 0);
PUSHs(&PL_sv_undef);
}
#endif
#ifdef PSX2008_HAS_POLL
void
poll(SV *pollfds, int timeout=-1);
PPCODE:
{
int rv = _poll50c(aTHX_ pollfds, timeout, NULL);
mPUSHs(newSViv(rv));
}
ppoll(SV *pollfds, SV *timeout=NULL, SV *sigmask=NULL);
PREINIT:
int rv;
struct timespec tmo = {0};
struct psx_ppollspec ppspec = {0};
PPCODE:
{
/* See POSIX::sigprocmask(). Can't be wrong [TM]. */
if (sigmask && SvOK(sigmask)) {
if (sv_isa(sigmask, "POSIX::SigSet")) {
#if PERL_BCDVERSION >= 0x5016000
#endif
#ifdef PSX2008_DIV
void
div(IV numer, IV denom);
PPCODE:
{
PSX2008_DIV_T result = PSX2008_DIV(numer, denom);
mPUSHs(newSViv(result.quot));
mPUSHs(newSViv(result.rem));
}
#endif
#ifdef PSX2008_HAS_FREXP
void
frexp(NV x);
PPCODE:
{
NV fr;
int exp;
# if defined(PSX2008_HAS_SQRTQ)
fr = frexpq(x, &exp);
#endif
#ifdef PSX2008_HAS_LRINT
void
lrint(NV x);
PPCODE:
{
# if defined(PSX2008_HAS_LLRINTQ)
long long ret = llrintq(x);
# elif defined(PSX2008_HAS_LRINTQ)
long ret = lrintq(x);
#endif
#ifdef PSX2008_HAS_LROUND
void
lround(NV x);
PPCODE:
{
# if defined(PSX2008_HAS_LLROUNDQ)
long long ret = llroundq(x);
# elif defined(PSX2008_HAS_LROUNDQ)
long ret = lroundq(x);
#ifdef PSX2008_HAS_REMAINDER
void
remainder(NV x, NV y);
INIT:
NV res;
PPCODE:
{
# if defined(PSX2008_HAS_SQRTQ)
res = remainderq(x, y);
# elif defined(PSX2008_HAS_SQRTL)
res = remainderl(x, y);
void
remquo(NV x, NV y);
INIT:
int quo;
NV res;
PPCODE:
{
# if defined(PSX2008_HAS_SQRTQ)
res = remquoq(x, y, &quo);
# elif defined(PSX2008_HAS_SQRTL)
res = remquol(x, y, &quo);
cproj(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = cprojq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = cprojl(z);
# else
cexp(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = cexpq(z);
# elif defined(PSX2008_HAS_CEXPL)
result = cexpl(z);
# else
clog(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = clogq(z);
# elif defined(PSX2008_HAS_CLOGL)
result = clogl(z);
# else
conj(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = conjq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = conjl(z);
# else
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T x, y;
COMPLEX_FROM_RE_IM(x, re_x, im_x);
COMPLEX_FROM_RE_IM(y, re_y, im_y);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = cpowq(x, y);
# elif defined(PSX2008_HAS_CSQRTL)
result = cpowl(x, y);
# else
csqrt(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = csqrtq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = csqrtl(z);
# else
cacos(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = cacosq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = cacosl(z);
# else
cacosh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = cacoshq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = cacoshl(z);
# else
casin(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = casinq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = casinl(z);
# else
casinh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = casinhq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = casinhl(z);
# else
catan(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = catanq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = catanl(z);
# else
catanh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = catanhq(z);
# elif defined(PSX2008_HAS_CSQRTL)
result = catanhl(z);
# else
ccos(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = ccosq(z);
# elif defined(PSX2008_HAS_CCOSL)
result = ccosl(z);
# else
ccosh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = ccoshq(z);
# elif defined(PSX2008_HAS_CCOSHL)
result = ccoshl(z);
# else
csin(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = csinq(z);
# elif defined(PSX2008_HAS_CSINL)
result = csinl(z);
# else
csinh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = csinhq(z);
# elif defined(PSX2008_HAS_CSINHL)
result = csinhl(z);
# else
ctan(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = ctanq(z);
# elif defined(PSX2008_HAS_CTANL)
result = ctanl(z);
# else
ctanh(NV re, NV im);
INIT:
PSX2008_COMPLEX_T result;
PSX2008_COMPLEX_T z;
COMPLEX_FROM_RE_IM(z, re, im);
PPCODE:
# if defined(PSX2008_HAS_CSQRTQ)
result = ctanhq(z);
# elif defined(PSX2008_HAS_CTANHL)
result = ctanhl(z);
# else
## DESTROY is called when a file handle we created (e.g. in openat)
## is cleaned up. This is just a dummy to silence AUTOLOAD. We leave
## it up to Perl to take the necessary steps.
void
DESTROY(...);
PPCODE:
BOOT:
{
}
view all matches for this distribution
view release on metacpan or search on metacpan
size_t msg_max_len
PREINIT:
char* msg_ptr;
ssize_t msg_len;
unsigned int msg_prio;
PPCODE:
if ((msg_ptr = malloc(msg_max_len)) == NULL) { XSRETURN_EMPTY; }
msg_len = mq_receive(mqdes, msg_ptr, msg_max_len, &msg_prio);
if (msg_len == -1)
{
free(msg_ptr);
PREINIT:
char* msg_ptr;
ssize_t msg_len;
unsigned int msg_prio;
PPCODE:
struct timespec abs_timeout;
clock_gettime(CLOCK_REALTIME, &abs_timeout);
abs_timeout.tv_sec += seconds;
if ((msg_ptr = malloc(msg_max_len)) == NULL) { XSRETURN_EMPTY; }
msg_len = mq_timedreceive(mqdes, msg_ptr, msg_max_len, &msg_prio,
mq_attr_unpack(mqa)
SV* mqa
PREINIT:
struct mq_attr* mqa_ptr;
STRLEN mqa_len;
PPCODE:
mqa_ptr = (struct mq_attr*) SvPV(mqa, mqa_len);
/* check mqa_len ? */
XPUSHs(sv_2mortal(newSViv(mqa_ptr->mq_flags)));
XPUSHs(sv_2mortal(newSViv(mqa_ptr->mq_maxmsg)));
XPUSHs(sv_2mortal(newSViv(mqa_ptr->mq_msgsize)));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POSIX/RT/Scheduler.xs view on Meta::CPAN
void
sched_priority_range(policy)
SV* policy;
PREINIT:
int real_policy;
PPCODE:
real_policy = get_policy(policy);
mXPUSHi(sched_get_priority_min(real_policy));
mXPUSHi(sched_get_priority_max(real_policy));
PUTBACK;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/POSIX/RT/Timer.xs view on Meta::CPAN
RETVAL
void get_timeout(POSIX::RT::Timer timer)
PREINIT:
struct itimerspec value;
PPCODE:
if (timer_gettime(timer, &value) == -1)
die_sys("Couldn't get_time: %s");
mXPUSHs(timespec_to_sv(value.it_value));
if (GIMME_V == G_LIST)
mXPUSHs(timespec_to_sv(value.it_interval));
void set_timeout(POSIX::RT::Timer timer, struct timespec new_value, struct timespec new_interval = no_time, bool abstime = FALSE)
PREINIT:
struct itimerspec old_itimer;
PPCODE:
struct itimerspec new_itimer = { new_value, new_interval };
if (timer_settime(timer, (abstime ? TIMER_ABSTIME : 0), &new_itimer, &old_itimer) == -1)
die_sys("Couldn't set_time: %s");
mXPUSHs(timespec_to_sv(old_itimer.it_value));
if (GIMME_V == G_LIST)
lib/POSIX/RT/Timer.xs view on Meta::CPAN
void get_clocks(...)
PREINIT:
size_t i;
const size_t max = sizeof clocks / sizeof *clocks;
PPCODE:
for (i = 0; i < max; ++i)
mXPUSHp(clocks[i].key, clocks[i].key_length);
PUTBACK;
Time::Spec get_time(POSIX::RT::Clock clockid)
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
void
capture_set_program(cp, prog)
POSIX::Run::Capture cp;
char *prog = NO_INIT;
PPCODE:
if (cp->program != &PL_sv_undef)
SvREFCNT_dec(cp->program);
cp->program = ST(1);
if (cp->program != &PL_sv_undef) {
SvREFCNT_inc(cp->program);
RETVAL
void
capture_program(cp)
POSIX::Run::Capture cp;
PPCODE:
if (cp->program == &PL_sv_undef && cp->rc.rc_argv) {
ST(0) = newSVpv(cp->rc.rc_argv[0], 0);
sv_2mortal(ST(0));
} else
ST(0) = cp->program;
view all matches for this distribution
view release on metacpan or search on metacpan
strptime.xs view on Meta::CPAN
tm_t.tm_hour = POSIX_STRPTIME_SENTINEL;
tm_t.tm_mday = POSIX_STRPTIME_SENTINEL;
tm_t.tm_mon = POSIX_STRPTIME_SENTINEL;
tm_t.tm_year = POSIX_STRPTIME_SENTINEL;
tm_t.tm_isdst = POSIX_STRPTIME_SENTINEL;
PPCODE:
strptime(SvPV_nolen(input), SvPV_nolen(format), &tm_t);
POSIX_STRPTIME_SET(tm_t.tm_sec);
POSIX_STRPTIME_SET(tm_t.tm_min);
POSIX_STRPTIME_SET(tm_t.tm_hour);
POSIX_STRPTIME_SET(tm_t.tm_mday);
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
PROTOTYPES: DISABLE
SV *
_PPI_Element__significant (self)
SV * self
PPCODE:
{
XSRETURN_YES;
}
SV *
_PPI_Token_Comment__significant (self)
SV * self
PPCODE:
{
XSRETURN_NO;
}
SV *
_PPI_Token_Whitespace__significant (self)
SV * self
PPCODE:
{
XSRETURN_NO;
}
SV *
_PPI_Token_End__significant (self)
SV * self
PPCODE:
{
XSRETURN_NO;
}
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
void
get_next_case (sfr)
struct sysreader_info *sfr;
PPCODE:
struct ccase *c;
if (c = casereader_read (sfr->reader))
{
int v;
view all matches for this distribution
view release on metacpan or search on metacpan
void
bless (stash, rv)
SV *stash
SV *rv
PPCODE:
sv_bless(rv, (HV *)SvRV(stash));
PUSHs(rv);
SV *
blessed (klass, obj)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Package/Prototype.xs view on Meta::CPAN
XS(XS_prototype_getter)
{
dVAR; dXSARGS;
SV *retval = (SV *)CvXSUBANY(cv).any_ptr;
SP -= items; /* PPCODE */
PUTBACK;
push_values(aTHX_ retval);
}
XS(XS_prototype_method)
lib/Package/Prototype.xs view on Meta::CPAN
PREINIT:
char *pkg;
STRLEN pkglen;
HE* entry;
HV *stash;
PPCODE:
{
if (!IsHashRef(ref))
Perl_croak(aTHX_ "Please pass an hash reference to the first argument");
if (pkgsv) {
view all matches for this distribution
view release on metacpan or search on metacpan
void
list_all_symbols(self, vartype=VAR_NONE)
SV *self
vartype_t vartype
PPCODE:
if (vartype == VAR_NONE) {
HV *namespace;
HE *entry;
int keys;
SV *self
vartype_t vartype
PREINIT:
HV *namespace, *ret;
HE *entry;
PPCODE:
namespace = _get_namespace(self);
ret = newHV();
hv_iterinit(namespace);
while ((entry = hv_iternext(namespace))) {
view all matches for this distribution
view release on metacpan or search on metacpan
SV *
FETCH(this, index)
SV *this
SV *index
PPCODE:
{
IV index_offset = SvIV(index);
SV *storage = SvRV(this);
IV curlen = SvCUR(storage);
SV *
STORE(this, index, value)
SV *this
SV *index
SV *value
PPCODE:
{
IV index_offset = SvIV(index);
IV value_value = SvIV(value);
SV *storage = SvRV(this);
IV curlen = SvCUR(storage);
}
SV *
TIEARRAY(classname, ...)
SV *classname
PPCODE:
{
SV *rv;
SV *tiething;
HV *stash = gv_stashsv(classname, 0);
tiething = newSVpvn("", 0); /* Begin with a zero-length string */
}
SV *
FETCHSIZE(this)
SV *this
PPCODE:
{
SV *thing = SvRV(this);
XPUSHs(sv_2mortal(newSViv(SvCUR(thing) / sizeof(IV))));
}
SV *
STORESIZE(this, size)
SV *this
SV *size
PPCODE:
{
SV *thing = SvRV(this);
IV curlen = SvIV(thing);
IV newsize = SvIV(size) * sizeof(IV);
IV byte_size;
view all matches for this distribution
view release on metacpan or search on metacpan
PadWalker.xs view on Meta::CPAN
peek_my(uplevel)
I32 uplevel;
PREINIT:
HV* ret = newHV();
HV* ignore = newHV();
PPCODE:
do_peek(aTHX_ uplevel, ret, ignore);
SvREFCNT_dec((SV*) ignore);
EXTEND(SP, 1);
PUSHs(sv_2mortal(newRV_noinc((SV*)ret)));
PadWalker.xs view on Meta::CPAN
peek_our(uplevel)
I32 uplevel;
PREINIT:
HV* ret = newHV();
HV* ignore = newHV();
PPCODE:
do_peek(aTHX_ uplevel, ignore, ret);
SvREFCNT_dec((SV*) ignore);
EXTEND(SP, 1);
PUSHs(sv_2mortal(newRV_noinc((SV*)ret)));
PadWalker.xs view on Meta::CPAN
peek_sub(cv)
CV* cv;
PREINIT:
HV* ret = newHV();
HV* ignore = newHV();
PPCODE:
if (CvISXSUB(cv))
die("PadWalker: cv has no padlist");
padlist_into_hash(aTHX_ CvPADLIST(cv), ret, ignore, 0, CvDEPTH(cv));
SvREFCNT_dec((SV*) ignore);
EXTEND(SP, 1);
PadWalker.xs view on Meta::CPAN
closed_over(cv)
CV* cv;
PREINIT:
HV* ret = newHV();
HV* targs;
PPCODE:
if (GIMME_V == G_ARRAY) {
targs = newHV();
get_closed_over(aTHX_ cv, ret, targs);
EXTEND(SP, 2);
PadWalker.xs view on Meta::CPAN
RETVAL
void
_upcontext(uplevel)
I32 uplevel
PPCODE:
/* This is used by Devel::Caller. */
XPUSHs(sv_2mortal(newSViv((IV)upcontext(aTHX_ uplevel, 0, 0, 0, 0))));
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Padre/Plugin/XS/PerlXS.pm view on Meta::CPAN
# TODO: Add colon where appropriate? Does that work at all?
my $xs_keywords = join(
' ', qw(
MODULE PACKAGE ALIAS
OUTPUT RETVAL
CODE PPCODE PREFIX
INIT NO_INIT PREINIT
POSTCALL NO_OUTPUT CLEANUP
INPUT SCOPE C_ARGS
OUTLIST IN IN_OUTLIST IN_OUT
BOOT REQUIRE VERSIONCHECK
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Panda/Install/ParseXS.pm view on Meta::CPAN
splice(@$linno, 1, 0, $linno->[0]);
}
}}
if ($lines->[1] and $lines->[1] !~ /^[A-Z]+\s*:/) {
splice(@$lines, 1, 0, $type =~ /^void(\s|$)/ ? 'PPCODE:' : 'CODE:');
splice(@$linno, 1, 0, $linno->[0]);
}
if ($alias) {
my @alias = split /\s*,\s*/, $alias;
view all matches for this distribution
view release on metacpan or search on metacpan
xs/Pango.xs view on Meta::CPAN
=for signature (MAJOR, MINOR, MICRO) = Pango->GET_VERSION_INFO
Fetch as a list the version of pango with which the Perl module was built.
=cut
void
GET_VERSION_INFO (class)
PPCODE:
EXTEND (SP, 3);
PUSHs (sv_2mortal (newSViv (PANGO_MAJOR_VERSION)));
PUSHs (sv_2mortal (newSViv (PANGO_MINOR_VERSION)));
PUSHs (sv_2mortal (newSViv (PANGO_MICRO_VERSION)));
PERL_UNUSED_VAR (ax);
view all matches for this distribution
view release on metacpan or search on metacpan
void
_Comm_free (comm)
SV * comm
PREINIT:
I32* temp;
PPCODE:
temp = PL_markstack_ptr++;
_Comm_free(comm);
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
int ret;
MPI_Status status;
#ifdef SEND_DEBUG
int i;
#endif
PPCODE:
if (! SvROK(ref))
croak("MPI_Recv: First argument is not a reference!");
if (SvTYPE(SvRV(ref)) == SVt_PVHV) {
croak("MPI_Recv: Hashes are not supported yet.");
MPI_Comm comm
PREINIT:
void* sendbuf, *recvbuf;
int ret;
MPI_Status status;
PPCODE:
if (! SvROK(sendref) || ! SvROK(recvref))
croak("MPI_Sendrecv: First and Fourth arguments must be references!");
if (SvTYPE(SvRV(sendref)) == SVt_PVAV &&
SvTYPE(SvRV(recvref)) == SVt_PVAV)
view all matches for this distribution
view release on metacpan or search on metacpan
PREINIT:
int tids[MAXPROCS];
int info;
int i;
char ** argv = (char **)0;
PPCODE:
if (argvRef)
{
int argc;
AV * av;
PREINIT:
int info, src, stag, scnt;
char *buf;
char *po;
int type;
PPCODE:
New(2401, buf, buflen, char);
info = pvm_precv(tid,tag,buf,buflen,PVM_BYTE,&src,&stag,&scnt);
XPUSHs(sv_2mortal(newSViv(info)));
XPUSHs(sv_2mortal(newSViv(src)));
unpack(buflen=MAXSTR)
int buflen
PREINIT:
char *buf, *po;
int type;
PPCODE:
New(2401, buf, buflen, char);
if (pvm_upkstr(buf) != 0) {
if (PL_dowarn) {
warn("pvm_upkstr failed");
Safefree(buf);
int ntask,i,info;
struct pvmtaskinfo *taskp;
int ti_tid,ti_ptid,ti_host,ti_flag,ti_pid;
char ti_a_out[256];
HV *hv_tmp;
PPCODE:
info = pvm_tasks(where,&ntask,&taskp);
XPUSHs(sv_2mortal(newSViv(info)));
if (info >= 0) /* ntask may be undefined if there was an error */
for(i=0;i<ntask;i++)
{
struct pvmhostinfo *hostp;
char hi_name[256], hi_arch[256];
int hi_tid, hi_speed;
int i;
HV *hv_tmp;
PPCODE:
info = pvm_config(&nhosts,&narch,&hostp);
if (info == PvmOk)
XPUSHs(sv_2mortal(newSViv(info)));
else
XPUSHs(sv_2mortal(newSViv(nhosts)));
int i;
int info;
char *po;
char *hosts[MAXHOSTS];
int infos[MAXHOSTS];
PPCODE:
if ( items < 1 )
croak("Usage: Parallel::Pvm::pvm_addhosts(host_list)");
for (i=0;i<items;i++)
{
hosts[i] = (char *)SvPV(ST(i), PL_na);
PREINIT:
char *po;
char *hosts[MAXHOSTS];
int infos[MAXHOSTS];
int info, i, nhost;
PPCODE:
if ( items < 1 )
croak("Usage: Parallel::Pvm::pvm_delhosts(host_list)");
for (i=0;i<items;i++)
{
hosts[i] = (char *)SvPV(ST(i), PL_na);
void
bufinfo(bufid)
int bufid
PREINIT:
int bytes, tag, tid, info;
PPCODE:
if (info = pvm_bufinfo(bufid,&bytes,&tag,&tid)) {
if (PL_dowarn) {
warn("pvm_bufinfo failed");
XSRETURN_EMPTY;
}
recv_notify(what)
int what
PREINIT:
int id,i,cnt;
int tids[MAXPROCS];
PPCODE:
pvm_recv(-1,-1);
switch (what )
{
case PvmTaskExit:
case PvmHostDelete:
PREINIT:
struct timeval rclk, delta;
int info;
int sec, usec;
HV *hv_tmp;
PPCODE:
info = pvm_hostsync(hst,&rclk,&delta);
XPUSHs(sv_2mortal(newSViv(info)));
sec = rclk.tv_sec;
usec = rclk.tv_usec;
/* set up hash entry */
siblings()
PREINIT:
int *tids;
int ntids;
int n;
PPCODE:
ntids = pvm_siblings(&tids);
XPUSHs(sv_2mortal(newSViv(ntids)));
for (n = 0; n < ntids; n++)
{
XPUSHs(sv_2mortal(newSViv(tids[n])));
char mi_name[256];
HV * hv_tmp;
AV * arr_tmp;
PPCODE:
info = pvm_getmboxinfo(pattern,&nclasses,&classes);
if (info == PvmOk)
XPUSHs(newSViv(nclasses));
else
XPUSHs(newSViv(info));
view all matches for this distribution
view release on metacpan or search on metacpan
cv_set_call_checker(cv, THX_ck_delay_caller_args, proto);
void
force(sv)
PROTOTYPE: $
PPCODE:
SV *sv = *PL_stack_sp--;
S_do_force(aTHX_ sv, use_caller_args_hint());
SP = PL_stack_sp;
#ifdef USE_ITHREADS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Params/Validate/XS.xs view on Meta::CPAN
SV* p
SV* specs
PROTOTYPE: \@$
PPCODE:
HV* ret = NULL;
AV* pa;
HV* ph;
HV* options;
lib/Params/Validate/XS.xs view on Meta::CPAN
validate_pos(p, ...)
SV* p
PROTOTYPE: \@@
PPCODE:
AV* specs;
AV* ret = NULL;
IV i;
IV ok;
lib/Params/Validate/XS.xs view on Meta::CPAN
RETURN_ARRAY(ret);
void
validate_with(...)
PPCODE:
HV* p;
SV* params;
SV* spec;
IV i;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Parse/Flex/Generate.pm view on Meta::CPAN
MODULE = Flexer PACKAGE = Flexer
void
yylex()
PPCODE:
char* id = 0;
if (id = (char*) yylex() ) {
XPUSHs (sv_2mortal(newSVpv(id,0)));
XPUSHs (sv_2mortal(newSVpv( yytext, 0)));
XSRETURN(2);
}
XSRETURN_EMPTY;
void
yylex_int()
PPCODE:
int id;
if (id = (int) yylex() ) {
XPUSHs (sv_2mortal(newSViv(id)));
XPUSHs (sv_2mortal(newSVpv( yytext, 0)));
XSRETURN(2);
view all matches for this distribution
view release on metacpan or search on metacpan
PREINIT:
IV x;
IV y;
PPCODE:
hilbert_d2xy(side, d, &x, &y);
EXTEND(SP, 2);
mPUSHi(x);
mPUSHi(y);
view all matches for this distribution