aboutsummaryrefslogtreecommitdiffstats
path: root/pyGHDL/libghdl/vhdl
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2021-01-07 16:03:52 +0100
committertgingold <tgingold@users.noreply.github.com>2021-01-10 10:14:16 +0100
commit2a13ab3ff6e86782018fd1691ceb3e6ad92bef96 (patch)
treef3fd979b7e769c4b01273e6d7b72ced5489934d9 /pyGHDL/libghdl/vhdl
parent886c4a2edb17a08901b3c488d11b9a9f77d16a7a (diff)
downloadghdl-2a13ab3ff6e86782018fd1691ceb3e6ad92bef96.tar.gz
ghdl-2a13ab3ff6e86782018fd1691ceb3e6ad92bef96.tar.bz2
ghdl-2a13ab3ff6e86782018fd1691ceb3e6ad92bef96.zip
Enhanced docstrings for Python/Ada interface.
Diffstat (limited to 'pyGHDL/libghdl/vhdl')
-rw-r--r--pyGHDL/libghdl/vhdl/canon.py10
-rw-r--r--pyGHDL/libghdl/vhdl/flists.py50
-rw-r--r--pyGHDL/libghdl/vhdl/formatters.py69
-rw-r--r--pyGHDL/libghdl/vhdl/lists.py128
-rw-r--r--pyGHDL/libghdl/vhdl/nodes_utils.py75
-rw-r--r--pyGHDL/libghdl/vhdl/parse.py23
-rw-r--r--pyGHDL/libghdl/vhdl/scanner.py96
-rw-r--r--pyGHDL/libghdl/vhdl/sem.py19
-rw-r--r--pyGHDL/libghdl/vhdl/sem_lib.py39
-rw-r--r--pyGHDL/libghdl/vhdl/std_package.py23
10 files changed, 447 insertions, 85 deletions
diff --git a/pyGHDL/libghdl/vhdl/canon.py b/pyGHDL/libghdl/vhdl/canon.py
index e54bb06e1..d4e5eb4e3 100644
--- a/pyGHDL/libghdl/vhdl/canon.py
+++ b/pyGHDL/libghdl/vhdl/canon.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -36,6 +37,11 @@ from ctypes import c_bool
from pyGHDL.libghdl import libghdl
+__all__ = [
+ 'Flag_Concurrent_Stmts',
+ 'Flag_Configurations',
+ 'Flag_Associations'
+]
Flag_Concurrent_Stmts = c_bool.in_dll(
libghdl, "vhdl__canon__canon_flag_concurrent_stmts"
diff --git a/pyGHDL/libghdl/vhdl/flists.py b/pyGHDL/libghdl/vhdl/flists.py
index df7f87cc5..2c123cb20 100644
--- a/pyGHDL/libghdl/vhdl/flists.py
+++ b/pyGHDL/libghdl/vhdl/flists.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -34,14 +35,51 @@
#
from ctypes import c_int32
+from pydecor import export
+
from pyGHDL.libghdl import libghdl
+__all__ = [
+ 'Flist_Type',
+ 'Ffirst'
+]
-Flist_Type = c_int32
+Flist_Type = c_int32 #: First index of a ``FList``.
Ffirst = 0
-Flast = libghdl.vhdl__flists__flast
-Length = libghdl.vhdl__flists__length
+@export
+def Flast(FList) -> int:
+ """
+ Last index of :obj:`FList`.
+
+ .. hint:: Could be used to iterate.
+
+ :param FList: List to query.
+ :return: Index of the last element in the list.
+ """
+ return libghdl.vhdl__flists__flast(FList)
+
+
+@export
+def Length(FList) -> int:
+ """
+ Get the length of :obj:`FList`.
+
+ :param FList: List to query.
+ :return: Number of elements in the list.
+ """
+ return libghdl.vhdl__flists__length(FList)
+
+
+@export
+def Get_Nth_Element(FList, N: int):
+ """
+ Get the N-th element of :obj:`FList`.
+
+ First element has index 0.
-Get_Nth_Element = libghdl.vhdl__flists__get_nth_element
+ :param FList: List to query.
+ :return: Type: ``El_Type``
+ """
+ return libghdl.vhdl__flists__get_nth_element(FList, N)
diff --git a/pyGHDL/libghdl/vhdl/formatters.py b/pyGHDL/libghdl/vhdl/formatters.py
index 3c15c724c..fe9098297 100644
--- a/pyGHDL/libghdl/vhdl/formatters.py
+++ b/pyGHDL/libghdl/vhdl/formatters.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -34,17 +35,67 @@
#
from ctypes import c_int32, c_char_p
+from pydecor import export
+
from pyGHDL.libghdl import libghdl
-Indent_String = libghdl.vhdl__formatters__indent_string
+@export
+def Indent_String(File, Handle, FirstLine: int, LastLine: int) -> None:
+ """
+ Reindent all lines of F between [First_Line; Last_Line] to :obj:`Handle`.
+
+ :param File: File to indent lines within. Type: ``Iir_Design_File``
+ :param Handle: undocumented. Type: ``Vstring_Acc``
+ :param FirstLine: undocumented.
+ :param LastLine: undocumented.
+ """
+ libghdl.vhdl__formatters__indent_string(File, Handle, FirstLine, LastLine)
+
+
+@export
+def Allocate_Handle():
+ """
+ .. todo:: Undocumented in Ada code.
+
+ :return: undocumented. Type: ``Vstring_Acc``
+ """
+ return libghdl.vhdl__formatters__allocate_handle()
+
+
+@export
+def Get_Length(Handle) -> int:
+ """
+ .. todo:: Undocumented in Ada code.
+
+ :param Handle: undocumented. Type: ``Vstring_Acc``
+ :return: undocumented.
+ """
+ func = libghdl.vhdl__formatters__get_length
+ func.restype = c_int32
+
+ return func(Handle)
+
+
+@export
+def Get_C_String(Handle):
+ """
+ .. todo:: Undocumented in Ada code.
+
+ :param Handle: undocumented. Type: ``Vstring_Acc``
+ :return: Type: ``Grt.Types.Ghdl_C_String``
+ """
+ func = libghdl.vhdl__formatters__get_c_string
+ func.restype = c_char_p
-Allocate_Handle = libghdl.vhdl__formatters__allocate_handle
+ return func(Handle)
-Get_Length = libghdl.vhdl__formatters__get_length
-Get_Length.restype = c_int32
-Get_C_String = libghdl.vhdl__formatters__get_c_string
-Get_C_String.restype = c_char_p
+@export
+def Free_Handle(Handle) -> None:
+ """
+ .. todo:: Undocumented in Ada code.
-Free_Handle = libghdl.vhdl__formatters__free_handle
+ :param Handle: undocumented. Type: ``Vstring_Acc``
+ """
+ libghdl.vhdl__formatters__free_handle(Handle)
diff --git a/pyGHDL/libghdl/vhdl/lists.py b/pyGHDL/libghdl/vhdl/lists.py
index efb5b4ea9..dc4391ebf 100644
--- a/pyGHDL/libghdl/vhdl/lists.py
+++ b/pyGHDL/libghdl/vhdl/lists.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -39,34 +40,117 @@ from pydecor import export
from pyGHDL.libghdl import libghdl
-List_Type = c_int32
+@export
+class Iterator(Structure):
+ _fields_ = [
+ ("chunk", c_int32),
+ ("chunk_idx", c_int32),
+ ("remain", c_int32)
+ ]
@export
-class Iterator(Structure):
- _fields_ = [("chunk", c_int32), ("chunk_idx", c_int32), ("remain", c_int32)]
+def Iterate(List) -> Iterator:
+ """
+ Create an iterator for a given list.
+
+ The idiomatic way to iterate is:
+ .. code-block:: Python
-Iterate = libghdl.vhdl__lists__iterate
-Iterate.argstype = [List_Type]
-Iterate.restype = Iterator
+ It = Iterate(List)
+ while Is_Valid(It):
+ El = Get_Element(It)
+ # ...
+ Next(It)
-Is_Valid = libghdl.vhdl__lists__is_valid
-Is_Valid.argstype = [POINTER(Iterator)]
-Is_Valid.restype = c_bool
+ :param List: List to create an iterator from.
+ :return: Iterator structure.
+ """
+ func = libghdl.vhdl__lists__iterate
+ func.argstype = [(c_int32)]
+ func.restype = Iterator
+
+ return func(List)
+
+
+@export
+def Is_Valid(Iterator) -> bool:
+ """
+ Check if iterator reached the end.
-Next = libghdl.vhdl__lists__next
-Next.argstype = [POINTER(Iterator)]
-Next.restype = None
+ :param Iterator: Iterator to check.
+ :return: False, if iterator has reached the end.
+ """
+ func = libghdl.vhdl__lists__is_valid
+ func.argstype = [POINTER(Iterator)]
+ func.restype = c_bool
-Get_Element = libghdl.vhdl__lists__get_element
-Get_Element.argstype = [POINTER(Iterator)]
-Get_Element.restype = c_int32
+ return func(Iterator)
-Get_Nbr_Elements = libghdl.vhdl__lists__get_nbr_elements
-Get_Nbr_Elements.argtype = [List_Type]
-Get_Nbr_Elements.restype = c_int32
-Create_Iir_List = libghdl.vhdl__lists__create_list
+@export
+def Next(Iterator):
+ """
+ Move iterator to the next element.
+
+ :param Iterator: Iterator to increment.
+ :return: False, if iterator has reached the end.
+ """
+ func = libghdl.vhdl__lists__next
+ func.argstype = [POINTER(Iterator)]
+ func.restype = None
+
+ func(Iterator)
+
+
+@export
+def Get_Element(Iterator) -> int:
+ """
+ Get the current element from iterator.
+
+ :param Iterator: Iterator the get the element from.
+ :return: The current element the iterator points to. Type: ``El_Type``
+ """
+ func = libghdl.vhdl__lists__get_element
+ func.argstype = [POINTER(Iterator)]
+ func.restype = c_int32
+
+ return func(Iterator)
+
+
+@export
+def Get_Nbr_Elements(List) -> int:
+ """
+ Return the number of elements in the list.
+
+ .. hint:: This is also 1 + the position of the last element.
+
+ :param List: The list to use.
+ :return: Number of list elements.
+ """
+ func = libghdl.vhdl__lists__get_nbr_elements
+ func.argtype = [(c_int32)]
+ func.restype = c_int32
+
+ return func(List)
+
+
+@export
+def Create_Iir_List():
+ """
+ Create a list.
+
+ :return: Type: ``List_Type``
+ """
+ return libghdl.vhdl__lists__create_list()
+
+
+@export
+def Destroy_Iir_List(List) -> None:
+ """
+ Destroy a list.
-Destroy_Iir_List = libghdl.vhdl__lists__destroy_list
+ :param List: List to destroy.
+ """
+ libghdl.vhdl__lists__destroy_list(List)
diff --git a/pyGHDL/libghdl/vhdl/nodes_utils.py b/pyGHDL/libghdl/vhdl/nodes_utils.py
index 650bc9f54..b2cbef56f 100644
--- a/pyGHDL/libghdl/vhdl/nodes_utils.py
+++ b/pyGHDL/libghdl/vhdl/nodes_utils.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -32,17 +33,71 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
#
-from pyGHDL.libghdl import libghdl
+from pydecor import export
+from pyGHDL.libghdl import libghdl, Iir
-Strip_Denoting_Name = libghdl.vhdl__utils__strip_denoting_name
-Get_Entity = libghdl.vhdl__utils__get_entity
+@export
+def Strip_Denoting_Name(Name: Iir) -> Iir:
+ """
+ If :obj:`Name` is a simple or an expanded name, return the denoted declaration.
+ Otherwise, return :obj:`Name`.
-Is_Second_Subprogram_Specification = (
- libghdl.vhdl__utils__is_second_subprogram_specification
-)
+ :param Name: Simple or an expanded name.
+ :return: Denoted declaration.
+ """
+ return libghdl.vhdl__utils__strip_denoting_name(Name)
-Get_Entity_From_Entity_Aspect = libghdl.vhdl__utils__get_entity_from_entity_aspect
-Get_Interface_Of_Formal = libghdl.vhdl__utils__get_interface_of_formal
+@export
+def Get_Entity(Decl: Iir) -> Iir:
+ """
+ This is a wrapper around ``Get_Entity_Name`` to return the entity declaration
+ of the entity name of :obj:`Decl`, or ``Null_Iir`` in case of error.
+
+ :param Decl: Declaration
+ :return: Entity
+ """
+ return libghdl.vhdl__utils__get_entity(Decl)
+
+
+@export
+def Is_Second_Subprogram_Specification(Spec: Iir) -> bool:
+ """
+ Check if :obj:`Spec` is the subprogram specification of a subprogram body
+ which was previously declared. In that case, the only use of :obj:`Spec`
+ is to match the body with its declaration.
+
+ :param Spec: Specification
+ :return: ``True`` if subprogram specification and previously declared subprogram body match
+ """
+ return libghdl.vhdl__utils__is_second_subprogram_specification(Spec)
+
+
+@export
+def Get_Entity_From_Entity_Aspect(Aspect: Iir) -> Iir:
+ """
+ Extract the entity from :obj:`Aspect`.
+
+ .. note::
+
+ If :obj:`Aspect` is a component declaration, return :obj:`Aspect`. |br|
+ If :obj:`Aspect` is open, return ``Null_Iir``
+
+ :param Aspect: Aspect
+ :return: Entity
+ """
+ return libghdl.vhdl__utils__get_entity_from_entity_aspect(Aspect)
+
+
+@export
+def Get_Interface_Of_Formal(Formal: Iir) -> Iir:
+ """
+ Get the interface corresponding to the formal name :obj:`Formal`. This is
+ always an interface, even if the formal is a name.
+
+ :param Formal: The formal.
+ :return: The corresponding interface.
+ """
+ return libghdl.vhdl__utils__get_interface_of_formal(Formal)
diff --git a/pyGHDL/libghdl/vhdl/parse.py b/pyGHDL/libghdl/vhdl/parse.py
index ecb84736f..69083c469 100644
--- a/pyGHDL/libghdl/vhdl/parse.py
+++ b/pyGHDL/libghdl/vhdl/parse.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -34,9 +35,25 @@
#
from ctypes import c_bool
+from pydecor import export
+
from pyGHDL.libghdl import libghdl
+__all__ = [
+ 'Flag_Parse_Parenthesis'
+]
-Parse_Design_File = libghdl.vhdl__parse__parse_design_file
Flag_Parse_Parenthesis = c_bool.in_dll(libghdl, "vhdl__parse__flag_parse_parenthesis")
+
+
+@export
+def Parse_Design_File():
+ """
+ Parse a file.
+
+ ..note:: The scanner must have been initialized as for parse_design_unit.
+
+ :return: Return :obj:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir` in case of error. Type: ``Iir_Design_File``
+ """
+ return libghdl.vhdl__parse__parse_design_file()
diff --git a/pyGHDL/libghdl/vhdl/scanner.py b/pyGHDL/libghdl/vhdl/scanner.py
index 1debe9dde..1215c97a2 100644
--- a/pyGHDL/libghdl/vhdl/scanner.py
+++ b/pyGHDL/libghdl/vhdl/scanner.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -34,26 +35,95 @@
#
from ctypes import c_int, c_bool
-from pyGHDL.libghdl import libghdl
-
+from pydecor import export
-Set_File = libghdl.vhdl__scanner__set_file
+from pyGHDL.libghdl import libghdl
+from pyGHDL.libghdl._types import SourceFileEntry, NameId
-Close_File = libghdl.vhdl__scanner__close_file
-Scan = libghdl.vhdl__scanner__scan
+__all__ = [
+ 'Current_Token',
+ 'Flag_Comment'
+]
# This is a c_int, so you want to use its .value
Current_Token = c_int.in_dll(libghdl, "vhdl__scanner__current_token")
-
Flag_Comment = c_bool.in_dll(libghdl, "vhdl__scanner__flag_comment")
-Get_Current_Line = libghdl.vhdl__scanner__get_current_line
-Get_Token_Offset = libghdl.vhdl__scanner__get_token_offset
+@export
+def Set_File(SourceFile: SourceFileEntry) -> None:
+ """
+ Initialize the scanner with file :obj:`SourceFile`.
+
+ :param SourceFile: File to scan.
+ """
+ libghdl.vhdl__scanner__set_file(SourceFile)
+
+
+@export
+def Close_File() -> None:
+ """Finalize the scanner."""
+ libghdl.vhdl__scanner__close_file()
+
+
+@export
+def Scan() -> None:
+ """Get a new token."""
+ libghdl.vhdl__scanner__scan()
+
+
+@export
+def Get_Current_Line() -> int:
+ """
+ Get the current token's line.
+
+ :return: Current token's line.
+ """
+ """ -- Get the current location, or the location of the current token.
+ -- Since a token cannot spread over lines, file and line of the current
+ -- token are the same as those of the current position.
+ -- The offset is the offset in the current line."""
+ return libghdl.vhdl__scanner__get_current_line()
+
+
+@export
+def Get_Token_Offset() -> int:
+ """
+ Get the current token's offset in the current line.
+
+ :return: Current token's offset.
+ """
+ return libghdl.vhdl__scanner__get_token_offset()
+
+
+@export
+def Get_Token_Position():
+ """
+ Get the current token's position.
+
+ :return: Current token's position. Type: ``Source_Ptr``
+ """
+ return libghdl.vhdl__scanner__get_token_position()
+
+
+@export
+def Get_Position():
+ """
+ Get the current position.
+
+ :return: Current position. Type: ``Source_Ptr``
+ """
+ return libghdl.vhdl__scanner__get_position()
-Get_Token_Position = libghdl.vhdl__scanner__get_token_position
-Get_Position = libghdl.vhdl__scanner__get_position
+@export
+def Current_Identifier() -> NameId:
+ """
+ When :attr:`~pyGHDL.libghdl.vhdl.scanner.Current_Token` is an
+ ``tok_identifier``, ``tok_char`` or ``tok_string``, its name_id can be
+ retrieved via this function.
-Current_Identifier = libghdl.vhdl__scanner__current_identifier
+ :return: NameId of the current token.
+ """
+ return libghdl.vhdl__scanner__current_identifier()
diff --git a/pyGHDL/libghdl/vhdl/sem.py b/pyGHDL/libghdl/vhdl/sem.py
index 751611cbe..24a9b44c3 100644
--- a/pyGHDL/libghdl/vhdl/sem.py
+++ b/pyGHDL/libghdl/vhdl/sem.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -32,7 +33,19 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
#
+from pydecor import export
+
from pyGHDL.libghdl import libghdl
-Semantic = libghdl.vhdl__sem__semantic
+@export
+def Semantic(DesignUnit) -> None:
+ """
+ Do the semantic analysis of design unit :obj:`DesignUnit`.
+
+ Also add a few node or change some nodes, when for exemple an identifier is
+ changed into an access to the type.
+
+ :param DesignUnit: Design unit to semantically analyze. Type: ``Iir_Design_Unit``
+ """
+ libghdl.vhdl__sem__semantic(DesignUnit)
diff --git a/pyGHDL/libghdl/vhdl/sem_lib.py b/pyGHDL/libghdl/vhdl/sem_lib.py
index d2a807656..9fcc7ac79 100644
--- a/pyGHDL/libghdl/vhdl/sem_lib.py
+++ b/pyGHDL/libghdl/vhdl/sem_lib.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -32,11 +33,39 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ============================================================================
#
+from pydecor import export
+
from pyGHDL.libghdl import libghdl
+from pyGHDL.libghdl._types import SourceFileEntry
+
+
+@export
+def Load_File(File: SourceFileEntry):
+ """
+ Start to analyse a file (i.e. load and parse it).
+
+ :param File: File to analyse.
+ :return: Return :attr:`~pyGHDL.libghdl.vhdl.nodes.Null_Iir` in case of parse error. Type: ``Iir_Design_File``
+ """
+ return libghdl.vhdl__sem_lib__load_file(File)
+
+
+@export
+def Finish_Compilation(Unit, Main: bool = False) -> None:
+ """
+ Analyze :obj:`Unit`.
+ :param Unit: Design unit to analyze.
+ :param Main: Is main unit.
+ """
+ libghdl.vhdl__sem_lib__finish_compilation(Unit, Main)
-Load_File = libghdl.vhdl__sem_lib__load_file
-Finish_Compilation = libghdl.vhdl__sem_lib__finish_compilation
+@export
+def Free_Dependence_List(Design) -> None:
+ """
+ Free the dependence list of :obj:`Design`.
-Free_Dependence_List = libghdl.vhdl__sem_lib__free_dependence_list
+ :param Design: Design unit to free dependencies for.
+ """
+ libghdl.vhdl__sem_lib__free_dependence_list(Design)
diff --git a/pyGHDL/libghdl/vhdl/std_package.py b/pyGHDL/libghdl/vhdl/std_package.py
index fa5d5e2b7..bf347efba 100644
--- a/pyGHDL/libghdl/vhdl/std_package.py
+++ b/pyGHDL/libghdl/vhdl/std_package.py
@@ -7,12 +7,13 @@
# |_| |___/ |___/
# =============================================================================
# Authors: Tristan Gingold
+# Patrick Lehmann
#
-# Package package: Python binding and low-level API for shared library 'libghdl'.
+# Package module: Python binding and low-level API for shared library 'libghdl'.
#
# License:
# ============================================================================
-# Copyright (C) 2019-2020 Tristan Gingold
+# Copyright (C) 2019-2021 Tristan Gingold
#
# GHDL is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -36,14 +37,12 @@ from ctypes import c_int32
from pyGHDL.libghdl import libghdl
+__all__ = [
+ 'Std_Location',
+ 'Standard_Package',
+ 'Character_Type_Definition'
+]
-# Use .value
-Std_Location = c_int32.in_dll(libghdl, "vhdl__std_package__std_location")
-
-# Use .value
-Standard_Package = c_int32.in_dll(libghdl, "vhdl__std_package__standard_package")
-
-# Use .value
-Character_Type_Definition = c_int32.in_dll(
- libghdl, "vhdl__std_package__character_type_definition"
-)
+Std_Location = c_int32.in_dll(libghdl, "vhdl__std_package__std_location") #: Virtual location for the ``std.standard`` package. Type ``Location_Type``. Use ``.value`` to access this variable inside libghdl.
+Standard_Package = c_int32.in_dll(libghdl, "vhdl__std_package__standard_package") #: Virtual package ``std.package``. Type ``Iir_Package_Declaration``. Use ``.value`` to access this variable inside libghdl.
+Character_Type_Definition = c_int32.in_dll(libghdl, "vhdl__std_package__character_type_definition") #: Predefined character. Type ``Iir_Enumeration_Type_Definition``. Use ``.value`` to access this variable inside libghdl.