ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
protocol.h File Reference

protocol helpers header file More...

#include "receptor.h"
Include dependency graph for protocol.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * _o_add_label (char *label, T *def)
 
T_o_make_protocol_def (SemTable *sem, Context c, char *label,...)
 
T_o_bindings2sem_map (T *bindings, T *sem_map, T *defaults)
 
T_o_unwrap (SemTable *sem, T *def, T *sem_map)
 
T_o_resolve (SemTable *sem, T *def, T *bindings)
 
void _o_express_role (Receptor *r, Symbol protocol, Symbol role, Aspect aspect, T *action)
 
T__o_initiate (Receptor *r, SemanticID protocol, SemanticID interaction, T *bindings, T **sem_mapP)
 
void _o_initiate (Receptor *r, SemanticID protocol, SemanticID interaction, T *bindings)
 

Detailed Description

protocol helpers header file

Definition in file protocol.h.

Function Documentation

T* __o_initiate ( Receptor r,
SemanticID  protocol,
SemanticID  interaction,
T bindings,
T **  sem_mapP 
)

build a run-tree and semantic map that will initiate a protocol interaction

Parameters
[in]receptorinitiating the protocol interaction
[in]protocolwhich protocol
[in]interactionwhich interaction in the protocol
[in]bindingstree of PROTOCOL_BINDINGS
[out]sem_mapsemantic map built by the protocol
Returns
run-tree

Definition at line 473 of file protocol.c.

T* _o_bindings2sem_map ( T bindings,
T sem_map,
T defaults 
)

convert PROTOCOL_BINDINGS to SEMANTIC_MAP adding in any defaults

Parameters
[in]bindingsPROTOCOL_BINDINGS to be converted
[in,out]sem_mapSEMANTIC_MAP to be added to (may be NULL)
[in]defaultsPROTOCOL_DEFAULTS to be added if not in bindings
Returns
either sem_map if given, or newly allocated SEMANTIC_MAP tree

Definition at line 234 of file protocol.c.

void _o_express_role ( Receptor r,
Protocol  protocol,
Symbol  role,
Aspect  aspect,
T bindings 
)

setup a receptor to participate as some role in a protocol

Parameters
[in]receptorin which to express the protocol role
[in]protocolwhich protocol
[in]rolesymbol of role to express
[in]aspecton which aspect to install the expectations
[in]bindingsPROTOCOL_BINDINGs tree to concretize the unknowns in the protocol def

Definition at line 409 of file protocol.c.

void _o_initiate ( Receptor r,
SemanticID  protocol,
SemanticID  interaction,
T bindings 
)

initiate the first signal in a protocol interaction

Parameters
[in]receptorinitiating the protocol interaction
[in]protocolwhich protocol
[in]interactionwhich interaction in the protocol
[in]bindingstree of PROTOCOL_BINDINGS

Definition at line 506 of file protocol.c.

T* _o_make_protocol_def ( SemTable sem,
Context  c,
char *  label,
  ... 
)

helper to build a PROTOCOL_DEFINITION

NOTE: this just makes it easier to build protocol defs in c. If you don't get the params right when calling it, it will segfault!

Parameters
[in,out]protocolsa protocols def tree containing protocols which will be added to
[in]labelthe name of the protocol
[in]...params in correct order
Returns
the new protocol def

Definition at line 37 of file protocol.c.

T* _o_resolve ( SemTable sem,
T def,
T sem_map 
)

convert a, possibly composed, protocol definition into an expressable definition

convert a PROTOCOL_DEF to a concretized version according to the RESOLUTIONs and LINKAGEs in the the def and the bindings

Parameters
[in]semSemTable contexts
[in,out]defprotocol definition to resolve
[in]rolethe role that needs resolving
[in]sem_mapused to resolve the bindings
Returns
a PROTOCOL_SEMANTICS tree of semantics that remain unbound

Definition at line 372 of file protocol.c.

T* _o_unwrap ( SemTable sem,
T def,
T sem_map 
)

recursively expand wrapped protocol defs

Parameters
[in]semSemTable of contexts
[in]defprotocol definition tree
[in,out]sem_mapsemantic map of the unwrapped protocols
Returns
unwrapped protocol definition tree

Definition at line 262 of file protocol.c.