language TCL engine command

## Contents

- Your rights

- Introduction

- Component model

- Component description file

- GenoM IDL mappings

- Running GenoM

- Tutorials

- Templates

  - Skeleton

  - Mappings

  - Interactive

  - Creating Templates

    - `template` command

    - `engine` command

    - `dotgen` command

    - `language` command

    - `$type` command

    - `$component` command

    - `$port` command

    - `$task` command

    - `$service` command

    - `$codel` command

    - `$param` command

## language TCL engine command

### lang 'language'

Set the current language for procedures that output a language dependent string

Arguments

'language' | The language name. Must be one of `c` or `c++`.

### comment ['-c'] 'text'

Return a string that is a valid comment in the current language.

Arguments

'c' | The string to use as a comment character (overriding current language).
'text' | The string to be commented.

### fileext ['-kind']

Return the cannonical file extension for the current language.

Arguments

'kind' | Must be one of the strings `source` or `header`.

### indent [#'n'|++|--] ['text' …​]

Output 'text', indented to the current indent level. Each 'text' argument is followed by a newline. Indent level can be changed by passing an absolute level with #'n', or incremented or decremented with `++` or `--`.

Arguments

'text' | The string to output indented.

### --- [-'column'] 'text' …​ 'filler'

This command, spelled with 3 dashes (`-`), return a string of length 'column' (70 by default), starting with 'text' and filled with the last character of the 'filler' string.

Arguments

'text' | The text to fill.
'filler' | The filler character.
'column' | The desired length of the returned string.

### wrap [-'column'] 'text' ['prefix'] ['sep']

Chop a string into lines of length 'column' (70 by default), prefixed with 'prefix' (empty by default). The string is split at spaces by default, or at 'sep' if given.

Arguments

'text' | The text to fill.
'prefix' | A string prefixed to each line.
'sep' | The separator for breaking text.
'column' | The desired maximum length of each line

### cname string|object

Return the cannonical name of the 'string' or the `genom3` 'object', according to the current language.

If a regular string is given, this procedure typically maps IDL `::` scope separator into the native scope separator symbol for the current language. If a codel object is given, this procedure returns the symbol name of the codel for the current language.

Arguments

'string' | The name to convert.
'object' | A `genom3` object.

### language mangle 'type'

Return a string containing a universally unique representation of the name of the 'type' object.

Arguments

'type' | A 'type' object.

### language mapping ['objects'] ['locations']

Generate and return a string containing the mapping of 'type' or 'codel' objects for the current language, or of all types if no argument is given. The returned string is a valid source code for the language.

Arguments

'type' | A 'type' object.
'locations' | A boolean variable controlling the generation of type location information (#line directives for cpp).

### language declarator 'type' ['var'] ['qualifier']

Return the abstract declarator for 'type' or for a variable 'var' of that type, in the current language.

Arguments

'type' | A 'type' object.
'var' | A string representing the name of a variable of type 'type'.
'qualifier' | Optional qualifier of type 'type', e.g. const.

### language address 'type' ['var']

Return an expression evaluating to the address of a variable in the current language.

Arguments

'type' | A 'type' object.
'var' | A string representing the name of a variable of type 'type'.

### language dereference' type' 'kind' ['var']

Return an expression dereferencing a parameter passed by value or reference, in the current language.

Arguments

'type' | A 'type' object.
'kind' | Must be `value` or `reference`.
'var' | A string representing the name of a parameter of type 'type'.

### language argument 'type' 'kind' ['var']

Return an expression that declares a parameter 'var' of type 'type', passed by value or reference according to 'kind'.

Arguments

'type' | A 'type' object.
'kind' | Must be `value` or `reference`.
'var' | A string representing the name of a variable of type 'type'.

### language returnvalue 'type' 'kind'

Return an expression that declares a return value of type 'type', returned by value or reference according to 'kind'.

Arguments

'type' | A 'type' object.
'kind' | Must be `value` or `reference`.

### language pass 'type' 'kind' ['var']

Return an expression that passes 'var' of type 'type' as a parameter, by value or reference according to 'kind'.

Arguments

'type' | A 'type' object.
'kind' | Must be `value` or `reference`.
'var' | A string representing the name of a variable of type 'type'.

### language member 'type' 'mlist'

Return the language construction to access a member of a 'type'. 'mlist' is a list interpreted as follow: if it starts with a letter, 'type' should be an aggregate type (like `struct`); if it starts with a numeric digit, 'type' should be an array type (like `sequence`).

Arguments

'type' | A 'type' object.
'mlist' | A list of hierachical members to access.

### language signature $codel ['separator'] ['location']

Return the signature of a codel in the current language. If separator is given, it is a string that is inserted between the return type of the codel and the codel name (for instance, a `\n` in C so that the symbol name is guaranteed to be on the first column).

Arguments

'codel' | A 'codel' object.
'separator' | A string, inserted between the return type and the codel symbol name.
'location' | A boolean indicating whether to generate `#line` directives corresponding to the codel location in `.gen` file.

### language invoke $codel 'params'

Return a string corresponding to the invocation of a codel in the current language.

Arguments

'codel' | A 'codel' object.
'params' | The list of parameters passed to the codel. Each element of this list must be a valid string in the current language corresponding to each parameter value or reference to be passed to the codel (`language pass`).