|
From: Leif J. <le...@am...> - 2003-04-30 08:35:47
|
On Tue, 29 Apr 2003, Joerg Faschingbauer wrote:
> How does an extern node behave? I mean, do you still know its
> structure and only not generate code for it, or is it more shallow so
> that it disappears from parameter lists?
I implemented this extern thing briefly in the 0.2 branch and then removed
it because it was evil. The implementation was basically a flag to include
generated code from "extern" child nodes in the metamodel graph. If this
flag was set then generated code from extern nodes would be propagated
upwards in the graph. If the flag was not set the code for such nodes
wouldn't be propagated upwards.
// data.idl
module Nature { struct Ocean { int depth; }; };
// ifaces.idl
#include "data.idl"
module Nature { interface Fisher { double fish_likelihood( in Ocean o ); }; };
// boat.idl
#include "ifaces.idl"
module Nature { component Boat { provides Fisher jane; }; };
If we have this IDL, parsing the boat.idl file will give a metamodel graph :
MContainer 'boat'
` MModuleDef 'Nature'
+ MInterfaceDef 'Fisher' (extern)
| ` MOperationDef 'fish_likelihood' (extern)
| ` MParameterDef 'o' (extern)
+ MStructDef 'Ocean' (extern)
` MComponentDef 'Boat'
` MProvidesDef 'jane'
So the difficulty is how we indicate to the code generators that, for
example, code from the 'Fisher' subgraph should not be propagated upwards
to the 'boat' container (and then written to disk), but the code from the
'fish_likelihood' subgraph should be propagated to the 'Boat' component
(and then written to disk).
Maybe it's enough to come up with a list of node types for which extern
code should be conditionally included, e.g. anything except struct, union,
and interface. Maybe we ought to say that code should be written to disk
for MStructDef, MUnionDef, MExceptionDef, MAliasDef, and MEnumDef nodes
(currently in the C++ generators code is only written to disk for
MContainer, MComponentDef, MHomeDef, and MInterfaceDef nodes).
leif
--
Leif Morgan Johnson . http://ambient.2y.net/leif/
IAESTE trainee . http://www.iaeste.org/
Salomon Automation . http://www.salomon.at/
|