aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-01-02 11:10:22 +0100
committertgingold <tgingold@users.noreply.github.com>2021-01-02 22:05:15 +0100
commitdf7dcf48f31c7bf393ce3c85f37d4db3c3761adb (patch)
treeff0451502ae14c149e59d46bac833e2171c5255e /pyGHDL
parentdb6cb88c1ce9de8e1fdc9bd0f983ea09dbc78ca0 (diff)
downloadghdl-df7dcf48f31c7bf393ce3c85f37d4db3c3761adb.tar.gz
ghdl-df7dcf48f31c7bf393ce3c85f37d4db3c3761adb.tar.bz2
ghdl-df7dcf48f31c7bf393ce3c85f37d4db3c3761adb.zip
Added '@export' to list public interface items in '__all__'.
(cherry picked from commit 17fa10f71a50c2441115459df8d656acdb337f6e)
Diffstat (limited to 'pyGHDL')
-rw-r--r--pyGHDL/libghdl/__init__.py7
-rw-r--r--pyGHDL/libghdl/errorout_memory.py1
-rw-r--r--pyGHDL/libghdl/name_table.py1
-rw-r--r--pyGHDL/libghdl/utils/__init__.py16
-rw-r--r--pyGHDL/libghdl/vhdl/lists.py1
5 files changed, 26 insertions, 0 deletions
diff --git a/pyGHDL/libghdl/__init__.py b/pyGHDL/libghdl/__init__.py
index a38c60e30..1f24ab631 100644
--- a/pyGHDL/libghdl/__init__.py
+++ b/pyGHDL/libghdl/__init__.py
@@ -146,21 +146,25 @@ libghdl.libghdl__set_exec_prefix(
*_to_char_p(str(_libghdl_path.parent.parent).encode("utf-8"))
)
+@export
def finalize() -> None:
"""Free all the memory, be ready for a new initialization."""
libghdl.options__finalize()
+@export
def initialize() -> None:
"""Initialize or re-initialize the shared library."""
libghdl.options__initialize()
+@export
def set_option(opt: bytes) -> bool:
"""Set option :param:`opt`. Return true, if the option is known and handled."""
return libghdl.libghdl__set_option(*_to_char_p(opt)) == 0
+@export
def analyze_init() -> None:
"""
Initialize the analyzer.
@@ -170,15 +174,18 @@ def analyze_init() -> None:
"""
libghdl.libghdl__analyze_init()
+@export
def analyze_init_status() -> int:
"""Initialize the analyzer. Returns 0 in case of success."""
return libghdl.libghdl__analyze_init_status()
+@export
def analyze_file(fname: bytes):
""""Analyze a given filename :param:`fname`."""
return libghdl.libghdl__analyze_file(*_to_char_p(fname))
+@export
def disp_config():
""""Display the configured prefixes for libghdl."""
return libghdl.ghdllocal__disp_config_prefixes()
diff --git a/pyGHDL/libghdl/errorout_memory.py b/pyGHDL/libghdl/errorout_memory.py
index 5318a6c7f..c7295c113 100644
--- a/pyGHDL/libghdl/errorout_memory.py
+++ b/pyGHDL/libghdl/errorout_memory.py
@@ -39,6 +39,7 @@ from pydecor import export
from pyGHDL.libghdl import libghdl
+@export
class Error_Message(Structure):
_fields_ = [
("id", c_int8),
diff --git a/pyGHDL/libghdl/name_table.py b/pyGHDL/libghdl/name_table.py
index e4f9d8ec0..e2190f3dd 100644
--- a/pyGHDL/libghdl/name_table.py
+++ b/pyGHDL/libghdl/name_table.py
@@ -47,6 +47,7 @@ Get_Name_Ptr.restype = c_char_p
_Get_Identifier_With_Len = libghdl.name_table__get_identifier_with_len
+@export
def Get_Identifier(s):
return _Get_Identifier_With_Len(c_char_p(s), len(s))
diff --git a/pyGHDL/libghdl/utils/__init__.py b/pyGHDL/libghdl/utils/__init__.py
index cb9075a3d..127878a6b 100644
--- a/pyGHDL/libghdl/utils/__init__.py
+++ b/pyGHDL/libghdl/utils/__init__.py
@@ -45,6 +45,7 @@ import pyGHDL.libghdl.vhdl.lists as lists
import pyGHDL.libghdl.vhdl.flists as flists
+@export
def name_image(nameid) -> str:
"""Lookup a :param:`nameid` and return its string."""
return name_table.Get_Name_Ptr(nameid).decode("utf-8")
@@ -62,6 +63,7 @@ def _build_enum_image(cls) -> List[str]:
_fields_image = _build_enum_image(nodes_meta.fields)
+@export
def fields_image(idx) -> str:
"""String representation of field :param:`idx`."""
return _fields_image[idx]
@@ -70,6 +72,7 @@ def fields_image(idx) -> str:
_kind_image = _build_enum_image(nodes.Iir_Kind)
+@export
def kind_image(k) -> str:
"""String representation of Iir_Kind :param:`k`."""
return _kind_image[k]
@@ -78,6 +81,7 @@ def kind_image(k) -> str:
_types_image = _build_enum_image(nodes_meta.types)
+@export
def types_image(t) -> str:
"""String representation of Nodes_Meta.Types :param:`t`."""
return _types_image[t]
@@ -86,11 +90,13 @@ def types_image(t) -> str:
_attr_image = _build_enum_image(nodes_meta.Attr)
+@export
def attr_image(a) -> str:
"""String representation of Nodes_Meta.Attr :param:`a`."""
return _attr_image[a]
+@export
def leftest_location(n):
while True:
if n == nodes.Null_Iir:
@@ -102,6 +108,7 @@ def leftest_location(n):
return nodes.Get_Location(n)
+@export
def fields_iter(n) -> Generator[Any, None, None]:
"""Iterate on fields of node :param:`n`."""
if n == nodes.Null_Iir:
@@ -113,6 +120,7 @@ def fields_iter(n) -> Generator[Any, None, None]:
yield nodes_meta.get_field_by_index(i)
+@export
def chain_iter(n) -> Generator[Any, None, None]:
"""Iterate of a chain headed by node :param:`n`."""
while n != nodes.Null_Iir:
@@ -120,11 +128,13 @@ def chain_iter(n) -> Generator[Any, None, None]:
n = nodes.Get_Chain(n)
+@export
def chain_to_list(n) -> List[Any]:
"""Convert a chain headed by node :param:`n` to a Python list."""
return [e for e in chain_iter(n)]
+@export
def nodes_iter(n) -> Generator[Any, None, None]:
"""
Iterate all nodes of :param:`n`, including :param:`n`.
@@ -167,6 +177,7 @@ def nodes_iter(n) -> Generator[Any, None, None]:
yield n2
+@export
def list_iter(lst) -> Generator[Any, None, None]:
"""Iterate all element of Iir_List :param:`lst`."""
if lst <= nodes.Iir_List_All:
@@ -177,6 +188,7 @@ def list_iter(lst) -> Generator[Any, None, None]:
lists.Next(byref(iter))
+@export
def flist_iter(lst) -> Generator[Any, None, None]:
"""Iterate all element of Iir_List :param:`lst`."""
if lst <= nodes.Iir_Flist_All:
@@ -185,6 +197,7 @@ def flist_iter(lst) -> Generator[Any, None, None]:
yield flists.Get_Nth_Element(lst, i)
+@export
def declarations_iter(n) -> Generator[Any, None, None]:
"""Iterate all declarations in node :param:`n`."""
k = nodes.Get_Kind(n)
@@ -302,6 +315,7 @@ def declarations_iter(n) -> Generator[Any, None, None]:
raise Exception("Unknown node of kind {}".format(kind_image(k)))
+@export
def concurrent_stmts_iter(n) -> Generator[Any, None, None]:
"""Iterate concurrent statements in node :param:`n`."""
k = nodes.Get_Kind(n)
@@ -338,6 +352,7 @@ def concurrent_stmts_iter(n) -> Generator[Any, None, None]:
yield n2
+@export
def constructs_iter(n) -> Generator[Any, None, None]:
"""
Iterate library units, concurrent statements and declarations
@@ -407,6 +422,7 @@ def constructs_iter(n) -> Generator[Any, None, None]:
yield n3
+@export
def sequential_iter(n) -> Generator[Any, None, None]:
"""
Iterate sequential statements. The first node must be either
diff --git a/pyGHDL/libghdl/vhdl/lists.py b/pyGHDL/libghdl/vhdl/lists.py
index 5b4a389e2..efb5b4ea9 100644
--- a/pyGHDL/libghdl/vhdl/lists.py
+++ b/pyGHDL/libghdl/vhdl/lists.py
@@ -42,6 +42,7 @@ from pyGHDL.libghdl import libghdl
List_Type = c_int32
+@export
class Iterator(Structure):
_fields_ = [("chunk", c_int32), ("chunk_idx", c_int32), ("remain", c_int32)]