pyGHDL.libghdl.files_map#

Variables

Functions


Variables

pyGHDL.libghdl.files_map.EOT#

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

b'\x04'
pyGHDL.libghdl.files_map.No_Source_File_Entry#

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

0
pyGHDL.libghdl.files_map.No_Location#

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

0

Functions

pyGHDL.libghdl.files_map.Location_To_File(Location)[source]#

Convert Location to a source file.

Parameters:

Location (TypeVar(LocationType, bound= c_uint)) – Location

Return type:

TypeVar(SourceFileEntry, bound= c_uint)

Returns:

Source file. Return No_Source_File_Entry if location is incorrect.

pyGHDL.libghdl.files_map.Location_File_To_Pos(Location, File)[source]#

Convert Location and File to a position (offset) into the source file.

Parameters:
Return type:

int

Returns:

Offset

pyGHDL.libghdl.files_map.Location_File_To_Line(Location, File)[source]#

Convert Location and File to a line number.

Parameters:
Return type:

int

Returns:

Line number

pyGHDL.libghdl.files_map.Location_File_Line_To_Offset(Location, File, Line)[source]#

Get the offset in Line of Location.

Parameters:
  • Location (TypeVar(LocationType, bound= c_uint)) – Location

  • File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

  • Line (int) – Line number

Return type:

int

Returns:

Offset

pyGHDL.libghdl.files_map.Location_File_Line_To_Col(Location, File, Line)[source]#

Get logical column (with HT expanded) from Location, File and Line.

Parameters:
  • Location (TypeVar(LocationType, bound= c_uint)) – Location

  • File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

  • Line (int) – Line number

Return type:

int

Returns:

logical column (horizontal tabs are expanded)

pyGHDL.libghdl.files_map.File_To_Location(File)[source]#

Convert a File into a location.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

Return type:

TypeVar(LocationType, bound= c_uint)

Returns:

Location.

pyGHDL.libghdl.files_map.File_Pos_To_Location(File, Pos)[source]#

Convert a File and an offset Pos in the file into a location.

Parameters:
  • File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

  • Pos (int) – Offset in the file

Return type:

TypeVar(LocationType, bound= c_uint)

Returns:

Location.

pyGHDL.libghdl.files_map.File_Line_To_Position(File, Line)[source]#

Convert a File and Line into a position.

Parameters:
  • File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

  • Line (int) – Line number

Return type:

int

Returns:

Return Source_Ptr_Bad in case of error (Line out of bounds).

pyGHDL.libghdl.files_map.Get_File_Name(File)[source]#

Return the name of the file.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file to get the filename from.

Return type:

TypeVar(NameId, bound= c_int)

Returns:

NameId for the filename.

pyGHDL.libghdl.files_map.Get_Directory_Name(File)[source]#

Return the directory of the file.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file to get the directory name from.

Return type:

TypeVar(NameId, bound= c_int)

Returns:

NameId for the directory.

pyGHDL.libghdl.files_map.Get_File_Buffer(File)[source]#

Return a buffer (access to the contents of the file) for a file entry.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file to get the buffer from.

Return type:

bytes

Returns:

Type: File_Buffer_Ptr

pyGHDL.libghdl.files_map.Get_File_Length(File)[source]#

Get the position of the first EOT character.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

Return type:

int

Returns:

Type: Source_Ptr

pyGHDL.libghdl.files_map.Set_File_Length(File, Length)[source]#

Set the length of the file (which is less than the size of the file buffer).

Set also append two EOT at the end of the file.

Parameters:
  • File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

  • Length (int) – Length for the file. Type: Source_Ptr

Return type:

None

pyGHDL.libghdl.files_map.Get_Buffer_Length(File)[source]#

Get the length of the buffer, including the gap and the two EOT.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file

Return type:

int

Returns:

Type: Source_Ptr

pyGHDL.libghdl.files_map.Reserve_Source_File(Directory, Name, Length)[source]#

Reserve an entry, but do not read any file.

The length should includes the two terminal EOT.

Parameters:
  • Directory (TypeVar(NameId, bound= c_int)) – Directory name

  • Name (TypeVar(NameId, bound= c_int)) – File name

  • Length (int) – Length to reserve. Type: Source_Ptr

Return type:

TypeVar(SourceFileEntry, bound= c_uint)

Returns:

SourceFile

pyGHDL.libghdl.files_map.Discard_Source_File(File)[source]#

Mark File as unavailable: clear the name and directory.

Hint

This is needed before creating a new source file with the same name.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file to discard.

Return type:

None

pyGHDL.libghdl.files_map.Free_Source_File(File)[source]#

Free resources used by File, but keep the entry.

Note

It could be recycled for files that could fit - not implemented.

Parameters:

File (TypeVar(SourceFileEntry, bound= c_uint)) – Source file to free.

Return type:

None

pyGHDL.libghdl.files_map.Get_Last_Source_File_Entry()[source]#

Returns the entry of the last known file.

Hint

This allows creating a table of SourceFileEntry.

Return type:

TypeVar(SourceFileEntry, bound= c_uint)

Returns:

Last SourceFileEntry. Type: SourceFileEntry