view release on metacpan or search on metacpan
source,tag,comm,&global_status);
MPIpm_errhandler("&PDL::Parallel::MPI::receive",retval);
void
get_status_list()
PPCODE:
/* return the status as a 4 element array:
* (count,MPI_SOURCE,MPI_TAG,MPI_ERROR) */
XPUSHs(sv_2mortal(newSViv(global_status.count)));
XPUSHs(sv_2mortal(newSViv(global_status.MPI_SOURCE)));
XPUSHs(sv_2mortal(newSViv(global_status.MPI_TAG)));
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
lib/PDL/Transform/Proj4.pd view on Meta::CPAN
# Utility functions for getting projection description information (in a general case).
pp_addxs('', <<'ENDXS' );
void
proj_version(...)
PPCODE:
EXTEND(sp, 3);
mPUSHu(PROJ_VERSION_MAJOR);
mPUSHu(PROJ_VERSION_MINOR);
mPUSHu(PROJ_VERSION_PATCH);
# returns input_units, output_units
void
units(proj_str)
char *proj_str
PPCODE:
PJ *proj = proj_create( NULL, proj_str ); /* Init the projection */
if (!proj)
croak("Failed to create PJ from '%s': %s", proj_str, proj_errno_string(proj_errno(proj)));
EXTEND(sp, 2);
char *input_u = proj_angular_input(proj, PJ_FWD) ||
view all matches for this distribution
view release on metacpan or search on metacpan
Basic/Gen/PP.pm view on Meta::CPAN
SV *parent = 0;
int nreturn;
$svdecls
$pars
PPCODE:
{
PDLA_COMMENT("Check if you can get a package name for this input value. ")
PDLA_COMMENT("It can be either a PDLA (SVt_PVMG) or a hash which is a ")
PDLA_COMMENT("derived PDLA subclass (SVt_PVHV) ")
view all matches for this distribution
view release on metacpan or search on metacpan
Graphics/IIS/iis.pd view on Meta::CPAN
MODULE = PDLA::Graphics::IIS PACKAGE = PDLA::Graphics::IIS
void
_iiscur_int()
PPCODE:
STRLEN n_a;
STRLEN n_b;
float x,y;
char ch;
int frame = (int)SvIV( perl_get_sv("iisframe", FALSE) );
view all matches for this distribution
view release on metacpan or search on metacpan
Basic/Gen/PP.pm view on Meta::CPAN
SV *parent = 0;
int nreturn;
$svdecls
$pars
PPCODE:
{
PDLA_COMMENT("Check if you can get a package name for this input value. ")
PDLA_COMMENT("It can be either a PDLA (SVt_PVMG) or a hash which is a ")
PDLA_COMMENT("derived PDLA subclass (SVt_PVHV) ")
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:
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
FR/perlxs.pod view on Meta::CPAN
simples, la valeur de RETVAL sera mise dans ST(0) sur la pile
d'arguments, où Perl le recevra comme valeur de retour de la XSUB.
Si la XSUB a un type de retour égal à C<void>, le compilateur ne
fournira pas de variable RETVAL pour cette fonction. Lorsqu'on utilise
la directive PPCODE:, la variable RETVAL n'est plus nécessaire, sauf
si on l'utilise explicitement.
Si la directive PPCODE: n'est pas utilisée, la valeur de retour
C<void> devrait être utilisée uniquement pour des sous-routines qui ne
renvoient pas de valeur, I<même si> la directive CODE: est utilisée
pour positionner ST(0) explicitement.
Dans des versions plus anciennes de ce document, on conseillait
FR/perlxs.pod view on Meta::CPAN
=head2 Le mot-clé C_ARGS
Le mot-clé C_ARGS permet de réaliser des XSUB que l'on n'appelle pas
de la même manière depuis Perl que depuis C, sans qu'il soit
nécessaire d'écrire une section CODE: ou PPCODE:. Le contenu du
paragraphe C_ARGS est passé comme argument à la fonction C, sans aucun
changement.
Supposons par exemple que la fonction C soit déclarée ainsi :
FR/perlxs.pod view on Meta::CPAN
symbolic function
int n
C_ARGS:
n, function, default_flags
=head2 Le mot-clé PPCODE
Le mot-clé PPCODE: est une variante du mot-clé CODE: qui est utilisée
pour indiquer au compilateur B<xsubpp> que le programmeur fournit le
code contrôlant la pile des arguments pour les valeurs de retour des
XSUB. On souhaite parfois que la XSUB renvoie une liste de valeurs et
non une valeur unique. Dans ce cas-là, il faut utiliser PPCODE: et
rajouter de manière explicite la liste des valeurs sur la pile. Les
mots-clés PPCODE: et CODE: ne sont pas utilisés simultanément dans la
même XSUB.
La XSUB suivante appelle la fonction C rpcb_gettime() et renvoie à Perl
ses deux valeurs de sortie, timep et status, comme une seule liste.
FR/perlxs.pod view on Meta::CPAN
rpcb_gettime(host)
char *host
PREINIT:
time_t timep;
bool_t status;
PPCODE:
status = rpcb_gettime( host, &timep );
EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv(status)));
PUSHs(sv_2mortal(newSViv(timep)));
FR/perlxs.pod view on Meta::CPAN
Le type de retour C<void> pour cette fonction indique au compilateur
B<xsubpp> que la variable RETVAL n'est pas nécessaire, qu'elle n'est
pas utlisée, et qu'elle ne devrait pas être créée. Dans la plupart des
cas, il faut utiliser le type de retour void avec l'instruction
PPCODE:.
On utilise la macro EXTEND() afin de dégager de la place sur la pile
des arguments pour les 2 valeurs de retour. L'instruction PPCODE: fait
en sorte que le compilateur B<xsubpp> crée un pointeur vers la pile
dans la variable C<SP> ; c'est ce pointeur qui est utilisé dans la
macro EXTEND(). Les valeurs sont ensuite rajoutées sur la pile avec
les macros PUSHs().
FR/perlxs.pod view on Meta::CPAN
avec l'instruction suivante.
($status, $timep) = rpcb_gettime("localhost");
Lorsque vous travaillez sur les paramètres en sortie avec une section
PPCODE:, assurez-vous de traiter l'effet 'set'
convenablement. Consultez L<perlguts> pour plus de détails sur cet
effet 'set'.
=head2 Renvoyer undef et des listes vides
FR/perlxs.pod view on Meta::CPAN
}
else{
ST(0) = &PL_sv_undef;
}
Pour renvoyer une liste vide, il faut utiliser un bloc PPCODE: et ne
pas rajouter de valeur de retour sur la pile.
void
rpcb_gettime(host)
char *host
PREINIT:
time_t timep;
PPCODE:
if( rpcb_gettime( host, &timep ) )
PUSHs(sv_2mortal(newSViv(timep)));
else{
/* Rien n'est remis sur la pile, donc une */
/* liste vide est renvoyee implicitement */
FR/perlxs.pod view on Meta::CPAN
=head2 Le mot-clé CLEANUP
Ce mot-clé peut être utilisé quand une XSUB doit exécuter des
procédures de nettoyage spéciales avant de se terminer. Quand le
mot-clé CLEANUP: est utilisé, il doit suivre tout bloc CODE:, PPCODE:
ou OUTPUT: présent dans la XSUB. Les instructions spécifiées dans le bloc de
nettoyage seront les dernières instructions de la XSUB.
=head2 Le mot-clé BOOT
FR/perlxs.pod view on Meta::CPAN
timep
=head2 Insérer des commentaires et des directives de pré-processeur C
Des directives de pré-processeur C peuvent prendre place à l'intérieur
des blocs BOOT:, PREINIT:, INIT:, CODE:, PPCODE: et CLEANUP:, de même
qu'en dehors des fonctions. Les commentaires sont autorisés partout
après le mot-clé MODULE. Le compilateur transmet les directives de
pré-processeur sans modification et supprime les lignes commentées.
On peut rajouter des commentaires dans les XSUB en mettant un C<#> sur
view all matches for this distribution
view release on metacpan or search on metacpan
IT/perlxstut.pod view on Meta::CPAN
In ogni caso, queste due XSUB forniscono un codice C generato praticamente
uguale: il compilatore B<xsubpp> E<egrave> abbastanza intelligente da intuire
la sezione C<CODE:> dalle prime due righe della descrizione XSUB. Che
dire della sezione C<OUTPUT:>? E<Egrave> assolutamente la stessa! Anche la
sezione C<OUTPUT:> puE<ograve> essere rimossa, I<sempre che le sezioni C<CODE:>
o C<PPCODE:> > non siano specificate: B<xsubpp> puE<ograve> quindi vedere che ha
bisogno di generare una sezione di chiamata a funzione, e genererE<agrave> anche
la sezione C<OUTPUT>. Per quanto detto, un'abbreviazione della XSUB
diventa:
double
IT/perlxstut.pod view on Meta::CPAN
char * path
INIT:
int i;
struct statfs buf;
PPCODE:
i = statfs(path, &buf);
if (i == 0) {
XPUSHs(sv_2mortal(newSVnv(buf.f_bavail)));
XPUSHs(sv_2mortal(newSVnv(buf.f_bfree)));
XPUSHs(sv_2mortal(newSVnv(buf.f_blocks)));
IT/perlxstut.pod view on Meta::CPAN
La direttiva C<INIT:> contiene codice che verrE<agrave> inserito immediatamente
dopo che lo stack degli argomenti viene decodificato. Il linguaggio C
non consente dichiarazioni di variaible in posizioni arbitrarie
all'interno di una funzione, per cui questa E<egrave> di norma la soluzione migliore
per dichiarare le variabili locali di cui la XSUB ha bisogno. (In
alternativa, E<egrave> possibile mettere l'intera sezione C<PPCODE:> in
parentesi graffe, ed aggiungere queste dichiarazioni all'inizio).
=item *
Questa routine restituisce anche un numero di argomenti differenti
IT/perlxstut.pod view on Meta::CPAN
come unico elemento di un array. Se la chiamata ha successo, viene
restituito un array di 9 elementi. PoichE<eacute> questa funzione riceve un solo
argomento, abbiamo bisogno di fare spazio sullo stack per tenere i
9 valori che potrebbero essere restituiti.
Otteniamo tutto ciE<ograve> utilizzando la direttiva C<PPCODE:>, piuttosto che
la direttiva C<CODE:>. Questo indica a B<xsubpp> che utilizzeremo i
valori di ritorno che saranno messi sullo stack degli argomenti da noi
stessi.
=item *
IT/perlxstut.pod view on Meta::CPAN
Questa funzione non utilizza una C<typemap>. Al contrario, dichiariamo che
accetta un parametro C<SV*> (scalare), e che restituisce un valore C<SV*>;
ci prendiamo direttamente cura di questi scalari all'interno del codice.
PoichE<eacute> stiamo restituendo un solo valore, non abbiamo bisogno di una
direttiva C<PPCODE:> - al contrario, utilizziamo le direttive C<CODE:> e
C<OUTPUT:>.
=item *
Quando si ha a che fare con i riferimenti, E<egrave> importante trattarli con
view all matches for this distribution
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
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 {
PUSHs(&PL_sv_undef);
ALIAS:
clock_gettime = 1
INIT:
int rv;
struct timespec res;
PPCODE:
rv = (!ix) ? clock_getres(clock_id, &res) : clock_gettime(clock_id, &res);
if (rv == 0)
PUSH_TIMESPEC(res);
#endif
PROTOTYPE: $$@
INIT:
int rv;
struct timespec request;
struct timespec remain = { 0, 0 };
PPCODE:
SvGETMAGIC(sec);
if (items == 3 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV(request, sec);
else
TIMESPEC_FROM_IV(request, sec, nsec);
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(tp, sec);
else
TIMESPEC_FROM_IV(tp, sec, nsec);
nanosleep(SV *sec, long nsec=0);
PROTOTYPE: @
INIT:
struct timespec request;
struct timespec remain = { 0, 0 };
PPCODE:
SvGETMAGIC(sec);
if (items == 1 && LOOKS_LIKE_NV(sec))
TIMESPEC_FROM_NV(request, sec);
else
TIMESPEC_FROM_IV(request, sec, nsec);
#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))
mPUSHi(rv);
else
PUSHs(&PL_sv_undef);
#ifdef PSX2008_HAS_GETDATE
void
getdate(const char *string);
INIT:
struct tm *tm = getdate(string);
PPCODE:
if (tm != NULL) {
EXTEND(SP, 9);
mPUSHi(tm->tm_sec);
mPUSHi(tm->tm_min);
mPUSHi(tm->tm_hour);
};
char *remainder;
size_t i, tm_count;
AV *tm_av = NULL;
U8 gimme = GIMME_V;
PPCODE:
{
if (items > 2) {
SV *tm_arg = ST(2l);
SvGETMAGIC(tm_arg);
if (SvROK(tm_arg) && SvTYPE(SvRV(tm_arg)) == SVt_PVAV) {
#if !defined(MAXHOSTNAMELEN) || MAXHOSTNAMELEN < 256
char name[256];
#else
char name[MAXHOSTNAMELEN];
#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, 4);
mPUSHi(value.it_interval.tv_sec);
mPUSHi(value.it_interval.tv_usec);
mPUSHi(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) {
EXTEND(SP, 4);
mPUSHi(ovalue.it_interval.tv_sec);
mPUSHi(ovalue.it_interval.tv_usec);
mPUSHi(ovalue.it_value.tv_sec);
#ifdef PSX2008_HAS_NICE
void
nice(int incr);
PREINIT:
int rv;
PPCODE:
{
SETERRNO(0, 0);
rv = nice(incr);
if (rv != -1 || errno == 0)
mPUSHi(rv);
#ifdef PSX2008_HAS_GETPRIORITY
void
getpriority(int which=PRIO_PROCESS, id_t who=0);
PREINIT:
int rv;
PPCODE:
{
SETERRNO(0, 0);
rv = getpriority(which, who);
if (rv != -1 || errno == 0)
mPUSHi(rv);
#ifdef PSX2008_HAS_GETUTXENT
void
getutxent();
INIT:
struct utmpx *utxent = getutxent();
PPCODE:
RETURN_UTXENT;
#endif
#ifdef PSX2008_HAS_GETUTXID
void
getutxid(short ut_type, char *ut_id=NULL);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {0};
PPCODE:
utxent_req.ut_type = ut_type;
if (ut_id != NULL) {
memcpy(utxent_req.ut_id, ut_id,
strnlen(ut_id, sizeof(utxent_req.ut_id)));
}
void
getutxline(char *ut_line);
INIT:
struct utmpx *utxent;
struct utmpx utxent_req = {0};
PPCODE:
if (ut_line != NULL) {
memcpy(utxent_req.ut_line, ut_line,
strnlen(ut_line, sizeof(utxent_req.ut_line)));
utxent = getutxline(&utxent_req);
RETURN_UTXENT;
void
erand48(unsigned short X0, unsigned short X1, unsigned short X2);
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
double result = erand48(xsubi);
PPCODE:
EXTEND(SP, 4);
mPUSHn(result);
mPUSHu(xsubi[0]);
mPUSHu(xsubi[1]);
mPUSHu(xsubi[2]);
ALIAS:
nrand48 = 1
INIT:
unsigned short xsubi[3] = { X0, X1, X2 };
long result = ix == 0 ? jrand48(xsubi) : nrand48(xsubi);
PPCODE:
EXTEND(SP, 4);
mPUSHi(result);
mPUSHu(xsubi[0]);
mPUSHu(xsubi[1]);
mPUSHu(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:
EXTEND(SP, 3);
mPUSHu(old[0]);
mPUSHu(old[1]);
mPUSHu(old[2]);
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, 4);
mPUSHi(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_PATHCONF
void
pathconf(SV *what, int name);
INIT:
long rv = -1;
PPCODE:
{
SETERRNO(0, 0);
SvGETMAGIC(what);
if (!SvOK(what))
errno = ENOENT;
#ifdef PSX2008_HAS_SYSCONF
void
sysconf(int name);
INIT:
long rv;
PPCODE:
{
SETERRNO(0, 0);
rv = sysconf(name);
if (rv == -1 && errno != 0)
PUSHs(&PL_sv_undef);
void
stat(SV *what);
INIT:
int rv = -1;
struct stat buf;
PPCODE:
SvGETMAGIC(what);
if (!SvOK(what))
errno = ENOENT;
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))
errno = ENOENT;
else if (SvPOK(what)) {
const char *path = SvPV_nomg_const_nolen(what);
#endif
#ifdef PSX2008_HAS_MKDTEMP
void
mkdtemp(SV *template);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template, 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);
PPCODE:
{
STRLEN len;
const char *ctmp = SvPV_const(template, 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;
STRLEN nbytes;
char *cbuf;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::read: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
nbytes = SvSTRLEN(count);
void
write(psx_fd_t fd, SV *buf, SV *count=NULL);
PREINIT:
STRLEN cbuflen, nbytes;
SSize_t rv;
PPCODE:
{
const char *cbuf = SvPV_const(buf, cbuflen);
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::write: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
#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 (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
else
#ifdef PSX2008_HAS_PREADV
void
preadv(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=&PL_sv_undef);
PROTOTYPE: $\[@$]$;$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, NULL);
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
else
#ifdef PSX2008_HAS_PREADV2
void
preadv2(psx_fd_t fd, SV *buffers, AV *sizes, SV *offset=&PL_sv_undef, \
SV *flags=&PL_sv_undef);
PROTOTYPE: $\[@$]$;$$
PPCODE:
{
SSize_t rv = _readv50c(aTHX_ fd, buffers, sizes, offset, flags);
if (LIKELY(rv != -1))
PUSH_INT_OR_PV((Size_t)rv);
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 (LIKELY(rv != -1))
#endif
#ifdef PSX2008_HAS_PWRITEV
void
pwritev(psx_fd_t fd, AV *buffers, SV *offset=NULL);
PPCODE:
{
struct iovec *iov;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
Off_t offs = SvUNDEF_purposely(offset) ? 0 : SvOFFt(offset);
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;
int iovcnt = _psx_av2iov(aTHX_ buffers, &iov);
Off_t offs = SvUNDEF_purposely(offset) ? 0 : SvOFFt(offset);
int i_flags = SvUNDEF_purposely(flags) ? 0 : (int)SvIV(flags);
PREINIT:
Off_t f_offset;
char *cbuf;
STRLEN cbuflen, new_len, b_offset, nbytes;
SSize_t rv;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::pread: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
PREINIT:
Off_t f_offset;
const char *cbuf;
STRLEN cbuflen, b_offset, max_nbytes, nbytes;
SSize_t rv;
PPCODE:
{
if (UNLIKELY(SvNEGATIVE(count))) /* Performs 'get' magic. */
croak("%s::pwrite: Can't handle negative count: %" SVf_QUOTEDPREFIX,
PACKNAME, SVfARG(count));
#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
#if defined(PSX2008_HAS_POLL)
void
poll(SV *pollfds, int timeout=-1);
PPCODE:
{
AV *pollfds_av = NULL;
Size_t nfds = 0;
SvGETMAGIC(pollfds);
#ifdef PSX2008_DIV
void
div(IV numer, IV denom);
INIT:
PSX2008_DIV_T result;
PPCODE:
result = PSX2008_DIV(numer, denom);
EXTEND(SP, 2);
mPUSHi(result.quot);
mPUSHi(result.rem);
#ifdef PSX2008_LROUND
void
lround(double x)
INIT:
PSX2008_LROUND_T ret;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
ret = PSX2008_LROUND(x);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0)
PUSH_INT_OR_PV(ret);
#ifdef PSX2008_HAS_REMAINDER
void
remainder(double x, double y);
INIT:
double res;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
res = remainder(x, y);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0)
mPUSHn(res);
void
remquo(double x, double y);
INIT:
int quo;
double res;
PPCODE:
SETERRNO(0, 0);
feclearexcept(FE_ALL_EXCEPT);
res = remquo(x, y, &quo);
if (errno == 0 && fetestexcept(FE_ALL_EXCEPT) == 0) {
mPUSHn(res);
void
conj(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = conj(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CPROJ
void
cexp(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cexp(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CLOG
void
clog(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = clog(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CPOW
cpow(double re_x, double im_x, double re_y, double im_y);
INIT:
double complex x = re_x + im_x * I;
double complex y = re_y + im_y * I;
double complex result = cpow(x, y);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSQRT
void
csqrt(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csqrt(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CACOS
void
cacos(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cacos(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CACOSH
void
cacosh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = cacosh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CASIN
void
casin(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = casin(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CASINH
void
casinh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = casinh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CATAN
void
catan(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = catan(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CATANH
void
catanh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = catanh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CCOS
void
ccos(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ccos(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CCOSH
void
ccosh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ccosh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSIN
void
csin(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csin(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CSINH
void
csinh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = csinh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CTAN
void
ctan(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ctan(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
#ifdef PSX2008_HAS_CTANH
void
ctanh(double re, double im);
INIT:
double complex z = re + im * I;
double complex result = ctanh(z);
PPCODE:
RETURN_COMPLEX(result);
#endif
## 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");
mXPUSHn(timespec_to_nv(&value.it_value));
if (GIMME_V == G_ARRAY)
mXPUSHn(timespec_to_nv(&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");
mXPUSHn(timespec_to_nv(&old_itimer.it_value));
if (GIMME_V == G_ARRAY)
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;
struct timespec 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