summaryrefslogtreecommitdiff
path: root/python/gras/GRAS_SBuffer.i
blob: 5ae910a0f862da289601ef051a89abe0164ac0d2 (plain)
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
// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.

%include <PMC/Registry.i>

%include <gras/sbuffer.i>

DECL_PMC_SWIG_TYPE(gras::SBuffer, swig_sbuffer)

%pythoncode %{

def pmc_to_sbuffer(p):
    s = pmc_to_swig_sbuffer(p)
    setattr(s, 'readonly', not isinstance(p, PMC))
    return s

RegisterPy2PMC(
    is_py = lambda x: type(x) is SBuffer,
    py2pmc = swig_sbuffer_to_pmc,
)

RegisterPMC2Py(
    is_pmc = pmc_is_swig_sbuffer,
    pmc2py = pmc_to_sbuffer,
)

%}