Table of Contents

Opensource compiler for motorola internal language

Git repo (http)

Project tracker

Orthogonal aspects

Orthogonal aspects must be decoupled to the maximal possible extent:

Output files structure (C)

.h

.c

Pack/unpack signature

<pack return type>
pack_<interface name>(
    SignalType signal, /* signal type */
    Param1_t_uunion *p1, /* only present when interface has explicit header with non-autogenerated fields */
    Param2_t_uunion *p2, /* only present when interface has explicit trailer */
    Param3_t_uunion *p3, /* signal data */
    <pdu arg type> pdu, /* pdu output buffer */
    <pdu size arg type> sz /* pdu buffer size */
);
<unpack return type>
unpack_<interface name>(
    <pdu arg type> pdu, /* input pdu buffer */
    <pdu size arg type> sz, /* pdu buffer size */
    SignalType *signal, /* signal type */
    Param1_t_uunion **p1, /* only present when interface has explicit header with non-autogenerated fields */
    Param2_t_uunion **p2, /* only present when interface has explicit trailer */
    Param3_t_uunion **p3, /* signal data */
);

When the header is absent Param1 corresponds to the trailer. If there's no trailer, its parameter number corresponds to the signal data.

Interfaces visible from root package, not referenced from other interfaces visible from root package get translated to pack/unpack.

Decoding context

Field decoder function signature

<unpack return type>
unpack_<field name>(
  <decoding context type> * dc, /* data location, updated during unpacking */
  <field type> * p /* filled in by this unpack */
);

Union member naming

Header:

Param1_t_uunion
{
    <interface name>_t <interface name>;
};

Trailer:

Param2_t_uunion
{
    <interface name>_trailer_t <interface name>_trailer;
};

Signal:

Param3_t_uunion
{
    <message name>_t <message name>;
};

Message type

Mandatory/optional sections

Mandatory_tagged and mandatory_unordered fields need iei. iei values for mandatory_unordered must be unique in each mandatory_unordered section (?).

All optional fields need iei, which must be unique in each optional section (?).

All sections may interleave, however mt does not diagnose possible ambiguities when first byte of mandatory field may be valid iei. Such diagnostic would be good.

Consecutive mandatory_unordered, optional and optional_repeated sections form a cluster where order of fields is insignificant. Cluster decoding runs for the length of the current scope. Initially this length is determined by PDU length and may be further narrowed down by the message/field own length.

Unknown iei triggers TLV recovery mechanism: mt reads 16 (?) bits after iei and use them as length of unknown iei field.

Only mandatory fields may have LengthRestriction > 1.

Derived interfaces

Validation constraints

Interface

Field/Message

Constants

Language features

Definitions

Namespaces

Namespace is set of object types and the set of rules, that describe how objects of the same name interact in certain scope.

Scopes

Packages

Naming for C output

There are two generic rules:

Field/message type

<C field type> = <Field name>_t

Ex:

field A
{
...
}

typedef struct {...} A_t;

Enum

Enum type:

<C Enum value> = <C enum type>_<Enum value>

Ex:

field A
{
    a : 1 byte { V1 = 1, V2 = 2 };
}
field B
{
    a : 1 byte { V1 = 1, V2 = 2 },
    b : 1 byte { V1 = 1, V2 = 2 };
}

typedef enum { A_t_V1 = 1, A_t_V2 = 2 } A_t; // reduction
typedef enum { B_a_t_V1 = 1, B_a_t_V2 = 2 } B_a_t;

Case

Choice is always represented by the following structure:

struct <C choice type_t> { <C choice type_t>_tag_enum _tag; <C choice type_t>_uunion U; };
typedef enum { <C choice type_t>_tag_enum_<C case name>, ... } <C choice type_t>_tag_enum;
union <C choice type_t>_uunion { <C choice type>_<C case name>_t <C case name>; ... };

Ex: see case.pdu

Schedule