Skip to content

AssemblerOutput

This module creates assembler source files in Accelerate format.

AssemblerOutput(file)

Create output files in Accelerate assembler format.

PARAMETER DESCRIPTION
file

The output file handle.

TYPE: IO[Any]

begin_object(name, section=None, visibility=None, alignment=None)

Begin a new object.

PARAMETER DESCRIPTION
name

The name of the object.

TYPE: str

section

The section to place the object in. If None, place in current section.

TYPE: str | None DEFAULT: None

visibility

The visibility of the object.

TYPE: str | None DEFAULT: None

alignment

The alignment of the object.

TYPE: int | None DEFAULT: None

byte(value)

Add a byte value as .data to current object.

PARAMETER DESCRIPTION
value

The byte value.

TYPE: Any

bytes(bytes_array)

Add a byte array as .data to current object.

PARAMETER DESCRIPTION
bytes_array

The byte array.

TYPE: bytes

bytes_object(name, bytes_array, section='data', visibility=None, alignment=None)

Create an object containing a byte array.

PARAMETER DESCRIPTION
name

The name of the object.

TYPE: str

bytes_array

The byte array.

TYPE: bytes

section

The section to place the object in. If None, place in current section.

TYPE: str DEFAULT: 'data'

visibility

The visibility of the object.

TYPE: str | None DEFAULT: None

alignment

The alignment of the object.

TYPE: int | None DEFAULT: None

combine_names(prefix, name)

Combine a prefix and name (either of which can be None) into a single name.

PARAMETER DESCRIPTION
prefix

The prefix.

TYPE: str | None

name

The name.

TYPE: str | None

RETURNS DESCRIPTION
str

The combined name.

RAISES DESCRIPTION
RuntimeError

If both prefix and name are None.

comment(comment)

Add a comment line.

PARAMETER DESCRIPTION
comment

The comment text.

TYPE: str

constant(name, value)

Define a constant.

PARAMETER DESCRIPTION
name

The name of the constant.

TYPE: str

value

The value of the constant.

TYPE: Any

data(value, encoding=None, line_length=16)

Add data as .data to current object.

PARAMETER DESCRIPTION
value

The data value or list of values.

TYPE: Any

encoding

The encoding to use for strings.

TYPE: str | None DEFAULT: None

line_length

The number of values per line.

TYPE: int DEFAULT: 16

data_object(name, data, section='data', visibility=None, alignment=None)

Create an object containing data.

PARAMETER DESCRIPTION
name

The name of the object.

TYPE: str

data

The data.

TYPE: Any

section

The section to place the object in.

TYPE: str DEFAULT: 'data'

visibility

The visibility of the object.

TYPE: str | None DEFAULT: None

alignment

The alignment of the object.

TYPE: int | None DEFAULT: None

empty_line()

Add an empty line to the output.

end_object()

End the current object.

header(input_file)

Add standard file header comment.

PARAMETER DESCRIPTION
input_file

The input file name, if any.

TYPE: str | None

label(name, visibility=None)

Add a label.

PARAMETER DESCRIPTION
name

The name of the label.

TYPE: str

visibility

The visibility of the label.

TYPE: str | None DEFAULT: None

parts(name, parts, include_count=True, include_index=True, names=None)

Create multiple objects from parts.

PARAMETER DESCRIPTION
name

The base name of the objects.

TYPE: str

parts

The data for each part.

TYPE: list

include_count

Whether to create an object with the count of parts.

TYPE: bool DEFAULT: True

include_index

Whether to create an index object referencing each part.

TYPE: bool DEFAULT: True

names

Optional list of name suffixes for the parts. If not provided, parts are named by their index.

TYPE: list | None DEFAULT: None

pre_else()

Add a preprocessor else directive.

pre_end()

Add a preprocessor end directive.

pre_if(predicate)

Add a preprocessor if directive.

PARAMETER DESCRIPTION
predicate

The predicate for the if directive.

TYPE: str

section(section)

Change current section.

PARAMETER DESCRIPTION
section

The section name.

TYPE: str

string(value, encoding=None, nul_terminate=False)

Add a string as .data to current object.

PARAMETER DESCRIPTION
value

The string value.

TYPE: str

encoding

The encoding to use for the string.

TYPE: str | None DEFAULT: None

nul_terminate

Whether to add a NUL terminator.

TYPE: bool DEFAULT: False

visibility(visibility)

Change current visibility.

PARAMETER DESCRIPTION
visibility

The visibility level.

TYPE: str

word(value)

Add a word value as .data to current object.

PARAMETER DESCRIPTION
value

The word value.

TYPE: Any