RIG - the rtmk interface generator

Introduction

RIG is the interface generator used with RTMK. It generates a presentation (in C) of a interface.

In normal interface generators, such a MiG, you defines the interface in a language that is pretty similar to the language that the presentation will be ``written'' in (e.g. C). This add some shortcomings; the user must often adopt his/her code to the presented interface. This usually adds overhead and makes the code insufficient.

RIG separates the interface from the presentation. The interface defines what should be sent through the ``wire'' (ipc-port). The presentation is what is presented to the user, i.e. the functions to call from C.

Interfaces

The interface is described by a defs file. It contains definitions of all methods but no language specific type definitions.

Example:

    (define-interface io 1000
      (define-method write (returns RTMK_MSG_TYPE_INTEGER32)
        (arguments (out fd      RTMK_MSG_TYPE_INTEGER_32)
                   (out buffer  RTMK_MSG_TYPE_INETGER_8[])
        )
    )
    
The code above defined an interface called io with base offset 1000 and a method called write that takes two arguments; FD and BUFFER. The second argument have unspecified length. The methods returns an integer.

(Note that the definition includes no language specific definitions)

Presentation

The presentation file defines how the interface should be presented to the user. It contains language specific definitions.

Example

    presentation io implements io
      {
        int write (int fd, PTR buffer, int length (length-of buffer));
        int write_string (int fd, char *str (null-terminated)) extends write;
      };
    
The code above defined two presentations of the same function; write. The first presentation write takes an extra argument; length that specifies the length of buffer. write_string takes only two arguments. str is a null-terminated string.

The ability to present the same method in different ways add new possibilities. In the example above, the length of the buffer is sometimes know - then it just adds overhead to calculate the length of the buffer all over again.


johan rydberg
Last modified: Thu Jan 17 20:53:47 CET 2002