Open Source & Linux Lab

It's better when it's simple

User Tools

Site Tools


etc:users:jcmvbkbc:isl

This is an old revision of the document!


Opensource compiler for motorola internal language

Orthogonal aspects

Orthogonal aspects must be decoupled to the maximal possible extent:

  • output language
  • output file structure
  • user data structures and field names
  • memory allocation

Output files structure (C)

.h

  • includes
  • enumerations
  • struct typedefs
  • structures
  • prototypes

.c

  • includes
  • internal declarations
  • field packers/unpackers
  • message packers/unpackers
  • interface packers/unpackers

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.

Decoding context

  • basic part:
    • bit stream location (byte offset, bit offset)
    • memory allocation context
  • custom part:
    • internal variables (managed by 'internal variable assignment' clause)

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>;
};

Language features

Packages

  • package nesting is unrestricted;
  • package may use only its direct subpackages;
  • use directive in not transitive, i.e. A use B and B use C doesn't mean A use C;
  • use directive cannot refer to packages brought into scope by the other use, i.e. if A contains B, B contains C and A use B, one cannot write A use C;
  • nested package sees all names of its ancestors;
  • package may not redefine visible name. More generally: identifiers visible at any scope (locally defined + ancestors + introduced by use) must not collide;
etc/users/jcmvbkbc/isl.1279922231.txt.gz · Last modified: 2010/07/24 01:57 by jcmvbkbc