Module msrpce_compiler

Internal compiler interface used by msrpce_parse_transform.

Description

Internal compiler interface used by msrpce_parse_transform.

Data Types

array_type()

array_type() = {fixed_array, count(), rpce_type()} | {conformant_array, rpce_type()} | {varying_array, rpce_type()} | {array, rpce_type()}

basic_type()

basic_type() = int_type() | string_type() | array_type() | pointer_type()

bit_type()

bit_type() = {bitset, int_type(), #{atom() => bitnum()}}

bitnum()

bitnum() = integer()

bytes()

bytes() = integer()

count()

count() = integer()

custom_type()

custom_type() = {custom, rpce_type(), expr(), expr()} | {builtin, rpce_type(), expr(), expr()}

endian_type()

endian_type() = {le, rpce_type()} | {be, rpce_type()}

expr()

expr() = erl_syntax:syntaxTree()

field_spec()

field_spec() = {record_field(), rpce_type()}

form()

form() = erl_syntax:syntaxTree()

int_type()

int_type() = boolean | uint8 | uint16 | uint32 | uint64 | int8 | int16 | int32 | int64

loc()

loc() = erl_syntax:annotation_or_location()

A source location, used as an annotation to make sure compiler errors have a line number and filename.

options()

options() = #{endian => big | little, pointer_aliasing => boolean()}

Compiler options, which determine how structures and streams will be compiled.
endian big | little Sets the endianness (byte order) of all multi-byte integers.
pointer_aliasing boolean() If true, then if a stream or struct contains multiple pointers that reference the same value, they will use the same referent (and that value will be represented only once in the stream). Not all implementations support this.

pointer_type()

pointer_type() = {pointer, rpce_type()}

record_field()

record_field() = atom()

record_name()

record_name() = atom()

rpce_type()

rpce_type() = basic_type() | struct_type() | bit_type() | custom_type() | endian_type() | size_type() | type_name()

The top-level intermediate representation of an RPCE type.

size_type()

size_type() = {size_of, record_field(), int_type()} | {length_of, record_field(), int_type()}

state()

abstract datatype: state()

string_type()

string_type() = unicode | varying_unicode | string | {fixed_string, bytes()} | varying_string | binary | {fixed_binary, bytes()} | varying_binary | {fixed_binary, Size::bytes(), Alignment::bytes()}

struct_type()

struct_type() = {struct, record_name(), [field_spec()]}

type_name()

type_name() = atom()

type_options()

type_options() = options() | #{location => loc()}

Function Index

compile_stream/4Compiles a stream.
compile_type/3Compiles a type or struct.
define_type/3Defines a type or struct.
func_forms/1Returns the compiled forms.
new/0Creates a new blank compiler state.
new/1Creates a new compiler state with the specified initial options.
set_options/2Changes the options on a compiler state.

Function Details

compile_stream/4

compile_stream(Name::type_name(), Structs::[type_name()], TOpts::type_options(), S0::state()) -> {ok, state()} | {error, term()}

Compiles a stream.

compile_type/3

compile_type(Name::type_name(), TOpts::type_options(), S0::state()) -> {ok, state()} | {error, term()}

Compiles a type or struct.

define_type/3

define_type(Name::type_name(), Type::rpce_type(), S0::state()) -> {ok, state()} | {error, term()}

Defines a type or struct.

func_forms/1

func_forms(X1::state()) -> [form()]

Returns the compiled forms.

new/0

new() -> state()

Creates a new blank compiler state.

new/1

new(Opts::options()) -> state()

Creates a new compiler state with the specified initial options.

set_options/2

set_options(NewOpts::options(), S0::state()) -> state()

Changes the options on a compiler state.

These options will only affect subsequent calls to compile_type/3, not the result of any previous calls.


Generated by EDoc