Difference between revisions of "Agent Calls"
(→Wrapper generation) |
(→Wrapper generation) |
||
Line 48: | Line 48: | ||
*Call the '''agent callee''' | *Call the '''agent callee''' | ||
− | + | For the '''agent creation''': | |
<code>[eiffel, N] | <code>[eiffel, N] | ||
agent f (?, 1, ?) | agent f (?, 1, ?) | ||
</code> | </code> | ||
− | + | the following wrapper function is generated: | |
+ | <code>[c, N] | ||
+ | agent f (?, 1, ?) | ||
+ | </code> | ||
+ | |||
+ | And for this '''agent creation''': | ||
+ | <code>[eiffel, N] | ||
+ | agent {C}.f (1, ?, "hello") | ||
+ | </code> | ||
+ | The wrapper function looks like: | ||
+ | |||
<code>[c, N] | <code>[c, N] | ||
agent f (?, 1, ?) | agent f (?, 1, ?) | ||
</code> | </code> |
Revision as of 16:06, 21 August 2006
Work in progress!
Terminology
In the following text the place where an agent is created (with the agent keyword or the tilde operator) is called the agent creation. The feature to which the agent points is the agent callee and the place (or places) where the agent is called is denoted agent call.
class TERMINOLOGY feature f1 local p: PROCEDURE [ANY, TUPLE] do p := agent target -- agent creation end f2 (p: PROCEDURE [ANY, TUPLE]) do p.call ([]) -- agent call end target -- callee do end end
Wrapper generation
Lets look first at frozen workbench code. Class C is used throughout the following examples.
class C feature f (p1, p2: INTEGER; p3: STRING): STRING do ... end end
For everly agent creation a c-function is generated. This wrapper function does the following:
- Reorder the closed and open arguments.
- Calculate the proper agent callee based on the dynamic type of the target.
- Call the agent callee
For the agent creation:
agent f (?, 1, ?)
the following wrapper function is generated:
agent f (?, 1, ?)
And for this agent creation:
agent {C}.f (1, ?, "hello")
The wrapper function looks like:
agent f (?, 1, ?)