File: typemap

package info (click to toggle)
libguestfs 1%3A1.40.2-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 123,660 kB
  • sloc: ansic: 460,074; ml: 63,059; sh: 14,955; java: 9,512; makefile: 9,133; cs: 6,300; haskell: 5,652; python: 3,856; perl: 3,619; erlang: 2,435; xml: 1,683; ruby: 350; pascal: 255; lex: 135; yacc: 128; cpp: 10
file content (38 lines) | stat: -rw-r--r-- 1,182 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
TYPEMAP
char *		T_PV
const char *	T_PV
guestfs_h *	O_OBJECT_guestfs_h
int64_t	  	O_OBJECT_int64
void * /* virDomainPtr */ O_OBJECT_virDomainPtr

INPUT
O_OBJECT_guestfs_h
    if (sv_isobject ($arg) && sv_derived_from ($arg, \"Sys::Guestfs\") &&
        SvTYPE ($arg) == SVt_RV &&
        SvTYPE (SvRV ($arg)) == SVt_PVHV) {
        HV *hv = (HV *) SvRV ($arg);
        SV **svp = hv_fetch (hv, \"_g\", 2, 0);
        if (svp == NULL)
            croak (\"${Package}::$func_name(): called on a closed handle\");
        $var = INT2PTR ($type, SvIV (*svp));
    } else {
        croak (\"${Package}::$func_name(): $var is not a blessed HV reference\");
    }

O_OBJECT_int64
    $var = my_SvIV64 ($arg);

O_OBJECT_virDomainPtr
    /* This is copied directly from the Sys::Virt typemap.  Dan has assured
     * me that he doesn't intend to change this implementation!
     */
    if (sv_isobject ($arg) && SvTYPE (SvRV ($arg)) == SVt_PVMG)
        $var = INT2PTR (void *, SvIV ((SV*) SvRV ($arg)));
    else {
        warn (\"${Package}::$func_name() -- $var is not a blessed SV reference\");
        XSRETURN_UNDEF;
    }

OUTPUT
O_OBJECT_guestfs_h
    sv_setiv ($arg, PTR2IV ($var));