anuragraghavan / franca

Automatically exported from code.google.com/p/franca
0 stars 0 forks source link

Create transformation C-header file to Franca (and back) #36

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
A new Franca-connector should be created which implements a mapping from Franca 
<-> C-headers. This could be used e.g. for creating a Franca interface for an 
open-source library written in C. The C header could be converted to a Franca 
interface, and e.g. a proxy for using the open-source library across an IPC 
channel could be created.

A first draft of the conceptual mapping (this list might be changed due to 
analysis results...):
- Franca primitive datatypes <=> C99 standard datatypes (e.g., uint8_t)
- Franca user-defined datatypes <=> appropriate C datatypes with typedefs
- Franca methods <=> C function (if more than one out-argument in Franca, 
define struct as a return value)
- Franca attributes <=> global variable declared as "extern"
- Franca broadcast <=> C function pointer

Open questions:
- How should we handle C pointers when transforming C-header to Franca?

Implementation notes:
- the Eclipse project should be named org.franca.connectors.c_header
- for a blueprint of the project's structure see org.franca.connectors.dbus
- for the implementation of the two transformations Xtend should be used
- develop on a new git branch "dev_cheader"
- the direction C-header to Franca should be based on the CDT's AST (we should 
avoid parsing the C-header ourselves)
- the direction Franca to C-header can be a simple text-generator
- start with implementation of C-header to Franca (in order to be sure to find 
all possible contents of C-headers)

Original issue reported on code.google.com by klaus.birken@gmail.com on 13 May 2013 at 11:34

GoogleCodeExporter commented 9 years ago
This feature request will be delayed until it is clear how to cope with C 
specialties (pointers, macros, #defines, ...).

Original comment by klaus.birken@gmail.com on 14 May 2013 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by szabt...@gmail.com on 2 Sep 2013 at 8:01

GoogleCodeExporter commented 9 years ago
The current implementation of the C header -> Franca transformator supports the 
following constructs:
- unions / enumerations / structs
- global variables with extern
- method definitions with appropriate in and out args (the out arg is simply 
named "out", maybe this should be discussed)

TODO: 
- typedef with primitive types
- finding the corresponding primitive type in Franca for a given c definition 
requires a lot of cases, currently the simplest ones are added only
- pointers are not supported yet

The 2 plugins can be found on the experimental branch. 

Original comment by szabt...@gmail.com on 2 Sep 2013 at 2:23