ceptr
|
Receptors provide the fundamental coherence contexts for ceptr. More...
Files | |
file | group.c |
implementation of some group communication receptors | |
file | group.h |
group communication receptors header file | |
file | process.c |
implementation of ceptr processing: instructions and run tree reduction | |
file | process.h |
processing header files | |
file | protocol.c |
implementation of protocol helpers | |
file | protocol.h |
protocol helpers header file | |
file | receptor.c |
receptor implementation | |
file | receptor.h |
receptor implementation header file | |
file | scape.c |
implementation of scapes | |
file | scape.h |
scape header files | |
file | shell.c |
implementation of a command line shell receptor | |
file | shell.h |
command line shell receptor header files | |
Macros | |
#define | __r_make_addr(p, t, a) ___r_make_addr(p,t,a,0) |
#define | is_null_symbol(s) ((s).semtype == 0 && (s).context == 0 && (s).id == 0) |
#define | is_null_xaddr(x) (is_null_symbol(x.symbol) && (x).addr == 0) |
#define | is_xaddr_eq(x, y) (semeq(x.symbol,y.symbol) && (x).addr == (y).addr) |
#define | spec_is_symbol_equal(r, got, expected) spec_total++; if (semeq(expected,got)){putchar('.');} else {putchar('F');sprintf(failures[spec_failures++],"%s:%d expected %s to be %s but was %s",__FUNCTION__,__LINE__,#got,_r_get_symbol_name(r,expected),_r_get_symbol_name(r,got));} |
#define | spec_is_structure_equal(r, got, expected) spec_total++; if (semeq(expected,got)){putchar('.');} else {putchar('F');sprintf(failures[spec_failures++],"%s:%d expected %s to be %s but was %s",__FUNCTION__,__LINE__,#got,_r_get_structure_name(r,expected),_r_get_structure_name(r,got));} |
#define | spec_is_process_equal(r, got, expected) spec_total++; if (semeq(expected,got)){putchar('.');} else {putchar('F');sprintf(failures[spec_failures++],"%s:%d expected %s to be %s but was %s",__FUNCTION__,__LINE__,#got,_r_get_process_name(r,expected),_r_get_process_name(r,got));} |
#define | spec_is_xaddr_equal(sem, got, expected) spec_total++; if (is_xaddr_eq(got,expected)){putchar('.');} else {putchar('F');sprintf(failures[spec_failures++],"%s:%d expected %s to be %s.%d but was %s.%d",__FUNCTION__,__LINE__,#got,!is_null_symbol(expected.symbol)?_sem_get_name(sem,expected.symbol):"0",expected.addr,!is_null_symbol(got.symbol) ? _sem_get_name(sem,got.symbol):"0",got.addr);} |
#define | __r_make_tick() __r_make_timestamp(TICK,00) |
Enumerations | |
enum | { noDeliveryErr } |
Functions | |
T * | __r_make_definitions () |
T * | _r_make_state () |
Receptor * | _r_new (SemTable *sem, SemanticID r) |
Creates a new receptor. More... | |
Receptor * | _r_new_receptor_from_package (SemTable *sem, Symbol s, T *p, T *bindings) |
Creates a new receptor from a receptor package. More... | |
T * | __r_build_expectation (Symbol carrier, T *pattern, T *action, T *with, T *until, T *using, T *cid) |
void | _r_add_expectation (Receptor *r, Aspect aspect, Symbol carrier, T *pattern, T *action, T *with, T *until, T *using, T *cid) |
Adds an expectation to a receptor's aspect. More... | |
void | __r_add_expectation (Receptor *r, Aspect aspect, T *e) |
void | _r_remove_expectation (Receptor *r, T *expectation) |
void | _r_free (Receptor *r) |
Symbol | _r_define_symbol (Receptor *r, Structure s, char *label) |
SemanticID | _r_get_sem_by_label (Receptor *r, char *label) |
Structure | _r_define_structure (Receptor *r, char *label, int num_params,...) |
Structure | __r_define_structure (Receptor *r, char *label, T *structure_def) |
Structure | __r_get_symbol_structure (Receptor *r, Symbol s) |
find a symbol's structure More... | |
size_t | __r_get_symbol_size (Receptor *r, Symbol s, void *surface) |
Process | _r_define_process (Receptor *r, T *code, char *name, char *intention, T *signature, T *link) |
Protocol | _r_define_protocol (Receptor *r, T *p) |
T * | _r_build_def_semtrex (Receptor *r, Symbol s) |
int | _r_def_match (Receptor *r, Symbol s, T *t) |
Xaddr | _r_new_instance (Receptor *r, T *t) |
T * | _r_get_instance (Receptor *r, Xaddr x) |
T * | _r_set_instance (Receptor *r, Xaddr x, T *t) |
T * | _r_delete_instance (Receptor *r, Xaddr x) |
TreeHash | _r_hash (Receptor *r, Xaddr t) |
void | _r_serialize (Receptor *r, void **surfaceP, size_t *lengthP) |
Receptor * | _r_unserialize (SemTable *sem, void *surface) |
T * | ___r_make_addr (T *parent, Symbol type, ReceptorAddress addr, bool is_run_node) |
ReceptorAddress | __r_get_addr (T *addr) |
T * | __r_make_signal (ReceptorAddress from, ReceptorAddress to, Aspect aspect, Symbol carrier, T *signal_contents, UUIDt *in_response_to, T *until, T *conversation) |
T * | __r_send (Receptor *r, T *signal) |
T * | _r_send (Receptor *r, T *signal) |
T * | _r_request (Receptor *r, T *signal, Symbol response_carrier, T *code_point, int process_id, T *cid) |
void | evaluateEndCondition (T *ec, bool *cleanup, bool *allow) |
void | __r_test_expectation (Receptor *r, T *expectation, T *signal) |
bool | __cid_equal (SemTable *sem, T *cid1, T *cid2) |
T * | __cid_new (T *parent, UUIDt *c, T *topic) |
UUIDt * | __cid_getUUID (T *cid) |
T * | _r_add_conversation (Receptor *r, UUIDt *parent_u, UUIDt *u, T *until, T *wakeup) |
T * | _r_find_conversation (Receptor *r, UUIDt *cuuid) |
T * | __r_cleanup_conversation (Receptor *r, UUIDt *cuuid) |
Error | _r_deliver (Receptor *r, T *signal) |
T * | __r_get_aspect (Receptor *r, Aspect aspect) |
T * | __r_get_expectations (Receptor *r, Aspect aspect) |
T * | __r_get_signals (Receptor *r, Aspect aspect) |
Receptor * | __r_get_receptor (T *installed_receptor) |
char * | __td (Receptor *r, T *t, char *buf) |
char * | _td (Receptor *r, T *t) |
char * | _r_get_structure_name (Receptor *r, Structure s) |
char * | _r_get_symbol_name (Receptor *r, Symbol s) |
char * | _r_get_process_name (Receptor *r, Process p) |
Receptor * | _r_makeStreamEdgeReceptor (SemTable *sem) |
SocketListener * | _r_addListener (Receptor *r, int port, T *code, T *params, T *err_handler, char *delim) |
void | _r_addReader (Receptor *r, Stream *st, ReceptorAddress to, Aspect aspect, Symbol carrier, Symbol result_symbol, bool conversation) |
void | _r_addWriter (Receptor *r, Stream *st, Aspect aspect) |
void | _r_defineClockReceptor (SemTable *sem) |
Receptor * | _r_makeClockReceptor (SemTable *sem) |
void * | ___clock_thread (void *arg) |
T * | __r_make_timestamp (Symbol s, int delta) |
void | __r_kill (Receptor *r) |
ReceptorAddress | __r_get_self_address (Receptor *r) |
void | __r_dump_instances (Receptor *r) |
Variables | |
Xaddr | G_null_xaddr |
Receptors provide the fundamental coherence contexts for ceptr.
void* ___clock_thread | ( | void * | arg | ) |
bad implementation of the clock receptor thread (but easy):
[in] | the | clock receptor |
Definition at line 1250 of file receptor.c.
define a new structure
version of _r_define_structure for complex structure defs where caller provides the STRUCTURE_DEF
[in] | r | receptor to provide a semantic context for new structure definitions |
[in] | s | the structure type for this symbol |
[in] | label | a c-string label for this symbol |
[in] | structure_def | tree of STRUCTURE_DEF structure |
Definition at line 258 of file receptor.c.
get the Receptor structure from an installed receptor
Definition at line 1039 of file receptor.c.
T* __r_make_signal | ( | ReceptorAddress | from, |
ReceptorAddress | to, | ||
Aspect | aspect, | ||
Symbol | carrier, | ||
T * | signal_contents, | ||
UUIDt * | in_response_to, | ||
T * | until, | ||
T * | cid | ||
) |
build a signal
[in] | from | source Receptor Xaddr |
[in] | to | destination Receptor Xaddr |
[in] | aspect | Aspect over which the message will be sent |
[in] | carrier | Carrier used for matching expectations |
[in] | signal_contents | the message to be sent, which will be wrapped in a BODY |
[in] | in_response_to | optional IN_RESPONSE_TO_UUID for request response |
[in] | until | optional END_CONDITIONS for a request |
[in] | conversation | optional conversation id for signals that should be routed to a conversation |
Definition at line 515 of file receptor.c.
low level function for testing expectation patterns on signals and either adding a new run tree onto the current Q or reawakening the process that's been blocked waiting for the expectation to match
Definition at line 656 of file receptor.c.
void _r_add_expectation | ( | Receptor * | r, |
Aspect | aspect, | ||
Symbol | carrier, | ||
T * | pattern, | ||
T * | action, | ||
T * | with, | ||
T * | until, | ||
T * | using, | ||
T * | cid | ||
) |
Adds an expectation to a receptor's aspect.
[in] | r | receptor to add to |
[in] | aspect | aspect on which to install the expectation |
[in] | carrier | pre-screeing of signals to match against |
[in] | pattern | semtrex to match against signals |
[in] | action | process to run if match |
[in] | with | parameters to pass into that process |
[in] | until | end conditions for cleaning up this expectation |
Definition at line 164 of file receptor.c.
Walks the definition of a symbol to build a semtrex that would match that definiton
[in] | r | the receptor context in which things are defined |
[in] | s | the symbol to build a semtrex for |
Definition at line 325 of file receptor.c.
Determine whether a tree matches a symbol definition, both structural and semantic
[in] | r | the receptor context in which things are defined |
[in] | s | the symbol we expect this tree to be |
[in] | t | the tree to match |
Examples (from test suite):
Definition at line 343 of file receptor.c.
Process _r_define_process | ( | Receptor * | r, |
T * | code, | ||
char * | name, | ||
char * | intention, | ||
T * | signature, | ||
T * | link | ||
) |
add a new process coding to a receptor
[in] | r | the receptor |
[in] | code | the code tree for this process |
[in] | name | the name of the process |
[in] | intention | a description of what the process intends to do/transform |
[in] | signature | the signature for the process |
[in] | link | the output signature for the process |
Definition at line 275 of file receptor.c.
define a new structure (simple version)
this call is handy for building simple STRUCTURE_SEQUENCE style structures
[in] | r | receptor to provide a semantic context for new structure definitions |
[in] | s | the structure type for this symbol |
[in] | label | a c-string label for this symbol |
[in] | num_params | number of symbols in the structure |
[in] | ... | variable list of Symbol type symbols |
Definition at line 236 of file receptor.c.
define a new symbol
[in] | r | receptor to provide a structural context for symbol declarations |
[in] | s | the structure type for this symbol |
[in] | label | a c-string label for this symbol |
Definition at line 218 of file receptor.c.
delete the instance for a given xaddr
[in] | r | the receptor context in which things are defined |
[in] | x | the xaddr of the instance |
Examples (from test suite):
Definition at line 407 of file receptor.c.
Send a signal to a receptor
This function checks to see if the signal is a response and if so activates the run-tree/action that's waiting for that response with the signal contents as the response value/param or, if it's a new signal, adds it to the flux, and then runs through all the expectations on the aspect the signal was sent on to see if it matches any expectation, and if so, builds action run-trees and adds them to receptor's process queue.
[in] | r | destination receptor |
[in] | signal | signal to be delivered to the receptor |
Examples (from test suite):
Definition at line 954 of file receptor.c.
void _r_free | ( | Receptor * | r | ) |
Destroys a receptor freeing all the memory it uses.
Definition at line 186 of file receptor.c.
retrieve the instance for a given xaddr
[in] | r | the receptor context in which things are defined |
[in] | x | the xaddr of the instance |
Examples (from test suite):
Definition at line 379 of file receptor.c.
SemanticID _r_get_sem_by_label | ( | Receptor * | r, |
char * | label | ||
) |
find a symbol by its label
Definition at line 288 of file receptor.c.
get the hash of a tree by Xaddr
Definition at line 414 of file receptor.c.
Receptor* _r_new | ( | SemTable * | sem, |
SemanticID | r | ||
) |
Creates a new receptor.
allocates all the memory needed in the heap
[in] | r | semantic ID for this receptor |
Examples (from test suite):
Definition at line 88 of file receptor.c.
Create a new instance of a tree
[in] | r | the receptor context in which things are defined |
[in] | t | the tree to instantiate |
Examples (from test suite):
Definition at line 365 of file receptor.c.
Creates a new receptor from a receptor package.
allocates all the memory needed in the heap, cloning the various parts from the package and binding the new receptor to the provided bindings
[in] | s | symbol for this receptor |
Definition at line 114 of file receptor.c.
T* _r_request | ( | Receptor * | r, |
T * | signal, | ||
Symbol | response_carrier, | ||
T * | code_point, | ||
int | process_id, | ||
T * | cid | ||
) |
send a request signal
[in] | r | sending receptor |
[in] | signal | Signal tree |
[in] | response_carrier | the carrier on which to expect a response |
[in] | code_point | the point in the code to re-awaken when a response comes back |
[in] | process_id | the id of the process in which that code point exists |
Definition at line 575 of file receptor.c.
send a simple signal (say)
[in] | r | the receptor sending the signal |
[in] | signal | Signal tree |
Definition at line 556 of file receptor.c.
void _r_serialize | ( | Receptor * | r, |
void ** | surfaceP, | ||
size_t * | lengthP | ||
) |
Serialize a receptor
Allocates a buffer for and serializes a receptor into the buffer
[in] | r | Receptor to serialize |
[in,out] | surfaceP | pointer to a void * to hold the resulting serialized data |
[in,out] | lengthP | pointer to a size_t to hold the resulting serialized data length |
Examples (from test suite):
Definition at line 432 of file receptor.c.
set the instance for a given xaddr
[in] | r | the receptor context in which things are defined |
[in] | x | the xaddr of the instance |
[in] | t | the new tree to set the instance value to |
Examples (from test suite):
Definition at line 394 of file receptor.c.
Unserialize a receptor
Given a serialized receptor, return an instantiated receptor tree
[in] | surface | serialized receptor data |
Definition at line 459 of file receptor.c.