ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
Accumulator

Where the VMHost takes care of processing and thinking, the Accumulator takes care of persistence and signaling (i.e. manifestation and sensation). It can be thought of as implementing the "body" of receptors. More...

Files

file  accumulator.c
 implementation file for accumulator
 
file  accumulator.h
 header file for the accumulator
 

Functions

void _a_boot (char *dir_name)
 
void _a_start_vmhost ()
 
void _a_shut_down ()
 
Xaddr _a_new_instance (Instances *i, T *t)
 
T_a_get_instance (Instances *i, Xaddr x)
 
void _a_get_instances (Instances *instances, Symbol s, T *t)
 
T_a_set_instance (Instances *instances, Xaddr x, T *t)
 
void _a_delete_instance (Instances *instances, Xaddr x)
 
void _a_free_instances (Instances *i)
 
S__a_serialize_instances (Instances *i)
 
void _a_serialize_instances (Instances *i, char *file)
 
void __a_unserialize_instances (SemTable *sem, Instances *instances, S *s)
 
void _a_unserialize_instances (SemTable *sem, Instances *i, char *file)
 
T_a_gen_token (Instances *i, Xaddr x, T *dependency)
 
Xaddr _a_get_token_xaddr (Instances *i, T *token, T *dependency)
 
void _a_add_dependency (Instances *instances, T *token, T *dependency)
 
void _a_delete_dependency (Instances *instances, T *token, T *dependency)
 
void _a_delete_token (Instances *instances, T *token)
 

Variables

VMHostG_vm
 
void * _o_add_label (char *label, T *def)
 
T_o_make_protocol_def (SemTable *sem, Context c, char *label,...)
 
void _t_replace_sem_refs (T *t, T *sem_map)
 
void _o_merge_sem_map (T *from, T *into)
 
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 *sem_map)
 
void _o_express_role (Receptor *r, Protocol protocol, Symbol role, Aspect aspect, T *bindings)
 
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

Where the VMHost takes care of processing and thinking, the Accumulator takes care of persistence and signaling (i.e. manifestation and sensation). It can be thought of as implementing the "body" of receptors.

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.

void _a_boot ( char *  dir_path)

bootstrap the ceptr system

starts up the vmhost and wakes up receptors that should be running in it.

check the compository to verify our version of the vmhost

Definition at line 60 of file accumulator.c.

void _a_shut_down ( )

clean shutdown of the the ceptr system

should be called by the thread that called _a_boot() (or _a_start_vmhost())

Definition at line 134 of file accumulator.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.