Skip to content

ffi

Provide the minimal pointer and opaque-handle type nodes that hosts can use when targeting IRx's stable public FFI layer.

Classes:

OpaqueHandleType

OpaqueHandleType(handle_name: str)

Bases: AnyType

Methods:

Source code in src/irx/astx/ffi.py
83
84
85
86
87
88
89
90
91
def __init__(self, handle_name: str) -> None:
    """
    title: Initialize one opaque-handle type.
    parameters:
      handle_name:
        type: str
    """
    super().__init__()
    self.handle_name = handle_name

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/astx/ffi.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Build one repr structure for an opaque-handle type.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    return self._prepare_struct(
        f"OPAQUE-HANDLE[{self.handle_name}]",
        self.handle_name,
        simplified,
    )

PointerType

PointerType(pointee_type: DataType | None = None)

Bases: AnyType

Methods:

Source code in src/irx/astx/ffi.py
30
31
32
33
34
35
36
37
38
def __init__(self, pointee_type: astx.DataType | None = None) -> None:
    """
    title: Initialize one pointer type.
    parameters:
      pointee_type:
        type: astx.DataType | None
    """
    super().__init__()
    self.pointee_type = pointee_type

get_struct

get_struct(simplified: bool = False) -> ReprStruct
Source code in src/irx/astx/ffi.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def get_struct(self, simplified: bool = False) -> astx.base.ReprStruct:
    """
    title: Build one repr structure for a pointer type.
    parameters:
      simplified:
        type: bool
    returns:
      type: astx.base.ReprStruct
    """
    key = "POINTER-TYPE"
    value = (
        None
        if self.pointee_type is None
        else self.pointee_type.get_struct(simplified)
    )
    return self._prepare_struct(
        key,
        cast(astx.base.ReprStruct, value),
        simplified,
    )